This commit is contained in:
Mahdi Dibaiee 2014-04-27 22:01:15 +04:30
parent dd103bd4b8
commit 88df69beaf
11 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,8 @@
<widget id='com.mdibaiee.sketchy' version='1.2.1'> <?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id='com.mdibaiee.sketchy' version='1.2.1'>
<name>Sketchy</name> <name>Sketchy</name>
<description> <description>
@ -9,6 +13,7 @@
</author> </author>
<content src='index.html'/> <content src='index.html'/>
<access origin='*'/> <access origin='*'/>
<feature name="http://api.phonegap.com/1.0/device" />
<preference name='KeepRunning' value='false'/> <preference name='KeepRunning' value='false'/>
<preference name='SplashScreen' value='sketchy'/> <preference name='SplashScreen' value='sketchy'/>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
$(function(){"use strict";function a(a,b,c){a/=360,b/=100,c/=100;var d,e,f;if(0==b)d=e=f=c;else{var g=function(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a},h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;d=g(i,h,a+1/3),e=g(i,h,a),f=g(i,h,a-1/3)}return{red:Math.round(255*d),green:Math.round(255*e),blue:Math.round(255*f)}}function b(a,b,c){a/=255,b/=255,c/=255;var d,e,f=Math.max(a,b,c),g=Math.min(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{hue:Math.round(360*d),saturation:Math.round(100*e),luminosity:Math.round(100*h)}}function c(a,b,c){return"#"+((1<<24)+(a<<16)+(b<<8)+c).toString(16).slice(1)}function d(a){var b=parseInt(a.replace("#",""),16),c=b>>16&255,d=b>>8&255,e=255&b;return{red:c,green:d,blue:e}}function e(a){var c=d(a);return b(c.red,c.green,c.blue)}function f(b,d,e){var f=a(b,d,e);return c(f.red,f.green,f.blue)}$.each($(".color-picker"),function(){function c(){var a=h.find(".pin").position(),b=l.width(),c=l.height();return{hue:Math.round(a.left/b*360),saturation:Math.round(a.top/c*100),luminosity:k.val()}}function d(){var b=c();switch(i.val()){case"HSL":j.val("hsl("+b.hue+", "+b.saturation+"%, "+b.luminosity+"%)");break;case"RGB":var d=a(b.hue,b.saturation,b.luminosity);j.val("rgb("+d.red+", "+d.green+", "+d.blue+")");break;case"Hex":j.val(f(b.hue,b.saturation,b.luminosity))}h.trigger("change")}function g(a){var b,c;50>=a?(b="0, 0, 0",c=1-a/100*2):(b="255, 255, 255",c=a/100*2-1),l.children().css("background-color","rgba("+b+", "+c+")")}var h=$(this),i=h.find(".format"),j=h.find(".color"),k=h.find("input[type=range]"),l=h.find(".spectrum"),m=h.find(".pin");i.on("change",function(){d()}),j.on("change",function(){var a;switch(i.val()){case"HSL":var c=$(this).val().match(/\d+/g);a={hue:c[0],saturation:c[1],luminosity:c[2]};break;case"RGB":var c=$(this).val().match(/\d+/g);a=b(c[0],c[1],c[2]);break;case"Hex":a=e($(this).val())}k.val(a.luminosity),g(a.luminosity),m.css({left:a.hue/360*100+"%",top:a.saturation+"%"}),h.trigger("change")}),k.on("change",function(){g($(this).val()),d()});var n=function(a){var b=l.offset(),c=l.width(),e=l.height(),f=a.changedTouches[0].clientX-b.left,g=a.changedTouches[0].clientY-b.top;0>f?f=0:f>=c&&(f=c),0>g?g=0:g>=e&&(g=e),m.css({left:f/c*100+"%",top:g/e*100+"%"}),d()};l.on("touchstart",function(a){a.preventDefault(),n(a),l.addClass("active"),$(document).on("touchmove",n)}),$(document).on("touchend",function(){l.removeClass("active"),$(document).off("touchmove",n)}),l.on("touchmove touchstart",n),h.on("change",function(){j.css("background-color",j.val()).toggleClass("dark",k.val()<=50)}),j.trigger("change")})});

View File

@ -0,0 +1 @@
$(function(){"use strict";function a(a,b,c){a/=360,b/=100,c/=100;var d,e,f;if(0==b)d=e=f=c;else{var g=function(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a},h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;d=g(i,h,a+1/3),e=g(i,h,a),f=g(i,h,a-1/3)}return{red:Math.round(255*d),green:Math.round(255*e),blue:Math.round(255*f)}}function b(a,b,c){a/=255,b/=255,c/=255;var d,e,f=Math.max(a,b,c),g=Math.min(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{hue:Math.round(360*d),saturation:Math.round(100*e),luminosity:Math.round(100*h)}}function c(a,b,c){return"#"+((1<<24)+(a<<16)+(b<<8)+c).toString(16).slice(1)}function d(a){var b=parseInt(a.replace("#",""),16),c=b>>16&255,d=b>>8&255,e=255&b;return{red:c,green:d,blue:e}}function e(a){var c=d(a);return b(c.red,c.green,c.blue)}function f(b,d,e){var f=a(b,d,e);return c(f.red,f.green,f.blue)}$.each($(".color-picker"),function(){function c(){var a=h.find(".pin").position(),b=l.width(),c=l.height();return{hue:Math.round(a.left/b*360),saturation:Math.round(a.top/c*100),luminosity:k.val()}}function d(){var b=c();switch(i.val()){case"HSL":j.val("hsl("+b.hue+", "+b.saturation+"%, "+b.luminosity+"%)");break;case"RGB":var d=a(b.hue,b.saturation,b.luminosity);j.val("rgb("+d.red+", "+d.green+", "+d.blue+")");break;case"Hex":j.val(f(b.hue,b.saturation,b.luminosity))}h.trigger("change")}function g(a){var b,c;50>=a?(b="0, 0, 0",c=1-a/100*2):(b="255, 255, 255",c=a/100*2-1),l.children().css("background-color","rgba("+b+", "+c+")")}var h=$(this),i=h.find(".format"),j=h.find(".color"),k=h.find("input[type=range]"),l=h.find(".spectrum"),m=h.find(".pin");i.on("change",function(){d()}),j.on("change",function(){var a;switch(i.val()){case"HSL":var c=$(this).val().match(/\d+/g);a={hue:c[0],saturation:c[1],luminosity:c[2]};break;case"RGB":var c=$(this).val().match(/\d+/g);a=b(c[0],c[1],c[2]);break;case"Hex":a=e($(this).val())}k.val(a.luminosity),g(a.luminosity),m.css({left:a.hue/360*100+"%",top:a.saturation+"%"}),h.trigger("change")}),k.on("change",function(){g($(this).val()),d()});var n=function(a){var b=l.offset(),c=l.width(),e=l.height(),f=a.clientX-b.left,g=a.clientY-b.top;0>f?f=0:f>=c&&(f=c),0>g?g=0:g>=e&&(g=e),m.css({left:f/c*100+"%",top:g/e*100+"%"}),d()};l.on("mousedown",function(a){a.preventDefault(),n(a),l.addClass("active"),$(document).on("mousemove",n)}),$(document).on("mouseup",function(){l.removeClass("active"),$(document).off("mousemove",n)}),l.on("touchmove touchstart",n),h.on("change",function(){j.css("background-color",j.val()).toggleClass("dark",k.val()<=50)}),j.trigger("change")})});

View File

@ -0,0 +1 @@
!function(a){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))&&(window.mobile=!0)}(navigator.userAgent||navigator.vendor||window.opera,"http://detectmobilebrowser.com/mobile");

