demo.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <!DOCTYPE HTML>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>jQuery.line by Szymon Działowski</title>
  6. <meta name="description" content="jQuery.line plugin to draw lines in HTML5 using pure CSS3 by Szymon Działowski">
  7. <meta name="keywords" content="jQuery.line plugin draw lines html5 css3">
  8. <script type="text/javascript" src="../../js/jquery.min.js"></script>
  9. <link rel="stylesheet" type="text/css" href="../../js/bootstrap/css/bootstrap-rewrite.css" media="all" />
  10. <script type="text/javascript" src="../../js/jquery.minicolors/jquery.minicolors.js"></script>
  11. <link rel="stylesheet" type="text/css" href="../../js/jquery.minicolors/jquery.minicolors.css" media="all" />
  12. <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  13. <script>window.jQuery || document.write(unescape('%3Cscript src="http://jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>
  14. <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" media="all" />
  15. <script type="text/javascript" src="http://httpd.pl/poligon/jquery.line/jquery.minicolors/jquery.minicolors.js"></script>
  16. <link rel="stylesheet" type="text/css" href="http://httpd.pl/poligon/jquery.line/jquery.minicolors/jquery.minicolors.css" media="all" />
  17. <link rel="stylesheet" type="text/css" href="http://stopsopa.bitbucket.org/js/bootstrap/css/bootstrap-rewrite.css" media="all" /> -->
  18. <link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700,800&subset=latin,cyrillic-ext,latin-ext,cyrillic" rel="stylesheet" type="text/css">
  19. <script type="text/javascript" src="jquery.line.js"></script>
  20. <style type="text/css">
  21. body {
  22. margin: 0;
  23. padding: 0;
  24. -webkit-user-select: none;
  25. -moz-user-select: -moz-none;
  26. -ms-user-select: none;
  27. user-select: none;
  28. font-family: "Open Sans",Arial,Helvetica,Sans-Serif;
  29. }
  30. #cont {
  31. width: 500px;
  32. margin: auto;
  33. /*border: 1px solid gray;*/
  34. height: 617px;
  35. }
  36. td {
  37. vertical-align: top;
  38. }
  39. #width {
  40. margin-right: 10px;
  41. }
  42. #color {
  43. width: 250px;
  44. padding-left: 36px;
  45. }
  46. #width,
  47. #correct {
  48. width: 50px;
  49. display: inline-block;
  50. text-align: center;
  51. }
  52. .clear {
  53. clear: both;
  54. }
  55. /* http://httpd.pl/cssmedia#InQiOiIxMCIsIm8iOiIwIiwiYSI6IjEwMCIsInoiOiIxMDAwIiwicyI6IiNjb250IiwiZCI6ImhlaWdodCIsImMiOiJoZWlnaHRfIiwiciI6Im1hcmdpbi10b3A6IDwlPSBtYXgvMiAtIDIwMCAlPnB4OyI= */
  56. @media (min-height: 101px) and (max-height: 110px) { #cont {margin-top: -145px;} }@media (min-height: 111px) and (max-height: 120px) { #cont {margin-top: -140px;} }@media (min-height: 121px) and (max-height: 130px) { #cont {margin-top: -135px;} }@media (min-height: 131px) and (max-height: 140px) { #cont {margin-top: -130px;} }@media (min-height: 141px) and (max-height: 150px) { #cont {margin-top: -125px;} }@media (min-height: 151px) and (max-height: 160px) { #cont {margin-top: -120px;} }@media (min-height: 161px) and (max-height: 170px) { #cont {margin-top: -115px;} }@media (min-height: 171px) and (max-height: 180px) { #cont {margin-top: -110px;} }@media (min-height: 181px) and (max-height: 190px) { #cont {margin-top: -105px;} }@media (min-height: 191px) and (max-height: 200px) { #cont {margin-top: -100px;} }@media (min-height: 201px) and (max-height: 210px) { #cont {margin-top: -95px;} }@media (min-height: 211px) and (max-height: 220px) { #cont {margin-top: -90px;} }@media (min-height: 221px) and (max-height: 230px) { #cont {margin-top: -85px;} }@media (min-height: 231px) and (max-height: 240px) { #cont {margin-top: -80px;} }@media (min-height: 241px) and (max-height: 250px) { #cont {margin-top: -75px;} }@media (min-height: 251px) and (max-height: 260px) { #cont {margin-top: -70px;} }@media (min-height: 261px) and (max-height: 270px) { #cont {margin-top: -65px;} }@media (min-height: 271px) and (max-height: 280px) { #cont {margin-top: -60px;} }@media (min-height: 281px) and (max-height: 290px) { #cont {margin-top: -55px;} }@media (min-height: 291px) and (max-height: 300px) { #cont {margin-top: -50px;} }@media (min-height: 301px) and (max-height: 310px) { #cont {margin-top: -45px;} }@media (min-height: 311px) and (max-height: 320px) { #cont {margin-top: -40px;} }@media (min-height: 321px) and (max-height: 330px) { #cont {margin-top: -35px;} }@media (min-height: 331px) and (max-height: 340px) { #cont {margin-top: -30px;} }@media (min-height: 341px) and (max-height: 350px) { #cont {margin-top: -25px;} }@media (min-height: 351px) and (max-height: 360px) { #cont {margin-top: -20px;} }@media (min-height: 361px) and (max-height: 370px) { #cont {margin-top: -15px;} }@media (min-height: 371px) and (max-height: 380px) { #cont {margin-top: -10px;} }@media (min-height: 381px) and (max-height: 390px) { #cont {margin-top: -5px;} }@media (min-height: 391px) and (max-height: 400px) { #cont {margin-top: 0px;} }@media (min-height: 401px) and (max-height: 410px) { #cont {margin-top: 5px;} }@media (min-height: 411px) and (max-height: 420px) { #cont {margin-top: 10px;} }@media (min-height: 421px) and (max-height: 430px) { #cont {margin-top: 15px;} }@media (min-height: 431px) and (max-height: 440px) { #cont {margin-top: 20px;} }@media (min-height: 441px) and (max-height: 450px) { #cont {margin-top: 25px;} }@media (min-height: 451px) and (max-height: 460px) { #cont {margin-top: 30px;} }@media (min-height: 461px) and (max-height: 470px) { #cont {margin-top: 35px;} }@media (min-height: 471px) and (max-height: 480px) { #cont {margin-top: 40px;} }@media (min-height: 481px) and (max-height: 490px) { #cont {margin-top: 45px;} }@media (min-height: 491px) and (max-height: 500px) { #cont {margin-top: 50px;} }@media (min-height: 501px) and (max-height: 510px) { #cont {margin-top: 55px;} }@media (min-height: 511px) and (max-height: 520px) { #cont {margin-top: 60px;} }@media (min-height: 521px) and (max-height: 530px) { #cont {margin-top: 65px;} }@media (min-height: 531px) and (max-height: 540px) { #cont {margin-top: 70px;} }@media (min-height: 541px) and (max-height: 550px) { #cont {margin-top: 75px;} }@media (min-height: 551px) and (max-height: 560px) { #cont {margin-top: 80px;} }@media (min-height: 561px) and (max-height: 570px) { #cont {margin-top: 85px;} }@media (min-height: 571px) and (max-height: 580px) { #cont {margin-top: 90px;} }@media (min-height: 581px) and (max-height: 590px) { #cont {margin-top: 95px;} }@media (min-height: 591px) and (max-height: 600px) { #cont {margin-top: 100px;} }@media (min-height: 601px) and (max-height: 610px) { #cont {margin-top: 105px;} }@media (min-height: 611px) and (max-height: 620px) { #cont {margin-top: 110px;} }@media (min-height: 621px) and (max-height: 630px) { #cont {margin-top: 115px;} }@media (min-height: 631px) and (max-height: 640px) { #cont {margin-top: 120px;} }@media (min-height: 641px) and (max-height: 650px) { #cont {margin-top: 125px;} }@media (min-height: 651px) and (max-height: 660px) { #cont {margin-top: 130px;} }@media (min-height: 661px) and (max-height: 670px) { #cont {margin-top: 135px;} }@media (min-height: 671px) and (max-height: 680px) { #cont {margin-top: 140px;} }@media (min-height: 681px) and (max-height: 690px) { #cont {margin-top: 145px;} }@media (min-height: 691px) and (max-height: 700px) { #cont {margin-top: 150px;} }@media (min-height: 701px) and (max-height: 710px) { #cont {margin-top: 155px;} }@media (min-height: 711px) and (max-height: 720px) { #cont {margin-top: 160px;} }@media (min-height: 721px) and (max-height: 730px) { #cont {margin-top: 165px;} }@media (min-height: 731px) and (max-height: 740px) { #cont {margin-top: 170px;} }@media (min-height: 741px) and (max-height: 750px) { #cont {margin-top: 175px;} }@media (min-height: 751px) and (max-height: 760px) { #cont {margin-top: 180px;} }@media (min-height: 761px) and (max-height: 770px) { #cont {margin-top: 185px;} }@media (min-height: 771px) and (max-height: 780px) { #cont {margin-top: 190px;} }@media (min-height: 781px) and (max-height: 790px) { #cont {margin-top: 195px;} }@media (min-height: 791px) and (max-height: 800px) { #cont {margin-top: 200px;} }@media (min-height: 801px) and (max-height: 810px) { #cont {margin-top: 205px;} }@media (min-height: 811px) and (max-height: 820px) { #cont {margin-top: 210px;} }@media (min-height: 821px) and (max-height: 830px) { #cont {margin-top: 215px;} }@media (min-height: 831px) and (max-height: 840px) { #cont {margin-top: 220px;} }@media (min-height: 841px) and (max-height: 850px) { #cont {margin-top: 225px;} }@media (min-height: 851px) and (max-height: 860px) { #cont {margin-top: 230px;} }@media (min-height: 861px) and (max-height: 870px) { #cont {margin-top: 235px;} }@media (min-height: 871px) and (max-height: 880px) { #cont {margin-top: 240px;} }@media (min-height: 881px) and (max-height: 890px) { #cont {margin-top: 245px;} }@media (min-height: 891px) and (max-height: 900px) { #cont {margin-top: 250px;} }@media (min-height: 901px) and (max-height: 910px) { #cont {margin-top: 255px;} }@media (min-height: 911px) and (max-height: 920px) { #cont {margin-top: 260px;} }@media (min-height: 921px) and (max-height: 930px) { #cont {margin-top: 265px;} }@media (min-height: 931px) and (max-height: 940px) { #cont {margin-top: 270px;} }@media (min-height: 941px) and (max-height: 950px) { #cont {margin-top: 275px;} }@media (min-height: 951px) and (max-height: 960px) { #cont {margin-top: 280px;} }@media (min-height: 961px) and (max-height: 970px) { #cont {margin-top: 285px;} }@media (min-height: 971px) and (max-height: 980px) { #cont {margin-top: 290px;} }@media (min-height: 981px) and (max-height: 990px) { #cont {margin-top: 295px;} }
  57. </style>
  58. <script type="text/javascript">
  59. function log(l) {try {console.log(l);}catch (e) {}}
  60. function track(style, action) {
  61. style || (style = 'unknown');
  62. action || (action = 'DrawLine');
  63. try {
  64. //_gaq.push(['_trackEvent', 'Events', 'DrawLine', style]); // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide?hl=pl#SettingUpEventTracking
  65. ga('send', 'event', 'Events', action, style); // https://developers.google.com/analytics/devguides/collection/analyticsjs/events?hl=pl
  66. }
  67. catch (e) {}
  68. }
  69. $(function () {
  70. var width = $('#width');
  71. var color = $('#color');
  72. $('#up, #down').click(function () {
  73. var t = $(this);
  74. var v = parseInt(width.html());
  75. if (t.is('#up')) {
  76. ++v
  77. }
  78. else {
  79. --v;
  80. if (v < 1) {
  81. v = 1;
  82. }
  83. }
  84. width.html(v);
  85. });
  86. function Correct() {
  87. var correct = $('#correct');
  88. var that = this;
  89. var step = 10;
  90. var box = $('#switch');
  91. this.states = function () {
  92. var v = this.get();
  93. if (v !== false && v !== true)
  94. return box.find('input').removeAttr('disabled');
  95. box.find('input').attr('disabled', 'disabled');
  96. return this;
  97. };
  98. $('#cup').click(function () {
  99. var v = that.get();
  100. var v = that.get();
  101. if (v === true) {
  102. correct.html(step+'');
  103. return that.states();
  104. }
  105. if (v === false) {
  106. correct.html('true');
  107. return that.states();
  108. }
  109. if (v === 0-step) {
  110. correct.html('false');
  111. return that.states();
  112. }
  113. correct.html(v+step);
  114. that.states();
  115. });
  116. $('#cdown').click(function () {
  117. var v = that.get();
  118. if (v === true) {
  119. correct.html('false');
  120. return that.states();
  121. }
  122. if (v === false) {
  123. correct.html('-'+(step+''));
  124. return that.states();
  125. }
  126. if (v === step) {
  127. correct.html('true');
  128. return that.states();
  129. }
  130. correct.html(v-step);
  131. that.states();
  132. });
  133. this.get = function () {
  134. var v = correct.html();
  135. if (v == 'true') {
  136. return true;
  137. }
  138. if (v == 'false') {
  139. return false;
  140. }
  141. return parseInt(v);
  142. };
  143. }
  144. var correct = (new Correct()).states();
  145. $('.minicolors').minicolors({
  146. control: 'hue',
  147. inline: false,
  148. letterCase: 'uppercase',
  149. theme: 'bootstrap'
  150. });
  151. function opt() {
  152. return {
  153. width: width.html(),
  154. color: color.val(),
  155. style: $('[name="style"]:checked').val(),
  156. correct: correct.get(),
  157. correctpos: $('[name="correctpos"]:checked').val(),
  158. css : {
  159. height: '0',
  160. zIndex: '999',
  161. zoom: 1
  162. }
  163. };
  164. }
  165. var a, b, hopt = {
  166. color: 'red',
  167. css : {
  168. zIndex: '1000'
  169. }
  170. };
  171. var mesure = $('#mesure');
  172. function callback(div, o, c, leave) {
  173. if (mesure.is(':checked') && o.correct !== false && o.correct !== true) {
  174. a = $.line(c.x1, c.y1, c.bx, c.by, hopt);
  175. b = $.line(c.x2, c.y2, c.dx, c.dy, $.extend({}, hopt, {color: 'green'}));
  176. if (leave) {
  177. a = b = null;
  178. }
  179. }
  180. }
  181. var x1, y1, x2, y2, run = false, t = $();
  182. $(window)
  183. .mousemove(function(e) {
  184. if (run) {
  185. t && t.remove();
  186. a && a.remove();
  187. b && b.remove();
  188. t = $.line(x1, y1, e.pageX, e.pageY, opt(), callback);
  189. }
  190. })
  191. .mousedown(function (e) {
  192. x1 = e.pageX;
  193. y1 = e.pageY;
  194. t = false;
  195. run = true;
  196. })
  197. .mouseup(function (e) {
  198. if ( (x1 - e.pageX) < 4 && (y1 - e.pageY) < 4 ) {
  199. return run = false;
  200. }
  201. run = false;
  202. t && t.remove();
  203. a && a.remove();
  204. b && b.remove();
  205. $.line(x1, y1, e.pageX, e.pageY, opt(), function (div, o, c) {
  206. callback(div, o, c, true);
  207. track(JSON.stringify({
  208. s: o.style,
  209. w: parseInt(o.width),
  210. c: o.color
  211. }));
  212. });
  213. });
  214. (function () {
  215. var go = false;
  216. $('#home').click(function (e) {
  217. e.preventDefault();
  218. var h = $(this).attr('href');
  219. if (!go) {
  220. go = true;
  221. track('home', 'redirect');
  222. setTimeout(function () {
  223. location.href = h;
  224. },1000);
  225. }
  226. });
  227. })();
  228. });
  229. </script>
  230. </head>
  231. <body>
  232. <div id="cont">
  233. <div class="btspa">
  234. <div>
  235. <a href="https://bitbucket.org/stopsopa/jquery.line" class="btn btn-link"><img src="favicon.png" alt="" /> manual/download</a>
  236. </div>
  237. <div class="alert alert-info">
  238. <i class="glyphicon glyphicon-info-sign"></i> Use your mouse to draw lines on screen
  239. </div>
  240. <table>
  241. <tbody>
  242. <tr>
  243. <td>
  244. width:
  245. </td>
  246. <td>
  247. <span id="width">3</span><button class="btn btn-primary btn-xs" id="up"><i class="glyphicon glyphicon-chevron-up"></i></button> <button class="btn btn-primary btn-xs" id="down"><i class="glyphicon glyphicon-chevron-down"></i></button>
  248. </td>
  249. </tr>
  250. <tr>
  251. <td colspan="2">
  252. <br />
  253. <br />
  254. </td>
  255. </tr>
  256. <tr>
  257. <td>
  258. color:
  259. </td>
  260. <td>
  261. <input type="text" class="form-control minicolors" value="#383838" id="color" autocomplete="off"/>
  262. </td>
  263. </tr>
  264. <tr>
  265. <td>
  266. style:
  267. </td>
  268. <td>
  269. <label><input type="radio" name="style" value="solid" autocomplete="off" checked="checked"/>solid</label>
  270. <label><input type="radio" name="style" value="dotted" autocomplete="off"/>dotted</label>
  271. <label><input type="radio" name="style" value="dashed" autocomplete="off"/>dashed</label>
  272. <label><input type="radio" name="style" value="double" autocomplete="off"/>double</label>
  273. <br />
  274. <label><input type="radio" name="style" value="groove" autocomplete="off"/>groove</label>
  275. <label><input type="radio" name="style" value="ridge" autocomplete="off"/>ridge</label>
  276. <label><input type="radio" name="style" value="inset" autocomplete="off"/>inset</label>
  277. <label><input type="radio" name="style" value="outset" autocomplete="off"/>outset</label>
  278. </td>
  279. </tr>
  280. <tr>
  281. <td>
  282. correct:
  283. </td>
  284. <td>
  285. <span id="correct">true</span><button class="btn btn-primary btn-xs" id="cup"><i class="glyphicon glyphicon-chevron-up"></i></button> <button class="btn btn-primary btn-xs" id="cdown"><i class="glyphicon glyphicon-chevron-down"></i></button>
  286. </td>
  287. </tr>
  288. <tr>
  289. <td>
  290. always on:
  291. </td>
  292. <td id="switch">
  293. <label><input type="radio" name="correctpos" value="normal" autocomplete="off" checked="checked"/>normal</label>
  294. <label><input type="radio" name="correctpos" value="top" autocomplete="off"/>top</label>
  295. <label><input type="radio" name="correctpos" value="bottom" autocomplete="off"/>bottom</label>
  296. <label><input type="radio" name="correctpos" value="left" autocomplete="off"/>left</label>
  297. <label><input type="radio" name="correctpos" value="right" autocomplete="off"/>right</label>
  298. <br />
  299. <label><input type="checkbox" id="mesure" autocomplete="off"/> mesure</label>
  300. </td>
  301. </tr>
  302. </tbody>
  303. </table>
  304. </div>
  305. </div>
  306. <div class="clear"></div>
  307. <div id="disqus_thread"></div>
  308. <script type="text/javascript">
  309. /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  310. var disqus_shortname = 'stopsopabitbucket'; // required: replace example with your forum shortname
  311. /* * * DON'T EDIT BELOW THIS LINE * * */
  312. (function() {
  313. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  314. dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  315. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  316. })();
  317. </script>
  318. <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  319. <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
  320. <script>
  321. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  322. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  323. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  324. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  325. ga('create', 'UA-52657901-1', 'auto');
  326. ga('send', 'pageview');
  327. </script>
  328. </body>
  329. </html>