View File

@ -0,0 +1 @@
!function(a){a.fn.end=function(){return this.prevObject||a()},a.fn.andSelf=function(){return this.add(this.prevObject||a())},"filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings".split(",").forEach(function(b){var c=a.fn[b];a.fn[b]=function(){var a=c.apply(this,arguments);return a.prevObject=this,a}})}(Zepto);

View File

@ -0,0 +1 @@
!function(a){function b(a,b,c,d){return Math.abs(a-b)>=Math.abs(c-d)?a-b>0?"Left":"Right":c-d>0?"Up":"Down"}function c(){k=null,m.last&&(m.el.trigger("longTap"),window.touchEl=m.el,m={})}function d(){k&&clearTimeout(k),k=null}function e(){h&&clearTimeout(h),i&&clearTimeout(i),j&&clearTimeout(j),k&&clearTimeout(k),h=i=j=k=null,m={}}function f(a){return("touch"==a.pointerType||a.pointerType==a.MSPOINTER_TYPE_TOUCH)&&a.isPrimary}function g(a,b){return a.type=="pointer"+b||a.type.toLowerCase()=="mspointer"+b}var h,i,j,k,l,m={},n=750;a(document).ready(function(){var o,p,q,r,s=0,t=0;"MSGesture"in window&&(l=new MSGesture,l.target=document.body),a(document).bind("MSGestureEnd",function(a){var b=a.velocityX>1?"Right":a.velocityX<-1?"Left":a.velocityY>1?"Down":a.velocityY<-1?"Up":null;b&&(m.el.trigger("swipe"),m.el.trigger("swipe"+b))}).on("touchstart MSPointerDown pointerdown",function(b){(!(r=g(b,"down"))||f(b))&&(q=r?b:b.touches[0],b.touches&&1===b.touches.length&&m.x2&&(m.x2=void 0,m.y2=void 0),o=Date.now(),p=o-(m.last||o),m.el=a("tagName"in q.target?q.target:q.target.parentNode),h&&clearTimeout(h),m.x1=q.pageX,m.y1=q.pageY,p>0&&250>=p&&(m.isDoubleTap=!0),m.last=o,k=setTimeout(c,n),l&&r&&l.addPointer(b.pointerId))}).on("touchmove MSPointerMove pointermove",function(b){(!(r=g(b,"move"))||f(b))&&(q=r?b:b.touches[0],a.moveCancel&&d(),m.x2=q.pageX,m.y2=q.pageY,s+=Math.abs(m.x1-m.x2),t+=Math.abs(m.y1-m.y2))}).on("touchend MSPointerUp pointerup",function(c){(!(r=g(c,"up"))||f(c))&&(d(),m.x2&&Math.abs(m.x1-m.x2)>30||m.y2&&Math.abs(m.y1-m.y2)>30?j=setTimeout(function(){m.el.trigger("swipe"),m.el.trigger("swipe"+b(m.x1,m.x2,m.y1,m.y2)),m={}},0):"last"in m&&(30>s&&30>t?i=setTimeout(function(){var b=a.Event("tap");b.cancelTouch=e,m.el.trigger(b),m.isDoubleTap?(m.el&&m.el.trigger("doubleTap"),m={}):h=setTimeout(function(){h=null,m.el&&m.el.trigger("singleTap"),m={}},250)},0):m={}),s=t=0)}).on("touchcancel MSPointerCancel pointercancel",e),a(window).on("scroll",e)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(b){a.fn[b]=function(a){return this.on(b,a)}})}(Zepto);

1
build/android/js/libs/yepnope.min.js vendored Normal file
View File

@ -0,0 +1 @@
!function(a,b,c){function d(a){return"[object Function]"==q.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=r.shift();s=1,a?a.t?o(function(){("c"==a.t?m.injectCss:m.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):s=0}function i(a,c,d,e,f,i,j){function k(b){if(!n&&g(l.readyState)&&(t.r=n=1,!s&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&o(function(){v.removeChild(l)},50);for(var d in A[c])A[c].hasOwnProperty(d)&&A[c][d].onload()}}var j=j||m.errorTimeout,l=b.createElement(a),n=0,q=0,t={t:d,s:c,e:f,a:i,x:j};1===A[c]&&(q=1,A[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,q)},r.splice(e,0,t),"img"!=a&&(q||2===A[c]?(v.insertBefore(l,u?null:p),o(k,j)):A[c].push(l))}function j(a,b,c,d,f){return s=0,b=b||"j",e(a)?i("c"==b?x:w,a,b,this.i++,c,d,f):(r.splice(this.i++,0,a),1==r.length&&h()),this}function k(){var a=m;return a.loader={load:j,i:0},a}var l,m,n=b.documentElement,o=a.setTimeout,p=b.getElementsByTagName("script")[0],q={}.toString,r=[],s=0,t="MozAppearance"in n.style,u=t&&!!b.createRange().compareNode,v=u?n:p.parentNode,n=a.opera&&"[object Opera]"==q.call(a.opera),n=!!b.attachEvent&&!n,w=t?"object":n?"script":"img",x=n?"script":w,y=Array.isArray||function(a){return"[object Array]"==q.call(a)},z=[],A={},B={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}};m=function(a){function b(a){var b,c,d,a=a.split("!"),e=z.length,f=a.pop(),g=a.length,f={url:f,origUrl:f,prefixes:a};for(c=0;g>c;c++)d=a[c].split("="),(b=B[d.shift()])&&(f=b(f,d));for(c=0;e>c;c++)f=z[c](f);return f}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(A[i.url]?i.noexec=!0:A[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),A[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(l=function(){var a=[].slice.call(arguments);m.apply(this,a),n()}),g(a,l,b,0,j);else if(Object(a)===a)for(i in h=function(){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c}(),a)a.hasOwnProperty(i)&&(!c&&!--h&&(d(l)?l=function(){var a=[].slice.call(arguments);m.apply(this,a),n()}:l[i]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),n()}}(m[i])),g(a[i],l,b,i,j))}else!c&&n()}var h,i,j=!!a.test,k=a.load||a.both,l=a.callback||f,m=l,n=a.complete||f;c(j?a.yep:a.nope,!!k),k&&c(k)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(y(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):y(j)?m(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},m.addPrefix=function(a,b){B[a]=b},m.addFilter=function(a){z.push(a)},m.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",l=function(){b.removeEventListener("DOMContentLoaded",l,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k,l,n=b.createElement("script"),e=e||m.errorTimeout;n.src=a;for(l in d)n.setAttribute(l,d[l]);c=j?h:c||f,n.onreadystatechange=n.onload=function(){!k&&g(n.readyState)&&(k=1,c(),n.onload=n.onreadystatechange=null)},o(function(){k||(k=1,c(1))},e),i?n.onload():p.parentNode.insertBefore(n,p)},a.yepnope.injectCss=function(a,c,d,e,g,i){var j,e=b.createElement("link"),c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(p.parentNode.insertBefore(e,p),o(c,0))}}(this,document);

1
build/android/js/libs/zepto.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
$(document).ready(function(){window.c=$("canvas")[0].getContext("2d"),window.o=$("canvas")[1].getContext("2d"),window.c.clear=window.o.clear=function(){this.clearRect(0,0,width(),height())},window.settings={stroke:!0,fill:!1,lineWidth:2,color:"black",bg:"white",type:"sketch",lineCap:"round",lineJoin:"round",furLength:50,connectTelorance:40,composite:"source-over",shape:"circle",shapeStart:{},comShape:{},drawingLine:[],version:1.2},window.points=[],window.$c=$("canvas"),window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]}],window.points.history.last=0,sizeAndPos(),$(".color-picker").change(function(){var a=$(this).find(".color").val(),b=$(this).parent().attr("data-caller");settings[b]=a,$("#set"+b+" span").html(a),"bg"==b&&$c.first().css("background",a)}),$(".color").val("#000000"),localStorage.getItem("sawTips")!=settings.version&&($(".tour").removeClass("hidden"),localStorage.setItem("sawTips",settings.version))});