diff --git a/.gitignore b/.gitignore index 53b7af4..b462f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp *.swo *~ +node_modules diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..4982baa --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,127 @@ +var which; +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + uglify: { + main: { + files: [ + { + expand: true, + cwd: 'Shared/js/', + src: '**', + dest: 'build/mobile/js/', + filter: 'isFile' + }, + { + expand: true, + cwd: 'Shared/js', + src: '**', + dest: 'build/web/js', + filter: 'isFile' + }, + { + expand: true, + cwd: 'Mobile/js/', + src: '*', + dest: 'build/mobile/js', + filter: 'isFile' + }, + { + expand: true, + cwd: 'Web/js/', + src: '*', + dest: 'build/web/js', + filter: 'isFile' + } + ] + } + }, + less: { + production: { + files: { + 'build/mobile/css/main.css': 'Shared/css/main.less', + 'build/web/css/main.css': 'Shared/css/main.less' + }, + compress: true + } + }, + copy: { + 'main files': { + files: [ + { + expand: true, + cwd: 'Shared', + src: 'img', + dest: 'build/mobile' + }, + { + expand: true, + cwd: 'Shared', + src: 'img', + dest: 'build/web' + }, + { + expand: true, + cwd: 'Mobile', + src: ['index.html', 'manifest.webapp'], + dest: 'build/mobile' + }, + { + expand: true, + cwd: 'Web', + src: ['index.html', 'manifest.webapp', 'cache.appcache'], + dest: 'build/web' + } + ] + }, + 'css assets': { + files: [ + { + expand: true, + cwd: 'Shared/css', + src: '*/**', + dest: 'build/mobile/css' + }, + { + expand: true, + cwd: 'Shared/css', + src: '*/**', + dest: 'build/web/css' + } + ] + } + }, + + watch: { + js: { + files: ['Shared/js/**', 'Mobile/js/**', 'Web/js/**'], + tasks: 'uglify', + options: { + spawn: false + } + }, + less: { + files: 'Shared/css/**', + tasks: 'less', + options: { + spawn: false + } + }, + copy: { + files: 'Shared/**', + tasks: 'copy', + options: { + spawn: false + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-less'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.registerTask('default', ['uglify','copy', 'less']) + +} diff --git a/Mobile/index.html b/Mobile/index.html index f7628c0..5620125 100755 --- a/Mobile/index.html +++ b/Mobile/index.html @@ -253,8 +253,9 @@ - - + + + diff --git a/Mobile/js/diff.js b/Mobile/js/diff.js new file mode 100644 index 0000000..a9b9856 --- /dev/null +++ b/Mobile/js/diff.js @@ -0,0 +1,103 @@ +$(document).ready(function() { + + $('*').off('click mousemove mousedown mouseup mouseleave').on('click mousemove mousedown mouseup mouseleave', function(e) { + e.preventDefault; + return false; + }) + + $('a[href^="http"]').tap(function(e) { + e.preventDefault(); + var href = $(this).attr('href'); + var view = new MozActivity({ + name: 'view', + data: { + type: 'url', + url: href + } + }) + }) + + $('a[href^="mailto"]').tap(function(e) { + e.preventDefault(); + var mail = /mailto:(.*)/.exec($(this).attr('href'))[1]; + var mail = new MozActivity({ + name: 'new', + data: { + type: 'mail', + url: mail + } + }) + }) + + window.save = function() { + switch(save.background) { + case 'white': { + c.fillStyle = 'white'; + c.globalCompositeOperation = 'destination-over'; + c.fillRect(0, 0, width(), height()); + c.fillStyle = settings.color; + c.globalCompositeOperation = settings.composite; + break; + } + case 'current color': { + c.fillStyle = settings.bg; + c.globalCompositeOperation = 'destination-over'; + c.fillRect(0, 0, width(), height()); + c.globalCompositeOperation = settings.composite; + break; + } + } + var data = $c[0].toDataURL(); + if( save.type == 'sketchy project' ) { + var list = JSON.parse(localStorage.getItem('projects')); + var index; + if( list && list.some(function(a, i) { if( a.name == save['file name'] ) {index = i; return true} return false }) ) { + if( confirm('A sketch with this name already exists. Do you want to overwrite ' + save['file name']) + '?' ) { + console.log(index); + list[index] = { + name: save['file name'], + data: data, + points: window.points, + settings: settings + } + localStorage.setItem('projects', JSON.stringify(list)); + } + } + else + list ? list.push({ + name: save['file name'], + data: data, + points: window.points + }) : list = [{ + name: save['file name'], + data: data, + points: window.points + }]; + localStorage.setItem('projects', JSON.stringify(list)); + } else { + window.open(data, '_blank').focus(); + } + + c.putImageData(window.points.history[window.points.history.last].data, 0, 0); + } + + window.load = function() { + var file = JSON.parse(localStorage.getItem('projects')).filter(function(a) { return a.name == load.file })[0]; + var img = document.createElement('img'); + img.src = file.data; + img.onload = function() { + c.clearRect(0, 0, width(), height()); + c.drawImage(img, 0, 0); + window.points = file.points; + window.points.history = [{ data: c.createImageData($c.width(), $c.height()), points: []}, { data: c.getImageData(0, 0, width(), height()), points: file.points}]; + $c.first().css('background', file.settings.bg); + window.settings.bg = file.settings.bg; + } + } + + if( localStorage.getItem('sawTips') != settings.version ) { + $('.tour').removeClass('hidden'); + localStorage.setItem('sawTips', settings.version); + } + +}) diff --git a/Mobile/js/functions-m.js b/Mobile/js/functions-m.js deleted file mode 100755 index 37b4973..0000000 --- a/Mobile/js/functions-m.js +++ /dev/null @@ -1,239 +0,0 @@ -"use strict"; -/*** ESSENTIALS ***/ - -function sizeAndPos() { - - var data = c.getImageData(0,0, $c.width(), $c.height()); - var w = $(window).width(), - h = $(window).height() - 53; - $c.attr('width', w * window.devicePixelRatio); - $c.attr('height',h * window.devicePixelRatio); - $c.css({ - 'width' : w, - 'height' : h - }); - c.clearRect(0,0, width(), height()); - c.putImageData(data, 0, 0); -} - -function relative(x,y, el) { - var el = el || $c[0]; - return { - x : x*window.devicePixelRatio - el.offset().left, - y : (y - 53) * window.devicePixelRatio - el.offset().top - } -} - -function threshold(x1, y1, x2, y2, threshold) { - var tr = threshold || 5; - if( x1 <= x2 + tr && x1 >= x2 - tr && y1 <= y2 + tr && y1 >= y2 - tr ) return true; - return false; -} - -function draw(x1, y1, x2, y2, opts, overlay) { - opts = opts || {}; - var c = window.c; - if( overlay ) var c = window.o; - c.beginPath(); - if( settings.type == 'eraser' ) c.globalCompositeOperation = 'destination-out'; - else c.globalCompositeOperation = opts.composite || settings.composite; - c.lineCap = opts.lineCap || settings.lineCap; - c.lineJoin = opts.lineJoin || settings.lineJoin; - c.strokeStyle = opts.color || settings.color; - c.fillStyle = opts.color || settings.color; - c.lineWidth = ( opts.lineWidth || settings.lineWidth ) / 10; - c.moveTo(x1, y1); - c.lineTo(x2, y2); - if( !opts.noStroke ) c.stroke(); - if( opts.fill ) c.fill(); -} - -function shape(opts, overlay) { - if(overlay) var c = window.o; - else var c = window.c; - c.beginPath(); - c.fillStyle = opts.color || settings.color; - switch(opts.type) { - - case 'circle': { - c.arc(opts.x, opts.y, opts.radius, 0, 2*Math.PI); - break; - } - case 'rectangle': { - c.rect(opts.x, opts.y, opts.width, opts.height); - break; - } - case 'square': { - c.rect(opts.x, opts.y, opts.width, opts.width); - break; - } - case 'triangle': { - c.fillStyle = opts - c.moveTo(opts.x1, opts.y1); - c.lineTo(opts.x2, opts.y2); - c.lineTo(opts.x3, opts.y3); - c.lineTo(opts.x1, opts.y1); - } - - } - c.fill(); -} - - -function undo() { - var history = window.points.history; - if( history.last > 1 ) { - var step = history[history.last-1]; - c.putImageData(step.data, 0, 0); - window.points = step.points.slice(0); - window.points.history = history; - window.points.history.last = history.last-1; - } else { - c.clearRect(0,0, width(), height()); - window.points = []; - window.points.history = history; - window.points.history.last = 0; - } - -} - -function redo() { - var history = window.points.history; - if( history.last < history.length-1 ) { - var step = history[history.last+1]; - c.putImageData(step.data, 0, 0); - window.points = step.points.slice(0); - window.points.history = history; - window.points.history.last = history.last+1; - } -} - -function width() { - return +$c.attr('width'); -} - -function height() { - return +$c.attr('height'); -} - -function dataToBlob(data) { - var binary = atob(data.split(',')[1]), array = []; - var type = data.split(',')[0].split(':')[1].split(';')[0]; - for(var i = 0; i < binary.length; i++) array.push(binary.charCodeAt(i)); - return new Blob([new Uint8Array(array)], {type: type}); -} - - -/*** END ***/ - -function startPoint(x, y) { - - // If no previous point exists, make the first one. - if( !points.length ) points.push({x: x, y: y, type: '', start: {x: x, y: y}}); - - var old = points[points.length-1], - start = old.start, - current = { - x : x, - y : y, - start : old.start || {x: x, y: y}, - type : settings.type - } - // Line - if( old.type !== 'line' && current.type == 'line' ) { - window.o.beginPath(); - window.o.fillStyle = 'red'; - window.o.arc(x,y, 3, 0, 2*Math.PI); - window.o.fill(); - } - - if( old.type == 'line' && current.type == 'line' ) { - if( points[points.indexOf(old)-1].type !== 'line' ) { - o.clearRect(old.x-3, old.y-3, 6, 6, true); - draw(old.x, old.y, x, y); - } else - draw(old.x, old.y, x, y); - } - - // Shapes - - if( old.type !== 'shape' && current.type == 'shape' ) { - settings.shape. - } - - var thresholds = window.mobile ? [10, 5] : [5, 2]; - if( points.length > 1 && ((start && threshold(start.x, start.y, x, y, thresholds[0])) || threshold(old.x, old.y, x, y, thresholds[1])) ) { - window.active = false; - points[points.length-1].type = ''; - points[points.length-1].start = undefined; - return; - } - points.push(current); -} - -function drawPoint(x,y) { - var capture = points[points.length-1]; - - switch(capture.type) { - case 'eraser': { - capture.type = 'pen'; - } - case 'pen': { - draw(capture.x, capture.y, x, y); - - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - - points.push(current); - break; - } - case 'sketch': { - draw(capture.x, capture.y, x, y); - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - points.push(current); - - for( var i = 0, len = points.length-1; i < len; i++ ) { - if(threshold(points[i].x, points[i].y, current.x, current.y, settings.connectTelorance)) { - var x = points[i].x - current.x, - y = points[i].y - current.y; - var w = settings.lineWidth/20 > 0.2 ? settings.lineWidth/20 : 0.2; - - draw(points[i].x - x*0.2, points[i].y - y*0.2, current.x + x*0.2, current.y + y*0.2, {strokeStyle: 'rgba(0,0,0,0.4)', lineWidth: w}) - } - } - break; - } - case 'fur': { - draw(capture.x, capture.y, x, y); - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - points.push(current); - - for( var i = 0, len = points.length-1; i < len; i++ ) { - if(threshold(points[i].x, points[i].y, current.x, current.y, settings.connectTelorance)) { - var x = points[i].x - current.x, - y = points[i].y - current.y; - var l = settings.furLength / 100 || 0.2; - var w = settings.lineWidth/20 > 0.2 ? settings.lineWidth/20 : 0.2; - - draw(points[i].x + x*l, points[i].y + y*l, current.x - x*l, current.y - y*l, {strokeStyle: 'rgba(0,0,0,0.4)', lineWidth: w}) - } - } - break; - } - } -} - diff --git a/Mobile/js/less-1.5.0.min.js b/Mobile/js/less-1.5.0.min.js deleted file mode 100755 index ef4be90..0000000 --- a/Mobile/js/less-1.5.0.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * LESS - Leaner CSS v1.5.0 - * http://lesscss.org - * - * Copyright (c) 2009-2013, Alexis Sellier - * Licensed under the Apache v2 License. - * - * @licence - */ - -function require(a){return window.less[a.split("/")[1]]}function log(a,b){"development"==less.env&&"undefined"!=typeof console&&less.logLevel>=b&&console.log("less: "+a)}function extractId(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function errorConsole(a,b){var c="{line} {content}",d=a.filename||b,e=[],f=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+d+" ",g=function(a,b,d){void 0!==a.extract[b]&&e.push(c.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[b]))};a.extract?(g(a,0,""),g(a,1,"line"),g(a,2,""),f+="on line "+a.line+", column "+(a.column+1)+":\n"+e.join("\n")):a.stack&&(f+=a.stack),log(f,logLevel.errors)}function createCSS(a,b,c){var d=b.href||"",e="less:"+(b.title||extractId(d)),f=document.getElementById(e),g=!1,h=document.createElement("style");if(h.setAttribute("type","text/css"),b.media&&h.setAttribute("media",b.media),h.id=e,h.styleSheet)try{h.styleSheet.cssText=a}catch(i){throw new Error("Couldn't reassign styleSheet.cssText.")}else h.appendChild(document.createTextNode(a)),g=null!==f&&f.childNodes.length>0&&h.childNodes.length>0&&f.firstChild.nodeValue===h.firstChild.nodeValue;var j=document.getElementsByTagName("head")[0];if(null===f||g===!1){var k=b&&b.nextSibling||null;k?k.parentNode.insertBefore(h,k):j.appendChild(h)}if(f&&g===!1&&f.parentNode.removeChild(f),c&&cache){log("saving "+d+" to cache.",logLevel.info);try{cache.setItem(d,a),cache.setItem(d+":timestamp",c)}catch(i){log("failed to save",logLevel.errors)}}}function errorHTML(a,b){var c,d,e="less-error-message:"+extractId(b||""),f='
  • {content}
  • ',g=document.createElement("div"),h=[],i=a.filename||b,j=i.match(/([^\/]+(\?.*)?)$/)[1];g.id=e,g.className="less-error-message",d="

    "+(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+"

    "+'

    in '+j+" ";var k=function(a,b,c){void 0!==a.extract[b]&&h.push(f.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract?(k(a,0,""),k(a,1,"line"),k(a,2,""),d+="on line "+a.line+", column "+(a.column+1)+":

    "+""):a.stack&&(d+="
    "+a.stack.split("\n").slice(1).join("
    ")),g.innerHTML=d,createCSS([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),g.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"==less.env&&(c=setInterval(function(){document.body&&(document.getElementById(e)?document.body.replaceChild(g,document.getElementById(e)):document.body.insertBefore(g,document.body.firstChild),clearInterval(c))},10))}function error(a,b){less.errorReporting&&"html"!==less.errorReporting?"console"===less.errorReporting?errorConsole(a,b):"function"==typeof less.errorReporting&&less.errorReporting("add",a,b):errorHTML(a,b)}function removeErrorHTML(a){var b=document.getElementById("less-error-message:"+extractId(a));b&&b.parentNode.removeChild(b)}function removeErrorConsole(){}function removeError(a){less.errorReporting&&"html"!==less.errorReporting?"console"===less.errorReporting?removeErrorConsole(a):"function"==typeof less.errorReporting&&less.errorReporting("remove",a):removeErrorHTML(a)}function loadStyles(a){for(var b,c=document.getElementsByTagName("style"),d=0;d0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=f[1]+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g}function pathDiff(a,b){var c,d,e,f,g=extractUrlParts(a),h=extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;c=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var f=getXMLHttpRequest(),g=isFileProtocol?less.fileAsync:less.async;"function"==typeof f.overrideMimeType&&f.overrideMimeType("text/css"),log("XHR: Getting '"+a+"'",logLevel.info),f.open("GET",a,g),f.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),f.send(null),isFileProtocol&&!less.fileAsync?0===f.status||f.status>=200&&f.status<300?c(f.responseText):d(f.status,a):g?f.onreadystatechange=function(){4==f.readyState&&e(f,c,d)}:e(f,c,d)}function loadFile(a,b,c,d,e){b&&b.currentDirectory&&!/^([a-z-]+:)?\//.test(a)&&(a=b.currentDirectory+a);var f=extractUrlParts(a,window.location.href),g=f.url,h={currentDirectory:f.path,filename:g};if(b?(h.entryPath=b.entryPath,h.rootpath=b.rootpath,h.rootFilename=b.rootFilename,h.relativeUrls=b.relativeUrls):(h.entryPath=f.path,h.rootpath=less.rootpath||f.path,h.rootFilename=g,h.relativeUrls=d.relativeUrls),h.relativeUrls&&(h.rootpath=d.rootpath?extractUrlParts(d.rootpath+pathDiff(f.path,h.entryPath)).path:f.path),d.useFileCache&&fileCache[g])try{var i=fileCache[g];e&&(i+="\n"+e),c(null,i,g,h,{lastModified:new Date})}catch(j){c(j,null,g)}else doXHR(g,d.mime,function(a,b){fileCache[g]=a;try{c(null,a,g,h,{lastModified:b})}catch(d){c(d,null,g)}},function(a,b){c({type:"File",message:"'"+b+"' wasn't found ("+a+")"},null,g)})}function loadStyleSheet(a,b,c,d,e){var f=new less.tree.parseEnv(less);f.mime=a.type,e&&(f.useFileCache=!0),loadFile(a.href,null,function(e,g,h,i,j){if(j){j.remaining=d;var k=cache&&cache.getItem(h),l=cache&&cache.getItem(h+":timestamp");if(!c&&l&&j.lastModified&&new Date(j.lastModified).valueOf()===new Date(l).valueOf())return createCSS(k,a),j.local=!0,b(null,null,g,a,j,h),void 0}removeError(h),g?(f.currentFileInfo=i,new less.Parser(f).parse(g,function(c,d){if(c)return b(c,null,null,a);try{b(c,d,g,a,j,h)}catch(c){b(c,null,null,a)}})):b(e,null,null,a,j,h)},f,e)}function loadStyleSheets(a,b,c){for(var d=0;dv&&(u[q]=u[q].slice(p-v),v=p)}function e(a){var b=a.charCodeAt(0);return 32===b||10===b||9===b}function f(a){var b,c;if(a instanceof Function)return a.call(w.parsers);if("string"==typeof a)b=o.charAt(p)===a?a:null,c=1,d();else{if(d(),!(b=a.exec(u[q])))return null;c=b[0].length}return b?(g(c),"string"==typeof b?b:1===b.length?b[0]:b):void 0}function g(a){for(var b=p,c=q,d=p+u[q].length,f=p+=a;d>p&&e(o.charAt(p));)p++;return u[q]=u[q].slice(a+(p-f)),v=p,0===u[q].length&&q=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}function m(a,b,c){var d=c.currentFileInfo.filename;return"browser"!==less.mode&&"rhino"!==less.mode&&(d=require("path").resolve(d)),{lineNumber:l(a,b).line+1,fileName:d}}function n(a,b){var c=k(a,b),d=l(a.index,c),e=d.line,f=d.column,g=a.call&&l(a.call,c).line,h=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.currentFileInfo.filename,this.index=a.index,this.line="number"==typeof e?e+1:null,this.callLine=g+1,this.callExtract=h[g],this.stack=a.stack,this.column=f,this.extract=[h[e-1],h[e],h[e+1]]}var o,p,q,r,s,t,u,v,w,x=a&&a.filename;a instanceof tree.parseEnv||(a=new tree.parseEnv(a));var y=this.imports={paths:a.paths||[],queue:[],files:a.files,contents:a.contents,mime:a.mime,error:null,push:function(b,c,d,e){var f=this;this.queue.push(b);var g=function(a,c,d){f.queue.splice(f.queue.indexOf(b),1);var g=d in f.files||d===x;f.files[d]=c,a&&!f.error&&(f.error=a),e(a,c,g,d)};less.Parser.importer?less.Parser.importer(b,c,g,a):less.Parser.fileLoader(b,c,function(b,e,f,h){if(b)return g(b),void 0;var i=new tree.parseEnv(a);i.currentFileInfo=h,i.processImports=!1,i.contents[f]=e,(c.reference||d.reference)&&(h.reference=!0),d.inline?g(null,e,f):new less.Parser(i).parse(e,function(a,b){g(a,b,f)})},a)}};return n.prototype=new Error,n.prototype.constructor=n,this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,w={imports:y,parse:function(b,c){var d,e,g,h=null;if(p=q=v=t=0,o=b.replace(/\r\n/g,"\n"),o=o.replace(/^\uFEFF/,""),w.imports.contents[a.currentFileInfo.filename]=o,u=function(b){for(var c,d,e,f,g=0,i=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,j=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,k=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,l=0,m=b[0],p=0;p0?"missing closing `}`":"missing opening `{`",filename:a.currentFileInfo.filename},a)),b.map(function(a){return a.join("")})}([[]]),h)return c(new n(h,a));try{d=new tree.Ruleset([],f(this.parsers.primary)),d.root=!0,d.firstRoot=!0}catch(i){return c(new n(i,a))}if(d.toCSS=function(b){return function(c,d){c=c||{};var e,f,g=new tree.evalEnv(c);"object"!=typeof d||Array.isArray(d)||(d=Object.keys(d).map(function(a){var b=d[a];return b instanceof tree.Value||(b instanceof tree.Expression||(b=new tree.Expression([b])),b=new tree.Value([b])),new tree.Rule("@"+a,b,!1,null,0)}),g.frames=[new tree.Ruleset(null,d)]);try{e=b.call(this,g),(new tree.joinSelectorVisitor).run(e),(new tree.processExtendsVisitor).run(e),new tree.toCSSVisitor({compress:Boolean(c.compress)}).run(e),c.sourceMap&&(e=new tree.sourceMapOutput({writeSourceMap:c.writeSourceMap,rootNode:e,contentsMap:w.imports.contents,sourceMapFilename:c.sourceMapFilename,outputFilename:c.sourceMapOutputFilename,sourceMapBasepath:c.sourceMapBasepath,sourceMapRootpath:c.sourceMapRootpath,outputSourceFiles:c.outputSourceFiles,sourceMapGenerator:c.sourceMapGenerator})),f=e.toCSS({compress:Boolean(c.compress),dumpLineNumbers:a.dumpLineNumbers,strictUnits:Boolean(c.strictUnits)})}catch(h){throw new n(h,a)}return c.cleancss&&"node"===less.mode?require("clean-css").process(f):c.compress?f.replace(/(^(\s)+)|((\s)+$)/g,""):f}}(d.eval),p57||43>b||47===b||44==b))return(a=f(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/))?new tree.Dimension(a[1],a[2]):void 0},unicodeDescriptor:function(){var a;return(a=f(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))?new tree.UnicodeDescriptor(a[0]):void 0},javascript:function(){var b,c,d=p;return"~"===o.charAt(d)&&(d++,c=!0),"`"===o.charAt(d)?(void 0===a.javascriptEnabled||a.javascriptEnabled||i("You are using JavaScript, which has been disabled."),c&&f("~"),(b=f(/^`([^`]*)`/))?new tree.JavaScript(b[1],p,c):void 0):void 0}},variable:function(){var a;return"@"===o.charAt(p)&&(a=f(/^(@[\w-]+)\s*:/))?a[1]:void 0},extend:function(a){var b,c,d,e=p,g=[];if(f(a?/^&:extend\(/:/^:extend\(/)){do{for(d=null,b=[];;){if(d=f(/^(all)(?=\s*(\)|,))/))break;if(c=f(this.element),!c)break;b.push(c)}d=d&&d[1],g.push(new tree.Extend(new tree.Selector(b),d,e))}while(f(","));return h(/^\)/),a&&h(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var d,e,g,i=[],k=p,l=o.charAt(p),m=!1;if("."===l||"#"===l){for(b();d=f(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/);)i.push(new tree.Element(e,d,p,a.currentFileInfo)),e=f(">");return f("(")&&(g=this.mixin.args.call(this,!0).args,h(")")),g=g||[],f(this.important)&&(m=!0),i.length>0&&(f(";")||j("}"))?new tree.mixin.Call(i,g,k,a.currentFileInfo,m):(c(),void 0)}},args:function(a){for(var b,c,d,e,g,j,k=[],l=[],m=[],n={args:null,variadic:!1};;){if(a)j=f(this.expression);else{if(f(this.comments),"."===o.charAt(p)&&f(/^\.{3}/)){n.variadic=!0,f(";")&&!b&&(b=!0),(b?l:m).push({variadic:!0});break}j=f(this.entities.variable)||f(this.entities.literal)||f(this.entities.keyword)}if(!j)break;e=null,j.throwAwayComments&&j.throwAwayComments(),g=j;var q=null;if(a?1==j.value.length&&(q=j.value[0]):q=j,q&&q instanceof tree.Variable)if(f(":"))k.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=h(this.expression),e=d=q.name;else{if(!a&&f(/^\.{3}/)){n.variadic=!0,f(";")&&!b&&(b=!0),(b?l:m).push({name:j.name,variadic:!0});break}a||(d=e=q.name,g=null)}g&&k.push(g),m.push({name:e,value:g}),f(",")||(f(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,k.length>1&&(g=new tree.Value(k)),l.push({name:d,value:g}),d=null,k=[],c=!1)}return n.args=b?l:m,n},definition:function(){var a,d,e,g,i=[],k=!1;if(!("."!==o.charAt(p)&&"#"!==o.charAt(p)||j(/^[^{]*\}/))&&(b(),d=f(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/))){a=d[1];var l=this.mixin.args.call(this,!1);if(i=l.args,k=l.variadic,f(")")||(t=p,c()),f(this.comments),f(/^when/)&&(g=h(this.conditions,"expected condition")),e=f(this.block))return new tree.mixin.Definition(a,i,e,g,k);c()}}},entity:function(){return f(this.entities.literal)||f(this.entities.variable)||f(this.entities.url)||f(this.entities.call)||f(this.entities.keyword)||f(this.entities.javascript)||f(this.comment)},end:function(){return f(";")||j("}")},alpha:function(){var a;if(f(/^\(opacity=/i))return(a=f(/^\d+/)||f(this.entities.variable))?(h(")"),new tree.Alpha(a)):void 0},element:function(){var b,c,d;return c=f(this.combinator),b=f(/^(?:\d+\.\d+|\d+)%/)||f(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||f("*")||f("&")||f(this.attribute)||f(/^\([^()@]+\)/)||f(/^[\.#](?=@)/)||f(this.entities.variableCurly),b||f("(")&&(d=f(this.selector))&&f(")")&&(b=new tree.Paren(d)),b?new tree.Element(c,b,p,a.currentFileInfo):void 0},combinator:function(){var a=o.charAt(p);if(">"===a||"+"===a||"~"===a||"|"===a){for(p++;o.charAt(p).match(/\s/);)p++;return new tree.Combinator(a)}return o.charAt(p-1).match(/\s/)?new tree.Combinator(" "):new tree.Combinator(null)},lessSelector:function(){return this.selector(!0)},selector:function(b){for(var c,d,e,g,j,k=[],l=[];(b&&(e=f(this.extend))||b&&(g=f(/^when/))||(c=f(this.element)))&&(g?j=h(this.conditions,"expected condition"):j?i("CSS guard can only be used at the end of selector"):e?l.push.apply(l,e):(l.length&&i("Extend can only be used at the end of selector"),d=o.charAt(p),k.push(c),c=null),"{"!==d&&"}"!==d&&";"!==d&&","!==d&&")"!==d););return k.length>0?new tree.Selector(k,l,j,p,a.currentFileInfo):(l.length&&i("Extend must be used to extend a selector, it cannot be used on its own"),void 0)},attribute:function(){var a,b,c;if(f("["))return(a=f(this.entities.variableCurly))||(a=h(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(c=f(/^[|~*$^]?=/))&&(b=f(this.entities.quoted)||f(/^[0-9]+%/)||f(/^[\w-]+/)||f(this.entities.variableCurly)),h("]"),new tree.Attribute(a,c,b)},block:function(){var a;return f("{")&&(a=f(this.primary))&&f("}")?a:void 0},ruleset:function(){var d,e,g,h=[];for(b(),a.dumpLineNumbers&&(g=m(p,o,a));(d=f(this.lessSelector))&&(h.push(d),f(this.comments),f(","));)d.condition&&i("Guards are only currently allowed on a single selector."),f(this.comments);if(h.length>0&&(e=f(this.block))){var j=new tree.Ruleset(h,e,a.strictImports);return a.dumpLineNumbers&&(j.debugInfo=g),j}t=p,c()},rule:function(d){var e,g,h,i=o.charAt(p),j=!1;if(b(),"."!==i&&"#"!==i&&"&"!==i&&(e=f(this.variable)||f(this.ruleProperty))){if(g=d||!a.compress&&"@"!==e.charAt(0)?f(this.anonymousValue)||f(this.value):f(this.value)||f(this.anonymousValue),h=f(this.important),"+"===e[e.length-1]&&(j=!0,e=e.substr(0,e.length-1)),g&&f(this.end))return new tree.Rule(e,g,h,j,s,a.currentFileInfo);if(t=p,c(),g&&!d)return this.rule(!0)}},anonymousValue:function(){var a;return(a=/^([^@+\/'"*`(;{}-]*);/.exec(u[q]))?(p+=a[0].length-1,new tree.Anonymous(a[1])):void 0},"import":function(){var d,e,g=p;b();var h=f(/^@import?\s+/),i=(h?f(this.importOptions):null)||{};return h&&(d=f(this.entities.quoted)||f(this.entities.url))&&(e=f(this.mediaFeatures),f(";"))?(e=e&&new tree.Value(e),new tree.Import(d,e,i,g,a.currentFileInfo)):(c(),void 0)},importOptions:function(){var a,b,c,d={};if(!f("("))return null;do if(a=f(this.importOption)){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!f(","))break}while(a);return h(")"),d},importOption:function(){var a=f(/^(less|css|multiple|once|inline|reference)/);return a?a[1]:void 0},mediaFeature:function(){var b,c,d=[];do if(b=f(this.entities.keyword)||f(this.entities.variable))d.push(b);else if(f("(")){if(c=f(this.property),b=f(this.value),!f(")"))return null;if(c&&b)d.push(new tree.Paren(new tree.Rule(c,b,null,null,p,a.currentFileInfo,!0)));else{if(!b)return null;d.push(new tree.Paren(b))}}while(b);return d.length>0?new tree.Expression(d):void 0},mediaFeatures:function(){var a,b=[];do if(a=f(this.mediaFeature)){if(b.push(a),!f(","))break}else if((a=f(this.entities.variable))&&(b.push(a),!f(",")))break;while(a);return b.length>0?b:null},media:function(){var b,c,d,e;return a.dumpLineNumbers&&(e=m(p,o,a)),f(/^@media/)&&(b=f(this.mediaFeatures),c=f(this.block))?(d=new tree.Media(c,b,p,a.currentFileInfo),a.dumpLineNumbers&&(d.debugInfo=e),d):void 0},directive:function(){var d,e,g,h,i,j,k,l;if("@"===o.charAt(p)){if(e=f(this["import"])||f(this.media))return e;if(b(),d=f(/^@[a-z-]+/)){switch(h=d,"-"==d.charAt(1)&&d.indexOf("-",2)>0&&(h="@"+d.slice(d.indexOf("-",2)+1)),h){case"@font-face":i=!0;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":i=!0;break;case"@host":case"@page":case"@document":case"@supports":case"@keyframes":i=!0,j=!0;break;case"@namespace":k=!0}if(j&&(l=(f(/^[^{]+/)||"").trim(),l&&(d+=" "+l)),i){if(g=f(this.block))return new tree.Directive(d,g,p,a.currentFileInfo)}else if((e=k?f(this.expression):f(this.entity))&&f(";")){var n=new tree.Directive(d,e,p,a.currentFileInfo);return a.dumpLineNumbers&&(n.debugInfo=m(p,o,a)),n}c()}}},value:function(){for(var a,b=[];(a=f(this.expression))&&(b.push(a),f(",")););return b.length>0?new tree.Value(b):void 0},important:function(){return"!"===o.charAt(p)?f(/^! *important/):void 0},sub:function(){var a,b;return f("(")&&(a=f(this.addition))?(b=new tree.Expression([a]),h(")"),b.parens=!0,b):void 0},multiplication:function(){var a,b,c,d,g;if(a=f(this.operand)){for(g=e(o.charAt(p-1));!j(/^\/[*\/]/)&&(c=f("/")||f("*"))&&(b=f(this.operand));)a.parensInOp=!0,b.parensInOp=!0,d=new tree.Operation(c,[d||a,b],g),g=e(o.charAt(p-1));return d||a}},addition:function(){var a,b,c,d,g;if(a=f(this.multiplication)){for(g=e(o.charAt(p-1));(c=f(/^[-+]\s+/)||!g&&(f("+")||f("-")))&&(b=f(this.multiplication));)a.parensInOp=!0,b.parensInOp=!0,d=new tree.Operation(c,[d||a,b],g),g=e(o.charAt(p-1));return d||a}},conditions:function(){var a,b,c,d=p;if(a=f(this.condition)){for(;j(/^,\s*(not\s*)?\(/)&&f(",")&&(b=f(this.condition));)c=new tree.Condition("or",c||a,b,d);return c||a}},condition:function(){var a,b,c,d,e=p,g=!1;return f(/^not/)&&(g=!0),h("("),(a=f(this.addition)||f(this.entities.keyword)||f(this.entities.quoted))?((d=f(/^(?:>=|<=|=<|[<=>])/))?(b=f(this.addition)||f(this.entities.keyword)||f(this.entities.quoted))?c=new tree.Condition(d,a,b,e,g):i("expected expression"):c=new tree.Condition("=",a,new tree.Keyword("true"),e,g),h(")"),f(/^and/)?new tree.Condition("and",c,f(this.condition)):c):void 0},operand:function(){var a,b=o.charAt(p+1);"-"!==o.charAt(p)||"@"!==b&&"("!==b||(a=f("-"));var c=f(this.sub)||f(this.entities.dimension)||f(this.entities.color)||f(this.entities.variable)||f(this.entities.call);return a&&(c.parensInOp=!0,c=new tree.Negative(c)),c},expression:function(){for(var a,b,c=[];a=f(this.addition)||f(this.entity);)c.push(a),!j(/^\/[\/*]/)&&(b=f("/"))&&c.push(new tree.Anonymous(b));return c.length>0?new tree.Expression(c):void 0},property:function(){var a;return(a=f(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/))?a[1]:void 0},ruleProperty:function(){var a;return(a=f(/^(\*?-?[_a-zA-Z0-9-]+)\s*(\+?)\s*:/))?a[1]+(a[2]||""):void 0}}}},function(a){function b(b){return a.functions.hsla(b.h,b.s,b.l,b.a)}function c(b,c){return b instanceof a.Dimension&&b.unit.is("%")?parseFloat(b.value*c/100):d(b)}function d(b){if(b instanceof a.Dimension)return parseFloat(b.unit.is("%")?b.value/100:b.value);if("number"==typeof b)return b;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function e(a){return Math.min(1,Math.max(0,a))}a.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(b,e,f,g){var h=[b,e,f].map(function(a){return c(a,256)});return g=d(g),new a.Color(h,g)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,c,f){function g(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?i+6*(h-i)*a:1>2*a?h:2>3*a?i+6*(h-i)*(2/3-a):i}a=d(a)%360/360,b=e(d(b)),c=e(d(c)),f=e(d(f));var h=.5>=c?c*(b+1):c+b-c*b,i=2*c-h;return this.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),f)},hsv:function(a,b,c){return this.hsva(a,b,c,1)},hsva:function(a,b,c,e){a=360*(d(a)%360/360),b=d(b),c=d(c),e=d(e);var f,g;f=Math.floor(a/60%6),g=a/60-f;var h=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],i=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(255*h[i[f][0]],255*h[i[f][1]],255*h[i[f][2]],e)},hue:function(b){return new a.Dimension(Math.round(b.toHSL().h))},saturation:function(b){return new a.Dimension(Math.round(100*b.toHSL().s),"%")},lightness:function(b){return new a.Dimension(Math.round(100*b.toHSL().l),"%")},hsvhue:function(b){return new a.Dimension(Math.round(b.toHSV().h))},hsvsaturation:function(b){return new a.Dimension(Math.round(100*b.toHSV().s),"%")},hsvvalue:function(b){return new a.Dimension(Math.round(100*b.toHSV().v),"%")},red:function(b){return new a.Dimension(b.rgb[0])},green:function(b){return new a.Dimension(b.rgb[1])},blue:function(b){return new a.Dimension(b.rgb[2])},alpha:function(b){return new a.Dimension(b.toHSL().a)},luma:function(b){return new a.Dimension(Math.round(100*b.luma()*b.alpha),"%")},saturate:function(a,c){if(!a.rgb)return null;var d=a.toHSL();return d.s+=c.value/100,d.s=e(d.s),b(d)},desaturate:function(a,c){var d=a.toHSL();return d.s-=c.value/100,d.s=e(d.s),b(d)},lighten:function(a,c){var d=a.toHSL();return d.l+=c.value/100,d.l=e(d.l),b(d)},darken:function(a,c){var d=a.toHSL();return d.l-=c.value/100,d.l=e(d.l),b(d)},fadein:function(a,c){var d=a.toHSL();return d.a+=c.value/100,d.a=e(d.a),b(d)},fadeout:function(a,c){var d=a.toHSL();return d.a-=c.value/100,d.a=e(d.a),b(d)},fade:function(a,c){var d=a.toHSL();return d.a=c.value/100,d.a=e(d.a),b(d)},spin:function(a,c){var d=a.toHSL(),e=(d.h+c.value)%360;return d.h=0>e?360+e:e,b(d)},mix:function(b,c,d){d||(d=new a.Dimension(50));var e=d.value/100,f=2*e-1,g=b.toHSL().a-c.toHSL().a,h=((-1==f*g?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[b.rgb[0]*h+c.rgb[0]*i,b.rgb[1]*h+c.rgb[1]*i,b.rgb[2]*h+c.rgb[2]*i],k=b.alpha*e+c.alpha*(1-e);return new a.Color(j,k)},greyscale:function(b){return this.desaturate(b,new a.Dimension(100))},contrast:function(a,b,c,e){if(!a.rgb)return null;if("undefined"==typeof c&&(c=this.rgba(255,255,255,1)),"undefined"==typeof b&&(b=this.rgba(0,0,0,1)),b.luma()>c.luma()){var f=c;c=b,b=f}return e="undefined"==typeof e?.43:d(e),a.luma()*a.alphah.value)&&(j[e]=f)):(k[i]=j.length,j.push(f))):j.push(f);return 1==j.length?j[0]:(c=j.map(function(a){return a.toCSS(this.env)}).join(this.env.compress?",":", "),new a.Anonymous((b?"min":"max")+"("+c+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},argb:function(b){return new a.Anonymous(b.toARGB())},percentage:function(b){return new a.Dimension(100*b.value,"%")},color:function(b){if(b instanceof a.Quoted){var c,d=b.value;if(c=a.Color.fromKeyword(d))return c;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(d))return new a.Color(d.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(b){return this._isa(b,a.Color)},isnumber:function(b){return this._isa(b,a.Dimension)},isstring:function(b){return this._isa(b,a.Quoted)},iskeyword:function(b){return this._isa(b,a.Keyword)},isurl:function(b){return this._isa(b,a.URL) -},ispixel:function(a){return this.isunit(a,"px")},ispercentage:function(a){return this.isunit(a,"%")},isem:function(a){return this.isunit(a,"em")},isunit:function(b,c){return b instanceof a.Dimension&&b.unit.is(c.value||c)?a.True:a.False},_isa:function(b,c){return b instanceof c?a.True:a.False},multiply:function(a,b){var c=a.rgb[0]*b.rgb[0]/255,d=a.rgb[1]*b.rgb[1]/255,e=a.rgb[2]*b.rgb[2]/255;return this.rgb(c,d,e)},screen:function(a,b){var c=255-(255-a.rgb[0])*(255-b.rgb[0])/255,d=255-(255-a.rgb[1])*(255-b.rgb[1])/255,e=255-(255-a.rgb[2])*(255-b.rgb[2])/255;return this.rgb(c,d,e)},overlay:function(a,b){var c=a.rgb[0]<128?2*a.rgb[0]*b.rgb[0]/255:255-2*(255-a.rgb[0])*(255-b.rgb[0])/255,d=a.rgb[1]<128?2*a.rgb[1]*b.rgb[1]/255:255-2*(255-a.rgb[1])*(255-b.rgb[1])/255,e=a.rgb[2]<128?2*a.rgb[2]*b.rgb[2]/255:255-2*(255-a.rgb[2])*(255-b.rgb[2])/255;return this.rgb(c,d,e)},softlight:function(a,b){var c=b.rgb[0]*a.rgb[0]/255,d=c+a.rgb[0]*(255-(255-a.rgb[0])*(255-b.rgb[0])/255-c)/255;c=b.rgb[1]*a.rgb[1]/255;var e=c+a.rgb[1]*(255-(255-a.rgb[1])*(255-b.rgb[1])/255-c)/255;c=b.rgb[2]*a.rgb[2]/255;var f=c+a.rgb[2]*(255-(255-a.rgb[2])*(255-b.rgb[2])/255-c)/255;return this.rgb(d,e,f)},hardlight:function(a,b){var c=b.rgb[0]<128?2*b.rgb[0]*a.rgb[0]/255:255-2*(255-b.rgb[0])*(255-a.rgb[0])/255,d=b.rgb[1]<128?2*b.rgb[1]*a.rgb[1]/255:255-2*(255-b.rgb[1])*(255-a.rgb[1])/255,e=b.rgb[2]<128?2*b.rgb[2]*a.rgb[2]/255:255-2*(255-b.rgb[2])*(255-a.rgb[2])/255;return this.rgb(c,d,e)},difference:function(a,b){var c=Math.abs(a.rgb[0]-b.rgb[0]),d=Math.abs(a.rgb[1]-b.rgb[1]),e=Math.abs(a.rgb[2]-b.rgb[2]);return this.rgb(c,d,e)},exclusion:function(a,b){var c=a.rgb[0]+b.rgb[0]*(255-a.rgb[0]-a.rgb[0])/255,d=a.rgb[1]+b.rgb[1]*(255-a.rgb[1]-a.rgb[1])/255,e=a.rgb[2]+b.rgb[2]*(255-a.rgb[2]-a.rgb[2])/255;return this.rgb(c,d,e)},average:function(a,b){var c=(a.rgb[0]+b.rgb[0])/2,d=(a.rgb[1]+b.rgb[1])/2,e=(a.rgb[2]+b.rgb[2])/2;return this.rgb(c,d,e)},negation:function(a,b){var c=255-Math.abs(255-b.rgb[0]-a.rgb[0]),d=255-Math.abs(255-b.rgb[1]-a.rgb[1]),e=255-Math.abs(255-b.rgb[2]-a.rgb[2]);return this.rgb(c,d,e)},tint:function(a,b){return this.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){return this.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(b){var c=Array.isArray(b.value)?b.value.length:1;return new a.Dimension(c)},"data-uri":function(b,c){if("undefined"!=typeof window)return new a.URL(c||b,this.currentFileInfo).eval(this.env);var d=b.value,e=c&&c.value,f=require("fs"),g=require("path"),h=!1;if(arguments.length<2&&(e=d),this.env.isPathRelative(e)&&(e=this.currentFileInfo.relativeUrls?g.join(this.currentFileInfo.currentDirectory,e):g.join(this.currentFileInfo.entryPath,e)),arguments.length<2){var i;try{i=require("mime")}catch(j){i=a._mime}d=i.lookup(e);var k=i.charsets.lookup(d);h=["US-ASCII","UTF-8"].indexOf(k)<0,h&&(d+=";base64")}else h=/;base64$/.test(d);var l=f.readFileSync(e),m=32,n=parseInt(l.length/1024,10);if(n>=m&&this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",e,n,m),new a.URL(c||b,this.currentFileInfo).eval(this.env);l=h?l.toString("base64"):encodeURIComponent(l);var o="'data:"+d+","+l+"'";return new a.URL(new a.Anonymous(o))},"svg-gradient":function(b){function c(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&c();var d,e,f,g,h,i,j,k=Array.prototype.slice.call(arguments,1),l="linear",m='x="0" y="0" width="1" height="1"',n=!0,o={compress:!1},p=b.toCSS(o);switch(p){case"to bottom":d='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":d='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":d='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":d='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":l="radial",d='cx="50%" cy="50%" r="75%"',m='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(e='<'+l+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+d+">",f=0;fj?' stop-opacity="'+j+'"':"")+"/>";if(e+=""+"',n)try{e=new Buffer(e).toString("base64")}catch(q){n=!1}return e="'data:image/svg+xml"+(n?";base64":"")+","+e+"'",new a.URL(new a.Anonymous(e))}},a._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(b){var c=require("path").extname(b),d=a._mime._types[c];if(void 0===d)throw new Error('Optional dependency "mime" is required for '+c);return d},charsets:{lookup:function(a){return a&&/^text\//.test(a)?"UTF-8":""}}};for(var f=[{name:"ceil"},{name:"floor"},{name:"sqrt"},{name:"abs"},{name:"tan",unit:""},{name:"sin",unit:""},{name:"cos",unit:""},{name:"atan",unit:"rad"},{name:"asin",unit:"rad"},{name:"acos",unit:"rad"}],g=function(a,b){return function(c){return null!=b&&(c=c.unify()),this._math(Math[a],b,c)}},h=0;h1?"["+a.value.map(function(a){return a.toCSS(!1)}).join(", ")+"]":a.toCSS(!1)},a.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},a.outputRuleset=function(a,b,c){b.add(a.compress?"{":" {\n"),a.tabLevel=(a.tabLevel||0)+1;for(var d=a.compress?"":Array(a.tabLevel+1).join(" "),e=a.compress?"":Array(a.tabLevel).join(" "),f=0;fb?-1:1},genCSS:function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:a.toCSS}}(require("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={type:"Assignment",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Assignment(this.key,this.value.eval(b)):this},genCSS:function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},toCSS:a.toCSS}}(require("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d},a.Call.prototype={type:"Call",accept:function(a){this.args=a.visit(this.args)},eval:function(b){var c,d,e=this.args.map(function(a){return a.eval(b)}),f=this.name.toLowerCase();if(f in a.functions)try{if(d=new a.functionCall(b,this.currentFileInfo),c=d[f].apply(d,e),null!=c)return c}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new a.Call(this.name,e,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;cf;f++)e[f]=a.operate(b,c,this.rgb[f],d.rgb[f]);return new a.Color(e,this.alpha+d.alpha)},toRGB:function(){return"#"+this.rgb.map(function(a){return a=Math.round(a),a=(a>255?255:0>a?0:a).toString(16),1===a.length?"0"+a:a}).join("")},toHSL:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},toHSV:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},toARGB:function(){var a=[Math.round(255*this.alpha)].concat(this.rgb);return"#"+a.map(function(a){return a=Math.round(a),a=(a>255?255:0>a?0:a).toString(16),1===a.length?"0"+a:a}).join("")},compare:function(a){return a.rgb?a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:-1:-1}},a.Color.fromKeyword=function(c){if(a.colors.hasOwnProperty(c))return new a.Color(a.colors[c].slice(1));if(c===b){var d=new a.Color([0,0,0],0);return d.isTransparentKeyword=!0,d}}}(require("../tree")),function(a){a.Comment=function(a,b,c,d){this.value=a,this.silent=!!b,this.currentFileInfo=d},a.Comment.prototype={type:"Comment",genCSS:function(b,c){this.debugInfo&&c.add(a.debugInfo(b,this),this.currentFileInfo,this.index),c.add(this.value.trim())},toCSS:a.toCSS,isSilent:function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&!this.value.match(/^\/\*!/);return this.silent||b||c},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(require("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype={type:"Condition",accept:function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},eval:function(a){var b,c=this.lvalue.eval(a),d=this.rvalue.eval(a),e=this.index;return b=function(a){switch(a){case"and":return c&&d;case"or":return c||d;default:if(c.compare)b=c.compare(d);else{if(!d.compare)throw{type:"Type",message:"Unable to perform comparison",index:e};b=d.compare(c)}switch(b){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a}}}(this.op),this.negate?!b:b}}}(require("../tree")),function(a){a.Dimension=function(b,c){this.value=parseFloat(b),this.unit=c&&c instanceof a.Unit?c:new a.Unit(c?[c]:void 0)},a.Dimension.prototype={type:"Dimension",accept:function(a){this.unit=a.visit(this.unit)},eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},genCSS:function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.value,d=String(c);if(0!==c&&1e-6>c&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return b.add(d),void 0;c>0&&1>c&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},toCSS:a.toCSS,operate:function(b,c,d){var e=a.operate(b,c,this.value,d.value),f=this.unit.clone();if("+"===c||"-"===c)if(0===f.numerator.length&&0===f.denominator.length)f.numerator=d.unit.numerator.slice(0),f.denominator=d.unit.denominator.slice(0);else if(0===d.unit.numerator.length&&0===f.denominator.length);else{if(d=d.convertTo(this.unit.usedUnits()),b.strictUnits&&d.unit.toString()!==f.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+f.toString()+"' and '"+d.unit.toString()+"'.");e=a.operate(b,c,this.value,d.value)}else"*"===c?(f.numerator=f.numerator.concat(d.unit.numerator).sort(),f.denominator=f.denominator.concat(d.unit.denominator).sort(),f.cancel()):"/"===c&&(f.numerator=f.numerator.concat(d.unit.denominator).sort(),f.denominator=f.denominator.concat(d.unit.numerator).sort(),f.cancel());return new a.Dimension(e,f)},compare:function(b){if(b instanceof a.Dimension){var c=this.unify(),d=b.unify(),e=c.value,f=d.value;return f>e?-1:e>f?1:d.unit.isEmpty()||0===c.unit.compare(d.unit)?0:-1}return-1},unify:function(){return this.convertTo({length:"m",duration:"s",angle:"rad"})},convertTo:function(b){var c,d,e,f,g,h=this.value,i=this.unit.clone(),j={};if("string"==typeof b){for(c in a.UnitConversions)a.UnitConversions[c].hasOwnProperty(b)&&(j={},j[c]=b);b=j}g=function(a,b){return e.hasOwnProperty(a)?(b?h/=e[a]/e[f]:h*=e[a]/e[f],f):a};for(d in b)b.hasOwnProperty(d)&&(f=b[d],e=a.UnitConversions[d],i.map(g));return i.cancel(),new a.Dimension(h,i)}},a.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,pt:.0254/72,pc:12*(.0254/72)},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}},a.Unit=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],this.backupUnit=c},a.Unit.prototype={type:"Unit",clone:function(){return new a.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(a,b){this.numerator.length>=1?b.add(this.numerator[0]):this.denominator.length>=1?b.add(this.denominator[0]):a&&a.strictUnits||!this.backupUnit||b.add(this.backupUnit)},toCSS:a.toCSS,toString:function(){var a,b=this.numerator.join("*");for(a=0;a0)for(b=0;e>b;b++)this.numerator.push(a);else if(0>e)for(b=0;-e>b;b++)this.denominator.push(a)}0===this.numerator.length&&0===this.denominator.length&&c&&(this.backupUnit=c),this.numerator.sort(),this.denominator.sort()}}}(require("../tree")),function(a){a.Directive=function(b,c,d,e){this.name=b,Array.isArray(c)?(this.rules=[new a.Ruleset([],c)],this.rules[0].allowImports=!0):this.value=c,this.currentFileInfo=e},a.Directive.prototype={type:"Directive",accept:function(a){this.rules=a.visit(this.rules),this.value=a.visit(this.value)},genCSS:function(b,c){c.add(this.name,this.currentFileInfo,this.index),this.rules?a.outputRuleset(b,c,this.rules):(c.add(" "),this.value.genCSS(b,c),c.add(";"))},toCSS:a.toCSS,eval:function(b){var c=this;return this.rules&&(b.frames.unshift(this),c=new a.Directive(this.name,null,this.index,this.currentFileInfo),c.rules=[this.rules[0].eval(b)],c.rules[0].root=!0,b.frames.shift()),c},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},markReferenced:function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules[0].rules,a=0;a":" > ","|":"|"},_outputMapCompressed:{"":""," ":" ",":":" :","+":"+","~":"~",">":">","|":"|"},genCSS:function(a,b){b.add((a.compress?this._outputMapCompressed:this._outputMap)[this.value])},toCSS:a.toCSS}}(require("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={type:"Expression",accept:function(a){this.value=a.visit(this.value)},eval:function(b){var c,d=this.parens&&!this.parensInOp,e=!1;return d&&b.inParenthesis(),this.value.length>1?c=new a.Expression(this.value.map(function(a){return a.eval(b)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),c=this.value[0].eval(b)):c=this,d&&b.outOfParenthesis(),this.parens&&this.parensInOp&&!b.isMathOn()&&!e&&(c=new a.Paren(c)),c},genCSS:function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[{elements:d}]}}}(require("../tree")),function(a){a.Import=function(a,b,c,d,e){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var f=this.getPath();f&&/css([\?;].*)?$/.test(f)&&(this.css=!0)}},a.Import.prototype={type:"Import",accept:function(a){this.features=a.visit(this.features),this.path=a.visit(this.path),this.options.inline||(this.root=a.visit(this.root))},genCSS:function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},toCSS:a.toCSS,getPath:function(){if(this.path instanceof a.Quoted){var b=this.path.value;return void 0!==this.css||/(\.[a-z]*$)|([\?;].*)$/.test(b)?b:b+".less"}return this.path instanceof a.URL?this.path.value.value:null},evalForImport:function(b){return new a.Import(this.path.eval(b),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(b){var c=this.path.eval(b),d=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(c instanceof a.URL)){if(d){var e=c.value;e&&b.isPathRelative(e)&&(c.value=d+e)}c.value=b.normalizePath(c.value)}return c},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.skip)return[];if(this.options.inline){var e=new a.Anonymous(this.root,0,{filename:this.importedFilename},!0);return this.features?new a.Media([e],this.features.value):[e]}if(this.css){var f=new a.Import(this.evalPath(b),d,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return c=new a.Ruleset([],this.root.rules.slice(0)),c.evalImports(b),this.features?new a.Media(c.rules,this.features.value):c.rules}}}(require("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={type:"JavaScript",eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify(new a.Variable("@"+e,d.index).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+f+"`",index:this.index}}for(var h in b.frames[0].variables())e[h.slice(1)]={value:b.frames[0].variables()[h].value,toJS:function(){return this.value.eval(b).toCSS()}};try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message+"'",index:this.index}}return"string"==typeof c?new a.Quoted('"'+c+'"',c,this.escaped,this.index):Array.isArray(c)?new a.Anonymous(c.join(", ")):new a.Anonymous(c)}}}(require("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(a,b){b.add(this.value)},toCSS:a.toCSS,compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(require("../tree")),function(a){a.Media=function(b,c,d,e){this.index=d,this.currentFileInfo=e;var f=this.emptySelectors();this.features=new a.Value(c),this.rules=[new a.Ruleset(f,b)],this.rules[0].allowImports=!0},a.Media.prototype={type:"Media",accept:function(a){this.features=a.visit(this.features),this.rules=a.visit(this.rules)},genCSS:function(b,c){c.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(b,c),a.outputRuleset(b,c,this.rules)},toCSS:a.toCSS,eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=new a.Media([],[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,c.debugInfo=this.debugInfo);var d=!1;b.strictMath||(d=!0,b.strictMath=!0);try{c.features=this.features.eval(b)}finally{d&&(b.strictMath=!1)}return b.mediaPath.push(c),b.mediaBlocks.push(c),b.frames.unshift(this.rules[0]),c.rules=[this.rules[0].eval(b)],b.frames.shift(),b.mediaPath.pop(),0===b.mediaPath.length?c.evalTop(b):c.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var b=new a.Element("","&",this.index,this.currentFileInfo);return[new a.Selector([b],null,null,this.index,this.currentFileInfo)]},markReferenced:function(){var a,b=this.rules[0].rules;for(this.isReferenced=!0,a=0;a1){var d=this.emptySelectors();c=new a.Ruleset(d,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},permute:function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(j=!0,g=0;gthis.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0}}}(require("../tree")),function(a){a.Negative=function(a){this.value=a},a.Negative.prototype={type:"Negative",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("-"),this.value.genCSS(a,b)},toCSS:a.toCSS,eval:function(b){return b.isMathOn()?new a.Operation("*",[new a.Dimension(-1),this.value]).eval(b):new a.Negative(this.value.eval(b))}}}(require("../tree")),function(a){a.Operation=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c},a.Operation.prototype={type:"Operation",accept:function(a){this.operands=a.visit(this.operands)},eval:function(b){var c,d=this.operands[0].eval(b),e=this.operands[1].eval(b);if(b.isMathOn()){if(d instanceof a.Dimension&&e instanceof a.Color){if("*"!==this.op&&"+"!==this.op)throw{type:"Operation",message:"Can't substract or divide a color from a number"};c=e,e=d,d=c}if(!d.operate)throw{type:"Operation",message:"Operation on an invalid type"};return d.operate(b,this.op,e)}return new a.Operation(this.op,[d,e],this.isSpaced)},genCSS:function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},toCSS:a.toCSS},a.operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}}}(require("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={type:"Paren",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){return new a.Paren(this.value.eval(b))}}}(require("../tree")),function(a){a.Quoted=function(a,b,c,d,e){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e},a.Quoted.prototype={type:"Quoted",genCSS:function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},toCSS:a.toCSS,eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return new a.JavaScript(e,c.index,!0).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=new a.Variable("@"+e,c.index,c.currentFileInfo).eval(b,!0);return f instanceof a.Quoted?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1}}}(require("../tree")),function(a){a.Rule=function(b,c,d,e,f,g,h){this.name=b,this.value=c instanceof a.Value?c:new a.Value([c]),this.important=d?" "+d.trim():"",this.merge=e,this.index=f,this.currentFileInfo=g,this.inline=h||!1,this.variable="@"===b.charAt(0)},a.Rule.prototype={type:"Rule",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},toCSS:a.toCSS,eval:function(b){var c=!1;"font"!==this.name||b.strictMath||(c=!0,b.strictMath=!0);try{return new a.Rule(this.name,this.value.eval(b),this.important,this.merge,this.index,this.currentFileInfo,this.inline)}finally{c&&(b.strictMath=!1)}},makeImportant:function(){return new a.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(require("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={type:"Ruleset",accept:function(a){if(this.paths)for(var b=0;bf.selectors[g].elements.length?Array.prototype.push.apply(e,f.find(new a.Selector(b.elements.slice(1)),c)):e.push(f);break}}),this._lookups[f]=e)},genCSS:function(b,c){var d,e,f,g,h,i=[],j=[],k=!0;b.tabLevel=b.tabLevel||0,this.root||b.tabLevel++;var l=b.compress?"":Array(b.tabLevel+1).join(" "),m=b.compress?"":Array(b.tabLevel).join(" ");for(d=0;d0&&this.mergeElementsOnToSelectors(r,i),f=0;f0&&(k[0].elements=k[0].elements.slice(0),k[0].elements.push(new a.Element(j.combinator,"",0,j.index,j.currentFileInfo))),s.push(k);else for(g=0;g0?(m=k.slice(0),q=m.pop(),o=d.createDerived(q.elements.slice(0)),p=!1):o=d.createDerived([]),l.length>1&&(n=n.concat(l.slice(1))),l.length>0&&(p=!1,o.elements.push(new a.Element(j.combinator,l[0].elements[0].value,j.index,j.currentFileInfo)),o.elements=o.elements.concat(l[0].elements.slice(1))),p||m.push(o),m=m.concat(n),s.push(m);i=s,r=[]}for(r.length>0&&this.mergeElementsOnToSelectors(r,i),e=0;e0&&b.push(i[e])}else if(c.length>0)for(e=0;e0?e[e.length-1]=e[e.length-1].createDerived(e[e.length-1].elements.concat(b)):e.push(new a.Selector(b))}}}(require("../tree")),function(a){a.Selector=function(a,b,c,d,e,f){this.elements=a,this.extendList=b||[],this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)},a.Selector.prototype={type:"Selector",accept:function(a){this.elements=a.visit(this.elements),this.extendList=a.visit(this.extendList),this.condition=a.visit(this.condition)},createDerived:function(b,c,d){d=null!=d?d:this.evaldCondition;var e=new a.Selector(b,c||this.extendList,this.condition,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=d,e},match:function(a){var b,c,d,e,f=this.elements,g=f.length;if(b=a.elements.slice(a.elements.length&&"&"===a.elements[0].value?1:0),c=b.length,d=Math.min(g,c),0===c||c>g)return!1;for(e=0;d>e;e++)if(f[e].value!==b[e].value)return!1;return!0},eval:function(a){var b=this.condition&&this.condition.eval(a);return this.createDerived(this.elements.map(function(b){return b.eval(a)}),this.extendList.map(function(b){return b.eval(a)}),b)},genCSS:function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;c0)&&e.splice(0,0,b);else{b.paths=b.paths.filter(function(b){var c;for(" "===b[0].elements[0].combinator.value&&(b[0].elements[0].combinator=new a.Combinator("")),c=0;c0&&b.accept(this._visitor),c.visitDeeper=!1,this._mergeRules(b.rules),this._removeDuplicateRules(b.rules),b.rules.length>0&&b.paths.length>0&&e.splice(0,0,b)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(b){var c,d,e,f={};for(e=b.length-1;e>=0;e--)if(d=b[e],d instanceof a.Rule)if(f[d.name]){c=f[d.name],c instanceof a.Rule&&(c=f[d.name]=[f[d.name].toCSS(this._env)]);var g=d.toCSS(this._env);-1!==c.indexOf(g)?b.splice(e,1):c.push(g)}else f[d.name]=d},_mergeRules:function(b){for(var c,d,e,f={},g=0;g1&&(d=c[0],d.value=new a.Value(c.map(function(a){return a.value})))})}}}(require("./tree")),function(a){a.extendFinderVisitor=function(){this._visitor=new a.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},a.extendFinderVisitor.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(b){if(!b.root){var c,d,e,f,g=[];for(c=0;c100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,c,d+1))}return m},inInheritanceChain:function(a,b){if(a===b)return!0;if(b.parents){if(this.inInheritanceChain(a,b.parents[0]))return!0;if(this.inInheritanceChain(a,b.parents[1]))return!0}return!1},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;d0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(c.slice(j,h.pathIndex)),l.push(new a.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=c[j].elements.length&&(k=0,j++);return j0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),j++),l=l.concat(c.slice(j,c.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(require("./tree")),function(a){a.sourceMapOutput=function(a){this._css=[],this._rootNode=a.rootNode,this._writeSourceMap=a.writeSourceMap,this._contentsMap=a.contentsMap,this._sourceMapFilename=a.sourceMapFilename,this._outputFilename=a.outputFilename,this._sourceMapBasepath=a.sourceMapBasepath,this._sourceMapRootpath=a.sourceMapRootpath,this._outputSourceFiles=a.outputSourceFiles,this._sourceMapGeneratorConstructor=a.sourceMapGenerator||require("source-map").SourceMapGenerator,this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/"),this._lineNumber=0,this._column=0},a.sourceMapOutput.prototype.normalizeFilename=function(a){return this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),("\\"===a.charAt(0)||"/"===a.charAt(0))&&(a=a.substring(1))),(this._sourceMapRootpath||"")+a.replace(/\\/g,"/")},a.sourceMapOutput.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename].substring(0,c);f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;i0){var c,d=JSON.stringify(this._sourceMapGenerator.toJSON());this._sourceMapFilename&&(c=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(d):c="data:application/json,"+encodeURIComponent(d),c&&this._css.push("/*# sourceMappingURL="+c+" */")}return this._css.join("")}}(require("./tree"));var isFileProtocol=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);less.env=less.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port.length>0||isFileProtocol?"development":"production");var logLevel={info:2,errors:1,none:0};if(less.logLevel="undefined"!=typeof less.logLevel?less.logLevel:logLevel.info,less.async=less.async||!1,less.fileAsync=less.fileAsync||!1,less.poll=less.poll||(isFileProtocol?1e3:1500),less.functions)for(var func in less.functions)less.tree.functions[func]=less.functions[func];var dumpLineNumbers=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);dumpLineNumbers&&(less.dumpLineNumbers=dumpLineNumbers[1]);var typePattern=/^text\/(x-)?less$/,cache=null,fileCache={};if(less.watch=function(){return less.watchMode||(less.env="development",initRunningMode()),this.watchMode=!0},less.unwatch=function(){return clearInterval(less.watchTimer),this.watchMode=!1},/!watch/.test(location.hash)&&less.watch(),"development"!=less.env)try{cache="undefined"==typeof window.localStorage?null:window.localStorage}catch(_){}var links=document.getElementsByTagName("link");less.sheets=[];for(var i=0;iNo Sketch found.

    ') - ); - return; - } - for( var i = 0, len = list.length; i < len; i++ ) { - $('#load ol').append( - $('
  • ') - ); - } - $confirm.find('li').off('tap').tap(function(e) { - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - }) - }) - $('#pro').tap(function() { - $('#save ol:nth-of-type(2) li').each(function() { - if( $(this).find('span').html() !== 'Transparent' ) { - $(this).addClass('hidden'); - $(this).removeAttr('aria-selected'); - } - else $(this).attr('aria-selected', 'true'); - }) - }) - $('#exp').tap(function() { - $('#save ol:nth-of-type(2) li').removeClass('hidden'); - }) - $c.last().on('touchstart', function(e) { - var xy = relative(e.changedTouches[0].pageX, e.changedTouches[0].pageY); - startPoint(xy.x, xy.y); - window.active = true; - }).on('touchmove', function(e) { - if (!window.active || settings.type == 'line') return; - var xy = relative(e.changedTouches[0].pageX, e.changedTouches[0].pageY); - drawPoint(xy.x, xy.y); - }).on('touchend', function(e) { - window.active = false; - if( settings.type == 'eraser' ) return; - - if( settings.type == 'shape' ) { - var s = settings.comShape; - o.clear(); - c.beginPath(); - c.fillStyle = settings.color; - c.strokeStyle = settings.color; - c.lineWidth = settings.lineWidth / 20; - switch(s.type) { - case 'circle': { - c.arc(s.x, s.y, s.radius, 0, 2*Math.PI); - break; - } - case 'rectangle': { - c.rect(s.x, s.y, s.w, s.h) - break; - } - case 'triangle': { - c.moveTo(s.start.x + s.dix, s.start.y); - c.lineTo(s.x, s.y); - c.lineTo(s.start.x, s.y); - c.lineTo(s.start.x + s.dix, s.start.y); - break; - } - } - if( settings.fill ) c.fill(); - if( settings.stroke ) c.stroke(); - } - - if( settings.type == 'line' ) return; - - if(window.points.history.last < window.points.history.length-1) { - window.points.history.splice(window.points.history.last+1); - } - - window.points.history.push({ - data: c.getImageData(0, 0, width(), height()), - points: window.points.slice(0) - }) - window.points.history.last = window.points.history.length-1; - }).on('longTap', function(e) { - if( points[points.length-1].type == 'line' ) { - window.active = false; - points[points.length-1].type = ''; - points[points.length-1].start = undefined; - finishLine(); - } - }) - - // Value Selector - - var $single = $('form[data-type="value-selector"].single'); - - $single.find('li').tap(function(e) { - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - var key = $(this).parents('form').attr('id'), - value = $(this).find('label span').html().toLowerCase(), - target = $(this).attr('data-target'); - window.settings[key] = value; - - $('button[id="set' + key + '"] span').html(value[0].toUpperCase() + value.substr(1)); - if( target ) { - $('#menu div.options > div').addClass('hidden'); - $('#menu div.options > .general, #menu div.options > .'+target).removeClass('hidden'); - } - $(this).parents('form').addClass('hidden'); - }) - $single.find('button').tap(function(e) { - e.preventDefault(); - $(this).parents('form').addClass('hidden'); - }) - - // Confirm - - var $confirm = $('form[data-type="value-selector"].confirm'); - - $confirm.each(function() { - - $(this).find('li').tap(function(e) { - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - }) - $(this).find('button').last().tap(function(e) { - e.preventDefault(); - var v = $(this).parents('form').attr('id'); - $(this).parents('form').find('h1').each(function(i) { - if( i > 0 ) { - var key = $(this).html().toLowerCase(); - var value = $(this).parent().find('ol:nth-of-type('+i+') li[aria-selected] span').html(); - if( key !== 'file name' && key !== 'file' ) value = value.toLowerCase(); - window[v][key] = value; - } - }) - $(this).parents('form').addClass('hidden'); - window[v](); - }) - $(this).find('button').first().tap(function(e) { - e.preventDefault(); - $(this).parents('form').addClass('hidden'); - }) - - }) - - // Value Selector Callers - - var $btn = $('button[id^="set"]'); - $btn.each(function() { - var target = /set(.*)/.exec($(this).attr('id'))[1]; - // Exception for Color - if( target == 'color' || target == 'bg' ) { - return $(this).tap(function() { - $('.picker').removeClass('hidden'); - $('.picker').attr('data-caller', target); - }) - } - $(this).tap(function(e) { - e.preventDefault(); - $('form[id="' + target + '"]').removeClass('hidden'); - }) - }) - - // Seekbar - - var sliderLeft; - $('div[role="slider"] button').on('touchstart', function() { - $(this).attr('data-moving','true'); - if( !sliderLeft ) sliderLeft = $('div[role="slider"] button').offset().left; - }).on('touchmove', function(e) { - if( $(this).attr('data-moving') ) { - var x = parseInt(e.changedTouches[0].pageX - sliderLeft - 15); - var $c = $('.'+$(this).parents('div[role="slider"]').attr('class')); - var progress = $c.find('progress'); - var max = +progress.attr('max'); - var min = +progress.attr('min'); - if( x <= max && x >= min ) { - $c.find('button').css('left', x+'%'); - progress.attr('value', x); - var key = $c.attr('class'); - settings[key] = x; - $('#'+ key +' span').html(x); - } - } - }).on('touchend', function() { - $(this).removeAttr('data-moving'); - }) - - $('.fill, .stroke').tap(function() { - var s = $('.'+$(this).attr('class')).find('span'); - if( s.html() == 'Yes' ) { - s.html('No'); - settings[$(this).attr('class')] = false; - } else { - s.html('Yes'); - settings[$(this).attr('class')] = true; - } - }) - - $('.close, .tour button').tap(function() { - $(this).parent().addClass('hidden'); - }) - - // Color Picker - - $('.close').tap(function() { - $(this).parent().addClass('hidden'); - }) - - // Bottom - - $('#clear').tap(function() { - c.clearRect(0, 0, width(), height()); - var h = window.points.history; - window.points = []; - window.points.history = h; - if(window.points.history.last < window.points.history.length-1) { - window.points.history.splice(window.points.history.last+1); - } - - window.points.history.push({ - data: c.getImageData(0, 0, width(), height()), - points: [] - }) - window.points.history.last = window.points.history.length-1; - }) - - $('#undo').tap(undo); - $('#redo').tap(redo); - - $('#about').tap(function() { - $('.about').removeClass('hidden'); - }) - -}); diff --git a/README.md b/README.md index ffe1f4c..e98321a 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ Sketchy ======= -Free Sketch / Paint application for Firefox OS with a lot of features. +Free Sketch / Paint application for Firefox with a lot of features. Key features: * Different types of brushes * Customizable brushes * Colorpicker * Unlimited Undo/Redo -* Save your sketch to sdcard +* Save your sketch to sdcard / PC +* Save your sketch as a "Sketchy Project" and edit it later +* Different shapes ( Circle, Rectangle, Square, Triangle ) +* Fill / Stroke New features are coming soon! Contact and tell us what feature you would like to see in next version ( you can make an issue ). @@ -18,6 +21,18 @@ Web version: https://mdibaiee.github.io/Sketchy/Web/ Firefox Marketplace: https://marketplace.firefox.com/app/sketchy/ +Start +===== + +To start working on: + + git clone https://github.com/mdibaiee/Sketchy + cd Sketchy + npm install + grunt + +Sketchy will be built to "build" folder, you can run `grunt watch` to automatically re-run tasks when you modify files. + Changelog ========= diff --git a/Mobile/css/color-picker.less b/Shared/css/color-picker.less similarity index 100% rename from Mobile/css/color-picker.less rename to Shared/css/color-picker.less diff --git a/Mobile/css/fonts.less b/Shared/css/fonts.less similarity index 100% rename from Mobile/css/fonts.less rename to Shared/css/fonts.less diff --git a/Mobile/css/fonts/MozTT-Bold.ttf b/Shared/css/fonts/MozTT-Bold.ttf similarity index 100% rename from Mobile/css/fonts/MozTT-Bold.ttf rename to Shared/css/fonts/MozTT-Bold.ttf diff --git a/Mobile/css/fonts/MozTT-Light.ttf b/Shared/css/fonts/MozTT-Light.ttf similarity index 100% rename from Mobile/css/fonts/MozTT-Light.ttf rename to Shared/css/fonts/MozTT-Light.ttf diff --git a/Mobile/css/fonts/MozTT-Medium.ttf b/Shared/css/fonts/MozTT-Medium.ttf similarity index 100% rename from Mobile/css/fonts/MozTT-Medium.ttf rename to Shared/css/fonts/MozTT-Medium.ttf diff --git a/Mobile/css/fonts/MozTT-Regular.ttf b/Shared/css/fonts/MozTT-Regular.ttf similarity index 100% rename from Mobile/css/fonts/MozTT-Regular.ttf rename to Shared/css/fonts/MozTT-Regular.ttf diff --git a/Mobile/css/imgs/bg_overlay_pressed_1.png b/Shared/css/imgs/bg_overlay_pressed_1.png similarity index 100% rename from Mobile/css/imgs/bg_overlay_pressed_1.png rename to Shared/css/imgs/bg_overlay_pressed_1.png diff --git a/Mobile/css/imgs/bg_overlay_pressed_2.png b/Shared/css/imgs/bg_overlay_pressed_2.png similarity index 100% rename from Mobile/css/imgs/bg_overlay_pressed_2.png rename to Shared/css/imgs/bg_overlay_pressed_2.png diff --git a/Mobile/css/imgs/clear.png b/Shared/css/imgs/clear.png similarity index 100% rename from Mobile/css/imgs/clear.png rename to Shared/css/imgs/clear.png diff --git a/Mobile/css/imgs/div_line_lg_black.png b/Shared/css/imgs/div_line_lg_black.png similarity index 100% rename from Mobile/css/imgs/div_line_lg_black.png rename to Shared/css/imgs/div_line_lg_black.png diff --git a/Mobile/css/imgs/div_line_sm_black.png b/Shared/css/imgs/div_line_sm_black.png similarity index 100% rename from Mobile/css/imgs/div_line_sm_black.png rename to Shared/css/imgs/div_line_sm_black.png diff --git a/Mobile/css/imgs/download.png b/Shared/css/imgs/download.png similarity index 100% rename from Mobile/css/imgs/download.png rename to Shared/css/imgs/download.png diff --git a/Mobile/css/imgs/header_bg_black.png b/Shared/css/imgs/header_bg_black.png similarity index 100% rename from Mobile/css/imgs/header_bg_black.png rename to Shared/css/imgs/header_bg_black.png diff --git a/Mobile/css/imgs/load.png b/Shared/css/imgs/load.png similarity index 100% rename from Mobile/css/imgs/load.png rename to Shared/css/imgs/load.png diff --git a/Mobile/css/imgs/menu.png b/Shared/css/imgs/menu.png similarity index 100% rename from Mobile/css/imgs/menu.png rename to Shared/css/imgs/menu.png diff --git a/Mobile/css/imgs/redo.png b/Shared/css/imgs/redo.png similarity index 100% rename from Mobile/css/imgs/redo.png rename to Shared/css/imgs/redo.png diff --git a/Mobile/css/imgs/settings.png b/Shared/css/imgs/settings.png similarity index 100% rename from Mobile/css/imgs/settings.png rename to Shared/css/imgs/settings.png diff --git a/Mobile/css/imgs/undo.png b/Shared/css/imgs/undo.png similarity index 100% rename from Mobile/css/imgs/undo.png rename to Shared/css/imgs/undo.png diff --git a/Mobile/css/main.css b/Shared/css/main.css similarity index 100% rename from Mobile/css/main.css rename to Shared/css/main.css diff --git a/Mobile/css/main.less b/Shared/css/main.less similarity index 100% rename from Mobile/css/main.less rename to Shared/css/main.less diff --git a/Mobile/css/seekbars.less b/Shared/css/seekbars.less similarity index 100% rename from Mobile/css/seekbars.less rename to Shared/css/seekbars.less diff --git a/Mobile/css/seekbars/images/ui/handler.png b/Shared/css/seekbars/images/ui/handler.png similarity index 100% rename from Mobile/css/seekbars/images/ui/handler.png rename to Shared/css/seekbars/images/ui/handler.png diff --git a/Mobile/css/seekbars/images/ui/handler@1.5x.png b/Shared/css/seekbars/images/ui/handler@1.5x.png similarity index 100% rename from Mobile/css/seekbars/images/ui/handler@1.5x.png rename to Shared/css/seekbars/images/ui/handler@1.5x.png diff --git a/Mobile/css/seekbars/images/ui/handler@2x.png b/Shared/css/seekbars/images/ui/handler@2x.png similarity index 100% rename from Mobile/css/seekbars/images/ui/handler@2x.png rename to Shared/css/seekbars/images/ui/handler@2x.png diff --git a/Mobile/css/seekbars/seekbars.css b/Shared/css/seekbars/seekbars.css similarity index 100% rename from Mobile/css/seekbars/seekbars.css rename to Shared/css/seekbars/seekbars.css diff --git a/Mobile/css/switches.less b/Shared/css/switches.less similarity index 100% rename from Mobile/css/switches.less rename to Shared/css/switches.less diff --git a/Mobile/css/switches/images/check/danger.png b/Shared/css/switches/images/check/danger.png similarity index 100% rename from Mobile/css/switches/images/check/danger.png rename to Shared/css/switches/images/check/danger.png diff --git a/Mobile/css/switches/images/check/danger@1.5x.png b/Shared/css/switches/images/check/danger@1.5x.png similarity index 100% rename from Mobile/css/switches/images/check/danger@1.5x.png rename to Shared/css/switches/images/check/danger@1.5x.png diff --git a/Mobile/css/switches/images/check/danger@2x.png b/Shared/css/switches/images/check/danger@2x.png similarity index 100% rename from Mobile/css/switches/images/check/danger@2x.png rename to Shared/css/switches/images/check/danger@2x.png diff --git a/Mobile/css/switches/images/check/default.png b/Shared/css/switches/images/check/default.png similarity index 100% rename from Mobile/css/switches/images/check/default.png rename to Shared/css/switches/images/check/default.png diff --git a/Mobile/css/switches/images/check/default@1.5x.png b/Shared/css/switches/images/check/default@1.5x.png similarity index 100% rename from Mobile/css/switches/images/check/default@1.5x.png rename to Shared/css/switches/images/check/default@1.5x.png diff --git a/Mobile/css/switches/images/check/default@2x.png b/Shared/css/switches/images/check/default@2x.png similarity index 100% rename from Mobile/css/switches/images/check/default@2x.png rename to Shared/css/switches/images/check/default@2x.png diff --git a/Mobile/css/switches/images/radio/danger.png b/Shared/css/switches/images/radio/danger.png similarity index 100% rename from Mobile/css/switches/images/radio/danger.png rename to Shared/css/switches/images/radio/danger.png diff --git a/Mobile/css/switches/images/radio/danger@1.5x.png b/Shared/css/switches/images/radio/danger@1.5x.png similarity index 100% rename from Mobile/css/switches/images/radio/danger@1.5x.png rename to Shared/css/switches/images/radio/danger@1.5x.png diff --git a/Mobile/css/switches/images/radio/danger@2x.png b/Shared/css/switches/images/radio/danger@2x.png similarity index 100% rename from Mobile/css/switches/images/radio/danger@2x.png rename to Shared/css/switches/images/radio/danger@2x.png diff --git a/Mobile/css/switches/images/radio/default.png b/Shared/css/switches/images/radio/default.png similarity index 100% rename from Mobile/css/switches/images/radio/default.png rename to Shared/css/switches/images/radio/default.png diff --git a/Mobile/css/switches/images/radio/default@1.5x.png b/Shared/css/switches/images/radio/default@1.5x.png similarity index 100% rename from Mobile/css/switches/images/radio/default@1.5x.png rename to Shared/css/switches/images/radio/default@1.5x.png diff --git a/Mobile/css/switches/images/radio/default@2x.png b/Shared/css/switches/images/radio/default@2x.png similarity index 100% rename from Mobile/css/switches/images/radio/default@2x.png rename to Shared/css/switches/images/radio/default@2x.png diff --git a/Mobile/css/switches/images/switch/background.png b/Shared/css/switches/images/switch/background.png similarity index 100% rename from Mobile/css/switches/images/switch/background.png rename to Shared/css/switches/images/switch/background.png diff --git a/Mobile/css/switches/images/switch/background@1.5x.png b/Shared/css/switches/images/switch/background@1.5x.png similarity index 100% rename from Mobile/css/switches/images/switch/background@1.5x.png rename to Shared/css/switches/images/switch/background@1.5x.png diff --git a/Mobile/css/switches/images/switch/background_off.png b/Shared/css/switches/images/switch/background_off.png similarity index 100% rename from Mobile/css/switches/images/switch/background_off.png rename to Shared/css/switches/images/switch/background_off.png diff --git a/Mobile/css/switches/images/switch/background_off@1.5x.png b/Shared/css/switches/images/switch/background_off@1.5x.png similarity index 100% rename from Mobile/css/switches/images/switch/background_off@1.5x.png rename to Shared/css/switches/images/switch/background_off@1.5x.png diff --git a/Mobile/css/value_selector.less b/Shared/css/value_selector.less similarity index 100% rename from Mobile/css/value_selector.less rename to Shared/css/value_selector.less diff --git a/Mobile/css/value_selector/images/icons/checked.png b/Shared/css/value_selector/images/icons/checked.png similarity index 100% rename from Mobile/css/value_selector/images/icons/checked.png rename to Shared/css/value_selector/images/icons/checked.png diff --git a/Mobile/css/value_selector/images/icons/checked@1.5x.png b/Shared/css/value_selector/images/icons/checked@1.5x.png similarity index 100% rename from Mobile/css/value_selector/images/icons/checked@1.5x.png rename to Shared/css/value_selector/images/icons/checked@1.5x.png diff --git a/Mobile/css/value_selector/images/icons/checked@2x.png b/Shared/css/value_selector/images/icons/checked@2x.png similarity index 100% rename from Mobile/css/value_selector/images/icons/checked@2x.png rename to Shared/css/value_selector/images/icons/checked@2x.png diff --git a/Mobile/css/value_selector/images/ui/affirmative.png b/Shared/css/value_selector/images/ui/affirmative.png similarity index 100% rename from Mobile/css/value_selector/images/ui/affirmative.png rename to Shared/css/value_selector/images/ui/affirmative.png diff --git a/Mobile/css/value_selector/images/ui/default.png b/Shared/css/value_selector/images/ui/default.png similarity index 100% rename from Mobile/css/value_selector/images/ui/default.png rename to Shared/css/value_selector/images/ui/default.png diff --git a/Mobile/css/value_selector/images/ui/gradient.png b/Shared/css/value_selector/images/ui/gradient.png similarity index 100% rename from Mobile/css/value_selector/images/ui/gradient.png rename to Shared/css/value_selector/images/ui/gradient.png diff --git a/Mobile/css/value_selector/images/ui/gradient@1.5x.png b/Shared/css/value_selector/images/ui/gradient@1.5x.png similarity index 100% rename from Mobile/css/value_selector/images/ui/gradient@1.5x.png rename to Shared/css/value_selector/images/ui/gradient@1.5x.png diff --git a/Mobile/css/value_selector/images/ui/pattern.png b/Shared/css/value_selector/images/ui/pattern.png similarity index 100% rename from Mobile/css/value_selector/images/ui/pattern.png rename to Shared/css/value_selector/images/ui/pattern.png diff --git a/Mobile/css/value_selector/images/ui/shadow-invert.png b/Shared/css/value_selector/images/ui/shadow-invert.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow-invert.png rename to Shared/css/value_selector/images/ui/shadow-invert.png diff --git a/Mobile/css/value_selector/images/ui/shadow-invert@1.5x.png b/Shared/css/value_selector/images/ui/shadow-invert@1.5x.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow-invert@1.5x.png rename to Shared/css/value_selector/images/ui/shadow-invert@1.5x.png diff --git a/Mobile/css/value_selector/images/ui/shadow-invert@2x.png b/Shared/css/value_selector/images/ui/shadow-invert@2x.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow-invert@2x.png rename to Shared/css/value_selector/images/ui/shadow-invert@2x.png diff --git a/Mobile/css/value_selector/images/ui/shadow.png b/Shared/css/value_selector/images/ui/shadow.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow.png rename to Shared/css/value_selector/images/ui/shadow.png diff --git a/Mobile/css/value_selector/images/ui/shadow@1.5x.png b/Shared/css/value_selector/images/ui/shadow@1.5x.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow@1.5x.png rename to Shared/css/value_selector/images/ui/shadow@1.5x.png diff --git a/Mobile/css/value_selector/images/ui/shadow@2x.png b/Shared/css/value_selector/images/ui/shadow@2x.png similarity index 100% rename from Mobile/css/value_selector/images/ui/shadow@2x.png rename to Shared/css/value_selector/images/ui/shadow@2x.png diff --git a/Mobile/img/icons/MozillaFXOSIconTemplate1_overlay.png b/Shared/img/icons/MozillaFXOSIconTemplate1_overlay.png similarity index 100% rename from Mobile/img/icons/MozillaFXOSIconTemplate1_overlay.png rename to Shared/img/icons/MozillaFXOSIconTemplate1_overlay.png diff --git a/Mobile/img/icons/icon120.png b/Shared/img/icons/icon120.png similarity index 100% rename from Mobile/img/icons/icon120.png rename to Shared/img/icons/icon120.png diff --git a/Mobile/img/icons/icon128.png b/Shared/img/icons/icon128.png similarity index 100% rename from Mobile/img/icons/icon128.png rename to Shared/img/icons/icon128.png diff --git a/Mobile/img/icons/icon16.png b/Shared/img/icons/icon16.png similarity index 100% rename from Mobile/img/icons/icon16.png rename to Shared/img/icons/icon16.png diff --git a/Mobile/img/icons/icon2.png b/Shared/img/icons/icon2.png similarity index 100% rename from Mobile/img/icons/icon2.png rename to Shared/img/icons/icon2.png diff --git a/Mobile/img/icons/icon2.svg b/Shared/img/icons/icon2.svg similarity index 100% rename from Mobile/img/icons/icon2.svg rename to Shared/img/icons/icon2.svg diff --git a/Mobile/img/icons/icon32.png b/Shared/img/icons/icon32.png similarity index 100% rename from Mobile/img/icons/icon32.png rename to Shared/img/icons/icon32.png diff --git a/Mobile/img/icons/icon48.png b/Shared/img/icons/icon48.png similarity index 100% rename from Mobile/img/icons/icon48.png rename to Shared/img/icons/icon48.png diff --git a/Mobile/img/icons/icon60.png b/Shared/img/icons/icon60.png similarity index 100% rename from Mobile/img/icons/icon60.png rename to Shared/img/icons/icon60.png diff --git a/Mobile/img/icons/icon64.png b/Shared/img/icons/icon64.png similarity index 100% rename from Mobile/img/icons/icon64.png rename to Shared/img/icons/icon64.png diff --git a/Mobile/img/icons/icon90.png b/Shared/img/icons/icon90.png similarity index 100% rename from Mobile/img/icons/icon90.png rename to Shared/img/icons/icon90.png diff --git a/Web/js/desktop.js b/Shared/js/events.js similarity index 80% rename from Web/js/desktop.js rename to Shared/js/events.js index 9b1bb16..dcf1e3b 100755 --- a/Web/js/desktop.js +++ b/Shared/js/events.js @@ -1,14 +1,14 @@ "use strict"; $(window).resize(sizeAndPos); - - $('.menu').click(function() { +$(document).ready(function() { + $('.menu').on('click tap', function() { $('#menu').toggleClass('pulled'); }) - $('.save').click(function() { + $('.save').on('click tap', function() { $('#save').removeClass('hidden'); }) - $('.load').click(function() { + $('.load').on('click tap', function() { $('#load').removeClass('hidden'); $('#load li').remove(); var list = JSON.parse(localStorage.getItem('projects')); @@ -24,11 +24,11 @@ $(window).resize(sizeAndPos); ); } - $confirm.find('li').off('click').click(function(e) { + $confirm.find('li').off('click').on('click tap', function(e) { $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); $(this).attr('aria-selected', 'true'); }) - $('#pro').click(function() { + $('#pro').on('click tap', function() { $('#save ol:nth-of-type(2) li').each(function() { if( $(this).find('span').html() !== 'Transparent' ) { $(this).addClass('hidden'); @@ -37,11 +37,11 @@ $(window).resize(sizeAndPos); else $(this).attr('aria-selected', 'true'); }) }) - $('#exp').click(function() { + $('#exp').on('click tap', function() { $('#save ol:nth-of-type(2) li').removeClass('hidden'); }) }) - $('#pro').click(function() { + $('#pro').on('click tap', function() { $('#save ol:nth-of-type(2) li').each(function() { if( $(this).find('span').html() !== 'Transparent' ) { $(this).addClass('hidden'); @@ -50,20 +50,24 @@ $(window).resize(sizeAndPos); else $(this).attr('aria-selected', 'true'); }) }) - $('#exp').click(function() { + $('#exp').on('click tap', function() { $('#save ol:nth-of-type(2) li').removeClass('hidden'); }) - $c.last().on('mousedown', function(e) { + $c.last().on('mousedown touchstart', function(e) { e.preventDefault(); + if( e.changedTouches ) + e = e.changedTouches[0]; var xy = relative(e.pageX, e.pageY); startPoint(xy.x, xy.y); window.active = true; - }).on('mousemove', function(e) { + }).on('mousemove touchmove', function(e) { e.preventDefault(); + if( e.changedTouches ) + e = e.changedTouches[0]; if (!window.active || settings.type == 'line') return; var xy = relative(e.pageX, e.pageY); drawPoint(xy.x, xy.y); - }).on('mouseup', function(e) { + }).on('mouseup touchend', function(e) { e.preventDefault(); window.active = false; @@ -116,7 +120,7 @@ $(window).resize(sizeAndPos); var $single = $('form.single'); - $single.find('li').click(function(e) { + $single.find('li').on('click tap', function(e) { $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); $(this).attr('aria-selected', 'true'); var key = $(this).parents('form').attr('id'), @@ -142,11 +146,11 @@ $(window).resize(sizeAndPos); $confirm.each(function() { - $(this).find('li').click(function(e) { + $(this).find('li').on('click tap', function(e) { $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); $(this).attr('aria-selected', 'true'); }) - $(this).find('button').last().click(function(e) { + $(this).find('button').last().on('click tap', function(e) { e.preventDefault(); var v = $(this).parents('form').attr('id'); $(this).parents('form').find('h1').each(function(i) { @@ -160,7 +164,7 @@ $(window).resize(sizeAndPos); $(this).parents('form').addClass('hidden'); window[v](); }) - $(this).find('button').first().click(function(e) { + $(this).find('button').first().on('click tap', function(e) { e.preventDefault(); $(this).parents('form').addClass('hidden'); }) @@ -174,12 +178,12 @@ $(window).resize(sizeAndPos); var target = /set(.*)/.exec($(this).attr('id'))[1]; // Exception for Color if( target == 'color' || target == 'bg' ) { - return $(this).click(function() { + return $(this).on('click tap', function() { $('.picker').removeClass('hidden'); $('.picker').attr('data-caller', target); }) } - $(this).click(function(e) { + $(this).on('click tap', function(e) { e.preventDefault(); $('form[id="' + target + '"]').removeClass('hidden'); }) @@ -188,11 +192,13 @@ $(window).resize(sizeAndPos); // Seekbar var sliderLeft; - $('div[role="slider"] button').on('mousedown', function() { + $('div[role="slider"] button').on('mousedown touchstart', function() { $(this).attr('data-moving','true'); if( !sliderLeft ) sliderLeft = $('div[role="slider"] button').offset().left; - }).on('mousemove', function(e) { + }).on('mousemove touchmove', function(e) { if( $(this).attr('data-moving') ) { + if( e.changedTouches ) + e = e.changedTouches[0]; var x = parseInt(e.pageX - sliderLeft - 15); var $c = $('.'+$(this).parents('div[role="slider"]').attr('class')); var progress = $c.find('progress'); @@ -206,11 +212,11 @@ $(window).resize(sizeAndPos); $('#'+ key +' span').html(x); } } - }).on('mouseup mouseleave', function() { + }).on('mouseup mouseleave touchend', function() { $(this).removeAttr('data-moving'); }) - $('.fill, .stroke').click(function() { + $('.fill, .stroke').on('click tap', function() { var s = $('.'+$(this).attr('class')).find('span'); if( s.html() == 'Yes' ) { s.html('No'); @@ -221,13 +227,13 @@ $(window).resize(sizeAndPos); } }) - $('.close, .tour button').click(function() { + $('.close, .tour button').on('click tap', function() { $(this).parent().addClass('hidden'); }) // Bottom - $('#clear').click(function() { + $('#clear').on('click tap', function() { c.clear(); var h = window.points.history; window.points = []; @@ -243,11 +249,16 @@ $(window).resize(sizeAndPos); window.points.history.last = window.points.history.length-1; }) - $('#undo').click(undo); - $('#redo').click(redo); + $('#undo').on('click tap', undo); + $('#redo').on('click tap', redo); - $('#about').click(function() { + $('#about').on('click tap', function() { $('.about').removeClass('hidden'); }) + if( window.mobile ) $('*').on('click mousemove mousedown mouseup mouseleave', function() {return false;}); + +}) + + diff --git a/Mobile/js/functions.js b/Shared/js/functions.js similarity index 100% rename from Mobile/js/functions.js rename to Shared/js/functions.js diff --git a/Mobile/js/libs/color-picker-touch.js b/Shared/js/libs/color-picker-touch.js similarity index 100% rename from Mobile/js/libs/color-picker-touch.js rename to Shared/js/libs/color-picker-touch.js diff --git a/Mobile/js/libs/color-picker.js b/Shared/js/libs/color-picker.js similarity index 100% rename from Mobile/js/libs/color-picker.js rename to Shared/js/libs/color-picker.js diff --git a/Mobile/js/libs/mobilebrowsers.js b/Shared/js/libs/mobilebrowsers.js similarity index 100% rename from Mobile/js/libs/mobilebrowsers.js rename to Shared/js/libs/mobilebrowsers.js diff --git a/Mobile/js/libs/stack.js b/Shared/js/libs/stack.js similarity index 100% rename from Mobile/js/libs/stack.js rename to Shared/js/libs/stack.js diff --git a/Mobile/js/libs/touch.js b/Shared/js/libs/touch.js similarity index 100% rename from Mobile/js/libs/touch.js rename to Shared/js/libs/touch.js diff --git a/Mobile/js/libs/yepnope.min.js b/Shared/js/libs/yepnope.min.js similarity index 100% rename from Mobile/js/libs/yepnope.min.js rename to Shared/js/libs/yepnope.min.js diff --git a/Mobile/js/libs/zepto.min.js b/Shared/js/libs/zepto.min.js similarity index 100% rename from Mobile/js/libs/zepto.min.js rename to Shared/js/libs/zepto.min.js diff --git a/Mobile/js/main.js b/Shared/js/shared.js old mode 100755 new mode 100644 similarity index 98% rename from Mobile/js/main.js rename to Shared/js/shared.js index 8ec8643..3187c80 --- a/Mobile/js/main.js +++ b/Shared/js/shared.js @@ -1,5 +1,3 @@ -"use strict"; - $(document).ready(function() { window.c = $('canvas')[0].getContext('2d'); window.o = $('canvas')[1].getContext('2d'); @@ -40,10 +38,9 @@ $(document).ready(function() { } }) $('.color').val('#000000'); - + if( localStorage.getItem('sawTips') != settings.version ) { $('.tour').removeClass('hidden'); localStorage.setItem('sawTips', settings.version); } - }) diff --git a/Web/css/color-picker.less b/Web/css/color-picker.less deleted file mode 100755 index cfcbba5..0000000 --- a/Web/css/color-picker.less +++ /dev/null @@ -1,90 +0,0 @@ -/* Purty Picker Copyright 2013 Jayden Seric (MIT license): https://github.com/jaydenseric/Purty-Picker */ -/* Core: No touchy! */ -.color-picker .spectrum { - position: relative; - /* To position pin, luminosity filter */ - background: linear-gradient(gray, transparent), linear-gradient(90deg, red, #ff2b00, #ff5500, #ff8000, #ffaa00, #ffd500, yellow, #d4ff00, #aaff00, #80ff00, #55ff00, #2bff00, lime, #00ff2b, #00ff55, #00ff80, #00ffaa, #00ffd5, cyan, #00d4ff, #00aaff, #007fff, #0055ff, #002bff, blue, #2a00ff, #5500ff, #7f00ff, #aa00ff, #d400ff, magenta, #ff00d4, #ff00aa, #ff0080, #ff0055, #ff002b, red); - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - /* Prevent pin interaction causing content selection */ - cursor: crosshair; -} -.color-picker .spectrum.active { - cursor: none; -} -.color-picker .spectrum.active .pin { - cursor: none; -} -.color-picker .spectrum > div { - /* Luminosity filter */ - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; -} -.color-picker .spectrum .pin { - position: absolute; - cursor: move; -} - -/* Customization: Default skin */ -.color-picker { - margin: 20px; - padding: 11px; - border: 1px solid #e3e3e3; - border-radius: 4px; - background-color: #f5f5f5; -} -.color-picker .color, -.color-picker .luminosity { - -moz-box-sizing: border-box; - box-sizing: border-box; - display: block; - width: 100%; -} -.color-picker .format { - display: block; - margin: 0 auto 10px auto; -} -.color-picker .color { - -webkit-appearance: none; - border: 0; - border-radius: 2px; - padding: 10px; - text-align: center; - font-size: 11px; - letter-spacing: 1px; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - color: rgba(0, 0, 0, 0.6); - box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); - transition: color 0.2s; -} -.color-picker .color.dark { - color: rgba(255, 255, 255, 0.7); -} -.color-picker .spectrum { - height: 150px; - /* Arbitary but required */ - overflow: hidden; - /* Prevent pin overflowing container */ - border-radius: 2px; - margin: 10px 0; -} -.color-picker .spectrum > div { - box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); -} -.color-picker .spectrum .pin { - margin-left: -4px; - margin-top: -4px; - width: 4px; - height: 4px; - border: 2px solid white; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); - border-radius: 100%; -} -.color-picker .luminosity { - margin: 0; -} diff --git a/Web/css/fonts.less b/Web/css/fonts.less deleted file mode 100755 index e92a90b..0000000 --- a/Web/css/fonts.less +++ /dev/null @@ -1,16 +0,0 @@ -@font-face { - font-family: 'MozTT-Regular'; - src: url('fonts/MozTT-Regular.ttf'); -} -@font-face { - font-family: 'MozTT-Light'; - src: url('fonts/MozTT-Light.ttf'); -} -@font-face { - font-family: 'MozTT-Medium'; - src: url('fonts/MozTT-Medium.ttf'); -} -@font-face { - font-family: 'MozTT-Bold'; - src: url('fonts/MozTT-Bold.ttf'); -} diff --git a/Web/css/main.less b/Web/css/main.less deleted file mode 100755 index 9cb6c0f..0000000 --- a/Web/css/main.less +++ /dev/null @@ -1,292 +0,0 @@ -@import 'fonts'; -@import 'color-picker'; -@import 'seekbars'; -@import 'value_selector'; - -html, body { - margin: 0; - font-size: 10px; - overflow: hidden; - width: 100%; - height: 100%; -} - -*::-moz-focus-inner { - border: none; -} -*:focus { - outline: none; -} - -.hidden { - display: none !important; - visibility: none !important; -} - -div#container { - position: absolute; -} - -canvas { - position: absolute; - top: 0; - left: 0; -} - -.separator { - display: block; - height: 4.8rem; - width: 0.1rem; - &.long { - background: url('imgs/div_line_lg_black.png'); - } - &.small { - background: url('imgs/div_line_sm_black.png'); - } - &.left { - float: left; - } - &.right { - float: right; - } - &.menu { - position: relative; - left: -3rem; - } -} - -.overlay { - z-index: 9999; - position: absolute; - left: 0; - top: 5.3rem;; -} - -button { - -moz-appearance: none; - z-index: 1; - position: relative; - border: none; -} - -.close { - display: block; - width: 2rem; - height: 2rem; - padding: 0 0 0.2rem 0.2rem; - font-size: 10pt; - border: 1px solid rgb(227, 227, 227); - border-radius: 50%; - position: absolute; - text-align: center; - top: -2%; - left: 97%; -} - -.picker, .about, .tour { - font-family: 'MozTT-Light'; - width: 30rem; - height: 24.6rem; - position: absolute; - left: 50%; - top: 50%; - margin-top: -12.3rem; - margin-left: -15rem; - - .color-picker { - margin: 0; - } -} - -.about, .tour { - background: #262626; - padding: 1rem 2rem;; - height: 23rem; - margin-top: -11.5rem; - margin-left: -17rem; - border-radius: 0.2rem; - color: white; - box-shadow: 0 0 0.3rem black; - - a, a:link, a:visited, a:active { - color: white; - } - - .close { - background: #262626; - color: white; - border: 1px solid gray; - } - - p { - font-size: 11pt; - } - span { - font-size: 8pt; - } -} - -.tour { - .button { - width: 30rem; - position: absolute; - bottom: 1rem; - left: 1.8rem; - } -} - -header { - width: 100%; - height: 5.3rem; - background: url('imgs/header_bg_black.png'); - - button { - width: 5rem; - height: 5rem; - } - - .menu { - background: url('imgs/menu.png') -12px center no-repeat; - float: left; - &:active { - background: url('imgs/menu.png') -12px center no-repeat, url('imgs/bg_overlay_pressed_1.png') left no-repeat; - } - } - - .save { - background: url('imgs/download.png') center center no-repeat; - float: right; - &:active { - background: url('imgs/download.png') center center no-repeat, url('imgs/bg_overlay_pressed_2.png') center center; - } - } - - .load { - background: url('imgs/load.png') center center no-repeat; - float: right; - &:active { - background: url('imgs/load.png') center center no-repeat, url('imgs/bg_overlay_pressed_2.png') center center; - } - } - - #title { - color: white; - font-size: 11pt; - font-family: 'MozTT-Regular'; - float: left; - margin: 1.5rem 0; - position: relative; - left: -2rem; - } -} - - -#menu { - width: 15rem; - height: 100%; - display: block; - background: #262626; - position: absolute; - left: -15rem; - top: 5rem; - color: white; - font-family: 'MozTT-Light'; - font-size: 8pt; - transition: left 0.2s ease-out; - border-collapse: collapse; - overflow-y: auto; - - &.pulled { - left: 0; - transition: left 0.2s ease-out; - } - - button[id^='set'], p, .bottom button { - background: none; - display: block; - width: 75%; - color: white; - text-align: left; - margin: 1rem 2.5rem; - font-family: 'MozTT-Light'; - font-size: 8pt; - padding: 0 0.6rem; - cursor: pointer; - } - p { - width: 65%; - } - span { - float: right; - font-size: 7pt; - } - div[role='slider'] { - width: 60%; - float: right; - margin: 0 2rem 0 0; - - div { - overflow: visible; - button { - margin-top: -3.4rem; - left: 0%; - } - } - } - hr { - clear: both; - padding: 0.7rem 0; - margin-bottom: 0.7rem; - border: none; - border-bottom: 1px solid rgba(255,255,255,0.3); - } - *[class^='icon'] { - display: block; - margin: 1rem 0.5rem; - - &:nth-of-type(2) { - padding-top: 0.5rem; - } - &:before { - content: ''; - background-size: 2rem; - width: 2rem; - height: 2rem; - display: block; - float: left; - margin: -0.3rem 0.5rem 0 0; - } - } - - .icon-settings:before { - background-image: url('imgs/settings.png'); - } - .icon-clear:before { - background-image: url('imgs/clear.png'); - } - .icon-undo:before { - background-image: url('imgs/undo.png'); - } - .icon-redo:before { - background-image: url('imgs/redo.png'); - } - - .options { - display: table-row; - vertical-align: top; - margin-top: 1rem; - } - .bottom { - width: 100%; - position: absolute; - bottom: 5rem; - button[class^='icon'] { - margin-left: 3.5rem; - } - button { - margin-left: 5rem; - } - } -} - - diff --git a/Web/css/switches.less b/Web/css/switches.less deleted file mode 100755 index 9025a22..0000000 --- a/Web/css/switches.less +++ /dev/null @@ -1,94 +0,0 @@ -/* ---------------------------------- - * CHECKBOXES / RADIOS - * ---------------------------------- */ - -label.pack-checkbox, -label.pack-radio, -label.pack-switch { - display: inline-block; - vertical-align: middle; - width: 5rem; - height: 5rem; - position: relative; - background: none; -} - -label.pack-checkbox input, -label.pack-radio input, -label.pack-switch input { - margin: 0; - opacity: 0; - position: absolute; - top: 0; - left: 0; -} - -label.pack-checkbox input ~ span:after, -label.pack-radio input ~ span:after { - content: ''; - position: absolute; - left: 50%; - top: 50%; - margin: -1.1rem 0 0 -1.1rem; - width: 2.2rem; - height: 2.2rem; - pointer-events: none; -} - -label.pack-checkbox input ~ span:after { - background: url(switches/images/check/default.png) no-repeat center top / 2.2rem auto; -} - -label.pack-radio input ~ span:after { - background: url(switches/images/radio/default.png) no-repeat center top / 2.2rem auto; -} - -label.pack-checkbox input:checked ~ span:after, -label.pack-radio input:checked ~ span:after, -label.pack-switch input:checked ~ span:after { - background-position: center bottom; -} - -/* 'Dangerous' switches */ - -label.pack-checkbox.danger input ~ span:after { - background-image: url(switches/images/check/danger.png); -} - -label.pack-radio.danger input ~ span:after { - background-image: url(switches/images/radio/danger.png); -} - - -/* ---------------------------------- - * ON/OFF SWITCHES - * ---------------------------------- */ - -label.pack-switch input ~ span:after { - content: ''; - position: absolute; - right: 0; - top: 50%; - width: 6rem; - margin: -1.4rem 0rem 0rem; - height: 2.7rem; - pointer-events: none; - border-radius: 1.35rem; - overflow: hidden; - background: #e6e6e6 url(switches/images/switch/background_off.png) no-repeat -3.2rem 0rem / 9.2rem 2.7rem; - transition: background 0.2s ease; -} - -/* switch: 'ON' state */ -label.pack-switch input:checked ~ span:after { - background: #e6e6e6 url(switches/images/switch/background.png) no-repeat 0rem 0rem / 9.2rem 2.7rem; -} - -/* switch: disabled state */ -label.pack-switch input:disabled ~ span:after { - opacity: 0.4; -} - -label.pack-switch input.uninit ~ span:after { - transition: none; -} diff --git a/Web/css/value_selector.less b/Web/css/value_selector.less deleted file mode 100755 index baaf1eb..0000000 --- a/Web/css/value_selector.less +++ /dev/null @@ -1,204 +0,0 @@ -/* ---------------------------------- - * Value selector (Single & Multiple) - * ---------------------------------- */ - -/* Main dialog setup */ -form[role="dialog"][data-type="value-selector"] { - background: url(value_selector/images/ui/pattern.png) repeat left top, url(value_selector/images/ui/gradient.png) no-repeat left top / 100% 100%; - overflow: hidden; - position: absolute; - z-index: 100; - top: 0; - left: 0; - right: 0; - bottom: 0; - padding: 0 0 7rem; - color: #fff; - font-family: sans-serif; -} - -form[role="dialog"][data-type="value-selector"] > section { - padding: 0 1.5rem 0; - -moz-box-sizing: padding-box; - width: 100%; - height: 100%; - overflow: auto; -} - -form[role="dialog"][data-type="value-selector"] h1 { - font-weight: 400; - font-size: 1.9rem; - line-height: 4.8rem; - color: #fff; - border-bottom: 0.1rem solid #616262; - background: rgba(0 ,0, 0, .2); - margin: 0 -1.5rem; - padding: 0 3rem 1rem; - height: 4.8rem; - -moz-box-sizing: border-box; -} - -/* Specific component code */ -form[role="dialog"][data-type="value-selector"] [role="listbox"] { - position: relative; - padding: 0; - margin: 0 -1.5rem; - max-height: calc(100% - 5rem); - overflow: auto; - border-top: solid 0.1rem #222323; -} - -form[role="dialog"][data-type="value-selector"] .scrollable:before { - content: ""; - display: block; - position: absolute; - pointer-events: none; - top: 4.8rem; - left: 0; - right: 0; - bottom: 6.9rem; - background: url(value_selector/images/ui/shadow.png) repeat-x left top, url(value_selector/images/ui/shadow-invert.png) repeat-x left bottom; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li { - margin: 0; - padding: 0 1.5rem; - height: auto; - list-style: none; - position: relative; - font-weight: lighter; - font-size: 2.2rem; - line-height: 3.9rem; - color: #fff; - transition: background-color 0.2s ease; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:first-child label { - border-top-color: transparent; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li label { - outline: none; - display: block; - color: #fff; - border-top: 0.1rem solid #666; - border-bottom: 0.1rem solid #000; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:last-child label { - border-bottom-color: transparent; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li label span { - display: block; - padding: 1rem 1.5rem; - line-height: 4rem; - word-wrap: break-word; -} - -/* Pressed status */ -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active { - background-color: #00ABCC; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active label { - border-color: transparent; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active + li label { - border-top-color: #000; -} - -form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active label span { - color: #fff !important; - background-image: none; -} - -/* Checked status */ -form[role="dialog"][data-type="value-selector"] [role="listbox"] li[aria-selected="true"]:not([data-input]) span { - padding-right: 2.6rem; - margin-right: 1.2rem; - color: #00abcd; - background: transparent url(value_selector/images/icons/checked.png) no-repeat 100% 50%; - background-size: 2rem; -} - - -/* Menu & buttons setup */ -form[role="dialog"][data-type="value-selector"] menu { - white-space: nowrap; - margin: 0; - padding: 1.5rem; - border-top: solid 0.1rem rgba(255, 255, 255, 0.1); - background: #2d2d2d url(value_selector/images/ui/pattern.png) repeat left top; - display: block; - overflow: hidden; - position: absolute; - left: 0; - right: 0; - bottom: 0; -} - -form[role="dialog"][data-type="value-selector"] menu button::-moz-focus-inner { - border: none; - outline: none; -} - -form[role="dialog"][data-type="value-selector"] menu button, .button { - width: calc((100% - 1rem) / 2); - height: 3.8rem; - margin: 0 0 1rem; - padding: 0 1.5rem; - -moz-box-sizing: border-box; - display: inline-block; - vertical-align: middle; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - background: #fafafa url(value_selector/images/ui/default.png) repeat-x left bottom/ auto 100%; - border: 0.1rem solid #a6a6a6; - border-radius: 0.3rem; - font-weight: 500; - font-size: 1.6rem; - line-height: 3.8rem; - color: #333; - text-align: center; - text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,0.3); - text-decoration: none; - outline: none; -} - -/* Press (default & affirmative) */ -form[role="dialog"][data-type="value-selector"] menu button:active, -form[role="dialog"][data-type="value-selector"] menu button.affirmative:active, .button:active { - border-color: #008aaa; - background: #008aaa; - color: #333; -} - -/* affirmative */ -form[role="dialog"][data-type="value-selector"] menu button.affirmative, .button.affirmative { - background-image: url(value_selector/images/ui/affirmative.png); - background-color: #00caf2; - border-color: #008eab; -} - -form[role="dialog"][data-type="value-selector"] menu button:last-child { - margin-left: 1rem; -} - -form[role="dialog"][data-type="value-selector"] menu button, -form[role="dialog"][data-type="value-selector"] menu button:first-child { - margin: 0; -} - -form[role="dialog"][data-type="value-selector"] menu button.full, .button.full { - width: 100%; -} - -/* Right to left tweaks */ -html[dir="rtl"] #value-selector li input:checked + span, -html[dir="rtl"] #value-selector li[aria-selected="true"] span { - padding-left: 2.6rem; - margin-left: 1.2rem; -} diff --git a/Web/img/icons/MozillaFXOSIconTemplate1_overlay.png b/Web/img/icons/MozillaFXOSIconTemplate1_overlay.png deleted file mode 100755 index 2389796..0000000 Binary files a/Web/img/icons/MozillaFXOSIconTemplate1_overlay.png and /dev/null differ diff --git a/Web/img/icons/icon120.png b/Web/img/icons/icon120.png deleted file mode 100755 index 9519dd3..0000000 Binary files a/Web/img/icons/icon120.png and /dev/null differ diff --git a/Web/img/icons/icon128.png b/Web/img/icons/icon128.png deleted file mode 100755 index 96e7f9f..0000000 Binary files a/Web/img/icons/icon128.png and /dev/null differ diff --git a/Web/img/icons/icon16.png b/Web/img/icons/icon16.png deleted file mode 100755 index 186045d..0000000 Binary files a/Web/img/icons/icon16.png and /dev/null differ diff --git a/Web/img/icons/icon2.png b/Web/img/icons/icon2.png deleted file mode 100755 index 559431b..0000000 Binary files a/Web/img/icons/icon2.png and /dev/null differ diff --git a/Web/img/icons/icon2.svg b/Web/img/icons/icon2.svg deleted file mode 100755 index 6256192..0000000 --- a/Web/img/icons/icon2.svg +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/Web/img/icons/icon32.png b/Web/img/icons/icon32.png deleted file mode 100755 index 78e4cf0..0000000 Binary files a/Web/img/icons/icon32.png and /dev/null differ diff --git a/Web/img/icons/icon48.png b/Web/img/icons/icon48.png deleted file mode 100755 index 301142f..0000000 Binary files a/Web/img/icons/icon48.png and /dev/null differ diff --git a/Web/img/icons/icon60.png b/Web/img/icons/icon60.png deleted file mode 100755 index bac55b3..0000000 Binary files a/Web/img/icons/icon60.png and /dev/null differ diff --git a/Web/img/icons/icon64.png b/Web/img/icons/icon64.png deleted file mode 100755 index fd0041a..0000000 Binary files a/Web/img/icons/icon64.png and /dev/null differ diff --git a/Web/img/icons/icon90.png b/Web/img/icons/icon90.png deleted file mode 100755 index 4e56717..0000000 Binary files a/Web/img/icons/icon90.png and /dev/null differ diff --git a/Web/index.html b/Web/index.html index 93d7f2f..3fa2c1e 100755 --- a/Web/index.html +++ b/Web/index.html @@ -253,7 +253,9 @@ + + diff --git a/Web/js/functions.js b/Web/js/functions.js deleted file mode 100755 index 463aec5..0000000 --- a/Web/js/functions.js +++ /dev/null @@ -1,345 +0,0 @@ -"use strict"; -/*** ESSENTIALS ***/ - -function sizeAndPos() { - - var data = c.getImageData(0,0, $c.width(), $c.height()); - var w = $(window).width(), - h = $(window).height() - 53; - $c.attr('width', w * window.devicePixelRatio); - $c.attr('height',h * window.devicePixelRatio); - $c.css({ - 'width' : w, - 'height' : h - }); - c.clear(); - c.putImageData(data, 0, 0); -} - -function relative(x,y, el) { - var el = el || $c, - offset = el.offset(); - return { - x : (x - offset.left) *window.devicePixelRatio, - y : (y - offset.top) * window.devicePixelRatio - } -} - -function threshold(x1, y1, x2, y2, threshold) { - var tr = threshold || 5; - if( x1 <= x2 + tr && x1 >= x2 - tr && y1 <= y2 + tr && y1 >= y2 - tr ) return true; - return false; -} - -function draw(x1, y1, x2, y2, opts, overlay) { - opts = opts || {}; - if( overlay ) var c = window.o; - else var c = window.c; - c.beginPath(); - if( settings.type == 'eraser' ) c.globalCompositeOperation = 'destination-out'; - else c.globalCompositeOperation = opts.composite || settings.composite; - c.lineCap = opts.lineCap || settings.lineCap; - c.lineJoin = opts.lineJoin || settings.lineJoin; - c.strokeStyle = opts.color || settings.color; - c.fillStyle = opts.color || settings.color; - c.lineWidth = ( opts.lineWidth || settings.lineWidth ) / 10; - c.moveTo(x1, y1); - c.lineTo(x2, y2); - if( !opts.noStroke || settings.noStroke ) c.stroke(); - if( opts.fill || settings.fill ) c.fill(); -} - -function mark(x, y) { - var o = window.o; - o.beginPath(); - o.fillStyle = 'red'; - o.arc(x,y, 3, 0, 2*Math.PI); - o.fill(); -} - -function erase(x1, y1, x2, y2, opts) { - var opts = opts || {}; - var c = window.c; - c.beginPath(); - c.lineWidth = ( opts.lineWidth || settings.lineWidth ) / 10; - c.globalCompositeOperation = 'source-out'; - c.moveTo(x1, y1); - c.lineTo(x2, y2); - window.points = window.points.filter(function(e, i) { - if(!threshold(e.x, e.y, x1, y1, c.lineWidth) && - !threshold(e.x, e.y, x2, y2, c.lineWidth) ) return true; - return false; - }) -} - -function line(x, y, opts) { - var opts = opts || {}; - var o = window.o; - o.beginPath(); - o.lineCap = opts.lineCap || settings.lineCap; - o.lineJoin = opts.lineJoin || settings.lineJoin; - o.strokeStyle = opts.color || settings.color; - o.fillStyle = opts.color || settings.color; - o.lineWidth = ( opts.lineWidth || settings.lineWidth ) / 10; - var last = settings.drawingLine.length-1; - o.moveTo(settings.drawingLine[last].x, settings.drawingLine[last].y); - o.lineTo(x,y); - settings.drawingLine.push({ - x: x, - y: y - }) - o.stroke(); - if( opts.fill || settings.fill ) o.fill(); -} - -function finishLine(opts) { - var opts = opts || {}; - var c = window.c; - o.clear(); - c.beginPath(); - c.strokeStyle = opts.color || settings.color; - c.fillStyle = opts.color || settings.color; - c.lineWidth = ( opts.lineWidth || settings.lineWidth ) / 10; - c.lineJoin = opts.lineJoin || settings.lineJoin; - c.lineCap = opts.lineJoin || settings.lineJoin; - c.moveTo(settings.drawingLine[0].x, settings.drawingLine[0].y); - for( var i = 1, len = settings.drawingLine.length; i < len; i++ ) { - c.lineTo(settings.drawingLine[i].x, settings.drawingLine[i].y); - } - if( settings.stroke ) c.stroke(); - if( settings.fill ) c.fill(); - settings.drawingLine = []; - window.points.history.push({ - data: c.getImageData(0, 0, width(), height()), - points: window.points.slice(0) - }) - window.points.history.last = window.points.history.length-1; -} - -function undo() { - var history = window.points.history; - if( history.last > 1 ) { - var step = history[history.last-1]; - c.putImageData(step.data, 0, 0); - window.points = step.points.slice(0); - window.points.history = history; - window.points.history.last = history.last-1; - } else { - c.clear(); - window.points = []; - window.points.history = history; - window.points.history.last = 0; - } - -} - -function redo() { - var history = window.points.history; - if( history.last < history.length-1 ) { - var step = history[history.last+1]; - c.putImageData(step.data, 0, 0); - window.points = step.points.slice(0); - window.points.history = history; - window.points.history.last = history.last+1; - } -} - -function width() { - return +$c.attr('width'); -} - -function height() { - return +$c.attr('height'); -} - -function dataToBlob(data) { - var binary = atob(data.split(',')[1]), array = []; - var type = data.split(',')[0].split(':')[1].split(';')[0]; - for(var i = 0; i < binary.length; i++) array.push(binary.charCodeAt(i)); - return new Blob([new Uint8Array(array)], {type: type}); -} - - -/*** END ***/ - -function startPoint(x, y) { - - // If no previous point exists, make the first one. - if( !points.length ) points.push({x: x, y: y, type: '', start: {x: x, y: y}}); - - var old = points[points.length-1], - start = old.start, - current = { - x : x, - y : y, - start : old.start || {x: x, y: y}, - type : settings.type - } - - // Line - if( old.type !== 'line' && current.type == 'line' ) { - mark(x, y); - settings.drawingLine.push({ - x: x, - y: y - }) - } - - if( old.type == 'line' && current.type == 'line' ) { - if( points[points.indexOf(old)-1].type !== 'line' ) { - o.clear(); - } - line(x, y); - } - - // Shapes - - if( current.type == 'shape' ) { - settings.shapeStart = current; - } - - var thresholds = window.mobile ? [10, 5] : [5, 2]; - if( points.length > 1 && ((start && threshold(start.x, start.y, x, y, thresholds[0])) || threshold(old.x, old.y, x, y, thresholds[1])) ) { - window.active = false; - points[points.length-1].type = ''; - points[points.length-1].start = undefined; - finishLine(); - return; - } - points.push(current); -} - -function drawPoint(x,y) { - var capture = points[points.length-1]; - - switch(capture.type) { - case 'eraser': { - erase(capture.x, capture.y, x, y); - } - case 'pencil': { - draw(capture.x, capture.y, x, y); - - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - - points.push(current); - break; - } - case 'sketch': { - draw(capture.x, capture.y, x, y); - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - points.push(current); - - for( var i = 0, len = points.length-1; i < len; i++ ) { - if(threshold(points[i].x, points[i].y, current.x, current.y, settings.connectTelorance)) { - var x = points[i].x - current.x, - y = points[i].y - current.y; - var w = settings.lineWidth/20 > 0.2 ? settings.lineWidth/20 : 0.2; - - draw(points[i].x - x*0.2, points[i].y - y*0.2, current.x + x*0.2, current.y + y*0.2, {strokeStyle: 'rgba(0,0,0,0.4)', lineWidth: w}) - } - } - break; - } - case 'fur': { - draw(capture.x, capture.y, x, y); - var current = { - x : x, - y : y, - start : capture.start, - type : capture.type - } - points.push(current); - - for( var i = 0, len = points.length-1; i < len; i++ ) { - if(threshold(points[i].x, points[i].y, current.x, current.y, settings.connectTelorance)) { - var x = points[i].x - current.x, - y = points[i].y - current.y; - var l = settings.furLength / 100 || 0.2; - var w = settings.lineWidth/20 > 0.2 ? settings.lineWidth/20 : 0.2; - - draw(points[i].x + x*l, points[i].y + y*l, current.x - x*l, current.y - y*l, {strokeStyle: 'rgba(0,0,0,0.4)', lineWidth: w}) - } - } - break; - } - case 'shape': { - o.clear(); - o.beginPath(); - o.fillStyle = settings.color; - o.strokeStyle = settings.color; - o.lineWidth = settings.lineWidth / 20; - var start = settings.shapeStart; - switch(settings.shape) { - case 'circle': { - var di = Math.abs(x - start.x); - o.arc(start.x, start.y, di, 0, 2*Math.PI); - settings.comShape = { - type: 'circle', - x: start.x, - y: start.y, - radius: di - } - break; - } - case 'rectangle': { - var w = x - start.x; - var h = y - start.y; - o.rect(start.x, start.y, w, h); - settings.comShape = { - type: 'rectangle', - x: start.x, - y: start.y, - w: w, - h: h - } - break; - } - case 'square': { - var w = x - start.x; - o.rect(start.x, start.y, w, w); - settings.comShape = { - type: 'rectangle', - x: start.x, - y: start.y, - w: w, - h: w - } - break; - } - case 'triangle': { - var dix = (x - start.x)/2; - var diy = (y - start.y)/2; - o.moveTo(start.x + dix, start.y); - o.lineTo(x, y); - o.lineTo(start.x, y); - o.lineTo(start.x + dix, start.y); - settings.comShape = { - type: 'triangle', - start: { - x: start.x, - y: start.y - }, - x: x, - y: y, - dix: dix, - diy: diy - } - } - } - if( settings.fill ) o.fill(); - if( settings.stroke ) o.stroke(); - break; - } - } -} - diff --git a/Web/js/less-1.5.0.min.js b/Web/js/less-1.5.0.min.js deleted file mode 100755 index ef4be90..0000000 --- a/Web/js/less-1.5.0.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * LESS - Leaner CSS v1.5.0 - * http://lesscss.org - * - * Copyright (c) 2009-2013, Alexis Sellier - * Licensed under the Apache v2 License. - * - * @licence - */ - -function require(a){return window.less[a.split("/")[1]]}function log(a,b){"development"==less.env&&"undefined"!=typeof console&&less.logLevel>=b&&console.log("less: "+a)}function extractId(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function errorConsole(a,b){var c="{line} {content}",d=a.filename||b,e=[],f=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+d+" ",g=function(a,b,d){void 0!==a.extract[b]&&e.push(c.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[b]))};a.extract?(g(a,0,""),g(a,1,"line"),g(a,2,""),f+="on line "+a.line+", column "+(a.column+1)+":\n"+e.join("\n")):a.stack&&(f+=a.stack),log(f,logLevel.errors)}function createCSS(a,b,c){var d=b.href||"",e="less:"+(b.title||extractId(d)),f=document.getElementById(e),g=!1,h=document.createElement("style");if(h.setAttribute("type","text/css"),b.media&&h.setAttribute("media",b.media),h.id=e,h.styleSheet)try{h.styleSheet.cssText=a}catch(i){throw new Error("Couldn't reassign styleSheet.cssText.")}else h.appendChild(document.createTextNode(a)),g=null!==f&&f.childNodes.length>0&&h.childNodes.length>0&&f.firstChild.nodeValue===h.firstChild.nodeValue;var j=document.getElementsByTagName("head")[0];if(null===f||g===!1){var k=b&&b.nextSibling||null;k?k.parentNode.insertBefore(h,k):j.appendChild(h)}if(f&&g===!1&&f.parentNode.removeChild(f),c&&cache){log("saving "+d+" to cache.",logLevel.info);try{cache.setItem(d,a),cache.setItem(d+":timestamp",c)}catch(i){log("failed to save",logLevel.errors)}}}function errorHTML(a,b){var c,d,e="less-error-message:"+extractId(b||""),f='
  • {content}
  • ',g=document.createElement("div"),h=[],i=a.filename||b,j=i.match(/([^\/]+(\?.*)?)$/)[1];g.id=e,g.className="less-error-message",d="

    "+(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+"

    "+'

    in '+j+" ";var k=function(a,b,c){void 0!==a.extract[b]&&h.push(f.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract?(k(a,0,""),k(a,1,"line"),k(a,2,""),d+="on line "+a.line+", column "+(a.column+1)+":

    "+"
      "+h.join("")+"
    "):a.stack&&(d+="
    "+a.stack.split("\n").slice(1).join("
    ")),g.innerHTML=d,createCSS([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),g.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"==less.env&&(c=setInterval(function(){document.body&&(document.getElementById(e)?document.body.replaceChild(g,document.getElementById(e)):document.body.insertBefore(g,document.body.firstChild),clearInterval(c))},10))}function error(a,b){less.errorReporting&&"html"!==less.errorReporting?"console"===less.errorReporting?errorConsole(a,b):"function"==typeof less.errorReporting&&less.errorReporting("add",a,b):errorHTML(a,b)}function removeErrorHTML(a){var b=document.getElementById("less-error-message:"+extractId(a));b&&b.parentNode.removeChild(b)}function removeErrorConsole(){}function removeError(a){less.errorReporting&&"html"!==less.errorReporting?"console"===less.errorReporting?removeErrorConsole(a):"function"==typeof less.errorReporting&&less.errorReporting("remove",a):removeErrorHTML(a)}function loadStyles(a){for(var b,c=document.getElementsByTagName("style"),d=0;d0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=f[1]+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g}function pathDiff(a,b){var c,d,e,f,g=extractUrlParts(a),h=extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;c=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var f=getXMLHttpRequest(),g=isFileProtocol?less.fileAsync:less.async;"function"==typeof f.overrideMimeType&&f.overrideMimeType("text/css"),log("XHR: Getting '"+a+"'",logLevel.info),f.open("GET",a,g),f.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),f.send(null),isFileProtocol&&!less.fileAsync?0===f.status||f.status>=200&&f.status<300?c(f.responseText):d(f.status,a):g?f.onreadystatechange=function(){4==f.readyState&&e(f,c,d)}:e(f,c,d)}function loadFile(a,b,c,d,e){b&&b.currentDirectory&&!/^([a-z-]+:)?\//.test(a)&&(a=b.currentDirectory+a);var f=extractUrlParts(a,window.location.href),g=f.url,h={currentDirectory:f.path,filename:g};if(b?(h.entryPath=b.entryPath,h.rootpath=b.rootpath,h.rootFilename=b.rootFilename,h.relativeUrls=b.relativeUrls):(h.entryPath=f.path,h.rootpath=less.rootpath||f.path,h.rootFilename=g,h.relativeUrls=d.relativeUrls),h.relativeUrls&&(h.rootpath=d.rootpath?extractUrlParts(d.rootpath+pathDiff(f.path,h.entryPath)).path:f.path),d.useFileCache&&fileCache[g])try{var i=fileCache[g];e&&(i+="\n"+e),c(null,i,g,h,{lastModified:new Date})}catch(j){c(j,null,g)}else doXHR(g,d.mime,function(a,b){fileCache[g]=a;try{c(null,a,g,h,{lastModified:b})}catch(d){c(d,null,g)}},function(a,b){c({type:"File",message:"'"+b+"' wasn't found ("+a+")"},null,g)})}function loadStyleSheet(a,b,c,d,e){var f=new less.tree.parseEnv(less);f.mime=a.type,e&&(f.useFileCache=!0),loadFile(a.href,null,function(e,g,h,i,j){if(j){j.remaining=d;var k=cache&&cache.getItem(h),l=cache&&cache.getItem(h+":timestamp");if(!c&&l&&j.lastModified&&new Date(j.lastModified).valueOf()===new Date(l).valueOf())return createCSS(k,a),j.local=!0,b(null,null,g,a,j,h),void 0}removeError(h),g?(f.currentFileInfo=i,new less.Parser(f).parse(g,function(c,d){if(c)return b(c,null,null,a);try{b(c,d,g,a,j,h)}catch(c){b(c,null,null,a)}})):b(e,null,null,a,j,h)},f,e)}function loadStyleSheets(a,b,c){for(var d=0;dv&&(u[q]=u[q].slice(p-v),v=p)}function e(a){var b=a.charCodeAt(0);return 32===b||10===b||9===b}function f(a){var b,c;if(a instanceof Function)return a.call(w.parsers);if("string"==typeof a)b=o.charAt(p)===a?a:null,c=1,d();else{if(d(),!(b=a.exec(u[q])))return null;c=b[0].length}return b?(g(c),"string"==typeof b?b:1===b.length?b[0]:b):void 0}function g(a){for(var b=p,c=q,d=p+u[q].length,f=p+=a;d>p&&e(o.charAt(p));)p++;return u[q]=u[q].slice(a+(p-f)),v=p,0===u[q].length&&q=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}function m(a,b,c){var d=c.currentFileInfo.filename;return"browser"!==less.mode&&"rhino"!==less.mode&&(d=require("path").resolve(d)),{lineNumber:l(a,b).line+1,fileName:d}}function n(a,b){var c=k(a,b),d=l(a.index,c),e=d.line,f=d.column,g=a.call&&l(a.call,c).line,h=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.currentFileInfo.filename,this.index=a.index,this.line="number"==typeof e?e+1:null,this.callLine=g+1,this.callExtract=h[g],this.stack=a.stack,this.column=f,this.extract=[h[e-1],h[e],h[e+1]]}var o,p,q,r,s,t,u,v,w,x=a&&a.filename;a instanceof tree.parseEnv||(a=new tree.parseEnv(a));var y=this.imports={paths:a.paths||[],queue:[],files:a.files,contents:a.contents,mime:a.mime,error:null,push:function(b,c,d,e){var f=this;this.queue.push(b);var g=function(a,c,d){f.queue.splice(f.queue.indexOf(b),1);var g=d in f.files||d===x;f.files[d]=c,a&&!f.error&&(f.error=a),e(a,c,g,d)};less.Parser.importer?less.Parser.importer(b,c,g,a):less.Parser.fileLoader(b,c,function(b,e,f,h){if(b)return g(b),void 0;var i=new tree.parseEnv(a);i.currentFileInfo=h,i.processImports=!1,i.contents[f]=e,(c.reference||d.reference)&&(h.reference=!0),d.inline?g(null,e,f):new less.Parser(i).parse(e,function(a,b){g(a,b,f)})},a)}};return n.prototype=new Error,n.prototype.constructor=n,this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,w={imports:y,parse:function(b,c){var d,e,g,h=null;if(p=q=v=t=0,o=b.replace(/\r\n/g,"\n"),o=o.replace(/^\uFEFF/,""),w.imports.contents[a.currentFileInfo.filename]=o,u=function(b){for(var c,d,e,f,g=0,i=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,j=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,k=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,l=0,m=b[0],p=0;p0?"missing closing `}`":"missing opening `{`",filename:a.currentFileInfo.filename},a)),b.map(function(a){return a.join("")})}([[]]),h)return c(new n(h,a));try{d=new tree.Ruleset([],f(this.parsers.primary)),d.root=!0,d.firstRoot=!0}catch(i){return c(new n(i,a))}if(d.toCSS=function(b){return function(c,d){c=c||{};var e,f,g=new tree.evalEnv(c);"object"!=typeof d||Array.isArray(d)||(d=Object.keys(d).map(function(a){var b=d[a];return b instanceof tree.Value||(b instanceof tree.Expression||(b=new tree.Expression([b])),b=new tree.Value([b])),new tree.Rule("@"+a,b,!1,null,0)}),g.frames=[new tree.Ruleset(null,d)]);try{e=b.call(this,g),(new tree.joinSelectorVisitor).run(e),(new tree.processExtendsVisitor).run(e),new tree.toCSSVisitor({compress:Boolean(c.compress)}).run(e),c.sourceMap&&(e=new tree.sourceMapOutput({writeSourceMap:c.writeSourceMap,rootNode:e,contentsMap:w.imports.contents,sourceMapFilename:c.sourceMapFilename,outputFilename:c.sourceMapOutputFilename,sourceMapBasepath:c.sourceMapBasepath,sourceMapRootpath:c.sourceMapRootpath,outputSourceFiles:c.outputSourceFiles,sourceMapGenerator:c.sourceMapGenerator})),f=e.toCSS({compress:Boolean(c.compress),dumpLineNumbers:a.dumpLineNumbers,strictUnits:Boolean(c.strictUnits)})}catch(h){throw new n(h,a)}return c.cleancss&&"node"===less.mode?require("clean-css").process(f):c.compress?f.replace(/(^(\s)+)|((\s)+$)/g,""):f}}(d.eval),p57||43>b||47===b||44==b))return(a=f(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/))?new tree.Dimension(a[1],a[2]):void 0},unicodeDescriptor:function(){var a;return(a=f(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))?new tree.UnicodeDescriptor(a[0]):void 0},javascript:function(){var b,c,d=p;return"~"===o.charAt(d)&&(d++,c=!0),"`"===o.charAt(d)?(void 0===a.javascriptEnabled||a.javascriptEnabled||i("You are using JavaScript, which has been disabled."),c&&f("~"),(b=f(/^`([^`]*)`/))?new tree.JavaScript(b[1],p,c):void 0):void 0}},variable:function(){var a;return"@"===o.charAt(p)&&(a=f(/^(@[\w-]+)\s*:/))?a[1]:void 0},extend:function(a){var b,c,d,e=p,g=[];if(f(a?/^&:extend\(/:/^:extend\(/)){do{for(d=null,b=[];;){if(d=f(/^(all)(?=\s*(\)|,))/))break;if(c=f(this.element),!c)break;b.push(c)}d=d&&d[1],g.push(new tree.Extend(new tree.Selector(b),d,e))}while(f(","));return h(/^\)/),a&&h(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var d,e,g,i=[],k=p,l=o.charAt(p),m=!1;if("."===l||"#"===l){for(b();d=f(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/);)i.push(new tree.Element(e,d,p,a.currentFileInfo)),e=f(">");return f("(")&&(g=this.mixin.args.call(this,!0).args,h(")")),g=g||[],f(this.important)&&(m=!0),i.length>0&&(f(";")||j("}"))?new tree.mixin.Call(i,g,k,a.currentFileInfo,m):(c(),void 0)}},args:function(a){for(var b,c,d,e,g,j,k=[],l=[],m=[],n={args:null,variadic:!1};;){if(a)j=f(this.expression);else{if(f(this.comments),"."===o.charAt(p)&&f(/^\.{3}/)){n.variadic=!0,f(";")&&!b&&(b=!0),(b?l:m).push({variadic:!0});break}j=f(this.entities.variable)||f(this.entities.literal)||f(this.entities.keyword)}if(!j)break;e=null,j.throwAwayComments&&j.throwAwayComments(),g=j;var q=null;if(a?1==j.value.length&&(q=j.value[0]):q=j,q&&q instanceof tree.Variable)if(f(":"))k.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=h(this.expression),e=d=q.name;else{if(!a&&f(/^\.{3}/)){n.variadic=!0,f(";")&&!b&&(b=!0),(b?l:m).push({name:j.name,variadic:!0});break}a||(d=e=q.name,g=null)}g&&k.push(g),m.push({name:e,value:g}),f(",")||(f(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,k.length>1&&(g=new tree.Value(k)),l.push({name:d,value:g}),d=null,k=[],c=!1)}return n.args=b?l:m,n},definition:function(){var a,d,e,g,i=[],k=!1;if(!("."!==o.charAt(p)&&"#"!==o.charAt(p)||j(/^[^{]*\}/))&&(b(),d=f(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/))){a=d[1];var l=this.mixin.args.call(this,!1);if(i=l.args,k=l.variadic,f(")")||(t=p,c()),f(this.comments),f(/^when/)&&(g=h(this.conditions,"expected condition")),e=f(this.block))return new tree.mixin.Definition(a,i,e,g,k);c()}}},entity:function(){return f(this.entities.literal)||f(this.entities.variable)||f(this.entities.url)||f(this.entities.call)||f(this.entities.keyword)||f(this.entities.javascript)||f(this.comment)},end:function(){return f(";")||j("}")},alpha:function(){var a;if(f(/^\(opacity=/i))return(a=f(/^\d+/)||f(this.entities.variable))?(h(")"),new tree.Alpha(a)):void 0},element:function(){var b,c,d;return c=f(this.combinator),b=f(/^(?:\d+\.\d+|\d+)%/)||f(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||f("*")||f("&")||f(this.attribute)||f(/^\([^()@]+\)/)||f(/^[\.#](?=@)/)||f(this.entities.variableCurly),b||f("(")&&(d=f(this.selector))&&f(")")&&(b=new tree.Paren(d)),b?new tree.Element(c,b,p,a.currentFileInfo):void 0},combinator:function(){var a=o.charAt(p);if(">"===a||"+"===a||"~"===a||"|"===a){for(p++;o.charAt(p).match(/\s/);)p++;return new tree.Combinator(a)}return o.charAt(p-1).match(/\s/)?new tree.Combinator(" "):new tree.Combinator(null)},lessSelector:function(){return this.selector(!0)},selector:function(b){for(var c,d,e,g,j,k=[],l=[];(b&&(e=f(this.extend))||b&&(g=f(/^when/))||(c=f(this.element)))&&(g?j=h(this.conditions,"expected condition"):j?i("CSS guard can only be used at the end of selector"):e?l.push.apply(l,e):(l.length&&i("Extend can only be used at the end of selector"),d=o.charAt(p),k.push(c),c=null),"{"!==d&&"}"!==d&&";"!==d&&","!==d&&")"!==d););return k.length>0?new tree.Selector(k,l,j,p,a.currentFileInfo):(l.length&&i("Extend must be used to extend a selector, it cannot be used on its own"),void 0)},attribute:function(){var a,b,c;if(f("["))return(a=f(this.entities.variableCurly))||(a=h(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(c=f(/^[|~*$^]?=/))&&(b=f(this.entities.quoted)||f(/^[0-9]+%/)||f(/^[\w-]+/)||f(this.entities.variableCurly)),h("]"),new tree.Attribute(a,c,b)},block:function(){var a;return f("{")&&(a=f(this.primary))&&f("}")?a:void 0},ruleset:function(){var d,e,g,h=[];for(b(),a.dumpLineNumbers&&(g=m(p,o,a));(d=f(this.lessSelector))&&(h.push(d),f(this.comments),f(","));)d.condition&&i("Guards are only currently allowed on a single selector."),f(this.comments);if(h.length>0&&(e=f(this.block))){var j=new tree.Ruleset(h,e,a.strictImports);return a.dumpLineNumbers&&(j.debugInfo=g),j}t=p,c()},rule:function(d){var e,g,h,i=o.charAt(p),j=!1;if(b(),"."!==i&&"#"!==i&&"&"!==i&&(e=f(this.variable)||f(this.ruleProperty))){if(g=d||!a.compress&&"@"!==e.charAt(0)?f(this.anonymousValue)||f(this.value):f(this.value)||f(this.anonymousValue),h=f(this.important),"+"===e[e.length-1]&&(j=!0,e=e.substr(0,e.length-1)),g&&f(this.end))return new tree.Rule(e,g,h,j,s,a.currentFileInfo);if(t=p,c(),g&&!d)return this.rule(!0)}},anonymousValue:function(){var a;return(a=/^([^@+\/'"*`(;{}-]*);/.exec(u[q]))?(p+=a[0].length-1,new tree.Anonymous(a[1])):void 0},"import":function(){var d,e,g=p;b();var h=f(/^@import?\s+/),i=(h?f(this.importOptions):null)||{};return h&&(d=f(this.entities.quoted)||f(this.entities.url))&&(e=f(this.mediaFeatures),f(";"))?(e=e&&new tree.Value(e),new tree.Import(d,e,i,g,a.currentFileInfo)):(c(),void 0)},importOptions:function(){var a,b,c,d={};if(!f("("))return null;do if(a=f(this.importOption)){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!f(","))break}while(a);return h(")"),d},importOption:function(){var a=f(/^(less|css|multiple|once|inline|reference)/);return a?a[1]:void 0},mediaFeature:function(){var b,c,d=[];do if(b=f(this.entities.keyword)||f(this.entities.variable))d.push(b);else if(f("(")){if(c=f(this.property),b=f(this.value),!f(")"))return null;if(c&&b)d.push(new tree.Paren(new tree.Rule(c,b,null,null,p,a.currentFileInfo,!0)));else{if(!b)return null;d.push(new tree.Paren(b))}}while(b);return d.length>0?new tree.Expression(d):void 0},mediaFeatures:function(){var a,b=[];do if(a=f(this.mediaFeature)){if(b.push(a),!f(","))break}else if((a=f(this.entities.variable))&&(b.push(a),!f(",")))break;while(a);return b.length>0?b:null},media:function(){var b,c,d,e;return a.dumpLineNumbers&&(e=m(p,o,a)),f(/^@media/)&&(b=f(this.mediaFeatures),c=f(this.block))?(d=new tree.Media(c,b,p,a.currentFileInfo),a.dumpLineNumbers&&(d.debugInfo=e),d):void 0},directive:function(){var d,e,g,h,i,j,k,l;if("@"===o.charAt(p)){if(e=f(this["import"])||f(this.media))return e;if(b(),d=f(/^@[a-z-]+/)){switch(h=d,"-"==d.charAt(1)&&d.indexOf("-",2)>0&&(h="@"+d.slice(d.indexOf("-",2)+1)),h){case"@font-face":i=!0;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":i=!0;break;case"@host":case"@page":case"@document":case"@supports":case"@keyframes":i=!0,j=!0;break;case"@namespace":k=!0}if(j&&(l=(f(/^[^{]+/)||"").trim(),l&&(d+=" "+l)),i){if(g=f(this.block))return new tree.Directive(d,g,p,a.currentFileInfo)}else if((e=k?f(this.expression):f(this.entity))&&f(";")){var n=new tree.Directive(d,e,p,a.currentFileInfo);return a.dumpLineNumbers&&(n.debugInfo=m(p,o,a)),n}c()}}},value:function(){for(var a,b=[];(a=f(this.expression))&&(b.push(a),f(",")););return b.length>0?new tree.Value(b):void 0},important:function(){return"!"===o.charAt(p)?f(/^! *important/):void 0},sub:function(){var a,b;return f("(")&&(a=f(this.addition))?(b=new tree.Expression([a]),h(")"),b.parens=!0,b):void 0},multiplication:function(){var a,b,c,d,g;if(a=f(this.operand)){for(g=e(o.charAt(p-1));!j(/^\/[*\/]/)&&(c=f("/")||f("*"))&&(b=f(this.operand));)a.parensInOp=!0,b.parensInOp=!0,d=new tree.Operation(c,[d||a,b],g),g=e(o.charAt(p-1));return d||a}},addition:function(){var a,b,c,d,g;if(a=f(this.multiplication)){for(g=e(o.charAt(p-1));(c=f(/^[-+]\s+/)||!g&&(f("+")||f("-")))&&(b=f(this.multiplication));)a.parensInOp=!0,b.parensInOp=!0,d=new tree.Operation(c,[d||a,b],g),g=e(o.charAt(p-1));return d||a}},conditions:function(){var a,b,c,d=p;if(a=f(this.condition)){for(;j(/^,\s*(not\s*)?\(/)&&f(",")&&(b=f(this.condition));)c=new tree.Condition("or",c||a,b,d);return c||a}},condition:function(){var a,b,c,d,e=p,g=!1;return f(/^not/)&&(g=!0),h("("),(a=f(this.addition)||f(this.entities.keyword)||f(this.entities.quoted))?((d=f(/^(?:>=|<=|=<|[<=>])/))?(b=f(this.addition)||f(this.entities.keyword)||f(this.entities.quoted))?c=new tree.Condition(d,a,b,e,g):i("expected expression"):c=new tree.Condition("=",a,new tree.Keyword("true"),e,g),h(")"),f(/^and/)?new tree.Condition("and",c,f(this.condition)):c):void 0},operand:function(){var a,b=o.charAt(p+1);"-"!==o.charAt(p)||"@"!==b&&"("!==b||(a=f("-"));var c=f(this.sub)||f(this.entities.dimension)||f(this.entities.color)||f(this.entities.variable)||f(this.entities.call);return a&&(c.parensInOp=!0,c=new tree.Negative(c)),c},expression:function(){for(var a,b,c=[];a=f(this.addition)||f(this.entity);)c.push(a),!j(/^\/[\/*]/)&&(b=f("/"))&&c.push(new tree.Anonymous(b));return c.length>0?new tree.Expression(c):void 0},property:function(){var a;return(a=f(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/))?a[1]:void 0},ruleProperty:function(){var a;return(a=f(/^(\*?-?[_a-zA-Z0-9-]+)\s*(\+?)\s*:/))?a[1]+(a[2]||""):void 0}}}},function(a){function b(b){return a.functions.hsla(b.h,b.s,b.l,b.a)}function c(b,c){return b instanceof a.Dimension&&b.unit.is("%")?parseFloat(b.value*c/100):d(b)}function d(b){if(b instanceof a.Dimension)return parseFloat(b.unit.is("%")?b.value/100:b.value);if("number"==typeof b)return b;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function e(a){return Math.min(1,Math.max(0,a))}a.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(b,e,f,g){var h=[b,e,f].map(function(a){return c(a,256)});return g=d(g),new a.Color(h,g)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,c,f){function g(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?i+6*(h-i)*a:1>2*a?h:2>3*a?i+6*(h-i)*(2/3-a):i}a=d(a)%360/360,b=e(d(b)),c=e(d(c)),f=e(d(f));var h=.5>=c?c*(b+1):c+b-c*b,i=2*c-h;return this.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),f)},hsv:function(a,b,c){return this.hsva(a,b,c,1)},hsva:function(a,b,c,e){a=360*(d(a)%360/360),b=d(b),c=d(c),e=d(e);var f,g;f=Math.floor(a/60%6),g=a/60-f;var h=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],i=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(255*h[i[f][0]],255*h[i[f][1]],255*h[i[f][2]],e)},hue:function(b){return new a.Dimension(Math.round(b.toHSL().h))},saturation:function(b){return new a.Dimension(Math.round(100*b.toHSL().s),"%")},lightness:function(b){return new a.Dimension(Math.round(100*b.toHSL().l),"%")},hsvhue:function(b){return new a.Dimension(Math.round(b.toHSV().h))},hsvsaturation:function(b){return new a.Dimension(Math.round(100*b.toHSV().s),"%")},hsvvalue:function(b){return new a.Dimension(Math.round(100*b.toHSV().v),"%")},red:function(b){return new a.Dimension(b.rgb[0])},green:function(b){return new a.Dimension(b.rgb[1])},blue:function(b){return new a.Dimension(b.rgb[2])},alpha:function(b){return new a.Dimension(b.toHSL().a)},luma:function(b){return new a.Dimension(Math.round(100*b.luma()*b.alpha),"%")},saturate:function(a,c){if(!a.rgb)return null;var d=a.toHSL();return d.s+=c.value/100,d.s=e(d.s),b(d)},desaturate:function(a,c){var d=a.toHSL();return d.s-=c.value/100,d.s=e(d.s),b(d)},lighten:function(a,c){var d=a.toHSL();return d.l+=c.value/100,d.l=e(d.l),b(d)},darken:function(a,c){var d=a.toHSL();return d.l-=c.value/100,d.l=e(d.l),b(d)},fadein:function(a,c){var d=a.toHSL();return d.a+=c.value/100,d.a=e(d.a),b(d)},fadeout:function(a,c){var d=a.toHSL();return d.a-=c.value/100,d.a=e(d.a),b(d)},fade:function(a,c){var d=a.toHSL();return d.a=c.value/100,d.a=e(d.a),b(d)},spin:function(a,c){var d=a.toHSL(),e=(d.h+c.value)%360;return d.h=0>e?360+e:e,b(d)},mix:function(b,c,d){d||(d=new a.Dimension(50));var e=d.value/100,f=2*e-1,g=b.toHSL().a-c.toHSL().a,h=((-1==f*g?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[b.rgb[0]*h+c.rgb[0]*i,b.rgb[1]*h+c.rgb[1]*i,b.rgb[2]*h+c.rgb[2]*i],k=b.alpha*e+c.alpha*(1-e);return new a.Color(j,k)},greyscale:function(b){return this.desaturate(b,new a.Dimension(100))},contrast:function(a,b,c,e){if(!a.rgb)return null;if("undefined"==typeof c&&(c=this.rgba(255,255,255,1)),"undefined"==typeof b&&(b=this.rgba(0,0,0,1)),b.luma()>c.luma()){var f=c;c=b,b=f}return e="undefined"==typeof e?.43:d(e),a.luma()*a.alphah.value)&&(j[e]=f)):(k[i]=j.length,j.push(f))):j.push(f);return 1==j.length?j[0]:(c=j.map(function(a){return a.toCSS(this.env)}).join(this.env.compress?",":", "),new a.Anonymous((b?"min":"max")+"("+c+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},argb:function(b){return new a.Anonymous(b.toARGB())},percentage:function(b){return new a.Dimension(100*b.value,"%")},color:function(b){if(b instanceof a.Quoted){var c,d=b.value;if(c=a.Color.fromKeyword(d))return c;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(d))return new a.Color(d.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(b){return this._isa(b,a.Color)},isnumber:function(b){return this._isa(b,a.Dimension)},isstring:function(b){return this._isa(b,a.Quoted)},iskeyword:function(b){return this._isa(b,a.Keyword)},isurl:function(b){return this._isa(b,a.URL) -},ispixel:function(a){return this.isunit(a,"px")},ispercentage:function(a){return this.isunit(a,"%")},isem:function(a){return this.isunit(a,"em")},isunit:function(b,c){return b instanceof a.Dimension&&b.unit.is(c.value||c)?a.True:a.False},_isa:function(b,c){return b instanceof c?a.True:a.False},multiply:function(a,b){var c=a.rgb[0]*b.rgb[0]/255,d=a.rgb[1]*b.rgb[1]/255,e=a.rgb[2]*b.rgb[2]/255;return this.rgb(c,d,e)},screen:function(a,b){var c=255-(255-a.rgb[0])*(255-b.rgb[0])/255,d=255-(255-a.rgb[1])*(255-b.rgb[1])/255,e=255-(255-a.rgb[2])*(255-b.rgb[2])/255;return this.rgb(c,d,e)},overlay:function(a,b){var c=a.rgb[0]<128?2*a.rgb[0]*b.rgb[0]/255:255-2*(255-a.rgb[0])*(255-b.rgb[0])/255,d=a.rgb[1]<128?2*a.rgb[1]*b.rgb[1]/255:255-2*(255-a.rgb[1])*(255-b.rgb[1])/255,e=a.rgb[2]<128?2*a.rgb[2]*b.rgb[2]/255:255-2*(255-a.rgb[2])*(255-b.rgb[2])/255;return this.rgb(c,d,e)},softlight:function(a,b){var c=b.rgb[0]*a.rgb[0]/255,d=c+a.rgb[0]*(255-(255-a.rgb[0])*(255-b.rgb[0])/255-c)/255;c=b.rgb[1]*a.rgb[1]/255;var e=c+a.rgb[1]*(255-(255-a.rgb[1])*(255-b.rgb[1])/255-c)/255;c=b.rgb[2]*a.rgb[2]/255;var f=c+a.rgb[2]*(255-(255-a.rgb[2])*(255-b.rgb[2])/255-c)/255;return this.rgb(d,e,f)},hardlight:function(a,b){var c=b.rgb[0]<128?2*b.rgb[0]*a.rgb[0]/255:255-2*(255-b.rgb[0])*(255-a.rgb[0])/255,d=b.rgb[1]<128?2*b.rgb[1]*a.rgb[1]/255:255-2*(255-b.rgb[1])*(255-a.rgb[1])/255,e=b.rgb[2]<128?2*b.rgb[2]*a.rgb[2]/255:255-2*(255-b.rgb[2])*(255-a.rgb[2])/255;return this.rgb(c,d,e)},difference:function(a,b){var c=Math.abs(a.rgb[0]-b.rgb[0]),d=Math.abs(a.rgb[1]-b.rgb[1]),e=Math.abs(a.rgb[2]-b.rgb[2]);return this.rgb(c,d,e)},exclusion:function(a,b){var c=a.rgb[0]+b.rgb[0]*(255-a.rgb[0]-a.rgb[0])/255,d=a.rgb[1]+b.rgb[1]*(255-a.rgb[1]-a.rgb[1])/255,e=a.rgb[2]+b.rgb[2]*(255-a.rgb[2]-a.rgb[2])/255;return this.rgb(c,d,e)},average:function(a,b){var c=(a.rgb[0]+b.rgb[0])/2,d=(a.rgb[1]+b.rgb[1])/2,e=(a.rgb[2]+b.rgb[2])/2;return this.rgb(c,d,e)},negation:function(a,b){var c=255-Math.abs(255-b.rgb[0]-a.rgb[0]),d=255-Math.abs(255-b.rgb[1]-a.rgb[1]),e=255-Math.abs(255-b.rgb[2]-a.rgb[2]);return this.rgb(c,d,e)},tint:function(a,b){return this.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){return this.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(b){var c=Array.isArray(b.value)?b.value.length:1;return new a.Dimension(c)},"data-uri":function(b,c){if("undefined"!=typeof window)return new a.URL(c||b,this.currentFileInfo).eval(this.env);var d=b.value,e=c&&c.value,f=require("fs"),g=require("path"),h=!1;if(arguments.length<2&&(e=d),this.env.isPathRelative(e)&&(e=this.currentFileInfo.relativeUrls?g.join(this.currentFileInfo.currentDirectory,e):g.join(this.currentFileInfo.entryPath,e)),arguments.length<2){var i;try{i=require("mime")}catch(j){i=a._mime}d=i.lookup(e);var k=i.charsets.lookup(d);h=["US-ASCII","UTF-8"].indexOf(k)<0,h&&(d+=";base64")}else h=/;base64$/.test(d);var l=f.readFileSync(e),m=32,n=parseInt(l.length/1024,10);if(n>=m&&this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",e,n,m),new a.URL(c||b,this.currentFileInfo).eval(this.env);l=h?l.toString("base64"):encodeURIComponent(l);var o="'data:"+d+","+l+"'";return new a.URL(new a.Anonymous(o))},"svg-gradient":function(b){function c(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&c();var d,e,f,g,h,i,j,k=Array.prototype.slice.call(arguments,1),l="linear",m='x="0" y="0" width="1" height="1"',n=!0,o={compress:!1},p=b.toCSS(o);switch(p){case"to bottom":d='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":d='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":d='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":d='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":l="radial",d='cx="50%" cy="50%" r="75%"',m='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(e='<'+l+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+d+">",f=0;fj?' stop-opacity="'+j+'"':"")+"/>";if(e+=""+"',n)try{e=new Buffer(e).toString("base64")}catch(q){n=!1}return e="'data:image/svg+xml"+(n?";base64":"")+","+e+"'",new a.URL(new a.Anonymous(e))}},a._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(b){var c=require("path").extname(b),d=a._mime._types[c];if(void 0===d)throw new Error('Optional dependency "mime" is required for '+c);return d},charsets:{lookup:function(a){return a&&/^text\//.test(a)?"UTF-8":""}}};for(var f=[{name:"ceil"},{name:"floor"},{name:"sqrt"},{name:"abs"},{name:"tan",unit:""},{name:"sin",unit:""},{name:"cos",unit:""},{name:"atan",unit:"rad"},{name:"asin",unit:"rad"},{name:"acos",unit:"rad"}],g=function(a,b){return function(c){return null!=b&&(c=c.unify()),this._math(Math[a],b,c)}},h=0;h1?"["+a.value.map(function(a){return a.toCSS(!1)}).join(", ")+"]":a.toCSS(!1)},a.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},a.outputRuleset=function(a,b,c){b.add(a.compress?"{":" {\n"),a.tabLevel=(a.tabLevel||0)+1;for(var d=a.compress?"":Array(a.tabLevel+1).join(" "),e=a.compress?"":Array(a.tabLevel).join(" "),f=0;fb?-1:1},genCSS:function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:a.toCSS}}(require("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={type:"Assignment",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Assignment(this.key,this.value.eval(b)):this},genCSS:function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},toCSS:a.toCSS}}(require("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d},a.Call.prototype={type:"Call",accept:function(a){this.args=a.visit(this.args)},eval:function(b){var c,d,e=this.args.map(function(a){return a.eval(b)}),f=this.name.toLowerCase();if(f in a.functions)try{if(d=new a.functionCall(b,this.currentFileInfo),c=d[f].apply(d,e),null!=c)return c}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new a.Call(this.name,e,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;cf;f++)e[f]=a.operate(b,c,this.rgb[f],d.rgb[f]);return new a.Color(e,this.alpha+d.alpha)},toRGB:function(){return"#"+this.rgb.map(function(a){return a=Math.round(a),a=(a>255?255:0>a?0:a).toString(16),1===a.length?"0"+a:a}).join("")},toHSL:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},toHSV:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},toARGB:function(){var a=[Math.round(255*this.alpha)].concat(this.rgb);return"#"+a.map(function(a){return a=Math.round(a),a=(a>255?255:0>a?0:a).toString(16),1===a.length?"0"+a:a}).join("")},compare:function(a){return a.rgb?a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:-1:-1}},a.Color.fromKeyword=function(c){if(a.colors.hasOwnProperty(c))return new a.Color(a.colors[c].slice(1));if(c===b){var d=new a.Color([0,0,0],0);return d.isTransparentKeyword=!0,d}}}(require("../tree")),function(a){a.Comment=function(a,b,c,d){this.value=a,this.silent=!!b,this.currentFileInfo=d},a.Comment.prototype={type:"Comment",genCSS:function(b,c){this.debugInfo&&c.add(a.debugInfo(b,this),this.currentFileInfo,this.index),c.add(this.value.trim())},toCSS:a.toCSS,isSilent:function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&!this.value.match(/^\/\*!/);return this.silent||b||c},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(require("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype={type:"Condition",accept:function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},eval:function(a){var b,c=this.lvalue.eval(a),d=this.rvalue.eval(a),e=this.index;return b=function(a){switch(a){case"and":return c&&d;case"or":return c||d;default:if(c.compare)b=c.compare(d);else{if(!d.compare)throw{type:"Type",message:"Unable to perform comparison",index:e};b=d.compare(c)}switch(b){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a}}}(this.op),this.negate?!b:b}}}(require("../tree")),function(a){a.Dimension=function(b,c){this.value=parseFloat(b),this.unit=c&&c instanceof a.Unit?c:new a.Unit(c?[c]:void 0)},a.Dimension.prototype={type:"Dimension",accept:function(a){this.unit=a.visit(this.unit)},eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},genCSS:function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.value,d=String(c);if(0!==c&&1e-6>c&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return b.add(d),void 0;c>0&&1>c&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},toCSS:a.toCSS,operate:function(b,c,d){var e=a.operate(b,c,this.value,d.value),f=this.unit.clone();if("+"===c||"-"===c)if(0===f.numerator.length&&0===f.denominator.length)f.numerator=d.unit.numerator.slice(0),f.denominator=d.unit.denominator.slice(0);else if(0===d.unit.numerator.length&&0===f.denominator.length);else{if(d=d.convertTo(this.unit.usedUnits()),b.strictUnits&&d.unit.toString()!==f.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+f.toString()+"' and '"+d.unit.toString()+"'.");e=a.operate(b,c,this.value,d.value)}else"*"===c?(f.numerator=f.numerator.concat(d.unit.numerator).sort(),f.denominator=f.denominator.concat(d.unit.denominator).sort(),f.cancel()):"/"===c&&(f.numerator=f.numerator.concat(d.unit.denominator).sort(),f.denominator=f.denominator.concat(d.unit.numerator).sort(),f.cancel());return new a.Dimension(e,f)},compare:function(b){if(b instanceof a.Dimension){var c=this.unify(),d=b.unify(),e=c.value,f=d.value;return f>e?-1:e>f?1:d.unit.isEmpty()||0===c.unit.compare(d.unit)?0:-1}return-1},unify:function(){return this.convertTo({length:"m",duration:"s",angle:"rad"})},convertTo:function(b){var c,d,e,f,g,h=this.value,i=this.unit.clone(),j={};if("string"==typeof b){for(c in a.UnitConversions)a.UnitConversions[c].hasOwnProperty(b)&&(j={},j[c]=b);b=j}g=function(a,b){return e.hasOwnProperty(a)?(b?h/=e[a]/e[f]:h*=e[a]/e[f],f):a};for(d in b)b.hasOwnProperty(d)&&(f=b[d],e=a.UnitConversions[d],i.map(g));return i.cancel(),new a.Dimension(h,i)}},a.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,pt:.0254/72,pc:12*(.0254/72)},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}},a.Unit=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],this.backupUnit=c},a.Unit.prototype={type:"Unit",clone:function(){return new a.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(a,b){this.numerator.length>=1?b.add(this.numerator[0]):this.denominator.length>=1?b.add(this.denominator[0]):a&&a.strictUnits||!this.backupUnit||b.add(this.backupUnit)},toCSS:a.toCSS,toString:function(){var a,b=this.numerator.join("*");for(a=0;a0)for(b=0;e>b;b++)this.numerator.push(a);else if(0>e)for(b=0;-e>b;b++)this.denominator.push(a)}0===this.numerator.length&&0===this.denominator.length&&c&&(this.backupUnit=c),this.numerator.sort(),this.denominator.sort()}}}(require("../tree")),function(a){a.Directive=function(b,c,d,e){this.name=b,Array.isArray(c)?(this.rules=[new a.Ruleset([],c)],this.rules[0].allowImports=!0):this.value=c,this.currentFileInfo=e},a.Directive.prototype={type:"Directive",accept:function(a){this.rules=a.visit(this.rules),this.value=a.visit(this.value)},genCSS:function(b,c){c.add(this.name,this.currentFileInfo,this.index),this.rules?a.outputRuleset(b,c,this.rules):(c.add(" "),this.value.genCSS(b,c),c.add(";"))},toCSS:a.toCSS,eval:function(b){var c=this;return this.rules&&(b.frames.unshift(this),c=new a.Directive(this.name,null,this.index,this.currentFileInfo),c.rules=[this.rules[0].eval(b)],c.rules[0].root=!0,b.frames.shift()),c},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},markReferenced:function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules[0].rules,a=0;a":" > ","|":"|"},_outputMapCompressed:{"":""," ":" ",":":" :","+":"+","~":"~",">":">","|":"|"},genCSS:function(a,b){b.add((a.compress?this._outputMapCompressed:this._outputMap)[this.value])},toCSS:a.toCSS}}(require("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={type:"Expression",accept:function(a){this.value=a.visit(this.value)},eval:function(b){var c,d=this.parens&&!this.parensInOp,e=!1;return d&&b.inParenthesis(),this.value.length>1?c=new a.Expression(this.value.map(function(a){return a.eval(b)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),c=this.value[0].eval(b)):c=this,d&&b.outOfParenthesis(),this.parens&&this.parensInOp&&!b.isMathOn()&&!e&&(c=new a.Paren(c)),c},genCSS:function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[{elements:d}]}}}(require("../tree")),function(a){a.Import=function(a,b,c,d,e){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var f=this.getPath();f&&/css([\?;].*)?$/.test(f)&&(this.css=!0)}},a.Import.prototype={type:"Import",accept:function(a){this.features=a.visit(this.features),this.path=a.visit(this.path),this.options.inline||(this.root=a.visit(this.root))},genCSS:function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},toCSS:a.toCSS,getPath:function(){if(this.path instanceof a.Quoted){var b=this.path.value;return void 0!==this.css||/(\.[a-z]*$)|([\?;].*)$/.test(b)?b:b+".less"}return this.path instanceof a.URL?this.path.value.value:null},evalForImport:function(b){return new a.Import(this.path.eval(b),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(b){var c=this.path.eval(b),d=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(c instanceof a.URL)){if(d){var e=c.value;e&&b.isPathRelative(e)&&(c.value=d+e)}c.value=b.normalizePath(c.value)}return c},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.skip)return[];if(this.options.inline){var e=new a.Anonymous(this.root,0,{filename:this.importedFilename},!0);return this.features?new a.Media([e],this.features.value):[e]}if(this.css){var f=new a.Import(this.evalPath(b),d,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return c=new a.Ruleset([],this.root.rules.slice(0)),c.evalImports(b),this.features?new a.Media(c.rules,this.features.value):c.rules}}}(require("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={type:"JavaScript",eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify(new a.Variable("@"+e,d.index).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+f+"`",index:this.index}}for(var h in b.frames[0].variables())e[h.slice(1)]={value:b.frames[0].variables()[h].value,toJS:function(){return this.value.eval(b).toCSS()}};try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message+"'",index:this.index}}return"string"==typeof c?new a.Quoted('"'+c+'"',c,this.escaped,this.index):Array.isArray(c)?new a.Anonymous(c.join(", ")):new a.Anonymous(c)}}}(require("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(a,b){b.add(this.value)},toCSS:a.toCSS,compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(require("../tree")),function(a){a.Media=function(b,c,d,e){this.index=d,this.currentFileInfo=e;var f=this.emptySelectors();this.features=new a.Value(c),this.rules=[new a.Ruleset(f,b)],this.rules[0].allowImports=!0},a.Media.prototype={type:"Media",accept:function(a){this.features=a.visit(this.features),this.rules=a.visit(this.rules)},genCSS:function(b,c){c.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(b,c),a.outputRuleset(b,c,this.rules)},toCSS:a.toCSS,eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=new a.Media([],[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,c.debugInfo=this.debugInfo);var d=!1;b.strictMath||(d=!0,b.strictMath=!0);try{c.features=this.features.eval(b)}finally{d&&(b.strictMath=!1)}return b.mediaPath.push(c),b.mediaBlocks.push(c),b.frames.unshift(this.rules[0]),c.rules=[this.rules[0].eval(b)],b.frames.shift(),b.mediaPath.pop(),0===b.mediaPath.length?c.evalTop(b):c.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var b=new a.Element("","&",this.index,this.currentFileInfo);return[new a.Selector([b],null,null,this.index,this.currentFileInfo)]},markReferenced:function(){var a,b=this.rules[0].rules;for(this.isReferenced=!0,a=0;a1){var d=this.emptySelectors();c=new a.Ruleset(d,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},permute:function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(j=!0,g=0;gthis.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0}}}(require("../tree")),function(a){a.Negative=function(a){this.value=a},a.Negative.prototype={type:"Negative",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("-"),this.value.genCSS(a,b)},toCSS:a.toCSS,eval:function(b){return b.isMathOn()?new a.Operation("*",[new a.Dimension(-1),this.value]).eval(b):new a.Negative(this.value.eval(b))}}}(require("../tree")),function(a){a.Operation=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c},a.Operation.prototype={type:"Operation",accept:function(a){this.operands=a.visit(this.operands)},eval:function(b){var c,d=this.operands[0].eval(b),e=this.operands[1].eval(b);if(b.isMathOn()){if(d instanceof a.Dimension&&e instanceof a.Color){if("*"!==this.op&&"+"!==this.op)throw{type:"Operation",message:"Can't substract or divide a color from a number"};c=e,e=d,d=c}if(!d.operate)throw{type:"Operation",message:"Operation on an invalid type"};return d.operate(b,this.op,e)}return new a.Operation(this.op,[d,e],this.isSpaced)},genCSS:function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},toCSS:a.toCSS},a.operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}}}(require("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={type:"Paren",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){return new a.Paren(this.value.eval(b))}}}(require("../tree")),function(a){a.Quoted=function(a,b,c,d,e){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e},a.Quoted.prototype={type:"Quoted",genCSS:function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},toCSS:a.toCSS,eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return new a.JavaScript(e,c.index,!0).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=new a.Variable("@"+e,c.index,c.currentFileInfo).eval(b,!0);return f instanceof a.Quoted?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1}}}(require("../tree")),function(a){a.Rule=function(b,c,d,e,f,g,h){this.name=b,this.value=c instanceof a.Value?c:new a.Value([c]),this.important=d?" "+d.trim():"",this.merge=e,this.index=f,this.currentFileInfo=g,this.inline=h||!1,this.variable="@"===b.charAt(0)},a.Rule.prototype={type:"Rule",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},toCSS:a.toCSS,eval:function(b){var c=!1;"font"!==this.name||b.strictMath||(c=!0,b.strictMath=!0);try{return new a.Rule(this.name,this.value.eval(b),this.important,this.merge,this.index,this.currentFileInfo,this.inline)}finally{c&&(b.strictMath=!1)}},makeImportant:function(){return new a.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(require("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={type:"Ruleset",accept:function(a){if(this.paths)for(var b=0;bf.selectors[g].elements.length?Array.prototype.push.apply(e,f.find(new a.Selector(b.elements.slice(1)),c)):e.push(f);break}}),this._lookups[f]=e)},genCSS:function(b,c){var d,e,f,g,h,i=[],j=[],k=!0;b.tabLevel=b.tabLevel||0,this.root||b.tabLevel++;var l=b.compress?"":Array(b.tabLevel+1).join(" "),m=b.compress?"":Array(b.tabLevel).join(" ");for(d=0;d0&&this.mergeElementsOnToSelectors(r,i),f=0;f0&&(k[0].elements=k[0].elements.slice(0),k[0].elements.push(new a.Element(j.combinator,"",0,j.index,j.currentFileInfo))),s.push(k);else for(g=0;g0?(m=k.slice(0),q=m.pop(),o=d.createDerived(q.elements.slice(0)),p=!1):o=d.createDerived([]),l.length>1&&(n=n.concat(l.slice(1))),l.length>0&&(p=!1,o.elements.push(new a.Element(j.combinator,l[0].elements[0].value,j.index,j.currentFileInfo)),o.elements=o.elements.concat(l[0].elements.slice(1))),p||m.push(o),m=m.concat(n),s.push(m);i=s,r=[]}for(r.length>0&&this.mergeElementsOnToSelectors(r,i),e=0;e0&&b.push(i[e])}else if(c.length>0)for(e=0;e0?e[e.length-1]=e[e.length-1].createDerived(e[e.length-1].elements.concat(b)):e.push(new a.Selector(b))}}}(require("../tree")),function(a){a.Selector=function(a,b,c,d,e,f){this.elements=a,this.extendList=b||[],this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)},a.Selector.prototype={type:"Selector",accept:function(a){this.elements=a.visit(this.elements),this.extendList=a.visit(this.extendList),this.condition=a.visit(this.condition)},createDerived:function(b,c,d){d=null!=d?d:this.evaldCondition;var e=new a.Selector(b,c||this.extendList,this.condition,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=d,e},match:function(a){var b,c,d,e,f=this.elements,g=f.length;if(b=a.elements.slice(a.elements.length&&"&"===a.elements[0].value?1:0),c=b.length,d=Math.min(g,c),0===c||c>g)return!1;for(e=0;d>e;e++)if(f[e].value!==b[e].value)return!1;return!0},eval:function(a){var b=this.condition&&this.condition.eval(a);return this.createDerived(this.elements.map(function(b){return b.eval(a)}),this.extendList.map(function(b){return b.eval(a)}),b)},genCSS:function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;c0)&&e.splice(0,0,b);else{b.paths=b.paths.filter(function(b){var c;for(" "===b[0].elements[0].combinator.value&&(b[0].elements[0].combinator=new a.Combinator("")),c=0;c0&&b.accept(this._visitor),c.visitDeeper=!1,this._mergeRules(b.rules),this._removeDuplicateRules(b.rules),b.rules.length>0&&b.paths.length>0&&e.splice(0,0,b)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(b){var c,d,e,f={};for(e=b.length-1;e>=0;e--)if(d=b[e],d instanceof a.Rule)if(f[d.name]){c=f[d.name],c instanceof a.Rule&&(c=f[d.name]=[f[d.name].toCSS(this._env)]);var g=d.toCSS(this._env);-1!==c.indexOf(g)?b.splice(e,1):c.push(g)}else f[d.name]=d},_mergeRules:function(b){for(var c,d,e,f={},g=0;g1&&(d=c[0],d.value=new a.Value(c.map(function(a){return a.value})))})}}}(require("./tree")),function(a){a.extendFinderVisitor=function(){this._visitor=new a.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},a.extendFinderVisitor.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(b){if(!b.root){var c,d,e,f,g=[];for(c=0;c100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,c,d+1))}return m},inInheritanceChain:function(a,b){if(a===b)return!0;if(b.parents){if(this.inInheritanceChain(a,b.parents[0]))return!0;if(this.inInheritanceChain(a,b.parents[1]))return!0}return!1},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;d0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(c.slice(j,h.pathIndex)),l.push(new a.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=c[j].elements.length&&(k=0,j++);return j0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),j++),l=l.concat(c.slice(j,c.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(require("./tree")),function(a){a.sourceMapOutput=function(a){this._css=[],this._rootNode=a.rootNode,this._writeSourceMap=a.writeSourceMap,this._contentsMap=a.contentsMap,this._sourceMapFilename=a.sourceMapFilename,this._outputFilename=a.outputFilename,this._sourceMapBasepath=a.sourceMapBasepath,this._sourceMapRootpath=a.sourceMapRootpath,this._outputSourceFiles=a.outputSourceFiles,this._sourceMapGeneratorConstructor=a.sourceMapGenerator||require("source-map").SourceMapGenerator,this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/"),this._lineNumber=0,this._column=0},a.sourceMapOutput.prototype.normalizeFilename=function(a){return this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),("\\"===a.charAt(0)||"/"===a.charAt(0))&&(a=a.substring(1))),(this._sourceMapRootpath||"")+a.replace(/\\/g,"/")},a.sourceMapOutput.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename].substring(0,c);f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;i0){var c,d=JSON.stringify(this._sourceMapGenerator.toJSON());this._sourceMapFilename&&(c=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(d):c="data:application/json,"+encodeURIComponent(d),c&&this._css.push("/*# sourceMappingURL="+c+" */")}return this._css.join("")}}(require("./tree"));var isFileProtocol=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);less.env=less.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port.length>0||isFileProtocol?"development":"production");var logLevel={info:2,errors:1,none:0};if(less.logLevel="undefined"!=typeof less.logLevel?less.logLevel:logLevel.info,less.async=less.async||!1,less.fileAsync=less.fileAsync||!1,less.poll=less.poll||(isFileProtocol?1e3:1500),less.functions)for(var func in less.functions)less.tree.functions[func]=less.functions[func];var dumpLineNumbers=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);dumpLineNumbers&&(less.dumpLineNumbers=dumpLineNumbers[1]);var typePattern=/^text\/(x-)?less$/,cache=null,fileCache={};if(less.watch=function(){return less.watchMode||(less.env="development",initRunningMode()),this.watchMode=!0},less.unwatch=function(){return clearInterval(less.watchTimer),this.watchMode=!1},/!watch/.test(location.hash)&&less.watch(),"development"!=less.env)try{cache="undefined"==typeof window.localStorage?null:window.localStorage}catch(_){}var links=document.getElementsByTagName("link");less.sheets=[];for(var i=0;i 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - }; - var q = l < 0.5 ? l * (1 + s) : l + s - l * s, - p = 2 * l - q; - r = hueToRGB(p, q, h + 1/3); - g = hueToRGB(p, q, h); - b = hueToRGB(p, q, h - 1/3); - } - return { - red: Math.round(r * 255), - green: Math.round(g * 255), - blue: Math.round(b * 255) - }; - } - -//---------------------- Convert RGB to HSL - -// Source: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c - - function RGBToHSL(r, g, b) { - r /= 255, - g /= 255, - b /= 255; - var max = Math.max(r, g, b), - min = Math.min(r, g, b); - var h, s, l = (max + min) / 2; - if (max == min) { - h = s = 0; // Achromatic - } else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { - hue: Math.round(h * 360), - saturation: Math.round(s * 100), - luminosity: Math.round(l * 100) - }; - } - -//---------------------- Convert RGB to Hex - -// Source: http://stackoverflow.com/a/5624139 - - function RGBToHex(r, g, b) { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - -//---------------------- Convert hex to RGB - -// Source: http://stackoverflow.com/a/11508164 - - function hexToRGB(hex) { - var bigInt = parseInt(hex.replace('#', ''), 16), - r = (bigInt >> 16) & 255, - g = (bigInt >> 8) & 255, - b = bigInt & 255; - return { - red: r, - green: g, - blue: b - }; - } - -//---------------------- Convert hex to HSL - - function hexToHSL(hex) { - var RGB = hexToRGB(hex); - return RGBToHSL(RGB.red, RGB.green, RGB.blue); - } - -//---------------------- Convert HSL to hex - - function HSLToHex(h, s, l) { - var RGB = HSLToRGB(h, s, l); - return RGBToHex(RGB.red, RGB.green, RGB.blue); - } - -//-------------------------------------------- Setup each color picker - - $.each($('.color-picker'), function() { - -//---------------------- Find componenets - - var picker = $(this), - formatInput = picker.find('.format'), - colorInput = picker.find('.color'), - luminosityInput = picker.find('input[type=range]'), - spectrum = picker.find('.spectrum'), - pin = picker.find('.pin'); - -//---------------------- Get current color in HSL - - function getHSL() { - var position = picker.find('.pin').position(), - width = spectrum.width(), - height = spectrum.height(); - return { - hue: Math.round(position.left / width * 360), - saturation: Math.round(position.top / height * 100), - luminosity: luminosityInput.val() - }; - } - -//---------------------- Output color in desired format - - function updateColorInput() { - var HSL = getHSL(); - switch (formatInput.val()) { - case 'HSL': - colorInput.val('hsl(' + HSL.hue + ', ' + HSL.saturation + '%, ' + HSL.luminosity + '%)'); - break; - case 'RGB': - var RGB = HSLToRGB(HSL.hue, HSL.saturation, HSL.luminosity); - colorInput.val('rgb(' + RGB.red + ', ' + RGB.green + ', ' + RGB.blue + ')'); - break; - case 'Hex': - colorInput.val(HSLToHex(HSL.hue, HSL.saturation, HSL.luminosity)); - break; - } - // Trigger color picker change event for custom callbacks - picker.trigger('change'); - } - -//---------------------- Set color format - - formatInput.on('change', function() { - updateColorInput(); - }); - -//---------------------- Set color - - colorInput.on('change', function() { - // Get the color values in HSL format - var HSL; - switch (formatInput.val()) { - case 'HSL': - var values = $(this).val().match(/\d+/g); - HSL = { - hue: values[0], - saturation: values[1], - luminosity: values[2] - }; - break; - case 'RGB': - var values = $(this).val().match(/\d+/g); - HSL = RGBToHSL(values[0], values[1], values[2]); - break; - case 'Hex': - HSL = hexToHSL($(this).val()); - break; - } - // Set the luminosity - luminosityInput.val(HSL.luminosity); - setLuminosity(HSL.luminosity); - // Place the pin - pin.css({ - left: HSL.hue / 360 * 100 + '%', - top: HSL.saturation + '%' - }); - // Trigger color picker change event for custom callbacks - picker.trigger('change'); - }); - -//---------------------- Set luminosity - -//---------- Set the luminosity spectrum overlay - - function setLuminosity(luminosity) { - var color, - alpha; - if (luminosity <= 50) { - color = '0, 0, 0'; - alpha = 1 - luminosity / 100 * 2; - } else { - color = '255, 255, 255'; - alpha = luminosity / 100 * 2 - 1; - } - // Apply luminosity to the spectrum - spectrum.children().css('background-color', 'rgba(' + color + ', ' + alpha + ')'); - } - -//---------- Luminosity input interaction - - luminosityInput.on('change', function() { - setLuminosity($(this).val()); - updateColorInput(); - }); - -//---------------------- Set hue, saturation via pin - -//---------- Move the pin - - var movePin = function(event) { - var offset = spectrum.offset(), - width = spectrum.width(), - height = spectrum.height(), - x = event.changedTouches[0].clientX - offset.left, - y = event.changedTouches[0].clientY - offset.top; - // Account for pin being dragged outside the spectrum area - // Sanatize x - if (x < 0) { - x = 0; - } else if (x >= width) { - x = width; - } - // Sanatize y - if (y < 0) { - y = 0; - } else if (y >= height) { - y = height; - } - // Place the pin - pin.css({ - left: x / width * 100 + '%', - top: y / height * 100 + '%' - }); - // Output new color value - updateColorInput(); - }; - -//---------- Pin interaction - - spectrum.on('touchstart', function(event) { - event.preventDefault(); - movePin(event); - spectrum.addClass('active'); - $(document).on('touchmove', movePin); - }); - - $(document).on('touchend', function() { - spectrum.removeClass('active'); - $(document).off('touchmove', movePin); - }); - - spectrum.on('touchmove touchstart', movePin); - -//---------------------- Output color preview - - picker.on('change', function() { - colorInput.css('background-color', colorInput.val()).toggleClass('dark', luminosityInput.val() <= 50); - }); - -//---------------------- Initialize this color picker - - colorInput.trigger('change'); - - }); -}); diff --git a/Web/js/libs/color-picker.js b/Web/js/libs/color-picker.js deleted file mode 100755 index 7c211f9..0000000 --- a/Web/js/libs/color-picker.js +++ /dev/null @@ -1,289 +0,0 @@ -/* - -Purty Picker Copyright 2013 Jayden Seric (MIT license). - -A super lightweight visual HSL, RGB and hex color picker with a responsive, touch-friendly and customizable UI. - -Requires jQuery or Zepto with core and event modules. - -https://github.com/jaydenseric/Purty-Picker - -*/ - -// DOM ready -$(function() { - 'use strict'; - -//-------------------------------------------- Color conversions - -//---------------------- Convert HSL to RGB - -// Source: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c - - function HSLToRGB(h, s, l) { - h /= 360; - s /= 100; - l /= 100; - var r, g, b; - if(s == 0) { - r = g = b = l; // Achromatic - } else { - var hueToRGB = function(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - }; - var q = l < 0.5 ? l * (1 + s) : l + s - l * s, - p = 2 * l - q; - r = hueToRGB(p, q, h + 1/3); - g = hueToRGB(p, q, h); - b = hueToRGB(p, q, h - 1/3); - } - return { - red: Math.round(r * 255), - green: Math.round(g * 255), - blue: Math.round(b * 255) - }; - } - -//---------------------- Convert RGB to HSL - -// Source: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c - - function RGBToHSL(r, g, b) { - r /= 255, - g /= 255, - b /= 255; - var max = Math.max(r, g, b), - min = Math.min(r, g, b); - var h, s, l = (max + min) / 2; - if (max == min) { - h = s = 0; // Achromatic - } else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { - hue: Math.round(h * 360), - saturation: Math.round(s * 100), - luminosity: Math.round(l * 100) - }; - } - -//---------------------- Convert RGB to Hex - -// Source: http://stackoverflow.com/a/5624139 - - function RGBToHex(r, g, b) { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - -//---------------------- Convert hex to RGB - -// Source: http://stackoverflow.com/a/11508164 - - function hexToRGB(hex) { - var bigInt = parseInt(hex.replace('#', ''), 16), - r = (bigInt >> 16) & 255, - g = (bigInt >> 8) & 255, - b = bigInt & 255; - return { - red: r, - green: g, - blue: b - }; - } - -//---------------------- Convert hex to HSL - - function hexToHSL(hex) { - var RGB = hexToRGB(hex); - return RGBToHSL(RGB.red, RGB.green, RGB.blue); - } - -//---------------------- Convert HSL to hex - - function HSLToHex(h, s, l) { - var RGB = HSLToRGB(h, s, l); - return RGBToHex(RGB.red, RGB.green, RGB.blue); - } - -//-------------------------------------------- Setup each color picker - - $.each($('.color-picker'), function() { - -//---------------------- Find componenets - - var picker = $(this), - formatInput = picker.find('.format'), - colorInput = picker.find('.color'), - luminosityInput = picker.find('input[type=range]'), - spectrum = picker.find('.spectrum'), - pin = picker.find('.pin'); - -//---------------------- Get current color in HSL - - function getHSL() { - var position = picker.find('.pin').position(), - width = spectrum.width(), - height = spectrum.height(); - return { - hue: Math.round(position.left / width * 360), - saturation: Math.round(position.top / height * 100), - luminosity: luminosityInput.val() - }; - } - -//---------------------- Output color in desired format - - function updateColorInput() { - var HSL = getHSL(); - switch (formatInput.val()) { - case 'HSL': - colorInput.val('hsl(' + HSL.hue + ', ' + HSL.saturation + '%, ' + HSL.luminosity + '%)'); - break; - case 'RGB': - var RGB = HSLToRGB(HSL.hue, HSL.saturation, HSL.luminosity); - colorInput.val('rgb(' + RGB.red + ', ' + RGB.green + ', ' + RGB.blue + ')'); - break; - case 'Hex': - colorInput.val(HSLToHex(HSL.hue, HSL.saturation, HSL.luminosity)); - break; - } - // Trigger color picker change event for custom callbacks - picker.trigger('change'); - } - -//---------------------- Set color format - - formatInput.on('change', function() { - updateColorInput(); - }); - -//---------------------- Set color - - colorInput.on('change', function() { - // Get the color values in HSL format - var HSL; - switch (formatInput.val()) { - case 'HSL': - var values = $(this).val().match(/\d+/g); - HSL = { - hue: values[0], - saturation: values[1], - luminosity: values[2] - }; - break; - case 'RGB': - var values = $(this).val().match(/\d+/g); - HSL = RGBToHSL(values[0], values[1], values[2]); - break; - case 'Hex': - HSL = hexToHSL($(this).val()); - break; - } - // Set the luminosity - luminosityInput.val(HSL.luminosity); - setLuminosity(HSL.luminosity); - // Place the pin - pin.css({ - left: HSL.hue / 360 * 100 + '%', - top: HSL.saturation + '%' - }); - // Trigger color picker change event for custom callbacks - picker.trigger('change'); - }); - -//---------------------- Set luminosity - -//---------- Set the luminosity spectrum overlay - - function setLuminosity(luminosity) { - var color, - alpha; - if (luminosity <= 50) { - color = '0, 0, 0'; - alpha = 1 - luminosity / 100 * 2; - } else { - color = '255, 255, 255'; - alpha = luminosity / 100 * 2 - 1; - } - // Apply luminosity to the spectrum - spectrum.children().css('background-color', 'rgba(' + color + ', ' + alpha + ')'); - } - -//---------- Luminosity input interaction - - luminosityInput.on('change', function() { - setLuminosity($(this).val()); - updateColorInput(); - }); - -//---------------------- Set hue, saturation via pin - -//---------- Move the pin - - var movePin = function(event) { - var offset = spectrum.offset(), - width = spectrum.width(), - height = spectrum.height(), - x = event.clientX - offset.left, - y = event.clientY - offset.top; - // Account for pin being dragged outside the spectrum area - // Sanatize x - if (x < 0) { - x = 0; - } else if (x >= width) { - x = width; - } - // Sanatize y - if (y < 0) { - y = 0; - } else if (y >= height) { - y = height; - } - // Place the pin - pin.css({ - left: x / width * 100 + '%', - top: y / height * 100 + '%' - }); - // Output new color value - updateColorInput(); - }; - -//---------- Pin interaction - - spectrum.on('mousedown', function(event) { - event.preventDefault(); - movePin(event); - spectrum.addClass('active'); - $(document).on('mousemove', movePin); - }); - - $(document).on('mouseup', function() { - spectrum.removeClass('active'); - $(document).off('mousemove', movePin); - }); - - spectrum.on('touchmove touchstart', movePin); - -//---------------------- Output color preview - - picker.on('change', function() { - colorInput.css('background-color', colorInput.val()).toggleClass('dark', luminosityInput.val() <= 50); - }); - -//---------------------- Initialize this color picker - - colorInput.trigger('change'); - }); -}); diff --git a/Web/js/libs/mobilebrowsers.js b/Web/js/libs/mobilebrowsers.js deleted file mode 100755 index 3d8d819..0000000 --- a/Web/js/libs/mobilebrowsers.js +++ /dev/null @@ -1 +0,0 @@ -(function(a,b){if(/(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=true})(navigator.userAgent||navigator.vendor||window.opera,'http://detectmobilebrowser.com/mobile'); diff --git a/Web/js/libs/stack.js b/Web/js/libs/stack.js deleted file mode 100755 index cbec614..0000000 --- a/Web/js/libs/stack.js +++ /dev/null @@ -1,22 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - $.fn.end = function(){ - return this.prevObject || $() - } - - $.fn.andSelf = function(){ - return this.add(this.prevObject || $()) - } - - 'filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings'.split(',').forEach(function(property){ - var fn = $.fn[property] - $.fn[property] = function(){ - var ret = fn.apply(this, arguments) - ret.prevObject = this - return ret - } - }) -})(Zepto) diff --git a/Web/js/libs/touch.js b/Web/js/libs/touch.js deleted file mode 100755 index cada189..0000000 --- a/Web/js/libs/touch.js +++ /dev/null @@ -1,166 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var touch = {}, - touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, - longTapDelay = 750, - gesture - - function swipeDirection(x1, x2, y1, y2) { - return Math.abs(x1 - x2) >= - Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down') - } - - function longTap() { - longTapTimeout = null - if (touch.last) { - touch.el.trigger('longTap') - window.touchEl = touch.el; - touch = {} - } - } - - function cancelLongTap() { - if (longTapTimeout) clearTimeout(longTapTimeout) - longTapTimeout = null - } - - function cancelAll() { - if (touchTimeout) clearTimeout(touchTimeout) - if (tapTimeout) clearTimeout(tapTimeout) - if (swipeTimeout) clearTimeout(swipeTimeout) - if (longTapTimeout) clearTimeout(longTapTimeout) - touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null - touch = {} - } - - function isPrimaryTouch(event){ - return (event.pointerType == 'touch' || - event.pointerType == event.MSPOINTER_TYPE_TOUCH) - && event.isPrimary - } - - function isPointerEventType(e, type){ - return (e.type == 'pointer'+type || - e.type.toLowerCase() == 'mspointer'+type) - } - - $(document).ready(function(){ - var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType - - if ('MSGesture' in window) { - gesture = new MSGesture() - gesture.target = document.body - } - - $(document) - .bind('MSGestureEnd', function(e){ - var swipeDirectionFromVelocity = - e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null; - if (swipeDirectionFromVelocity) { - touch.el.trigger('swipe') - touch.el.trigger('swipe'+ swipeDirectionFromVelocity) - } - }) - .on('touchstart MSPointerDown pointerdown', function(e){ - if((_isPointerType = isPointerEventType(e, 'down')) && - !isPrimaryTouch(e)) return - firstTouch = _isPointerType ? e : e.touches[0] - if (e.touches && e.touches.length === 1 && touch.x2) { - // Clear out touch movement data if we have it sticking around - // This can occur if touchcancel doesn't fire due to preventDefault, etc. - touch.x2 = undefined - touch.y2 = undefined - } - now = Date.now() - delta = now - (touch.last || now) - touch.el = $('tagName' in firstTouch.target ? - firstTouch.target : firstTouch.target.parentNode) - touchTimeout && clearTimeout(touchTimeout) - touch.x1 = firstTouch.pageX - touch.y1 = firstTouch.pageY - if (delta > 0 && delta <= 250) touch.isDoubleTap = true - touch.last = now - longTapTimeout = setTimeout(longTap, longTapDelay) - // adds the current touch contact for IE gesture recognition - if (gesture && _isPointerType) gesture.addPointer(e.pointerId); - }) - .on('touchmove MSPointerMove pointermove', function(e){ - if((_isPointerType = isPointerEventType(e, 'move')) && - !isPrimaryTouch(e)) return - firstTouch = _isPointerType ? e : e.touches[0] - if( $.moveCancel ) cancelLongTap() - touch.x2 = firstTouch.pageX - touch.y2 = firstTouch.pageY - - deltaX += Math.abs(touch.x1 - touch.x2) - deltaY += Math.abs(touch.y1 - touch.y2) - }) - .on('touchend MSPointerUp pointerup', function(e){ - if((_isPointerType = isPointerEventType(e, 'up')) && - !isPrimaryTouch(e)) return - cancelLongTap() - - // swipe - if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || - (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)) - - swipeTimeout = setTimeout(function() { - touch.el.trigger('swipe') - touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))) - touch = {} - }, 0) - - // normal tap - else if ('last' in touch) - // don't fire tap when delta position changed by more than 30 pixels, - // for instance when moving to a point and back to origin - if (deltaX < 30 && deltaY < 30) { - // delay by one tick so we can cancel the 'tap' event if 'scroll' fires - // ('tap' fires before 'scroll') - tapTimeout = setTimeout(function() { - - // trigger universal 'tap' with the option to cancelTouch() - // (cancelTouch cancels processing of single vs double taps for faster 'tap' response) - var event = $.Event('tap') - event.cancelTouch = cancelAll - touch.el.trigger(event) - - // trigger double tap immediately - if (touch.isDoubleTap) { - if (touch.el) touch.el.trigger('doubleTap') - touch = {} - } - - // trigger single tap after 250ms of inactivity - else { - touchTimeout = setTimeout(function(){ - touchTimeout = null - if (touch.el) touch.el.trigger('singleTap') - touch = {} - }, 250) - } - }, 0) - } else { - touch = {} - } - deltaX = deltaY = 0 - - }) - // when the browser window loses focus, - // for example when a modal dialog is shown, - // cancel all ongoing events - .on('touchcancel MSPointerCancel pointercancel', cancelAll) - - // scrolling the window indicates intention of the user - // to scroll, not tap or swipe, so cancel all ongoing events - $(window).on('scroll', cancelAll) - }) - - ;['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', - 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){ - $.fn[eventName] = function(callback){ return this.on(eventName, callback) } - }) -})(Zepto) diff --git a/Web/js/libs/yepnope.min.js b/Web/js/libs/yepnope.min.js deleted file mode 100755 index 73655a5..0000000 --- a/Web/js/libs/yepnope.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*yepnope1.5.x|WTFPL*/ -(function(a,b,c){function d(a){return"[object Function]"==o.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=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[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,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f0?c.fn.concat.apply([],a):a}function Q(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function R(a){return a in j?j[a]:j[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function S(a,b){return typeof b=="number"&&!k[Q(a)]?b+"px":b}function T(a){var b,c;return i[a]||(b=h.createElement(a),h.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),c=="none"&&(c="block"),i[a]=c),i[a]}function U(a){return"children"in a?f.call(a.children):c.map(a.childNodes,function(a){if(a.nodeType==1)return a})}function V(c,d,e){for(b in d)e&&(L(d[b])||M(d[b]))?(L(d[b])&&!L(c[b])&&(c[b]={}),M(d[b])&&!M(c[b])&&(c[b]=[]),V(c[b],d[b],e)):d[b]!==a&&(c[b]=d[b])}function W(a,b){return b==null?c(a):c(a).filter(b)}function X(a,b,c,d){return H(b)?b.call(a,c,d):b}function Y(a,b,c){c==null?a.removeAttribute(b):a.setAttribute(b,c)}function Z(b,c){var d=b.className,e=d&&d.baseVal!==a;if(c===a)return e?d.baseVal:d;e?d.baseVal=c:b.className=c}function $(a){var b;try{return a?a=="true"||(a=="false"?!1:a=="null"?null:!/^0/.test(a)&&!isNaN(b=Number(a))?b:/^[\[\{]/.test(a)?c.parseJSON(a):a):a}catch(d){return a}}function _(a,b){b(a);for(var c in a.childNodes)_(a.childNodes[c],b)}var a,b,c,d,e=[],f=e.slice,g=e.filter,h=window.document,i={},j={},k={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,m=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,o=/^(?:body|html)$/i,p=/([A-Z])/g,q=["val","css","html","text","data","width","height","offset"],r=["after","prepend","before","append"],s=h.createElement("table"),t=h.createElement("tr"),u={tr:h.createElement("tbody"),tbody:s,thead:s,tfoot:s,td:t,th:t,"*":h.createElement("div")},v=/complete|loaded|interactive/,w=/^\.([\w-]+)$/,x=/^#([\w-]*)$/,y=/^[\w-]*$/,z={},A=z.toString,B={},C,D,E=h.createElement("div"),F={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return B.matches=function(a,b){if(!b||!a||a.nodeType!==1)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=E).appendChild(a),d=~B.qsa(e,b).indexOf(a),f&&E.removeChild(a),d},C=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},D=function(a){return g.call(a,function(b,c){return a.indexOf(b)==c})},B.fragment=function(b,d,e){var g,i,j;return m.test(b)&&(g=c(h.createElement(RegExp.$1))),g||(b.replace&&(b=b.replace(n,"<$1>")),d===a&&(d=l.test(b)&&RegExp.$1),d in u||(d="*"),j=u[d],j.innerHTML=""+b,g=c.each(f.call(j.childNodes),function(){j.removeChild(this)})),L(e)&&(i=c(g),c.each(e,function(a,b){q.indexOf(a)>-1?i[a](b):i.attr(a,b)})),g},B.Z=function(a,b){return a=a||[],a.__proto__=c.fn,a.selector=b||"",a},B.isZ=function(a){return a instanceof B.Z},B.init=function(b,d){var e;if(!b)return B.Z();if(typeof b=="string"){b=b.trim();if(b[0]=="<"&&l.test(b))e=B.fragment(b,RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}else{if(H(b))return c(h).ready(b);if(B.isZ(b))return b;if(M(b))e=O(b);else if(K(b))e=[b],b=null;else if(l.test(b))e=B.fragment(b.trim(),RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}return B.Z(e,b)},c=function(a,b){return B.init(a,b)},c.extend=function(a){var b,c=f.call(arguments,1);return typeof a=="boolean"&&(b=a,a=c.shift()),c.forEach(function(c){V(a,c,b)}),a},B.qsa=function(a,b){var c,d=b[0]=="#",e=!d&&b[0]==".",g=d||e?b.slice(1):b,h=y.test(g);return J(a)&&h&&d?(c=a.getElementById(g))?[c]:[]:a.nodeType!==1&&a.nodeType!==9?[]:f.call(h&&!d?e?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},c.contains=function(a,b){return a!==b&&a.contains(b)},c.type=G,c.isFunction=H,c.isWindow=I,c.isArray=M,c.isPlainObject=L,c.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},c.inArray=function(a,b,c){return e.indexOf.call(b,a,c)},c.camelCase=C,c.trim=function(a){return a==null?"":String.prototype.trim.call(a)},c.uuid=0,c.support={},c.expr={},c.map=function(a,b){var c,d=[],e,f;if(N(a))for(e=0;e=0?b:b+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})},each:function(a){return e.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return H(a)?this.not(this.not(a)):c(g.call(this,function(b){return B.matches(b,a)}))},add:function(a,b){return c(D(this.concat(c(a,b))))},is:function(a){return this.length>0&&B.matches(this[0],a)},not:function(b){var d=[];if(H(b)&&b.call!==a)this.each(function(a){b.call(this,a)||d.push(this)});else{var e=typeof b=="string"?this.filter(b):N(b)&&H(b.item)?f.call(b):c(b);this.forEach(function(a){e.indexOf(a)<0&&d.push(a)})}return c(d)},has:function(a){return this.filter(function(){return K(a)?c.contains(this,a):c(this).find(a).size()})},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!K(a)?a:c(a)},last:function(){var a=this[this.length-1];return a&&!K(a)?a:c(a)},find:function(a){var b,d=this;return typeof a=="object"?b=c(a).filter(function(){var a=this;return e.some.call(d,function(b){return c.contains(b,a)})}):this.length==1?b=c(B.qsa(this[0],a)):b=this.map(function(){return B.qsa(this,a)}),b},closest:function(a,b){var d=this[0],e=!1;typeof a=="object"&&(e=c(a));while(d&&!(e?e.indexOf(d)>=0:B.matches(d,a)))d=d!==b&&!J(d)&&d.parentNode;return c(d)},parents:function(a){var b=[],d=this;while(d.length>0)d=c.map(d,function(a){if((a=a.parentNode)&&!J(a)&&b.indexOf(a)<0)return b.push(a),a});return W(b,a)},parent:function(a){return W(D(this.pluck("parentNode")),a)},children:function(a){return W(this.map(function(){return U(this)}),a)},contents:function(){return this.map(function(){return f.call(this.childNodes)})},siblings:function(a){return W(this.map(function(a,b){return g.call(U(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return c.map(this,function(b){return b[a]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=""),getComputedStyle(this,"").getPropertyValue("display")=="none"&&(this.style.display=T(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var b=H(a);if(this[0]&&!b)var d=c(a).get(0),e=d.parentNode||this.length>1;return this.each(function(f){c(this).wrapAll(b?a.call(this,f):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){c(this[0]).before(a=c(a));var b;while((b=a.children()).length)a=b.first();c(a).append(this)}return this},wrapInner:function(a){var b=H(a);return this.each(function(d){var e=c(this),f=e.contents(),g=b?a.call(this,d):a;f.length?f.wrapAll(g):e.append(g)})},unwrap:function(){return this.parent().each(function(){c(this).replaceWith(c(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(b){return this.each(function(){var d=c(this);(b===a?d.css("display")=="none":b)?d.show():d.hide()})},prev:function(a){return c(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return c(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return arguments.length===0?this.length>0?this[0].innerHTML:null:this.each(function(b){var d=this.innerHTML;c(this).empty().append(X(this,a,b,d))})},text:function(b){return arguments.length===0?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=b===a?"":""+b})},attr:function(c,d){var e;return typeof c=="string"&&d===a?this.length==0||this[0].nodeType!==1?a:c=="value"&&this[0].nodeName=="INPUT"?this.val():!(e=this[0].getAttribute(c))&&c in this[0]?this[0][c]:e:this.each(function(a){if(this.nodeType!==1)return;if(K(c))for(b in c)Y(this,b,c[b]);else Y(this,c,X(this,d,a,this.getAttribute(c)))})},removeAttr:function(a){return this.each(function(){this.nodeType===1&&Y(this,a)})},prop:function(b,c){return b=F[b]||b,c===a?this[0]&&this[0][b]:this.each(function(a){this[b]=X(this,c,a,this[b])})},data:function(b,c){var d=this.attr("data-"+b.replace(p,"-$1").toLowerCase(),c);return d!==null?$(d):a},val:function(a){return arguments.length===0?this[0]&&(this[0].multiple?c(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=X(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var d=c(this),e=X(this,a,b,d.offset()),f=d.offsetParent().offset(),g={top:e.top-f.top,left:e.left-f.left};d.css("position")=="static"&&(g.position="relative"),d.css(g)});if(this.length==0)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(a,d){if(arguments.length<2){var e=this[0],f=getComputedStyle(e,"");if(!e)return;if(typeof a=="string")return e.style[C(a)]||f.getPropertyValue(a);if(M(a)){var g={};return c.each(M(a)?a:[a],function(a,b){g[b]=e.style[C(b)]||f.getPropertyValue(b)}),g}}var h="";if(G(a)=="string")!d&&d!==0?this.each(function(){this.style.removeProperty(Q(a))}):h=Q(a)+":"+S(a,d);else for(b in a)!a[b]&&a[b]!==0?this.each(function(){this.style.removeProperty(Q(b))}):h+=Q(b)+":"+S(b,a[b])+";";return this.each(function(){this.style.cssText+=";"+h})},index:function(a){return a?this.indexOf(c(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?e.some.call(this,function(a){return this.test(Z(a))},R(a)):!1},addClass:function(a){return a?this.each(function(b){d=[];var e=Z(this),f=X(this,a,b,e);f.split(/\s+/g).forEach(function(a){c(this).hasClass(a)||d.push(a)},this),d.length&&Z(this,e+(e?" ":"")+d.join(" "))}):this},removeClass:function(b){return this.each(function(c){if(b===a)return Z(this,"");d=Z(this),X(this,b,c,d).split(/\s+/g).forEach(function(a){d=d.replace(R(a)," ")}),Z(this,d.trim())})},toggleClass:function(b,d){return b?this.each(function(e){var f=c(this),g=X(this,b,e,Z(this));g.split(/\s+/g).forEach(function(b){(d===a?!f.hasClass(b):d)?f.addClass(b):f.removeClass(b)})}):this},scrollTop:function(b){if(!this.length)return;var c="scrollTop"in this[0];return b===a?c?this[0].scrollTop:this[0].pageYOffset:this.each(c?function(){this.scrollTop=b}:function(){this.scrollTo(this.scrollX,b)})},scrollLeft:function(b){if(!this.length)return;var c="scrollLeft"in this[0];return b===a?c?this[0].scrollLeft:this[0].pageXOffset:this.each(c?function(){this.scrollLeft=b}:function(){this.scrollTo(b,this.scrollY)})},position:function(){if(!this.length)return;var a=this[0],b=this.offsetParent(),d=this.offset(),e=o.test(b[0].nodeName)?{top:0,left:0}:b.offset();return d.top-=parseFloat(c(a).css("margin-top"))||0,d.left-=parseFloat(c(a).css("margin-left"))||0,e.top+=parseFloat(c(b[0]).css("border-top-width"))||0,e.left+=parseFloat(c(b[0]).css("border-left-width"))||0,{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||h.body;while(a&&!o.test(a.nodeName)&&c(a).css("position")=="static")a=a.offsetParent;return a})}},c.fn.detach=c.fn.remove,["width","height"].forEach(function(b){var d=b.replace(/./,function(a){return a[0].toUpperCase()});c.fn[b]=function(e){var f,g=this[0];return e===a?I(g)?g["inner"+d]:J(g)?g.documentElement["scroll"+d]:(f=this.offset())&&f[b]:this.each(function(a){g=c(this),g.css(b,X(this,e,a,g[b]()))})}}),r.forEach(function(a,b){var d=b%2;c.fn[a]=function(){var a,e=c.map(arguments,function(b){return a=G(b),a=="object"||a=="array"||b==null?b:B.fragment(b)}),f,g=this.length>1;return e.length<1?this:this.each(function(a,h){f=d?h:h.parentNode,h=b==0?h.nextSibling:b==1?h.firstChild:b==2?h:null,e.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!f)return c(a).remove();_(f.insertBefore(a,h),function(a){a.nodeName!=null&&a.nodeName.toUpperCase()==="SCRIPT"&&(!a.type||a.type==="text/javascript")&&!a.src&&window.eval.call(window,a.innerHTML)})})})},c.fn[d?a+"To":"insert"+(b?"Before":"After")]=function(b){return c(b)[a](this),this}}),B.Z.prototype=c.fn,B.uniq=D,B.deserializeValue=$,c.zepto=B,c}();window.Zepto=Zepto,window.$===undefined&&(window.$=Zepto),function(a){function m(a){return a._zid||(a._zid=c++)}function n(a,b,c,d){b=o(b);if(b.ns)var e=p(b.ns);return(h[m(a)]||[]).filter(function(a){return a&&(!b.e||a.e==b.e)&&(!b.ns||e.test(a.ns))&&(!c||m(a.fn)===m(c))&&(!d||a.sel==d)})}function o(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function p(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function q(a,b){return a.del&&!j&&a.e in k||!!b}function r(a){return l[a]||j&&k[a]||a}function s(b,c,e,f,g,i,j){var k=m(b),n=h[k]||(h[k]=[]);c.split(/\s/).forEach(function(c){if(c=="ready")return a(document).ready(e);var h=o(c);h.fn=e,h.sel=g,h.e in l&&(e=function(b){var c=b.relatedTarget;if(!c||c!==this&&!a.contains(this,c))return h.fn.apply(this,arguments)}),h.del=i;var k=i||e;h.proxy=function(a){a=y(a);if(a.isImmediatePropagationStopped())return;a.data=f;var c=k.apply(b,a._args==d?[a]:[a].concat(a._args));return c===!1&&(a.preventDefault(),a.stopPropagation()),c},h.i=n.length,n.push(h),"addEventListener"in b&&b.addEventListener(r(h.e),h.proxy,q(h,j))})}function t(a,b,c,d,e){var f=m(a);(b||"").split(/\s/).forEach(function(b){n(a,b,c,d).forEach(function(b){delete h[f][b.i],"removeEventListener"in a&&a.removeEventListener(r(b.e),b.proxy,q(b,e))})})}function y(b,c){if(c||!b.isDefaultPrevented){c||(c=b),a.each(x,function(a,d){var e=c[a];b[a]=function(){return this[d]=u,e&&e.apply(c,arguments)},b[d]=v});if(c.defaultPrevented!==d?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())b.isDefaultPrevented=u}return b}function z(a){var b,c={originalEvent:a};for(b in a)!w.test(b)&&a[b]!==d&&(c[b]=a[b]);return y(c,a)}var b=a.zepto.qsa,c=1,d,e=Array.prototype.slice,f=a.isFunction,g=function(a){return typeof a=="string"},h={},i={},j="onfocusin"in window,k={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};i.click=i.mousedown=i.mouseup=i.mousemove="MouseEvents",a.event={add:s,remove:t},a.proxy=function(b,c){if(f(b)){var d=function(){return b.apply(c,arguments)};return d._zid=m(b),d}if(g(c))return a.proxy(b[c],b);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var u=function(){return!0},v=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,x={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,h,i,j){var k,l,m=this;if(b&&!g(b))return a.each(b,function(a,b){m.on(a,c,h,b,j)}),m;!g(c)&&!f(i)&&i!==!1&&(i=h,h=c,c=d);if(f(h)||h===!1)i=h,h=d;return i===!1&&(i=v),m.each(function(d,f){j&&(k=function(a){return t(f,a.type,i),i.apply(this,arguments)}),c&&(l=function(b){var d,g=a(b.target).closest(c,f).get(0);if(g&&g!==f)return d=a.extend(z(b),{currentTarget:g,liveFired:f}),(k||i).apply(g,[d].concat(e.call(arguments,1)))}),s(f,b,i,h,c,l||k)})},a.fn.off=function(b,c,e){var h=this;return b&&!g(b)?(a.each(b,function(a,b){h.off(a,c,b)}),h):(!g(c)&&!f(e)&&e!==!1&&(e=c,c=d),e===!1&&(e=v),h.each(function(){t(this,b,e,c)}))},a.fn.trigger=function(b,c){return b=g(b)||a.isPlainObject(b)?a.Event(b):y(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,c){var d,e;return this.each(function(f,h){d=z(g(b)?a.Event(b):b),d._args=c,d.target=h,a.each(n(h,b.type||b),function(a,b){e=b.proxy(d);if(d.isImmediatePropagationStopped())return!1})}),e},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){g(a)||(b=a,a=b.type);var c=document.createEvent(i[a]||"Events"),d=!0;if(b)for(var e in b)e=="bubbles"?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),y(c)}}(Zepto),function($){function triggerAndReturn(a,b,c){var d=$.Event(b);return $(a).trigger(d,c),!d.isDefaultPrevented()}function triggerGlobal(a,b,c,d){if(a.global)return triggerAndReturn(b||document,c,d)}function ajaxStart(a){a.global&&$.active++===0&&triggerGlobal(a,null,"ajaxStart")}function ajaxStop(a){a.global&&!--$.active&&triggerGlobal(a,null,"ajaxStop")}function ajaxBeforeSend(a,b){var c=b.context;if(b.beforeSend.call(c,a,b)===!1||triggerGlobal(b,c,"ajaxBeforeSend",[a,b])===!1)return!1;triggerGlobal(b,c,"ajaxSend",[a,b])}function ajaxSuccess(a,b,c,d){var e=c.context,f="success";c.success.call(e,a,f,b),d&&d.resolveWith(e,[a,f,b]),triggerGlobal(c,e,"ajaxSuccess",[b,c,a]),ajaxComplete(f,b,c)}function ajaxError(a,b,c,d,e){var f=d.context;d.error.call(f,c,b,a),e&&e.rejectWith(f,[c,b,a]),triggerGlobal(d,f,"ajaxError",[c,d,a||b]),ajaxComplete(b,c,d)}function ajaxComplete(a,b,c){var d=c.context;c.complete.call(d,b,a),triggerGlobal(c,d,"ajaxComplete",[b,c]),ajaxStop(c)}function empty(){}function mimeToDataType(a){return a&&(a=a.split(";",2)[0]),a&&(a==htmlType?"html":a==jsonType?"json":scriptTypeRE.test(a)?"script":xmlTypeRE.test(a)&&"xml")||"text"}function appendQuery(a,b){return b==""?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function serializeData(a){a.processData&&a.data&&$.type(a.data)!="string"&&(a.data=$.param(a.data,a.traditional)),a.data&&(!a.type||a.type.toUpperCase()=="GET")&&(a.url=appendQuery(a.url,a.data),a.data=undefined)}function parseArguments(a,b,c,d){var e=!$.isFunction(b);return{url:a,data:e?b:undefined,success:e?$.isFunction(c)?c:undefined:b,dataType:e?d||c:c}}function serialize(a,b,c,d){var e,f=$.isArray(b),g=$.isPlainObject(b);$.each(b,function(b,h){e=$.type(h),d&&(b=c?d:d+"["+(g||e=="object"||e=="array"?b:"")+"]"),!d&&f?a.add(h.name,h.value):e=="array"||!c&&e=="object"?serialize(a,h,c,b):a.add(b,h)})}var jsonpID=0,document=window.document,key,name,rscript=/)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/;$.active=0,$.ajaxJSONP=function(a,b){if("type"in a){var c=a.jsonpCallback,d=($.isFunction(c)?c():c)||"jsonp"+ ++jsonpID,e=document.createElement("script"),f=window[d],g,h=function(a){$(e).triggerHandler("error",a||"abort")},i={abort:h},j;return b&&b.promise(i),$(e).on("load error",function(c,h){clearTimeout(j),$(e).off().remove(),c.type=="error"||!g?ajaxError(null,h||"error",i,a,b):ajaxSuccess(g[0],i,a,b),window[d]=f,g&&$.isFunction(f)&&f(g[0]),f=g=undefined}),ajaxBeforeSend(i,a)===!1?(h("abort"),i):(window[d]=function(){g=arguments},e.src=a.url.replace(/=\?/,"="+d),document.head.appendChild(e),a.timeout>0&&(j=setTimeout(function(){h("timeout")},a.timeout)),i)}return $.ajax(a)},$.ajaxSettings={type:"GET",beforeSend:empty,success:empty,error:empty,complete:empty,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:jsonType,xml:"application/xml, text/xml",html:htmlType,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},$.ajax=function(options){var settings=$.extend({},options||{}),deferred=$.Deferred&&$.Deferred();for(key in $.ajaxSettings)settings[key]===undefined&&(settings[key]=$.ajaxSettings[key]);ajaxStart(settings),settings.crossDomain||(settings.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(settings.url)&&RegExp.$2!=window.location.host),settings.url||(settings.url=window.location.toString()),serializeData(settings),settings.cache===!1&&(settings.url=appendQuery(settings.url,"_="+Date.now()));var dataType=settings.dataType,hasPlaceholder=/=\?/.test(settings.url);if(dataType=="jsonp"||hasPlaceholder)return hasPlaceholder||(settings.url=appendQuery(settings.url,settings.jsonp?settings.jsonp+"=?":settings.jsonp===!1?"":"callback=?")),$.ajaxJSONP(settings,deferred);var mime=settings.accepts[dataType],headers={},setHeader=function(a,b){headers[a.toLowerCase()]=[a,b]},protocol=/^([\w-]+:)\/\//.test(settings.url)?RegExp.$1:window.location.protocol,xhr=settings.xhr(),nativeSetHeader=xhr.setRequestHeader,abortTimeout;deferred&&deferred.promise(xhr),settings.crossDomain||setHeader("X-Requested-With","XMLHttpRequest"),setHeader("Accept",mime||"*/*");if(mime=settings.mimeType||mime)mime.indexOf(",")>-1&&(mime=mime.split(",",2)[0]),xhr.overrideMimeType&&xhr.overrideMimeType(mime);(settings.contentType||settings.contentType!==!1&&settings.data&&settings.type.toUpperCase()!="GET")&&setHeader("Content-Type",settings.contentType||"application/x-www-form-urlencoded");if(settings.headers)for(name in settings.headers)setHeader(name,settings.headers[name]);xhr.setRequestHeader=setHeader,xhr.onreadystatechange=function(){if(xhr.readyState==4){xhr.onreadystatechange=empty,clearTimeout(abortTimeout);var result,error=!1;if(xhr.status>=200&&xhr.status<300||xhr.status==304||xhr.status==0&&protocol=="file:"){dataType=dataType||mimeToDataType(settings.mimeType||xhr.getResponseHeader("content-type")),result=xhr.responseText;try{dataType=="script"?(1,eval)(result):dataType=="xml"?result=xhr.responseXML:dataType=="json"&&(result=blankRE.test(result)?null:$.parseJSON(result))}catch(e){error=e}error?ajaxError(error,"parsererror",xhr,settings,deferred):ajaxSuccess(result,xhr,settings,deferred)}else ajaxError(xhr.statusText||null,xhr.status?"error":"abort",xhr,settings,deferred)}};if(ajaxBeforeSend(xhr,settings)===!1)return xhr.abort(),ajaxError(null,"abort",xhr,settings,deferred),xhr;if(settings.xhrFields)for(name in settings.xhrFields)xhr[name]=settings.xhrFields[name];var async="async"in settings?settings.async:!0;xhr.open(settings.type,settings.url,async,settings.username,settings.password);for(name in headers)nativeSetHeader.apply(xhr,headers[name]);return settings.timeout>0&&(abortTimeout=setTimeout(function(){xhr.onreadystatechange=empty,xhr.abort(),ajaxError(null,"timeout",xhr,settings,deferred)},settings.timeout)),xhr.send(settings.data?settings.data:null),xhr},$.get=function(a,b,c,d){return $.ajax(parseArguments.apply(null,arguments))},$.post=function(a,b,c,d){var e=parseArguments.apply(null,arguments);return e.type="POST",$.ajax(e)},$.getJSON=function(a,b,c){var d=parseArguments.apply(null,arguments);return d.dataType="json",$.ajax(d)},$.fn.load=function(a,b,c){if(!this.length)return this;var d=this,e=a.split(/\s/),f,g=parseArguments(a,b,c),h=g.success;return e.length>1&&(g.url=e[0],f=e[1]),g.success=function(a){d.html(f?$("
    ").html(a.replace(rscript,"")).find(f):a),h&&h.apply(d,arguments)},$.ajax(g),this};var escape=encodeURIComponent;$.param=function(a,b){var c=[];return c.add=function(a,b){this.push(escape(a)+"="+escape(b))},serialize(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b=[],c;return a([].slice.call(this.get(0).elements)).each(function(){c=a(this);var d=c.attr("type");this.nodeName.toLowerCase()!="fieldset"&&!this.disabled&&d!="submit"&&d!="reset"&&d!="button"&&(d!="radio"&&d!="checkbox"||this.checked)&&b.push({name:c.attr("name"),value:c.val()})}),b},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){return b=b||[],a.extend(b,a.fn),b.selector=c||"",b.__Z=!0,b},isZ:function(b){return a.type(b)==="array"&&"__Z"in b}});try{getComputedStyle(undefined)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}}(Zepto) \ No newline at end of file diff --git a/Web/js/main.js b/Web/js/main.js index c79ec61..84b1954 100755 --- a/Web/js/main.js +++ b/Web/js/main.js @@ -1,52 +1,11 @@ "use strict"; $(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: true, - fill: false, - lineWidth : 2, - color : 'black', - 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(); - //$(window).resize(sizeAndPos); - - $('.color-picker').change(function() { - var c = $(this).find('.color').val(); - var caller = $(this).parent().attr('data-caller'); - settings[caller] = c; - $('#set' + caller + ' span').html(c); - if( caller == 'bg' ) { - $c.first().css('background', c); - } - }) - $('.color').val('#000000'); yepnope({ test: window.mobile, - yep : ['js/libs/touch.js', 'js/mobile.js', 'js/libs/color-picker-touch.js'], - nope: ['js/desktop.js', 'js/libs/color-picker.js'] + yep : ['js/mobile.js', 'js/libs/color-picker-touch.js'], + nope: ['js/libs/color-picker.js'] }) @@ -120,13 +79,6 @@ $(document).ready(function() { window.load = load; window.save = save; - - if( localStorage.getItem('sawTips') != settings.version ) { - $('.tour').removeClass('hidden'); - localStorage.setItem('sawTips', settings.version); - } - - // TODO: Check for Update /*var request = navigator.mozApps.getInstalled(); diff --git a/Web/js/mobile.js b/Web/js/mobile.js deleted file mode 100755 index ae65e9f..0000000 --- a/Web/js/mobile.js +++ /dev/null @@ -1,231 +0,0 @@ -"use strict"; - -// Open External Links in browser - -$('.menu').tap(function() { - $('#menu').toggleClass('pulled'); -}) -$('.save').tap(function() { - $('#save').removeClass('hidden'); -}) -$('.load').tap(function() { - $('#load').removeClass('hidden'); - $('#load li').remove(); - for( var i = 0, len = localStorage.length; i < len; i++ ) { - $('#load ol').append( - $('
  • ') - ); - } - if( localStorage.length < 1 ) { - $('#load ol').append( - $('

    No sketch found.

    ') - ); - } - $confirm.find('li').off('tap').tap(function(e) { - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - }) - $('#pro').click(function() { - $('#save ol:nth-of-type(2) li').each(function() { - if( $(this).find('span').html() !== 'Transparent' ) { - $(this).addClass('hidden'); - $(this).removeAttr('aria-selected'); - } - else $(this).attr('aria-selected', 'true'); - }) - }) - $('#exp').click(function() { - $('#save ol:nth-of-type(2) li').removeClass('hidden'); - }) -}) -$('#pro').click(function() { - $('#save ol:nth-of-type(2) li').each(function() { - if( $(this).find('span').html() !== 'Transparent' ) { - $(this).addClass('hidden'); - $(this).removeAttr('aria-selected'); - } - else $(this).attr('aria-selected', 'true'); - }) -}) -$('#exp').click(function() { - $('#save ol:nth-of-type(2) li').removeClass('hidden'); -}) -$c.last().on('touchstart', function(e) { - var xy = relative(e.changedTouches[0].pageX, e.changedTouches[0].pageY); - startPoint(xy.x, xy.y); - window.active = true; -}).on('touchmove', function(e) { - if (!window.active || settings.type == 'line') return; - var xy = relative(e.changedTouches[0].pageX, e.changedTouches[0].pageY); - drawPoint(xy.x, xy.y); -}).on('touchend', function(e) { - window.active = false; - if( settings.type == 'eraser' ) return; - - if(window.points.history.last < window.points.history.length-1) { - window.points.history.splice(window.points.history.last+1); - } - if( settings.type == 'shape' ) { - var s = settings.comShape; - o.clear(); - c.beginPath(); - c.fillStyle = settings.color; - switch(s.type) { - case 'circle': { - c.arc(s.x, s.y, s.radius, 0, 2*Math.PI); - break; - } - case 'rectangle': { - c.rect(s.x, s.y, s.w, s.h) - break; - } - case 'triangle': { - c.moveTo(s.start.x + s.dix, s.start.y); - c.lineTo(s.x, s.y); - c.lineTo(s.start.x, s.y); - c.lineTo(s.start.x + s.dix, s.start.y); - break; - } - } - c.fill(); - } - window.points.history.push({ - data: c.getImageData(0, 0, width(), height()), - points: window.points.slice(0) - }) - window.points.history.last = window.points.history.length-1; -}).on('longTap', function(e) { - if( points[points.length-1].type == 'line' ) { - window.active = false; - points[points.length-1].type = ''; - points[points.length-1].start = undefined; - } -}) - -// Value Selector - -var $single = $('form[data-type="value-selector"].single'); - -$single.find('li').tap(function(e) { - e.preventDefault(); - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - var key = $(this).parents('form').attr('id'), - value = $(this).find('label span').html().toLowerCase(); - window.settings[key] = value; - - $('button[id="set' + key + '"] span').html(value[0].toUpperCase() + value.substr(1)); - $('#menu div.options > div').addClass('hidden'); - $('#menu div.options > .general, #menu div.options > .'+value).removeClass('hidden'); - - $(this).parents('form').addClass('hidden'); -}) - -$single.submit(function(e) { - e.preventDefault(); - $(this).addClass('hidden'); -}) - -// Confirm - -var $confirm = $('form[data-type="value-selector"].confirm'); - -$confirm.each(function() { - - $(this).find('li').click(function(e) { - $(this).parent().find('li[aria-selected]').removeAttr('aria-selected'); - $(this).attr('aria-selected', 'true'); - }) - $(this).find('button').last().click(function(e) { - e.preventDefault(); - var v = $(this).parents('form').attr('id'); - $(this).parents('form').find('h1').each(function(i) { - if( i > 0 ) { - var key = $(this).html().toLowerCase(); - var value = $(this).parent().find('ol:nth-of-type('+i+') li[aria-selected] span').html(); - if( key !== 'file name' && key !== 'file' ) value = value.toLowerCase(); - window[v][key] = value; - } - }) - $(this).parents('form').addClass('hidden'); - window[v](); - }) - $(this).find('button').first().click(function(e) { - e.preventDefault(); - $(this).parents('form').addClass('hidden'); - }) - -}) - -// Value Selector Callers - -var $btn = $('button[id^="set"]'); -$btn.each(function() { - var target = /set(.*)/.exec($(this).attr('id'))[1]; - if( target == 'color' ) { - return $(this).tap(function() { - $('.picker').removeClass('hidden'); - }) - } - $(this).tap(function(e) { - e.preventDefault(); - $('form[id="' + target + '"]').removeClass('hidden'); - }) -}) - -// Seekbar - -var sliderLeft; -$('div[role="slider"] button').on('touchstart', function() { - $(this).attr('data-moving','true'); - if( !sliderLeft ) sliderLeft = $('div[role="slider"] button').offset().left; -}).on('touchmove', function(e) { - if( $(this).attr('data-moving') ) { - var x = parseInt(e.changedTouches[0].pageX - sliderLeft - 15); - var $c = $('.'+$(this).parents('div[role="slider"]').attr('class')); - var progress = $c.find('progress'); - var max = +progress.attr('max'); - var min = +progress.attr('min'); - if( x <= max && x >= min ) { - $c.find('button').css('left', x+'%'); - progress.attr('value', x); - var key = $c.attr('class'); - settings[key] = x; - $('#'+ key +' span').html(x); - } - } -}).on('touchend', function() { - $(this).removeAttr('data-moving'); -}) - -// Color Picker - -$('.close, .tour button').tap(function() { - $(this).parent().addClass('hidden'); -}) - -// Bottom - -$('#clear').tap(function() { - c.clearRect(0, 0, width(), height()); - var h = window.points.history; - window.points = []; - window.points.history = h; - if(window.points.history.last < window.points.history.length-1) { - window.points.history.splice(window.points.history.last+1); - } - - window.points.history.push({ - data: c.getImageData(0, 0, width(), height()), - points: [] - }) - window.points.history.last = window.points.history.length-1; -}) - -$('#undo').tap(undo); -$('#redo').tap(redo); - -$('#about').tap(function() { - $('.about').removeClass('hidden'); -}) - diff --git a/Web/manifest-web.webapp b/Web/manifest.webapp similarity index 100% rename from Web/manifest-web.webapp rename to Web/manifest.webapp diff --git a/Web/css/fonts/MozTT-Bold.ttf b/build/mobile/css/fonts/MozTT-Bold.ttf old mode 100755 new mode 100644 similarity index 100% rename from Web/css/fonts/MozTT-Bold.ttf rename to build/mobile/css/fonts/MozTT-Bold.ttf diff --git a/Web/css/fonts/MozTT-Light.ttf b/build/mobile/css/fonts/MozTT-Light.ttf old mode 100755 new mode 100644 similarity index 100% rename from Web/css/fonts/MozTT-Light.ttf rename to build/mobile/css/fonts/MozTT-Light.ttf diff --git a/Web/css/fonts/MozTT-Medium.ttf b/build/mobile/css/fonts/MozTT-Medium.ttf old mode 100755 new mode 100644 similarity index 100% rename from Web/css/fonts/MozTT-Medium.ttf rename to build/mobile/css/fonts/MozTT-Medium.ttf diff --git a/Web/css/fonts/MozTT-Regular.ttf b/build/mobile/css/fonts/MozTT-Regular.ttf old mode 100755 new mode 100644 similarity index 100% rename from Web/css/fonts/MozTT-Regular.ttf rename to build/mobile/css/fonts/MozTT-Regular.ttf diff --git a/Web/css/imgs/bg_overlay_pressed_1.png b/build/mobile/css/imgs/bg_overlay_pressed_1.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/bg_overlay_pressed_1.png rename to build/mobile/css/imgs/bg_overlay_pressed_1.png diff --git a/Web/css/imgs/bg_overlay_pressed_2.png b/build/mobile/css/imgs/bg_overlay_pressed_2.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/bg_overlay_pressed_2.png rename to build/mobile/css/imgs/bg_overlay_pressed_2.png diff --git a/Web/css/imgs/clear.png b/build/mobile/css/imgs/clear.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/clear.png rename to build/mobile/css/imgs/clear.png diff --git a/Web/css/imgs/div_line_lg_black.png b/build/mobile/css/imgs/div_line_lg_black.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/div_line_lg_black.png rename to build/mobile/css/imgs/div_line_lg_black.png diff --git a/Web/css/imgs/div_line_sm_black.png b/build/mobile/css/imgs/div_line_sm_black.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/div_line_sm_black.png rename to build/mobile/css/imgs/div_line_sm_black.png diff --git a/Web/css/imgs/download.png b/build/mobile/css/imgs/download.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/download.png rename to build/mobile/css/imgs/download.png diff --git a/Web/css/imgs/header_bg_black.png b/build/mobile/css/imgs/header_bg_black.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/header_bg_black.png rename to build/mobile/css/imgs/header_bg_black.png diff --git a/Web/css/imgs/load.png b/build/mobile/css/imgs/load.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/load.png rename to build/mobile/css/imgs/load.png diff --git a/Web/css/imgs/menu.png b/build/mobile/css/imgs/menu.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/menu.png rename to build/mobile/css/imgs/menu.png diff --git a/Web/css/imgs/redo.png b/build/mobile/css/imgs/redo.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/redo.png rename to build/mobile/css/imgs/redo.png diff --git a/Web/css/imgs/settings.png b/build/mobile/css/imgs/settings.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/settings.png rename to build/mobile/css/imgs/settings.png diff --git a/Web/css/imgs/undo.png b/build/mobile/css/imgs/undo.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/imgs/undo.png rename to build/mobile/css/imgs/undo.png diff --git a/Web/css/main.css b/build/mobile/css/main.css old mode 100755 new mode 100644 similarity index 100% rename from Web/css/main.css rename to build/mobile/css/main.css diff --git a/Web/css/seekbars/images/ui/handler.png b/build/mobile/css/seekbars/images/ui/handler.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/seekbars/images/ui/handler.png rename to build/mobile/css/seekbars/images/ui/handler.png diff --git a/Web/css/seekbars/images/ui/handler@1.5x.png b/build/mobile/css/seekbars/images/ui/handler@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/seekbars/images/ui/handler@1.5x.png rename to build/mobile/css/seekbars/images/ui/handler@1.5x.png diff --git a/Web/css/seekbars/images/ui/handler@2x.png b/build/mobile/css/seekbars/images/ui/handler@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/seekbars/images/ui/handler@2x.png rename to build/mobile/css/seekbars/images/ui/handler@2x.png diff --git a/Web/css/seekbars/seekbars.css b/build/mobile/css/seekbars/seekbars.css old mode 100755 new mode 100644 similarity index 100% rename from Web/css/seekbars/seekbars.css rename to build/mobile/css/seekbars/seekbars.css diff --git a/Web/css/switches/images/check/danger.png b/build/mobile/css/switches/images/check/danger.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/danger.png rename to build/mobile/css/switches/images/check/danger.png diff --git a/Web/css/switches/images/check/danger@1.5x.png b/build/mobile/css/switches/images/check/danger@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/danger@1.5x.png rename to build/mobile/css/switches/images/check/danger@1.5x.png diff --git a/Web/css/switches/images/check/danger@2x.png b/build/mobile/css/switches/images/check/danger@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/danger@2x.png rename to build/mobile/css/switches/images/check/danger@2x.png diff --git a/Web/css/switches/images/check/default.png b/build/mobile/css/switches/images/check/default.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/default.png rename to build/mobile/css/switches/images/check/default.png diff --git a/Web/css/switches/images/check/default@1.5x.png b/build/mobile/css/switches/images/check/default@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/default@1.5x.png rename to build/mobile/css/switches/images/check/default@1.5x.png diff --git a/Web/css/switches/images/check/default@2x.png b/build/mobile/css/switches/images/check/default@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/check/default@2x.png rename to build/mobile/css/switches/images/check/default@2x.png diff --git a/Web/css/switches/images/radio/danger.png b/build/mobile/css/switches/images/radio/danger.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/danger.png rename to build/mobile/css/switches/images/radio/danger.png diff --git a/Web/css/switches/images/radio/danger@1.5x.png b/build/mobile/css/switches/images/radio/danger@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/danger@1.5x.png rename to build/mobile/css/switches/images/radio/danger@1.5x.png diff --git a/Web/css/switches/images/radio/danger@2x.png b/build/mobile/css/switches/images/radio/danger@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/danger@2x.png rename to build/mobile/css/switches/images/radio/danger@2x.png diff --git a/Web/css/switches/images/radio/default.png b/build/mobile/css/switches/images/radio/default.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/default.png rename to build/mobile/css/switches/images/radio/default.png diff --git a/Web/css/switches/images/radio/default@1.5x.png b/build/mobile/css/switches/images/radio/default@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/default@1.5x.png rename to build/mobile/css/switches/images/radio/default@1.5x.png diff --git a/Web/css/switches/images/radio/default@2x.png b/build/mobile/css/switches/images/radio/default@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/radio/default@2x.png rename to build/mobile/css/switches/images/radio/default@2x.png diff --git a/Web/css/switches/images/switch/background.png b/build/mobile/css/switches/images/switch/background.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/switch/background.png rename to build/mobile/css/switches/images/switch/background.png diff --git a/Web/css/switches/images/switch/background@1.5x.png b/build/mobile/css/switches/images/switch/background@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/switch/background@1.5x.png rename to build/mobile/css/switches/images/switch/background@1.5x.png diff --git a/Web/css/switches/images/switch/background_off.png b/build/mobile/css/switches/images/switch/background_off.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/switch/background_off.png rename to build/mobile/css/switches/images/switch/background_off.png diff --git a/Web/css/switches/images/switch/background_off@1.5x.png b/build/mobile/css/switches/images/switch/background_off@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/switches/images/switch/background_off@1.5x.png rename to build/mobile/css/switches/images/switch/background_off@1.5x.png diff --git a/Web/css/value_selector/images/icons/checked.png b/build/mobile/css/value_selector/images/icons/checked.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/icons/checked.png rename to build/mobile/css/value_selector/images/icons/checked.png diff --git a/Web/css/value_selector/images/icons/checked@1.5x.png b/build/mobile/css/value_selector/images/icons/checked@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/icons/checked@1.5x.png rename to build/mobile/css/value_selector/images/icons/checked@1.5x.png diff --git a/Web/css/value_selector/images/icons/checked@2x.png b/build/mobile/css/value_selector/images/icons/checked@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/icons/checked@2x.png rename to build/mobile/css/value_selector/images/icons/checked@2x.png diff --git a/Web/css/value_selector/images/ui/affirmative.png b/build/mobile/css/value_selector/images/ui/affirmative.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/affirmative.png rename to build/mobile/css/value_selector/images/ui/affirmative.png diff --git a/Web/css/value_selector/images/ui/default.png b/build/mobile/css/value_selector/images/ui/default.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/default.png rename to build/mobile/css/value_selector/images/ui/default.png diff --git a/Web/css/value_selector/images/ui/gradient.png b/build/mobile/css/value_selector/images/ui/gradient.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/gradient.png rename to build/mobile/css/value_selector/images/ui/gradient.png diff --git a/Web/css/value_selector/images/ui/gradient@1.5x.png b/build/mobile/css/value_selector/images/ui/gradient@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/gradient@1.5x.png rename to build/mobile/css/value_selector/images/ui/gradient@1.5x.png diff --git a/Web/css/value_selector/images/ui/pattern.png b/build/mobile/css/value_selector/images/ui/pattern.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/pattern.png rename to build/mobile/css/value_selector/images/ui/pattern.png diff --git a/Web/css/value_selector/images/ui/shadow-invert.png b/build/mobile/css/value_selector/images/ui/shadow-invert.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow-invert.png rename to build/mobile/css/value_selector/images/ui/shadow-invert.png diff --git a/Web/css/value_selector/images/ui/shadow-invert@1.5x.png b/build/mobile/css/value_selector/images/ui/shadow-invert@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow-invert@1.5x.png rename to build/mobile/css/value_selector/images/ui/shadow-invert@1.5x.png diff --git a/Web/css/value_selector/images/ui/shadow-invert@2x.png b/build/mobile/css/value_selector/images/ui/shadow-invert@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow-invert@2x.png rename to build/mobile/css/value_selector/images/ui/shadow-invert@2x.png diff --git a/Web/css/value_selector/images/ui/shadow.png b/build/mobile/css/value_selector/images/ui/shadow.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow.png rename to build/mobile/css/value_selector/images/ui/shadow.png diff --git a/Web/css/value_selector/images/ui/shadow@1.5x.png b/build/mobile/css/value_selector/images/ui/shadow@1.5x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow@1.5x.png rename to build/mobile/css/value_selector/images/ui/shadow@1.5x.png diff --git a/Web/css/value_selector/images/ui/shadow@2x.png b/build/mobile/css/value_selector/images/ui/shadow@2x.png old mode 100755 new mode 100644 similarity index 100% rename from Web/css/value_selector/images/ui/shadow@2x.png rename to build/mobile/css/value_selector/images/ui/shadow@2x.png diff --git a/build/mobile/index.html b/build/mobile/index.html new file mode 100644 index 0000000..ecb646d --- /dev/null +++ b/build/mobile/index.html @@ -0,0 +1,263 @@ + + + + + Sketchy + + + + + + +
    + + +

    Sketchy

    + + + +
    + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/mobile/js/Untitled Document b/build/mobile/js/Untitled Document new file mode 100644 index 0000000..e69de29 diff --git a/build/mobile/js/diff.js b/build/mobile/js/diff.js new file mode 100644 index 0000000..417dc8b --- /dev/null +++ b/build/mobile/js/diff.js @@ -0,0 +1 @@ +$(document).ready(function(){$("*").off("click mousemove mousedown mouseup mouseleave").on("click mousemove mousedown mouseup mouseleave",function(a){return a.preventDefault,!1}),$('a[href^="http"]').tap(function(a){a.preventDefault();{var b=$(this).attr("href");new MozActivity({name:"view",data:{type:"url",url:b}})}}),$('a[href^="mailto"]').tap(function(a){a.preventDefault();var b=/mailto:(.*)/.exec($(this).attr("href"))[1],b=new MozActivity({name:"new",data:{type:"mail",url:b}})}),window.save=function(){switch(save.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var a=$c[0].toDataURL();if("sketchy project"==save.type){var b,d=JSON.parse(localStorage.getItem("projects"));d&&d.some(function(a,c){return a.name==save["file name"]?(b=c,!0):!1})?(console.log(b),d[b]={name:save["file name"],data:a,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(d))):d?d.push({name:save["file name"],data:a,points:window.points}):d=[{name:save["file name"],data:a,points:window.points}],localStorage.setItem("projects",JSON.stringify(d))}else window.open(a,"_blank").focus();c.putImageData(window.points.history[window.points.history.last].data,0,0)},window.load=function(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==load.file})[0],b=document.createElement("img");b.src=a.data,b.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(b,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}},localStorage.getItem("sawTips")!=settings.version&&($(".tour").removeClass("hidden"),localStorage.setItem("sawTips",settings.version))}); \ No newline at end of file diff --git a/build/mobile/js/events.js b/build/mobile/js/events.js new file mode 100644 index 0000000..6c0a2e6 --- /dev/null +++ b/build/mobile/js/events.js @@ -0,0 +1 @@ +"use strict";$(window).resize(sizeAndPos),$(document).ready(function(){$(".menu").on("click tap",function(){$("#menu").toggleClass("pulled")}),$(".save").on("click tap",function(){$("#save").removeClass("hidden")}),$(".load").on("click tap",function(){$("#load").removeClass("hidden"),$("#load li").remove();var a=JSON.parse(localStorage.getItem("projects"));if(!a||a.length<1)return void $("#load ol").append($("

    No sketch found.

    "));for(var c=0,d=a.length;d>c;c++)$("#load ol").append($("
  • "));b.find("li").off("click").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Transparent"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2) li").removeClass("hidden")})}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Transparent"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2) li").removeClass("hidden")}),$c.last().on("mousedown touchstart",function(a){a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]);var b=relative(a.pageX,a.pageY);startPoint(b.x,b.y),window.active=!0}).on("mousemove touchmove",function(a){if(a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]),window.active&&"line"!=settings.type){var b=relative(a.pageX,a.pageY);drawPoint(b.x,b.y)}}).on("mouseup touchend",function(a){if(a.preventDefault(),window.active=!1,"eraser"!=settings.type){if(window.points.history.last div").addClass("hidden"),$("#menu div.options > .general, #menu div.options > ."+c).removeClass("hidden")),$(this).parents("form").addClass("hidden")}),a.submit(function(a){a.preventDefault(),$(this).addClass("hidden")});var b=$("form.confirm");b.each(function(){$(this).find("li").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$(this).find("button").last().on("click tap",function(a){a.preventDefault();var b=$(this).parents("form").attr("id");$(this).parents("form").find("h1").each(function(a){if(a>0){var c=$(this).html().toLowerCase(),d=$(this).parent().find("ol:nth-of-type("+a+") li[aria-selected] span").html();"file name"!==c&&"file"!==c&&(d=d.toLowerCase()),window[b][c]=d}}),$(this).parents("form").addClass("hidden"),window[b]()}),$(this).find("button").first().on("click tap",function(a){a.preventDefault(),$(this).parents("form").addClass("hidden")})});var d=$('button[id^="set"]');d.each(function(){var a=/set(.*)/.exec($(this).attr("id"))[1];return"color"==a||"bg"==a?$(this).on("click tap",function(){$(".picker").removeClass("hidden"),$(".picker").attr("data-caller",a)}):void $(this).on("click tap",function(b){b.preventDefault(),$('form[id="'+a+'"]').removeClass("hidden")})});var e;$('div[role="slider"] button').on("mousedown touchstart",function(){$(this).attr("data-moving","true"),e||(e=$('div[role="slider"] button').offset().left)}).on("mousemove touchmove",function(a){if($(this).attr("data-moving")){a.changedTouches&&(a=a.changedTouches[0]);var b=parseInt(a.pageX-e-15),c=$("."+$(this).parents('div[role="slider"]').attr("class")),d=c.find("progress"),f=+d.attr("max"),g=+d.attr("min");if(f>=b&&b>=g){c.find("button").css("left",b+"%"),d.attr("value",b);var h=c.attr("class");settings[h]=b,$("#"+h+" span").html(b)}}}).on("mouseup mouseleave touchend",function(){$(this).removeAttr("data-moving")}),$(".fill, .stroke").on("click tap",function(){var a=$("."+$(this).attr("class")).find("span");"Yes"==a.html()?(a.html("No"),settings[$(this).attr("class")]=!1):(a.html("Yes"),settings[$(this).attr("class")]=!0)}),$(".close, .tour button").on("click tap",function(){$(this).parent().addClass("hidden")}),$("#clear").on("click tap",function(){c.clear();var a=window.points.history;window.points=[],window.points.history=a,window.points.history.last=a&&a>=c-f&&d+f>=b&&b>=d-f?!0:!1}function draw(a,b,c,d,e,f){if(e=e||{},f)var g=window.o;else var g=window.c;g.beginPath(),g.globalCompositeOperation="eraser"==settings.type?"destination-out":e.composite||settings.composite,g.lineCap=e.lineCap||settings.lineCap,g.lineJoin=e.lineJoin||settings.lineJoin,g.strokeStyle=e.color||settings.color,g.fillStyle=e.color||settings.color,g.lineWidth=(e.lineWidth||settings.lineWidth)/10,g.moveTo(a,b),g.lineTo(c,d),(!e.noStroke||settings.noStroke)&&g.stroke(),(e.fill||settings.fill)&&g.fill()}function mark(a,b){var c=window.o;c.beginPath(),c.fillStyle="red",c.arc(a,b,3,0,2*Math.PI),c.fill()}function erase(a,b,c,d,e){var e=e||{},f=window.c;f.beginPath(),f.lineWidth=(e.lineWidth||settings.lineWidth)/10,f.globalCompositeOperation="source-out",f.moveTo(a,b),f.lineTo(c,d),window.points=window.points.filter(function(e){return threshold(e.x,e.y,a,b,f.lineWidth)||threshold(e.x,e.y,c,d,f.lineWidth)?!1:!0})}function line(a,b,c){var c=c||{},d=window.o;d.beginPath(),d.lineCap=c.lineCap||settings.lineCap,d.lineJoin=c.lineJoin||settings.lineJoin,d.strokeStyle=c.color||settings.color,d.fillStyle=c.color||settings.color,d.lineWidth=(c.lineWidth||settings.lineWidth)/10;var e=settings.drawingLine.length-1;d.moveTo(settings.drawingLine[e].x,settings.drawingLine[e].y),d.lineTo(a,b),settings.drawingLine.push({x:a,y:b}),d.stroke(),(c.fill||settings.fill)&&d.fill()}function finishLine(a){var a=a||{},b=window.c;o.clear(),b.beginPath(),b.strokeStyle=a.color||settings.color,b.fillStyle=a.color||settings.color,b.lineWidth=(a.lineWidth||settings.lineWidth)/10,b.lineJoin=a.lineJoin||settings.lineJoin,b.lineCap=a.lineJoin||settings.lineJoin,b.moveTo(settings.drawingLine[0].x,settings.drawingLine[0].y);for(var c=1,d=settings.drawingLine.length;d>c;c++)b.lineTo(settings.drawingLine[c].x,settings.drawingLine[c].y);settings.stroke&&b.stroke(),settings.fill&&b.fill(),settings.drawingLine=[],window.points.history.push({data:b.getImageData(0,0,width(),height()),points:window.points.slice(0)}),window.points.history.last=window.points.history.length-1}function undo(){var a=window.points.history;if(a.last>1){var b=a[a.last-1];c.putImageData(b.data,0,0),window.points=b.points.slice(0),window.points.history=a,window.points.history.last=a.last-1}else c.clear(),window.points=[],window.points.history=a,window.points.history.last=0}function redo(){var a=window.points.history;if(a.last1&&(d&&threshold(d.x,d.y,a,b,f[0])||threshold(c.x,c.y,a,b,f[1]))?(window.active=!1,points[points.length-1].type="",points[points.length-1].start=void 0,void finishLine()):void points.push(e)}function drawPoint(a,b){var c=points[points.length-1];switch(c.type){case"eraser":erase(c.x,c.y,a,b);case"pencil":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);break;case"sketch":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);for(var e=0,f=points.length-1;f>e;e++)if(threshold(points[e].x,points[e].y,d.x,d.y,settings.connectTelorance)){var a=points[e].x-d.x,b=points[e].y-d.y,g=settings.lineWidth/20>.2?settings.lineWidth/20:.2;draw(points[e].x-.2*a,points[e].y-.2*b,d.x+.2*a,d.y+.2*b,{strokeStyle:"rgba(0,0,0,0.4)",lineWidth:g})}break;case"fur":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);for(var e=0,f=points.length-1;f>e;e++)if(threshold(points[e].x,points[e].y,d.x,d.y,settings.connectTelorance)){var a=points[e].x-d.x,b=points[e].y-d.y,h=settings.furLength/100||.2,g=settings.lineWidth/20>.2?settings.lineWidth/20:.2;draw(points[e].x+a*h,points[e].y+b*h,d.x-a*h,d.y-b*h,{strokeStyle:"rgba(0,0,0,0.4)",lineWidth:g})}break;case"shape":o.clear(),o.beginPath(),o.fillStyle=settings.color,o.strokeStyle=settings.color,o.lineWidth=settings.lineWidth/20;var i=settings.shapeStart;switch(settings.shape){case"circle":var j=Math.abs(a-i.x);o.arc(i.x,i.y,j,0,2*Math.PI),settings.comShape={type:"circle",x:i.x,y:i.y,radius:j};break;case"rectangle":var g=a-i.x,k=b-i.y;o.rect(i.x,i.y,g,k),settings.comShape={type:"rectangle",x:i.x,y:i.y,w:g,h:k};break;case"square":var g=a-i.x;o.rect(i.x,i.y,g,g),settings.comShape={type:"rectangle",x:i.x,y:i.y,w:g,h:g};break;case"triangle":var l=(a-i.x)/2,m=(b-i.y)/2;o.moveTo(i.x+l,i.y),o.lineTo(a,b),o.lineTo(i.x,b),o.lineTo(i.x+l,i.y),settings.comShape={type:"triangle",start:{x:i.x,y:i.y},x:a,y:b,dix:l,diy:m}}settings.fill&&o.fill(),settings.stroke&&o.stroke()}} \ No newline at end of file diff --git a/build/mobile/js/libs/color-picker-touch.js b/build/mobile/js/libs/color-picker-touch.js new file mode 100644 index 0000000..a4b5f79 --- /dev/null +++ b/build/mobile/js/libs/color-picker-touch.js @@ -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")})}); \ No newline at end of file diff --git a/build/mobile/js/libs/color-picker.js b/build/mobile/js/libs/color-picker.js new file mode 100644 index 0000000..0563b45 --- /dev/null +++ b/build/mobile/js/libs/color-picker.js @@ -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")})}); \ No newline at end of file diff --git a/build/mobile/js/libs/mobilebrowsers.js b/build/mobile/js/libs/mobilebrowsers.js new file mode 100644 index 0000000..a7caf2a --- /dev/null +++ b/build/mobile/js/libs/mobilebrowsers.js @@ -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"); \ No newline at end of file diff --git a/build/mobile/js/libs/stack.js b/build/mobile/js/libs/stack.js new file mode 100644 index 0000000..f9c8d3b --- /dev/null +++ b/build/mobile/js/libs/stack.js @@ -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); \ No newline at end of file diff --git a/build/mobile/js/libs/touch.js b/build/mobile/js/libs/touch.js new file mode 100644 index 0000000..4981bd7 --- /dev/null +++ b/build/mobile/js/libs/touch.js @@ -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); \ No newline at end of file diff --git a/build/mobile/js/libs/yepnope.min.js b/build/mobile/js/libs/yepnope.min.js new file mode 100644 index 0000000..bd57852 --- /dev/null +++ b/build/mobile/js/libs/yepnope.min.js @@ -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;i0?y.fn.concat.apply([],a):a}function k(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(a){return a in H?H[a]:H[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function m(a,b){return"number"!=typeof b||I[k(a)]?b:b+"px"}function n(a){var b,c;return G[a]||(b=F.createElement(a),F.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),"none"==c&&(c="block"),G[a]=c),G[a]}function o(a){return"children"in a?D.call(a.children):y.map(a.childNodes,function(a){return 1==a.nodeType?a:void 0})}function p(a,b,c){for(x in b)c&&(f(b[x])||g(b[x]))?(f(b[x])&&!f(a[x])&&(a[x]={}),g(b[x])&&!g(a[x])&&(a[x]=[]),p(a[x],b[x],c)):b[x]!==w&&(a[x]=b[x])}function q(a,b){return null==b?y(a):y(a).filter(b)}function r(a,c,d,e){return b(c)?c.call(a,d,e):c}function s(a,b,c){null==c?a.removeAttribute(b):a.setAttribute(b,c)}function t(a,b){var c=a.className,d=c&&c.baseVal!==w;return b===w?d?c.baseVal:c:void(d?c.baseVal=b:a.className=b)}function u(a){var b;try{return a?"true"==a||("false"==a?!1:"null"==a?null:/^0/.test(a)||isNaN(b=Number(a))?/^[\[\{]/.test(a)?y.parseJSON(a):a:b):a}catch(c){return a}}function v(a,b){b(a);for(var c in a.childNodes)v(a.childNodes[c],b)}var w,x,y,z,A,B,C=[],D=C.slice,E=C.filter,F=window.document,G={},H={},I={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},J=/^\s*<(\w+|!)[^>]*>/,K=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,L=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,M=/^(?:body|html)$/i,N=/([A-Z])/g,O=["val","css","html","text","data","width","height","offset"],P=["after","prepend","before","append"],Q=F.createElement("table"),R=F.createElement("tr"),S={tr:F.createElement("tbody"),tbody:Q,thead:Q,tfoot:Q,td:R,th:R,"*":F.createElement("div")},T=/complete|loaded|interactive/,U=/^[\w-]*$/,V={},W=V.toString,X={},Y=F.createElement("div"),Z={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return X.matches=function(a,b){if(!b||!a||1!==a.nodeType)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=Y).appendChild(a),d=~X.qsa(e,b).indexOf(a),f&&Y.removeChild(a),d},A=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},B=function(a){return E.call(a,function(b,c){return a.indexOf(b)==c})},X.fragment=function(a,b,c){var d,e,g;return K.test(a)&&(d=y(F.createElement(RegExp.$1))),d||(a.replace&&(a=a.replace(L,"<$1>")),b===w&&(b=J.test(a)&&RegExp.$1),b in S||(b="*"),g=S[b],g.innerHTML=""+a,d=y.each(D.call(g.childNodes),function(){g.removeChild(this)})),f(c)&&(e=y(d),y.each(c,function(a,b){O.indexOf(a)>-1?e[a](b):e.attr(a,b)})),d},X.Z=function(a,b){return a=a||[],a.__proto__=y.fn,a.selector=b||"",a},X.isZ=function(a){return a instanceof X.Z},X.init=function(a,c){var d;if(!a)return X.Z();if("string"==typeof a)if(a=a.trim(),"<"==a[0]&&J.test(a))d=X.fragment(a,RegExp.$1,c),a=null;else{if(c!==w)return y(c).find(a);d=X.qsa(F,a)}else{if(b(a))return y(F).ready(a);if(X.isZ(a))return a;if(g(a))d=i(a);else if(e(a))d=[a],a=null;else if(J.test(a))d=X.fragment(a.trim(),RegExp.$1,c),a=null;else{if(c!==w)return y(c).find(a);d=X.qsa(F,a)}}return X.Z(d,a)},y=function(a,b){return X.init(a,b)},y.extend=function(a){var b,c=D.call(arguments,1);return"boolean"==typeof a&&(b=a,a=c.shift()),c.forEach(function(c){p(a,c,b)}),a},X.qsa=function(a,b){var c,e="#"==b[0],f=!e&&"."==b[0],g=e||f?b.slice(1):b,h=U.test(g);return d(a)&&h&&e?(c=a.getElementById(g))?[c]:[]:1!==a.nodeType&&9!==a.nodeType?[]:D.call(h&&!e?f?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},y.contains=function(a,b){return a!==b&&a.contains(b)},y.type=a,y.isFunction=b,y.isWindow=c,y.isArray=g,y.isPlainObject=f,y.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},y.inArray=function(a,b,c){return C.indexOf.call(b,a,c)},y.camelCase=A,y.trim=function(a){return null==a?"":String.prototype.trim.call(a)},y.uuid=0,y.support={},y.expr={},y.map=function(a,b){var c,d,e,f=[];if(h(a))for(d=0;d=0?a:a+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(a){return C.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return b(a)?this.not(this.not(a)):y(E.call(this,function(b){return X.matches(b,a)}))},add:function(a,b){return y(B(this.concat(y(a,b))))},is:function(a){return this.length>0&&X.matches(this[0],a)},not:function(a){var c=[];if(b(a)&&a.call!==w)this.each(function(b){a.call(this,b)||c.push(this)});else{var d="string"==typeof a?this.filter(a):h(a)&&b(a.item)?D.call(a):y(a);this.forEach(function(a){d.indexOf(a)<0&&c.push(a)})}return y(c)},has:function(a){return this.filter(function(){return e(a)?y.contains(this,a):y(this).find(a).size()})},eq:function(a){return-1===a?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!e(a)?a:y(a)},last:function(){var a=this[this.length-1];return a&&!e(a)?a:y(a)},find:function(a){var b,c=this;return b="object"==typeof a?y(a).filter(function(){var a=this;return C.some.call(c,function(b){return y.contains(b,a)})}):1==this.length?y(X.qsa(this[0],a)):this.map(function(){return X.qsa(this,a)})},closest:function(a,b){var c=this[0],e=!1;for("object"==typeof a&&(e=y(a));c&&!(e?e.indexOf(c)>=0:X.matches(c,a));)c=c!==b&&!d(c)&&c.parentNode;return y(c)},parents:function(a){for(var b=[],c=this;c.length>0;)c=y.map(c,function(a){return(a=a.parentNode)&&!d(a)&&b.indexOf(a)<0?(b.push(a),a):void 0});return q(b,a)},parent:function(a){return q(B(this.pluck("parentNode")),a)},children:function(a){return q(this.map(function(){return o(this)}),a)},contents:function(){return this.map(function(){return D.call(this.childNodes)})},siblings:function(a){return q(this.map(function(a,b){return E.call(o(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return y.map(this,function(b){return b[a]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=n(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var c=b(a);if(this[0]&&!c)var d=y(a).get(0),e=d.parentNode||this.length>1;return this.each(function(b){y(this).wrapAll(c?a.call(this,b):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){y(this[0]).before(a=y(a));for(var b;(b=a.children()).length;)a=b.first();y(a).append(this)}return this},wrapInner:function(a){var c=b(a);return this.each(function(b){var d=y(this),e=d.contents(),f=c?a.call(this,b):a;e.length?e.wrapAll(f):d.append(f)})},unwrap:function(){return this.parent().each(function(){y(this).replaceWith(y(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(a){return this.each(function(){var b=y(this);(a===w?"none"==b.css("display"):a)?b.show():b.hide()})},prev:function(a){return y(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return y(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(b){var c=this.innerHTML;y(this).empty().append(r(this,a,b,c))})},text:function(a){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=a===w?"":""+a})},attr:function(a,b){var c;return"string"==typeof a&&b===w?0==this.length||1!==this[0].nodeType?w:"value"==a&&"INPUT"==this[0].nodeName?this.val():!(c=this[0].getAttribute(a))&&a in this[0]?this[0][a]:c:this.each(function(c){if(1===this.nodeType)if(e(a))for(x in a)s(this,x,a[x]);else s(this,a,r(this,b,c,this.getAttribute(a)))})},removeAttr:function(a){return this.each(function(){1===this.nodeType&&s(this,a)})},prop:function(a,b){return a=Z[a]||a,b===w?this[0]&&this[0][a]:this.each(function(c){this[a]=r(this,b,c,this[a])})},data:function(a,b){var c=this.attr("data-"+a.replace(N,"-$1").toLowerCase(),b);return null!==c?u(c):w},val:function(a){return 0===arguments.length?this[0]&&(this[0].multiple?y(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=r(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var c=y(this),d=r(this,a,b,c.offset()),e=c.offsetParent().offset(),f={top:d.top-e.top,left:d.left-e.left};"static"==c.css("position")&&(f.position="relative"),c.css(f)});if(0==this.length)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(b,c){if(arguments.length<2){var d=this[0],e=getComputedStyle(d,"");if(!d)return;if("string"==typeof b)return d.style[A(b)]||e.getPropertyValue(b);if(g(b)){var f={};return y.each(g(b)?b:[b],function(a,b){f[b]=d.style[A(b)]||e.getPropertyValue(b)}),f}}var h="";if("string"==a(b))c||0===c?h=k(b)+":"+m(b,c):this.each(function(){this.style.removeProperty(k(b))});else for(x in b)b[x]||0===b[x]?h+=k(x)+":"+m(x,b[x])+";":this.each(function(){this.style.removeProperty(k(x))});return this.each(function(){this.style.cssText+=";"+h})},index:function(a){return a?this.indexOf(y(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?C.some.call(this,function(a){return this.test(t(a))},l(a)):!1},addClass:function(a){return a?this.each(function(b){z=[];var c=t(this),d=r(this,a,b,c);d.split(/\s+/g).forEach(function(a){y(this).hasClass(a)||z.push(a)},this),z.length&&t(this,c+(c?" ":"")+z.join(" "))}):this},removeClass:function(a){return this.each(function(b){return a===w?t(this,""):(z=t(this),r(this,a,b,z).split(/\s+/g).forEach(function(a){z=z.replace(l(a)," ")}),t(this,z.trim()),void 0)})},toggleClass:function(a,b){return a?this.each(function(c){var d=y(this),e=r(this,a,c,t(this));e.split(/\s+/g).forEach(function(a){(b===w?!d.hasClass(a):b)?d.addClass(a):d.removeClass(a)})}):this},scrollTop:function(a){if(this.length){var b="scrollTop"in this[0];return a===w?b?this[0].scrollTop:this[0].pageYOffset:this.each(b?function(){this.scrollTop=a}:function(){this.scrollTo(this.scrollX,a)})}},scrollLeft:function(a){if(this.length){var b="scrollLeft"in this[0];return a===w?b?this[0].scrollLeft:this[0].pageXOffset:this.each(b?function(){this.scrollLeft=a}:function(){this.scrollTo(a,this.scrollY)})}},position:function(){if(this.length){var a=this[0],b=this.offsetParent(),c=this.offset(),d=M.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(y(a).css("margin-top"))||0,c.left-=parseFloat(y(a).css("margin-left"))||0,d.top+=parseFloat(y(b[0]).css("border-top-width"))||0,d.left+=parseFloat(y(b[0]).css("border-left-width"))||0,{top:c.top-d.top,left:c.left-d.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||F.body;a&&!M.test(a.nodeName)&&"static"==y(a).css("position");)a=a.offsetParent;return a})}},y.fn.detach=y.fn.remove,["width","height"].forEach(function(a){var b=a.replace(/./,function(a){return a[0].toUpperCase()});y.fn[a]=function(e){var f,g=this[0];return e===w?c(g)?g["inner"+b]:d(g)?g.documentElement["scroll"+b]:(f=this.offset())&&f[a]:this.each(function(b){g=y(this),g.css(a,r(this,e,b,g[a]()))})}}),P.forEach(function(b,c){var d=c%2;y.fn[b]=function(){var b,e,f=y.map(arguments,function(c){return b=a(c),"object"==b||"array"==b||null==c?c:X.fragment(c)}),g=this.length>1;return f.length<1?this:this.each(function(a,b){e=d?b:b.parentNode,b=0==c?b.nextSibling:1==c?b.firstChild:2==c?b:null,f.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!e)return y(a).remove();v(e.insertBefore(a,b),function(a){null!=a.nodeName&&"SCRIPT"===a.nodeName.toUpperCase()&&(!a.type||"text/javascript"===a.type)&&!a.src&&window.eval.call(window,a.innerHTML)})})})},y.fn[d?b+"To":"insert"+(c?"Before":"After")]=function(a){return y(a)[b](this),this}}),X.Z.prototype=y.fn,X.uniq=B,X.deserializeValue=u,y.zepto=X,y}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(a){function b(a){return a._zid||(a._zid=m++)}function c(a,c,f,g){if(c=d(c),c.ns)var h=e(c.ns);return(q[b(a)]||[]).filter(function(a){return!(!a||c.e&&a.e!=c.e||c.ns&&!h.test(a.ns)||f&&b(a.fn)!==b(f)||g&&a.sel!=g)})}function d(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function e(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function f(a,b){return a.del&&!s&&a.e in t||!!b}function g(a){return u[a]||s&&t[a]||a}function h(c,e,h,i,k,m,n){var o=b(c),p=q[o]||(q[o]=[]);e.split(/\s/).forEach(function(b){if("ready"==b)return a(document).ready(h);var e=d(b);e.fn=h,e.sel=k,e.e in u&&(h=function(b){var c=b.relatedTarget;return!c||c!==this&&!a.contains(this,c)?e.fn.apply(this,arguments):void 0}),e.del=m;var o=m||h;e.proxy=function(a){if(a=j(a),!a.isImmediatePropagationStopped()){a.data=i;var b=o.apply(c,a._args==l?[a]:[a].concat(a._args));return b===!1&&(a.preventDefault(),a.stopPropagation()),b}},e.i=p.length,p.push(e),"addEventListener"in c&&c.addEventListener(g(e.e),e.proxy,f(e,n))})}function i(a,d,e,h,i){var j=b(a);(d||"").split(/\s/).forEach(function(b){c(a,b,e,h).forEach(function(b){delete q[j][b.i],"removeEventListener"in a&&a.removeEventListener(g(b.e),b.proxy,f(b,i))})})}function j(b,c){return(c||!b.isDefaultPrevented)&&(c||(c=b),a.each(y,function(a,d){var e=c[a];b[a]=function(){return this[d]=v,e&&e.apply(c,arguments)},b[d]=w}),(c.defaultPrevented!==l?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())&&(b.isDefaultPrevented=v)),b}function k(a){var b,c={originalEvent:a};for(b in a)!x.test(b)&&a[b]!==l&&(c[b]=a[b]);return j(c,a)}var l,m=(a.zepto.qsa,1),n=Array.prototype.slice,o=a.isFunction,p=function(a){return"string"==typeof a},q={},r={},s="onfocusin"in window,t={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};r.click=r.mousedown=r.mouseup=r.mousemove="MouseEvents",a.event={add:h,remove:i},a.proxy=function(c,d){if(o(c)){var e=function(){return c.apply(d,arguments)};return e._zid=b(c),e}if(p(d))return a.proxy(c[d],c);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var v=function(){return!0},w=function(){return!1},x=/^([A-Z]|returnValue$|layer[XY]$)/,y={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,d,e,f){var g,j,m=this;return b&&!p(b)?(a.each(b,function(a,b){m.on(a,c,d,b,f)}),m):(!p(c)&&!o(e)&&e!==!1&&(e=d,d=c,c=l),(o(d)||d===!1)&&(e=d,d=l),e===!1&&(e=w),m.each(function(l,m){f&&(g=function(a){return i(m,a.type,e),e.apply(this,arguments)}),c&&(j=function(b){var d,f=a(b.target).closest(c,m).get(0);return f&&f!==m?(d=a.extend(k(b),{currentTarget:f,liveFired:m}),(g||e).apply(f,[d].concat(n.call(arguments,1)))):void 0}),h(m,b,e,d,c,j||g)}))},a.fn.off=function(b,c,d){var e=this;return b&&!p(b)?(a.each(b,function(a,b){e.off(a,c,b)}),e):(!p(c)&&!o(d)&&d!==!1&&(d=c,c=l),d===!1&&(d=w),e.each(function(){i(this,b,d,c)}))},a.fn.trigger=function(b,c){return b=p(b)||a.isPlainObject(b)?a.Event(b):j(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,d){var e,f;return this.each(function(g,h){e=k(p(b)?a.Event(b):b),e._args=d,e.target=h,a.each(c(h,b.type||b),function(a,b){return f=b.proxy(e),e.isImmediatePropagationStopped()?!1:void 0})}),f},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){p(a)||(b=a,a=b.type);var c=document.createEvent(r[a]||"Events"),d=!0;if(b)for(var e in b)"bubbles"==e?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),j(c)}}(Zepto),function(a){function b(b,c,d){var e=a.Event(c);return a(b).trigger(e,d),!e.isDefaultPrevented()}function c(a,c,d,e){return a.global?b(c||s,d,e):void 0}function d(b){b.global&&0===a.active++&&c(b,null,"ajaxStart")}function e(b){b.global&&!--a.active&&c(b,null,"ajaxStop")}function f(a,b){var d=b.context;return b.beforeSend.call(d,a,b)===!1||c(b,d,"ajaxBeforeSend",[a,b])===!1?!1:void c(b,d,"ajaxSend",[a,b])}function g(a,b,d,e){var f=d.context,g="success";d.success.call(f,a,g,b),e&&e.resolveWith(f,[a,g,b]),c(d,f,"ajaxSuccess",[b,d,a]),i(g,b,d)}function h(a,b,d,e,f){var g=e.context;e.error.call(g,d,b,a),f&&f.rejectWith(g,[d,b,a]),c(e,g,"ajaxError",[d,e,a||b]),i(b,d,e)}function i(a,b,d){var f=d.context;d.complete.call(f,b,a),c(d,f,"ajaxComplete",[b,d]),e(d)}function j(){}function k(a){return a&&(a=a.split(";",2)[0]),a&&(a==x?"html":a==w?"json":u.test(a)?"script":v.test(a)&&"xml")||"text"}function l(a,b){return""==b?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function m(b){b.processData&&b.data&&"string"!=a.type(b.data)&&(b.data=a.param(b.data,b.traditional)),b.data&&(!b.type||"GET"==b.type.toUpperCase())&&(b.url=l(b.url,b.data),b.data=void 0)}function n(b,c,d,e){var f=!a.isFunction(c);return{url:b,data:f?c:void 0,success:f?a.isFunction(d)?d:void 0:c,dataType:f?e||d:d}}function o(b,c,d,e){var f,g=a.isArray(c),h=a.isPlainObject(c);a.each(c,function(c,i){f=a.type(i),e&&(c=d?e:e+"["+(h||"object"==f||"array"==f?c:"")+"]"),!e&&g?b.add(i.name,i.value):"array"==f||!d&&"object"==f?o(b,i,d,c):b.add(c,i)})}var p,q,r=0,s=window.document,t=/)<[^<]*)*<\/script>/gi,u=/^(?:text|application)\/javascript/i,v=/^(?:text|application)\/xml/i,w="application/json",x="text/html",y=/^\s*$/;a.active=0,a.ajaxJSONP=function(b,c){if("type"in b){var d,e,i=b.jsonpCallback,j=(a.isFunction(i)?i():i)||"jsonp"+ ++r,k=s.createElement("script"),l=window[j],m=function(b){a(k).triggerHandler("error",b||"abort")},n={abort:m};return c&&c.promise(n),a(k).on("load error",function(f,i){clearTimeout(e),a(k).off().remove(),"error"!=f.type&&d?g(d[0],n,b,c):h(null,i||"error",n,b,c),window[j]=l,d&&a.isFunction(l)&&l(d[0]),l=d=void 0}),f(n,b)===!1?(m("abort"),n):(window[j]=function(){d=arguments},k.src=b.url.replace(/=\?/,"="+j),s.head.appendChild(k),b.timeout>0&&(e=setTimeout(function(){m("timeout")},b.timeout)),n)}return a.ajax(b)},a.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:w,xml:"application/xml, text/xml",html:x,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},a.ajax=function(b){var c=a.extend({},b||{}),e=a.Deferred&&a.Deferred();for(p in a.ajaxSettings)void 0===c[p]&&(c[p]=a.ajaxSettings[p]);d(c),c.crossDomain||(c.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(c.url)&&RegExp.$2!=window.location.host),c.url||(c.url=window.location.toString()),m(c),c.cache===!1&&(c.url=l(c.url,"_="+Date.now()));var i=c.dataType,n=/=\?/.test(c.url);if("jsonp"==i||n)return n||(c.url=l(c.url,c.jsonp?c.jsonp+"=?":c.jsonp===!1?"":"callback=?")),a.ajaxJSONP(c,e);var o,r=c.accepts[i],s={},t=function(a,b){s[a.toLowerCase()]=[a,b]},u=/^([\w-]+:)\/\//.test(c.url)?RegExp.$1:window.location.protocol,v=c.xhr(),w=v.setRequestHeader;if(e&&e.promise(v),c.crossDomain||t("X-Requested-With","XMLHttpRequest"),t("Accept",r||"*/*"),(r=c.mimeType||r)&&(r.indexOf(",")>-1&&(r=r.split(",",2)[0]),v.overrideMimeType&&v.overrideMimeType(r)),(c.contentType||c.contentType!==!1&&c.data&&"GET"!=c.type.toUpperCase())&&t("Content-Type",c.contentType||"application/x-www-form-urlencoded"),c.headers)for(q in c.headers)t(q,c.headers[q]);if(v.setRequestHeader=t,v.onreadystatechange=function(){if(4==v.readyState){v.onreadystatechange=j,clearTimeout(o);var b,d=!1;if(v.status>=200&&v.status<300||304==v.status||0==v.status&&"file:"==u){i=i||k(c.mimeType||v.getResponseHeader("content-type")),b=v.responseText;try{"script"==i?(1,eval)(b):"xml"==i?b=v.responseXML:"json"==i&&(b=y.test(b)?null:a.parseJSON(b))}catch(f){d=f}d?h(d,"parsererror",v,c,e):g(b,v,c,e)}else h(v.statusText||null,v.status?"error":"abort",v,c,e)}},f(v,c)===!1)return v.abort(),h(null,"abort",v,c,e),v;if(c.xhrFields)for(q in c.xhrFields)v[q]=c.xhrFields[q];var x="async"in c?c.async:!0;v.open(c.type,c.url,x,c.username,c.password);for(q in s)w.apply(v,s[q]);return c.timeout>0&&(o=setTimeout(function(){v.onreadystatechange=j,v.abort(),h(null,"timeout",v,c,e)},c.timeout)),v.send(c.data?c.data:null),v},a.get=function(){return a.ajax(n.apply(null,arguments))},a.post=function(){var b=n.apply(null,arguments);return b.type="POST",a.ajax(b)},a.getJSON=function(){var b=n.apply(null,arguments);return b.dataType="json",a.ajax(b)},a.fn.load=function(b,c,d){if(!this.length)return this;var e,f=this,g=b.split(/\s/),h=n(b,c,d),i=h.success;return g.length>1&&(h.url=g[0],e=g[1]),h.success=function(b){f.html(e?a("
    ").html(b.replace(t,"")).find(e):b),i&&i.apply(f,arguments)},a.ajax(h),this};var z=encodeURIComponent;a.param=function(a,b){var c=[];return c.add=function(a,b){this.push(z(a)+"="+z(b))},o(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b,c=[];return a([].slice.call(this.get(0).elements)).each(function(){b=a(this);var d=b.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=d&&"reset"!=d&&"button"!=d&&("radio"!=d&&"checkbox"!=d||this.checked)&&c.push({name:b.attr("name"),value:b.val()})}),c},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){return b=b||[],a.extend(b,a.fn),b.selector=c||"",b.__Z=!0,b},isZ:function(b){return"array"===a.type(b)&&"__Z"in b}});try{getComputedStyle(void 0)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}}(Zepto); \ No newline at end of file diff --git a/build/mobile/js/main.js b/build/mobile/js/main.js new file mode 100644 index 0000000..e882e71 --- /dev/null +++ b/build/mobile/js/main.js @@ -0,0 +1 @@ +"use strict";$(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",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(),localStorage.getItem("sawTips")!=settings.version&&($(".tour").removeClass("hidden"),localStorage.setItem("sawTips",settings.version))}); \ No newline at end of file diff --git a/build/mobile/js/shared.js b/build/mobile/js/shared.js new file mode 100644 index 0000000..937af65 --- /dev/null +++ b/build/mobile/js/shared.js @@ -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",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))}); \ No newline at end of file diff --git a/build/mobile/manifest.webapp b/build/mobile/manifest.webapp new file mode 100644 index 0000000..e644881 --- /dev/null +++ b/build/mobile/manifest.webapp @@ -0,0 +1,42 @@ +{ + "name": "Sketchy", + "description": "Free Sketch/Paint app", + "version": "1.2", + "fullscreen": "true", + "type": "privileged", + "launch_path": "/index.html", + "default_locale": "en", + "icons": { + "16": "/img/icons/icon16.png", + "32": "/img/icons/icon32.png", + "48": "/img/icons/icon48.png", + "60": "/img/icons/icon60.png", + "64": "/img/icons/icon64.png", + "90": "/img/icons/icon90.png", + "120": "/img/icons/icon120.png", + "128": "/img/icons/icon128.png" + }, + "developer": { + "name": "Mahdi Dibaiee", + "url": "https://twitter.com/mdibaiee" + }, + "locales": { + "en": { + "name": "Sketchy", + "description": "Free Sketch/Paint app" + }, + "fa": { + "name": "Sketchy", + "description": "برنامه‌ی رایگان طراحی/نقاشی" + } + }, + "orientation": [ + "portrait" + ], + "permissions": { + "device-storage:pictures": { + "description": "Required to save sketched pics", + "access": "readwrite" + } + } +} diff --git a/build/web/cache.appcache b/build/web/cache.appcache new file mode 100644 index 0000000..1094b86 --- /dev/null +++ b/build/web/cache.appcache @@ -0,0 +1,5 @@ +CACHE MANIFEST +# v1 +index.html +js +css diff --git a/build/web/css/fonts/MozTT-Bold.ttf b/build/web/css/fonts/MozTT-Bold.ttf new file mode 100644 index 0000000..8ad5fab Binary files /dev/null and b/build/web/css/fonts/MozTT-Bold.ttf differ diff --git a/build/web/css/fonts/MozTT-Light.ttf b/build/web/css/fonts/MozTT-Light.ttf new file mode 100644 index 0000000..0553c17 Binary files /dev/null and b/build/web/css/fonts/MozTT-Light.ttf differ diff --git a/build/web/css/fonts/MozTT-Medium.ttf b/build/web/css/fonts/MozTT-Medium.ttf new file mode 100644 index 0000000..91466be Binary files /dev/null and b/build/web/css/fonts/MozTT-Medium.ttf differ diff --git a/build/web/css/fonts/MozTT-Regular.ttf b/build/web/css/fonts/MozTT-Regular.ttf new file mode 100644 index 0000000..e74e0b2 Binary files /dev/null and b/build/web/css/fonts/MozTT-Regular.ttf differ diff --git a/build/web/css/imgs/bg_overlay_pressed_1.png b/build/web/css/imgs/bg_overlay_pressed_1.png new file mode 100644 index 0000000..753e953 Binary files /dev/null and b/build/web/css/imgs/bg_overlay_pressed_1.png differ diff --git a/build/web/css/imgs/bg_overlay_pressed_2.png b/build/web/css/imgs/bg_overlay_pressed_2.png new file mode 100644 index 0000000..8db4bbf Binary files /dev/null and b/build/web/css/imgs/bg_overlay_pressed_2.png differ diff --git a/build/web/css/imgs/clear.png b/build/web/css/imgs/clear.png new file mode 100644 index 0000000..cfcff2e Binary files /dev/null and b/build/web/css/imgs/clear.png differ diff --git a/build/web/css/imgs/div_line_lg_black.png b/build/web/css/imgs/div_line_lg_black.png new file mode 100644 index 0000000..2fd663e Binary files /dev/null and b/build/web/css/imgs/div_line_lg_black.png differ diff --git a/build/web/css/imgs/div_line_sm_black.png b/build/web/css/imgs/div_line_sm_black.png new file mode 100644 index 0000000..c1b4c09 Binary files /dev/null and b/build/web/css/imgs/div_line_sm_black.png differ diff --git a/build/web/css/imgs/download.png b/build/web/css/imgs/download.png new file mode 100644 index 0000000..897c9f2 Binary files /dev/null and b/build/web/css/imgs/download.png differ diff --git a/build/web/css/imgs/header_bg_black.png b/build/web/css/imgs/header_bg_black.png new file mode 100644 index 0000000..5670021 Binary files /dev/null and b/build/web/css/imgs/header_bg_black.png differ diff --git a/build/web/css/imgs/load.png b/build/web/css/imgs/load.png new file mode 100644 index 0000000..193d42f Binary files /dev/null and b/build/web/css/imgs/load.png differ diff --git a/build/web/css/imgs/menu.png b/build/web/css/imgs/menu.png new file mode 100644 index 0000000..c0d38c0 Binary files /dev/null and b/build/web/css/imgs/menu.png differ diff --git a/build/web/css/imgs/redo.png b/build/web/css/imgs/redo.png new file mode 100644 index 0000000..d2864fb Binary files /dev/null and b/build/web/css/imgs/redo.png differ diff --git a/build/web/css/imgs/settings.png b/build/web/css/imgs/settings.png new file mode 100644 index 0000000..6792c46 Binary files /dev/null and b/build/web/css/imgs/settings.png differ diff --git a/build/web/css/imgs/undo.png b/build/web/css/imgs/undo.png new file mode 100644 index 0000000..6117001 Binary files /dev/null and b/build/web/css/imgs/undo.png differ diff --git a/build/web/css/main.css b/build/web/css/main.css new file mode 100644 index 0000000..e2da7ab --- /dev/null +++ b/build/web/css/main.css @@ -0,0 +1,631 @@ +@font-face { + font-family: 'MozTT-Regular'; + src: url('fonts/MozTT-Regular.ttf'); +} +@font-face { + font-family: 'MozTT-Light'; + src: url('fonts/MozTT-Light.ttf'); +} +@font-face { + font-family: 'MozTT-Medium'; + src: url('fonts/MozTT-Medium.ttf'); +} +@font-face { + font-family: 'MozTT-Bold'; + src: url('fonts/MozTT-Bold.ttf'); +} +/* Purty Picker Copyright 2013 Jayden Seric (MIT license): https://github.com/jaydenseric/Purty-Picker */ +/* Core: No touchy! */ +.color-picker .spectrum { + position: relative; + /* To position pin, luminosity filter */ + background: linear-gradient(#808080, transparent), linear-gradient(90deg, #ff0000, #ff2b00, #ff5500, #ff8000, #ffaa00, #ffd500, #ffff00, #d4ff00, #aaff00, #80ff00, #55ff00, #2bff00, #00ff00, #00ff2b, #00ff55, #00ff80, #00ffaa, #00ffd5, #00ffff, #00d4ff, #00aaff, #007fff, #0055ff, #002bff, #0000ff, #2a00ff, #5500ff, #7f00ff, #aa00ff, #d400ff, #ff00ff, #ff00d4, #ff00aa, #ff0080, #ff0055, #ff002b, #ff0000); + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + /* Prevent pin interaction causing content selection */ + cursor: crosshair; +} +.color-picker .spectrum.active { + cursor: none; +} +.color-picker .spectrum.active .pin { + cursor: none; +} +.color-picker .spectrum > div { + /* Luminosity filter */ + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; +} +.color-picker .spectrum .pin { + position: absolute; + cursor: move; +} +/* Customization: Default skin */ +.color-picker { + margin: 20px; + padding: 11px; + border: 1px solid #e3e3e3; + border-radius: 4px; + background-color: #f5f5f5; +} +.color-picker .color, +.color-picker .luminosity { + -moz-box-sizing: border-box; + box-sizing: border-box; + display: block; + width: 100%; +} +.color-picker .format { + display: block; + margin: 0 auto 10px auto; +} +.color-picker .color { + -webkit-appearance: none; + border: 0; + border-radius: 2px; + padding: 10px; + text-align: center; + font-size: 11px; + letter-spacing: 1px; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + color: rgba(0, 0, 0, 0.6); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); + transition: color 0.2s; +} +.color-picker .color.dark { + color: rgba(255, 255, 255, 0.7); +} +.color-picker .spectrum { + height: 150px; + /* Arbitary but required */ + overflow: hidden; + /* Prevent pin overflowing container */ + border-radius: 2px; + margin: 10px 0; +} +.color-picker .spectrum > div { + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); +} +.color-picker .spectrum .pin { + margin-left: -4px; + margin-top: -4px; + width: 4px; + height: 4px; + border: 2px solid white; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); + border-radius: 100%; +} +.color-picker .luminosity { + margin: 0; +} +/* ---------------------------------- +* Seekbars +* ---------------------------------- */ +div[role="slider"] { + position: relative; + height: 3.5rem; +} +div[role="slider"] > div { + display: block; + padding: 0; + overflow-y: hidden; + position: relative; + height: 100%; +} +div[role="slider"] progress { + width: 100%; + background: #000; + border: none; + height: 0.1rem; + display: block; + border-radius: 0; + margin-top: 1.9rem; +} +div[role="slider"] progress::-moz-progress-bar { + background: #01c5ed; + height: 0.6rem; + margin-top: -0.3rem; + border-radius: 0; +} +div[role="slider"] > label { + font-size: 1.5rem; + line-height: 3.8rem; + font-family: sans-serif; + color: #00aacb; + float: right; + padding: 0 0 0 1rem; + height: 3.5rem; + width: auto; +} +div[role="slider"] label:first-of-type { + float: left; + padding: 0 1rem 0 0; +} +div[role="slider"] > label.icon { + width: 3rem; + height: 3rem; + margin-top: 0.5rem; + font-size: 0; + background: no-repeat right top / 3rem auto; +} +div[role="slider"] > label.icon:first-of-type { + background-position: top left; +} +div[role="slider"] button { + width: 3.2rem; + height: 3.2rem; + background: url(seekbars/images/ui/handler.png) no-repeat center center / 3rem auto; + font: 0/0 a; + position: absolute; + top: 50%; + left: 0; + margin: -1.5rem 0 0 -1.6rem; + border-radius: 3.2rem; + border: solid 0.1rem transparent; + transition: border 0.15s ease; + padding: 0; + z-index: 10; +} +div[role="slider"] button:active { + border: solid 0.5rem #01c5ed; +} +/* ---------------------------------- + * Value selector (Single & Multiple) + * ---------------------------------- */ +/* Main dialog setup */ +form[role="dialog"][data-type="value-selector"] { + background: url(value_selector/images/ui/pattern.png) repeat left top, url(value_selector/images/ui/gradient.png) no-repeat left top / 100% 100%; + overflow: hidden; + position: absolute; + z-index: 100; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding: 0 0 7rem; + color: #fff; + font-family: sans-serif; +} +form[role="dialog"][data-type="value-selector"] > section { + padding: 0 1.5rem 0; + -moz-box-sizing: padding-box; + width: 100%; + height: 100%; + overflow: auto; +} +form[role="dialog"][data-type="value-selector"] h1 { + font-weight: 400; + font-size: 1.9rem; + line-height: 4.8rem; + color: #fff; + border-bottom: 0.1rem solid #616262; + background: rgba(0, 0, 0, 0.2); + margin: 0 -1.5rem; + padding: 0 3rem 1rem; + height: 4.8rem; + -moz-box-sizing: border-box; +} +/* Specific component code */ +form[role="dialog"][data-type="value-selector"] [role="listbox"] { + position: relative; + padding: 0; + margin: 0 -1.5rem; + max-height: calc(95%); + overflow: auto; + border-top: solid 0.1rem #222323; +} +form[role="dialog"][data-type="value-selector"] .scrollable:before { + content: ""; + display: block; + position: absolute; + pointer-events: none; + top: 4.8rem; + left: 0; + right: 0; + bottom: 6.9rem; + background: url(value_selector/images/ui/shadow.png) repeat-x left top, url(value_selector/images/ui/shadow-invert.png) repeat-x left bottom; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li { + margin: 0; + padding: 0 1.5rem; + height: auto; + list-style: none; + position: relative; + font-weight: lighter; + font-size: 2.2rem; + line-height: 3.9rem; + color: #fff; + transition: background-color 0.2s ease; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:first-child label { + border-top-color: transparent; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li label { + outline: none; + display: block; + color: #fff; + border-top: 0.1rem solid #666; + border-bottom: 0.1rem solid #000; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:last-child label { + border-bottom-color: transparent; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li label span { + display: block; + padding: 1rem 1.5rem; + line-height: 4rem; + word-wrap: break-word; +} +/* Pressed status */ +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active { + background-color: #00ABCC; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active label { + border-color: transparent; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active + li label { + border-top-color: #000; +} +form[role="dialog"][data-type="value-selector"] [role="listbox"] li:active label span { + color: #fff !important; + background-image: none; +} +/* Checked status */ +form[role="dialog"][data-type="value-selector"] [role="listbox"] li[aria-selected="true"]:not([data-input]) span { + padding-right: 2.6rem; + margin-right: 1.2rem; + color: #00abcd; + background: transparent url(value_selector/images/icons/checked.png) no-repeat 100% 50%; + background-size: 2rem; +} +/* Menu & buttons setup */ +form[role="dialog"][data-type="value-selector"] menu { + white-space: nowrap; + margin: 0; + padding: 1.5rem; + border-top: solid 0.1rem rgba(255, 255, 255, 0.1); + background: #2d2d2d url(value_selector/images/ui/pattern.png) repeat left top; + display: block; + overflow: hidden; + position: absolute; + left: 0; + right: 0; + bottom: 0; +} +form[role="dialog"][data-type="value-selector"] menu button::-moz-focus-inner { + border: none; + outline: none; +} +form[role="dialog"][data-type="value-selector"] menu button, +.button { + width: calc(49.5%); + height: 3.8rem; + margin: 0 0 1rem; + padding: 0 1.5rem; + -moz-box-sizing: border-box; + display: inline-block; + vertical-align: middle; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + background: #fafafa url(value_selector/images/ui/default.png) repeat-x left bottom / auto 100%; + border: 0.1rem solid #a6a6a6; + border-radius: 0.3rem; + font-weight: 500; + font-size: 1.6rem; + line-height: 3.8rem; + color: #333; + text-align: center; + text-shadow: 0.1rem 0.1rem 0 rgba(255, 255, 255, 0.3); + text-decoration: none; + outline: none; +} +/* Press (default & affirmative) */ +form[role="dialog"][data-type="value-selector"] menu button:active, +form[role="dialog"][data-type="value-selector"] menu button.affirmative:active, +.button:active { + border-color: #008aaa; + background: #008aaa; + color: #333; +} +/* affirmative */ +form[role="dialog"][data-type="value-selector"] menu button.affirmative, +.button.affirmative { + background-image: url(value_selector/images/ui/affirmative.png); + background-color: #00caf2; + border-color: #008eab; +} +form[role="dialog"][data-type="value-selector"] menu button:last-child { + margin-left: 1rem; +} +form[role="dialog"][data-type="value-selector"] menu button, +form[role="dialog"][data-type="value-selector"] menu button:first-child { + margin: 0; +} +form[role="dialog"][data-type="value-selector"] menu button.full, +.button.full { + width: 100%; +} +/* Right to left tweaks */ +html[dir="rtl"] #value-selector li input:checked + span, +html[dir="rtl"] #value-selector li[aria-selected="true"] span { + padding-left: 2.6rem; + margin-left: 1.2rem; +} +html, +body { + margin: 0; + font-size: 10px; + overflow: hidden; + width: 100%; + height: 100%; +} +*::-moz-focus-inner { + border: none; +} +*:focus { + outline: none; +} +.hidden { + display: none !important; + visibility: none !important; +} +div#container { + position: absolute; +} +canvas { + position: absolute; + top: 0; + left: 0; +} +.separator { + display: block; + height: 4.8rem; + width: 0.1rem; +} +.separator.long { + background: url('imgs/div_line_lg_black.png'); +} +.separator.small { + background: url('imgs/div_line_sm_black.png'); +} +.separator.left { + float: left; +} +.separator.right { + float: right; +} +.separator.menu { + position: relative; + left: -3rem; +} +.overlay { + z-index: 9999; + position: absolute; + left: 0; + top: 5.3rem; +} +button { + -moz-appearance: none; + z-index: 1; + position: relative; + border: none; +} +.close { + display: block; + width: 2rem; + height: 2rem; + padding: 0 0 0.2rem 0.2rem; + font-size: 10pt; + border: 1px solid #e3e3e3; + border-radius: 50%; + position: absolute; + text-align: center; + top: -2%; + left: 97%; +} +.picker, +.about, +.tour { + font-family: 'MozTT-Light'; + width: 30rem; + height: 24.6rem; + position: absolute; + left: 50%; + top: 50%; + margin-top: -12.3rem; + margin-left: -15rem; +} +.picker .color-picker, +.about .color-picker, +.tour .color-picker { + margin: 0; +} +.about, +.tour { + background: #262626; + padding: 1rem 2rem; + height: 23rem; + margin-top: -11.5rem; + margin-left: -17rem; + border-radius: 0.2rem; + color: white; + box-shadow: 0 0 0.3rem black; +} +.about a, +.tour a, +.about a:link, +.tour a:link, +.about a:visited, +.tour a:visited, +.about a:active, +.tour a:active { + color: white; +} +.about .close, +.tour .close { + background: #262626; + color: white; + border: 1px solid gray; +} +.about p, +.tour p { + font-size: 11pt; +} +.about span, +.tour span { + font-size: 8pt; +} +.tour .button { + width: 30rem; + position: absolute; + bottom: 1rem; + left: 1.8rem; +} +header { + width: 100%; + height: 5.3rem; + background: url('imgs/header_bg_black.png'); +} +header button { + width: 5rem; + height: 5rem; +} +header .menu { + background: url('imgs/menu.png') -12px center no-repeat; + float: left; +} +header .menu:active { + background: url('imgs/menu.png') -12px center no-repeat, url('imgs/bg_overlay_pressed_1.png') left no-repeat; +} +header .save { + background: url('imgs/download.png') center center no-repeat; + float: right; +} +header .save:active { + background: url('imgs/download.png') center center no-repeat, url('imgs/bg_overlay_pressed_2.png') center center; +} +header .load { + background: url('imgs/load.png') center center no-repeat; + float: right; +} +header .load:active { + background: url('imgs/load.png') center center no-repeat, url('imgs/bg_overlay_pressed_2.png') center center; +} +header #title { + color: white; + font-size: 11pt; + font-family: 'MozTT-Regular'; + float: left; + margin: 1.5rem 0; + position: relative; + left: -2rem; +} +#menu { + width: 15rem; + height: 100%; + display: block; + background: #262626; + position: absolute; + left: -15rem; + top: 5rem; + color: white; + font-family: 'MozTT-Light'; + font-size: 8pt; + transition: left 0.2s ease-out; + border-collapse: collapse; + overflow-y: auto; +} +#menu.pulled { + left: 0; + transition: left 0.2s ease-out; +} +#menu button[id^='set'], +#menu p, +#menu .bottom button { + background: none; + display: block; + width: 75%; + color: white; + text-align: left; + margin: 1rem 2.5rem; + font-family: 'MozTT-Light'; + font-size: 8pt; + padding: 0 0.6rem; + cursor: pointer; +} +#menu p { + width: 65%; +} +#menu span { + float: right; + font-size: 7pt; +} +#menu div[role='slider'] { + width: 60%; + float: right; + margin: 0 2rem 0 0; +} +#menu div[role='slider'] div { + overflow: visible; +} +#menu div[role='slider'] div button { + margin-top: -3.4rem; + left: 0%; +} +#menu hr { + clear: both; + padding: 0.7rem 0; + margin-bottom: 0.7rem; + border: none; + border-bottom: 1px solid rgba(255, 255, 255, 0.3); +} +#menu *[class^='icon'] { + display: block; + margin: 1rem 0.5rem; +} +#menu *[class^='icon']:nth-of-type(2) { + padding-top: 0.5rem; +} +#menu *[class^='icon']:before { + content: ''; + background-size: 2rem; + width: 2rem; + height: 2rem; + display: block; + float: left; + margin: -0.3rem 0.5rem 0 0; +} +#menu .icon-settings:before { + background-image: url('imgs/settings.png'); +} +#menu .icon-clear:before { + background-image: url('imgs/clear.png'); +} +#menu .icon-undo:before { + background-image: url('imgs/undo.png'); +} +#menu .icon-redo:before { + background-image: url('imgs/redo.png'); +} +#menu .options { + display: table-row; + vertical-align: top; + margin-top: 1rem; +} +#menu .bottom { + width: 100%; + position: absolute; + bottom: 5rem; +} +#menu .bottom button[class^='icon'] { + margin-left: 3.5rem; +} +#menu .bottom button { + margin-left: 5rem; +} diff --git a/build/web/css/seekbars/images/ui/handler.png b/build/web/css/seekbars/images/ui/handler.png new file mode 100644 index 0000000..246b7b4 Binary files /dev/null and b/build/web/css/seekbars/images/ui/handler.png differ diff --git a/build/web/css/seekbars/images/ui/handler@1.5x.png b/build/web/css/seekbars/images/ui/handler@1.5x.png new file mode 100644 index 0000000..26a5092 Binary files /dev/null and b/build/web/css/seekbars/images/ui/handler@1.5x.png differ diff --git a/build/web/css/seekbars/images/ui/handler@2x.png b/build/web/css/seekbars/images/ui/handler@2x.png new file mode 100644 index 0000000..9a69e77 Binary files /dev/null and b/build/web/css/seekbars/images/ui/handler@2x.png differ diff --git a/Web/css/seekbars.less b/build/web/css/seekbars/seekbars.css old mode 100755 new mode 100644 similarity index 97% rename from Web/css/seekbars.less rename to build/web/css/seekbars/seekbars.css index 4717d37..a92a477 --- a/Web/css/seekbars.less +++ b/build/web/css/seekbars/seekbars.css @@ -8,8 +8,8 @@ div[role="slider"] { div[role="slider"] > div { display: block; + overflow: hidden; padding: 0; - overflow-y: hidden; position: relative; height: 100%; } @@ -72,7 +72,6 @@ div[role="slider"] button { border: solid 0.1rem transparent; transition: border 0.15s ease; padding: 0; - z-index: 10; } div[role="slider"] button:active { diff --git a/build/web/css/switches/images/check/danger.png b/build/web/css/switches/images/check/danger.png new file mode 100644 index 0000000..ed1f267 Binary files /dev/null and b/build/web/css/switches/images/check/danger.png differ diff --git a/build/web/css/switches/images/check/danger@1.5x.png b/build/web/css/switches/images/check/danger@1.5x.png new file mode 100644 index 0000000..8d4b61d Binary files /dev/null and b/build/web/css/switches/images/check/danger@1.5x.png differ diff --git a/build/web/css/switches/images/check/danger@2x.png b/build/web/css/switches/images/check/danger@2x.png new file mode 100644 index 0000000..7befd67 Binary files /dev/null and b/build/web/css/switches/images/check/danger@2x.png differ diff --git a/build/web/css/switches/images/check/default.png b/build/web/css/switches/images/check/default.png new file mode 100644 index 0000000..9f188bb Binary files /dev/null and b/build/web/css/switches/images/check/default.png differ diff --git a/build/web/css/switches/images/check/default@1.5x.png b/build/web/css/switches/images/check/default@1.5x.png new file mode 100644 index 0000000..8c25cae Binary files /dev/null and b/build/web/css/switches/images/check/default@1.5x.png differ diff --git a/build/web/css/switches/images/check/default@2x.png b/build/web/css/switches/images/check/default@2x.png new file mode 100644 index 0000000..3e19692 Binary files /dev/null and b/build/web/css/switches/images/check/default@2x.png differ diff --git a/build/web/css/switches/images/radio/danger.png b/build/web/css/switches/images/radio/danger.png new file mode 100644 index 0000000..d285887 Binary files /dev/null and b/build/web/css/switches/images/radio/danger.png differ diff --git a/build/web/css/switches/images/radio/danger@1.5x.png b/build/web/css/switches/images/radio/danger@1.5x.png new file mode 100644 index 0000000..3b6a7d2 Binary files /dev/null and b/build/web/css/switches/images/radio/danger@1.5x.png differ diff --git a/build/web/css/switches/images/radio/danger@2x.png b/build/web/css/switches/images/radio/danger@2x.png new file mode 100644 index 0000000..812f9a3 Binary files /dev/null and b/build/web/css/switches/images/radio/danger@2x.png differ diff --git a/build/web/css/switches/images/radio/default.png b/build/web/css/switches/images/radio/default.png new file mode 100644 index 0000000..086d61a Binary files /dev/null and b/build/web/css/switches/images/radio/default.png differ diff --git a/build/web/css/switches/images/radio/default@1.5x.png b/build/web/css/switches/images/radio/default@1.5x.png new file mode 100644 index 0000000..27ead41 Binary files /dev/null and b/build/web/css/switches/images/radio/default@1.5x.png differ diff --git a/build/web/css/switches/images/radio/default@2x.png b/build/web/css/switches/images/radio/default@2x.png new file mode 100644 index 0000000..a93f80b Binary files /dev/null and b/build/web/css/switches/images/radio/default@2x.png differ diff --git a/build/web/css/switches/images/switch/background.png b/build/web/css/switches/images/switch/background.png new file mode 100644 index 0000000..99bfe33 Binary files /dev/null and b/build/web/css/switches/images/switch/background.png differ diff --git a/build/web/css/switches/images/switch/background@1.5x.png b/build/web/css/switches/images/switch/background@1.5x.png new file mode 100644 index 0000000..d1c2bd5 Binary files /dev/null and b/build/web/css/switches/images/switch/background@1.5x.png differ diff --git a/build/web/css/switches/images/switch/background_off.png b/build/web/css/switches/images/switch/background_off.png new file mode 100644 index 0000000..963a0d1 Binary files /dev/null and b/build/web/css/switches/images/switch/background_off.png differ diff --git a/build/web/css/switches/images/switch/background_off@1.5x.png b/build/web/css/switches/images/switch/background_off@1.5x.png new file mode 100644 index 0000000..c7bb7f5 Binary files /dev/null and b/build/web/css/switches/images/switch/background_off@1.5x.png differ diff --git a/build/web/css/value_selector/images/icons/checked.png b/build/web/css/value_selector/images/icons/checked.png new file mode 100644 index 0000000..69d5c3d Binary files /dev/null and b/build/web/css/value_selector/images/icons/checked.png differ diff --git a/build/web/css/value_selector/images/icons/checked@1.5x.png b/build/web/css/value_selector/images/icons/checked@1.5x.png new file mode 100644 index 0000000..490dded Binary files /dev/null and b/build/web/css/value_selector/images/icons/checked@1.5x.png differ diff --git a/build/web/css/value_selector/images/icons/checked@2x.png b/build/web/css/value_selector/images/icons/checked@2x.png new file mode 100644 index 0000000..c1a6fbd Binary files /dev/null and b/build/web/css/value_selector/images/icons/checked@2x.png differ diff --git a/build/web/css/value_selector/images/ui/affirmative.png b/build/web/css/value_selector/images/ui/affirmative.png new file mode 100644 index 0000000..c1823eb Binary files /dev/null and b/build/web/css/value_selector/images/ui/affirmative.png differ diff --git a/build/web/css/value_selector/images/ui/default.png b/build/web/css/value_selector/images/ui/default.png new file mode 100644 index 0000000..a174b67 Binary files /dev/null and b/build/web/css/value_selector/images/ui/default.png differ diff --git a/build/web/css/value_selector/images/ui/gradient.png b/build/web/css/value_selector/images/ui/gradient.png new file mode 100644 index 0000000..d2e6f5b Binary files /dev/null and b/build/web/css/value_selector/images/ui/gradient.png differ diff --git a/build/web/css/value_selector/images/ui/gradient@1.5x.png b/build/web/css/value_selector/images/ui/gradient@1.5x.png new file mode 100644 index 0000000..0e420cd Binary files /dev/null and b/build/web/css/value_selector/images/ui/gradient@1.5x.png differ diff --git a/build/web/css/value_selector/images/ui/pattern.png b/build/web/css/value_selector/images/ui/pattern.png new file mode 100644 index 0000000..af03f56 Binary files /dev/null and b/build/web/css/value_selector/images/ui/pattern.png differ diff --git a/build/web/css/value_selector/images/ui/shadow-invert.png b/build/web/css/value_selector/images/ui/shadow-invert.png new file mode 100644 index 0000000..b1b905f Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow-invert.png differ diff --git a/build/web/css/value_selector/images/ui/shadow-invert@1.5x.png b/build/web/css/value_selector/images/ui/shadow-invert@1.5x.png new file mode 100644 index 0000000..ee2dc1c Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow-invert@1.5x.png differ diff --git a/build/web/css/value_selector/images/ui/shadow-invert@2x.png b/build/web/css/value_selector/images/ui/shadow-invert@2x.png new file mode 100644 index 0000000..15c95ed Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow-invert@2x.png differ diff --git a/build/web/css/value_selector/images/ui/shadow.png b/build/web/css/value_selector/images/ui/shadow.png new file mode 100644 index 0000000..728fe77 Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow.png differ diff --git a/build/web/css/value_selector/images/ui/shadow@1.5x.png b/build/web/css/value_selector/images/ui/shadow@1.5x.png new file mode 100644 index 0000000..44b35b4 Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow@1.5x.png differ diff --git a/build/web/css/value_selector/images/ui/shadow@2x.png b/build/web/css/value_selector/images/ui/shadow@2x.png new file mode 100644 index 0000000..f515eff Binary files /dev/null and b/build/web/css/value_selector/images/ui/shadow@2x.png differ diff --git a/build/web/index.html b/build/web/index.html new file mode 100644 index 0000000..3fa2c1e --- /dev/null +++ b/build/web/index.html @@ -0,0 +1,262 @@ + + + + + Sketchy + + + + + + + + +
    + + +

    Sketchy

    + + + +
    + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/web/js/Untitled Document b/build/web/js/Untitled Document new file mode 100644 index 0000000..e69de29 diff --git a/build/web/js/events.js b/build/web/js/events.js new file mode 100644 index 0000000..6c0a2e6 --- /dev/null +++ b/build/web/js/events.js @@ -0,0 +1 @@ +"use strict";$(window).resize(sizeAndPos),$(document).ready(function(){$(".menu").on("click tap",function(){$("#menu").toggleClass("pulled")}),$(".save").on("click tap",function(){$("#save").removeClass("hidden")}),$(".load").on("click tap",function(){$("#load").removeClass("hidden"),$("#load li").remove();var a=JSON.parse(localStorage.getItem("projects"));if(!a||a.length<1)return void $("#load ol").append($("

    No sketch found.

    "));for(var c=0,d=a.length;d>c;c++)$("#load ol").append($("
  • "));b.find("li").off("click").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Transparent"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2) li").removeClass("hidden")})}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Transparent"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2) li").removeClass("hidden")}),$c.last().on("mousedown touchstart",function(a){a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]);var b=relative(a.pageX,a.pageY);startPoint(b.x,b.y),window.active=!0}).on("mousemove touchmove",function(a){if(a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]),window.active&&"line"!=settings.type){var b=relative(a.pageX,a.pageY);drawPoint(b.x,b.y)}}).on("mouseup touchend",function(a){if(a.preventDefault(),window.active=!1,"eraser"!=settings.type){if(window.points.history.last div").addClass("hidden"),$("#menu div.options > .general, #menu div.options > ."+c).removeClass("hidden")),$(this).parents("form").addClass("hidden")}),a.submit(function(a){a.preventDefault(),$(this).addClass("hidden")});var b=$("form.confirm");b.each(function(){$(this).find("li").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$(this).find("button").last().on("click tap",function(a){a.preventDefault();var b=$(this).parents("form").attr("id");$(this).parents("form").find("h1").each(function(a){if(a>0){var c=$(this).html().toLowerCase(),d=$(this).parent().find("ol:nth-of-type("+a+") li[aria-selected] span").html();"file name"!==c&&"file"!==c&&(d=d.toLowerCase()),window[b][c]=d}}),$(this).parents("form").addClass("hidden"),window[b]()}),$(this).find("button").first().on("click tap",function(a){a.preventDefault(),$(this).parents("form").addClass("hidden")})});var d=$('button[id^="set"]');d.each(function(){var a=/set(.*)/.exec($(this).attr("id"))[1];return"color"==a||"bg"==a?$(this).on("click tap",function(){$(".picker").removeClass("hidden"),$(".picker").attr("data-caller",a)}):void $(this).on("click tap",function(b){b.preventDefault(),$('form[id="'+a+'"]').removeClass("hidden")})});var e;$('div[role="slider"] button').on("mousedown touchstart",function(){$(this).attr("data-moving","true"),e||(e=$('div[role="slider"] button').offset().left)}).on("mousemove touchmove",function(a){if($(this).attr("data-moving")){a.changedTouches&&(a=a.changedTouches[0]);var b=parseInt(a.pageX-e-15),c=$("."+$(this).parents('div[role="slider"]').attr("class")),d=c.find("progress"),f=+d.attr("max"),g=+d.attr("min");if(f>=b&&b>=g){c.find("button").css("left",b+"%"),d.attr("value",b);var h=c.attr("class");settings[h]=b,$("#"+h+" span").html(b)}}}).on("mouseup mouseleave touchend",function(){$(this).removeAttr("data-moving")}),$(".fill, .stroke").on("click tap",function(){var a=$("."+$(this).attr("class")).find("span");"Yes"==a.html()?(a.html("No"),settings[$(this).attr("class")]=!1):(a.html("Yes"),settings[$(this).attr("class")]=!0)}),$(".close, .tour button").on("click tap",function(){$(this).parent().addClass("hidden")}),$("#clear").on("click tap",function(){c.clear();var a=window.points.history;window.points=[],window.points.history=a,window.points.history.last=a&&a>=c-f&&d+f>=b&&b>=d-f?!0:!1}function draw(a,b,c,d,e,f){if(e=e||{},f)var g=window.o;else var g=window.c;g.beginPath(),g.globalCompositeOperation="eraser"==settings.type?"destination-out":e.composite||settings.composite,g.lineCap=e.lineCap||settings.lineCap,g.lineJoin=e.lineJoin||settings.lineJoin,g.strokeStyle=e.color||settings.color,g.fillStyle=e.color||settings.color,g.lineWidth=(e.lineWidth||settings.lineWidth)/10,g.moveTo(a,b),g.lineTo(c,d),(!e.noStroke||settings.noStroke)&&g.stroke(),(e.fill||settings.fill)&&g.fill()}function mark(a,b){var c=window.o;c.beginPath(),c.fillStyle="red",c.arc(a,b,3,0,2*Math.PI),c.fill()}function erase(a,b,c,d,e){var e=e||{},f=window.c;f.beginPath(),f.lineWidth=(e.lineWidth||settings.lineWidth)/10,f.globalCompositeOperation="source-out",f.moveTo(a,b),f.lineTo(c,d),window.points=window.points.filter(function(e){return threshold(e.x,e.y,a,b,f.lineWidth)||threshold(e.x,e.y,c,d,f.lineWidth)?!1:!0})}function line(a,b,c){var c=c||{},d=window.o;d.beginPath(),d.lineCap=c.lineCap||settings.lineCap,d.lineJoin=c.lineJoin||settings.lineJoin,d.strokeStyle=c.color||settings.color,d.fillStyle=c.color||settings.color,d.lineWidth=(c.lineWidth||settings.lineWidth)/10;var e=settings.drawingLine.length-1;d.moveTo(settings.drawingLine[e].x,settings.drawingLine[e].y),d.lineTo(a,b),settings.drawingLine.push({x:a,y:b}),d.stroke(),(c.fill||settings.fill)&&d.fill()}function finishLine(a){var a=a||{},b=window.c;o.clear(),b.beginPath(),b.strokeStyle=a.color||settings.color,b.fillStyle=a.color||settings.color,b.lineWidth=(a.lineWidth||settings.lineWidth)/10,b.lineJoin=a.lineJoin||settings.lineJoin,b.lineCap=a.lineJoin||settings.lineJoin,b.moveTo(settings.drawingLine[0].x,settings.drawingLine[0].y);for(var c=1,d=settings.drawingLine.length;d>c;c++)b.lineTo(settings.drawingLine[c].x,settings.drawingLine[c].y);settings.stroke&&b.stroke(),settings.fill&&b.fill(),settings.drawingLine=[],window.points.history.push({data:b.getImageData(0,0,width(),height()),points:window.points.slice(0)}),window.points.history.last=window.points.history.length-1}function undo(){var a=window.points.history;if(a.last>1){var b=a[a.last-1];c.putImageData(b.data,0,0),window.points=b.points.slice(0),window.points.history=a,window.points.history.last=a.last-1}else c.clear(),window.points=[],window.points.history=a,window.points.history.last=0}function redo(){var a=window.points.history;if(a.last1&&(d&&threshold(d.x,d.y,a,b,f[0])||threshold(c.x,c.y,a,b,f[1]))?(window.active=!1,points[points.length-1].type="",points[points.length-1].start=void 0,void finishLine()):void points.push(e)}function drawPoint(a,b){var c=points[points.length-1];switch(c.type){case"eraser":erase(c.x,c.y,a,b);case"pencil":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);break;case"sketch":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);for(var e=0,f=points.length-1;f>e;e++)if(threshold(points[e].x,points[e].y,d.x,d.y,settings.connectTelorance)){var a=points[e].x-d.x,b=points[e].y-d.y,g=settings.lineWidth/20>.2?settings.lineWidth/20:.2;draw(points[e].x-.2*a,points[e].y-.2*b,d.x+.2*a,d.y+.2*b,{strokeStyle:"rgba(0,0,0,0.4)",lineWidth:g})}break;case"fur":draw(c.x,c.y,a,b);var d={x:a,y:b,start:c.start,type:c.type};points.push(d);for(var e=0,f=points.length-1;f>e;e++)if(threshold(points[e].x,points[e].y,d.x,d.y,settings.connectTelorance)){var a=points[e].x-d.x,b=points[e].y-d.y,h=settings.furLength/100||.2,g=settings.lineWidth/20>.2?settings.lineWidth/20:.2;draw(points[e].x+a*h,points[e].y+b*h,d.x-a*h,d.y-b*h,{strokeStyle:"rgba(0,0,0,0.4)",lineWidth:g})}break;case"shape":o.clear(),o.beginPath(),o.fillStyle=settings.color,o.strokeStyle=settings.color,o.lineWidth=settings.lineWidth/20;var i=settings.shapeStart;switch(settings.shape){case"circle":var j=Math.abs(a-i.x);o.arc(i.x,i.y,j,0,2*Math.PI),settings.comShape={type:"circle",x:i.x,y:i.y,radius:j};break;case"rectangle":var g=a-i.x,k=b-i.y;o.rect(i.x,i.y,g,k),settings.comShape={type:"rectangle",x:i.x,y:i.y,w:g,h:k};break;case"square":var g=a-i.x;o.rect(i.x,i.y,g,g),settings.comShape={type:"rectangle",x:i.x,y:i.y,w:g,h:g};break;case"triangle":var l=(a-i.x)/2,m=(b-i.y)/2;o.moveTo(i.x+l,i.y),o.lineTo(a,b),o.lineTo(i.x,b),o.lineTo(i.x+l,i.y),settings.comShape={type:"triangle",start:{x:i.x,y:i.y},x:a,y:b,dix:l,diy:m}}settings.fill&&o.fill(),settings.stroke&&o.stroke()}} \ No newline at end of file diff --git a/build/web/js/libs/color-picker-touch.js b/build/web/js/libs/color-picker-touch.js new file mode 100644 index 0000000..a4b5f79 --- /dev/null +++ b/build/web/js/libs/color-picker-touch.js @@ -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")})}); \ No newline at end of file diff --git a/build/web/js/libs/color-picker.js b/build/web/js/libs/color-picker.js new file mode 100644 index 0000000..0563b45 --- /dev/null +++ b/build/web/js/libs/color-picker.js @@ -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")})}); \ No newline at end of file diff --git a/build/web/js/libs/mobilebrowsers.js b/build/web/js/libs/mobilebrowsers.js new file mode 100644 index 0000000..a7caf2a --- /dev/null +++ b/build/web/js/libs/mobilebrowsers.js @@ -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"); \ No newline at end of file diff --git a/build/web/js/libs/stack.js b/build/web/js/libs/stack.js new file mode 100644 index 0000000..f9c8d3b --- /dev/null +++ b/build/web/js/libs/stack.js @@ -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); \ No newline at end of file diff --git a/build/web/js/libs/touch.js b/build/web/js/libs/touch.js new file mode 100644 index 0000000..4981bd7 --- /dev/null +++ b/build/web/js/libs/touch.js @@ -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); \ No newline at end of file diff --git a/build/web/js/libs/yepnope.min.js b/build/web/js/libs/yepnope.min.js new file mode 100644 index 0000000..bd57852 --- /dev/null +++ b/build/web/js/libs/yepnope.min.js @@ -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;i0?y.fn.concat.apply([],a):a}function k(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(a){return a in H?H[a]:H[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function m(a,b){return"number"!=typeof b||I[k(a)]?b:b+"px"}function n(a){var b,c;return G[a]||(b=F.createElement(a),F.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),"none"==c&&(c="block"),G[a]=c),G[a]}function o(a){return"children"in a?D.call(a.children):y.map(a.childNodes,function(a){return 1==a.nodeType?a:void 0})}function p(a,b,c){for(x in b)c&&(f(b[x])||g(b[x]))?(f(b[x])&&!f(a[x])&&(a[x]={}),g(b[x])&&!g(a[x])&&(a[x]=[]),p(a[x],b[x],c)):b[x]!==w&&(a[x]=b[x])}function q(a,b){return null==b?y(a):y(a).filter(b)}function r(a,c,d,e){return b(c)?c.call(a,d,e):c}function s(a,b,c){null==c?a.removeAttribute(b):a.setAttribute(b,c)}function t(a,b){var c=a.className,d=c&&c.baseVal!==w;return b===w?d?c.baseVal:c:void(d?c.baseVal=b:a.className=b)}function u(a){var b;try{return a?"true"==a||("false"==a?!1:"null"==a?null:/^0/.test(a)||isNaN(b=Number(a))?/^[\[\{]/.test(a)?y.parseJSON(a):a:b):a}catch(c){return a}}function v(a,b){b(a);for(var c in a.childNodes)v(a.childNodes[c],b)}var w,x,y,z,A,B,C=[],D=C.slice,E=C.filter,F=window.document,G={},H={},I={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},J=/^\s*<(\w+|!)[^>]*>/,K=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,L=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,M=/^(?:body|html)$/i,N=/([A-Z])/g,O=["val","css","html","text","data","width","height","offset"],P=["after","prepend","before","append"],Q=F.createElement("table"),R=F.createElement("tr"),S={tr:F.createElement("tbody"),tbody:Q,thead:Q,tfoot:Q,td:R,th:R,"*":F.createElement("div")},T=/complete|loaded|interactive/,U=/^[\w-]*$/,V={},W=V.toString,X={},Y=F.createElement("div"),Z={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return X.matches=function(a,b){if(!b||!a||1!==a.nodeType)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=Y).appendChild(a),d=~X.qsa(e,b).indexOf(a),f&&Y.removeChild(a),d},A=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},B=function(a){return E.call(a,function(b,c){return a.indexOf(b)==c})},X.fragment=function(a,b,c){var d,e,g;return K.test(a)&&(d=y(F.createElement(RegExp.$1))),d||(a.replace&&(a=a.replace(L,"<$1>")),b===w&&(b=J.test(a)&&RegExp.$1),b in S||(b="*"),g=S[b],g.innerHTML=""+a,d=y.each(D.call(g.childNodes),function(){g.removeChild(this)})),f(c)&&(e=y(d),y.each(c,function(a,b){O.indexOf(a)>-1?e[a](b):e.attr(a,b)})),d},X.Z=function(a,b){return a=a||[],a.__proto__=y.fn,a.selector=b||"",a},X.isZ=function(a){return a instanceof X.Z},X.init=function(a,c){var d;if(!a)return X.Z();if("string"==typeof a)if(a=a.trim(),"<"==a[0]&&J.test(a))d=X.fragment(a,RegExp.$1,c),a=null;else{if(c!==w)return y(c).find(a);d=X.qsa(F,a)}else{if(b(a))return y(F).ready(a);if(X.isZ(a))return a;if(g(a))d=i(a);else if(e(a))d=[a],a=null;else if(J.test(a))d=X.fragment(a.trim(),RegExp.$1,c),a=null;else{if(c!==w)return y(c).find(a);d=X.qsa(F,a)}}return X.Z(d,a)},y=function(a,b){return X.init(a,b)},y.extend=function(a){var b,c=D.call(arguments,1);return"boolean"==typeof a&&(b=a,a=c.shift()),c.forEach(function(c){p(a,c,b)}),a},X.qsa=function(a,b){var c,e="#"==b[0],f=!e&&"."==b[0],g=e||f?b.slice(1):b,h=U.test(g);return d(a)&&h&&e?(c=a.getElementById(g))?[c]:[]:1!==a.nodeType&&9!==a.nodeType?[]:D.call(h&&!e?f?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},y.contains=function(a,b){return a!==b&&a.contains(b)},y.type=a,y.isFunction=b,y.isWindow=c,y.isArray=g,y.isPlainObject=f,y.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},y.inArray=function(a,b,c){return C.indexOf.call(b,a,c)},y.camelCase=A,y.trim=function(a){return null==a?"":String.prototype.trim.call(a)},y.uuid=0,y.support={},y.expr={},y.map=function(a,b){var c,d,e,f=[];if(h(a))for(d=0;d=0?a:a+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(a){return C.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return b(a)?this.not(this.not(a)):y(E.call(this,function(b){return X.matches(b,a)}))},add:function(a,b){return y(B(this.concat(y(a,b))))},is:function(a){return this.length>0&&X.matches(this[0],a)},not:function(a){var c=[];if(b(a)&&a.call!==w)this.each(function(b){a.call(this,b)||c.push(this)});else{var d="string"==typeof a?this.filter(a):h(a)&&b(a.item)?D.call(a):y(a);this.forEach(function(a){d.indexOf(a)<0&&c.push(a)})}return y(c)},has:function(a){return this.filter(function(){return e(a)?y.contains(this,a):y(this).find(a).size()})},eq:function(a){return-1===a?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!e(a)?a:y(a)},last:function(){var a=this[this.length-1];return a&&!e(a)?a:y(a)},find:function(a){var b,c=this;return b="object"==typeof a?y(a).filter(function(){var a=this;return C.some.call(c,function(b){return y.contains(b,a)})}):1==this.length?y(X.qsa(this[0],a)):this.map(function(){return X.qsa(this,a)})},closest:function(a,b){var c=this[0],e=!1;for("object"==typeof a&&(e=y(a));c&&!(e?e.indexOf(c)>=0:X.matches(c,a));)c=c!==b&&!d(c)&&c.parentNode;return y(c)},parents:function(a){for(var b=[],c=this;c.length>0;)c=y.map(c,function(a){return(a=a.parentNode)&&!d(a)&&b.indexOf(a)<0?(b.push(a),a):void 0});return q(b,a)},parent:function(a){return q(B(this.pluck("parentNode")),a)},children:function(a){return q(this.map(function(){return o(this)}),a)},contents:function(){return this.map(function(){return D.call(this.childNodes)})},siblings:function(a){return q(this.map(function(a,b){return E.call(o(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return y.map(this,function(b){return b[a]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=n(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var c=b(a);if(this[0]&&!c)var d=y(a).get(0),e=d.parentNode||this.length>1;return this.each(function(b){y(this).wrapAll(c?a.call(this,b):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){y(this[0]).before(a=y(a));for(var b;(b=a.children()).length;)a=b.first();y(a).append(this)}return this},wrapInner:function(a){var c=b(a);return this.each(function(b){var d=y(this),e=d.contents(),f=c?a.call(this,b):a;e.length?e.wrapAll(f):d.append(f)})},unwrap:function(){return this.parent().each(function(){y(this).replaceWith(y(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(a){return this.each(function(){var b=y(this);(a===w?"none"==b.css("display"):a)?b.show():b.hide()})},prev:function(a){return y(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return y(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(b){var c=this.innerHTML;y(this).empty().append(r(this,a,b,c))})},text:function(a){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=a===w?"":""+a})},attr:function(a,b){var c;return"string"==typeof a&&b===w?0==this.length||1!==this[0].nodeType?w:"value"==a&&"INPUT"==this[0].nodeName?this.val():!(c=this[0].getAttribute(a))&&a in this[0]?this[0][a]:c:this.each(function(c){if(1===this.nodeType)if(e(a))for(x in a)s(this,x,a[x]);else s(this,a,r(this,b,c,this.getAttribute(a)))})},removeAttr:function(a){return this.each(function(){1===this.nodeType&&s(this,a)})},prop:function(a,b){return a=Z[a]||a,b===w?this[0]&&this[0][a]:this.each(function(c){this[a]=r(this,b,c,this[a])})},data:function(a,b){var c=this.attr("data-"+a.replace(N,"-$1").toLowerCase(),b);return null!==c?u(c):w},val:function(a){return 0===arguments.length?this[0]&&(this[0].multiple?y(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=r(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var c=y(this),d=r(this,a,b,c.offset()),e=c.offsetParent().offset(),f={top:d.top-e.top,left:d.left-e.left};"static"==c.css("position")&&(f.position="relative"),c.css(f)});if(0==this.length)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(b,c){if(arguments.length<2){var d=this[0],e=getComputedStyle(d,"");if(!d)return;if("string"==typeof b)return d.style[A(b)]||e.getPropertyValue(b);if(g(b)){var f={};return y.each(g(b)?b:[b],function(a,b){f[b]=d.style[A(b)]||e.getPropertyValue(b)}),f}}var h="";if("string"==a(b))c||0===c?h=k(b)+":"+m(b,c):this.each(function(){this.style.removeProperty(k(b))});else for(x in b)b[x]||0===b[x]?h+=k(x)+":"+m(x,b[x])+";":this.each(function(){this.style.removeProperty(k(x))});return this.each(function(){this.style.cssText+=";"+h})},index:function(a){return a?this.indexOf(y(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?C.some.call(this,function(a){return this.test(t(a))},l(a)):!1},addClass:function(a){return a?this.each(function(b){z=[];var c=t(this),d=r(this,a,b,c);d.split(/\s+/g).forEach(function(a){y(this).hasClass(a)||z.push(a)},this),z.length&&t(this,c+(c?" ":"")+z.join(" "))}):this},removeClass:function(a){return this.each(function(b){return a===w?t(this,""):(z=t(this),r(this,a,b,z).split(/\s+/g).forEach(function(a){z=z.replace(l(a)," ")}),t(this,z.trim()),void 0)})},toggleClass:function(a,b){return a?this.each(function(c){var d=y(this),e=r(this,a,c,t(this));e.split(/\s+/g).forEach(function(a){(b===w?!d.hasClass(a):b)?d.addClass(a):d.removeClass(a)})}):this},scrollTop:function(a){if(this.length){var b="scrollTop"in this[0];return a===w?b?this[0].scrollTop:this[0].pageYOffset:this.each(b?function(){this.scrollTop=a}:function(){this.scrollTo(this.scrollX,a)})}},scrollLeft:function(a){if(this.length){var b="scrollLeft"in this[0];return a===w?b?this[0].scrollLeft:this[0].pageXOffset:this.each(b?function(){this.scrollLeft=a}:function(){this.scrollTo(a,this.scrollY)})}},position:function(){if(this.length){var a=this[0],b=this.offsetParent(),c=this.offset(),d=M.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(y(a).css("margin-top"))||0,c.left-=parseFloat(y(a).css("margin-left"))||0,d.top+=parseFloat(y(b[0]).css("border-top-width"))||0,d.left+=parseFloat(y(b[0]).css("border-left-width"))||0,{top:c.top-d.top,left:c.left-d.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||F.body;a&&!M.test(a.nodeName)&&"static"==y(a).css("position");)a=a.offsetParent;return a})}},y.fn.detach=y.fn.remove,["width","height"].forEach(function(a){var b=a.replace(/./,function(a){return a[0].toUpperCase()});y.fn[a]=function(e){var f,g=this[0];return e===w?c(g)?g["inner"+b]:d(g)?g.documentElement["scroll"+b]:(f=this.offset())&&f[a]:this.each(function(b){g=y(this),g.css(a,r(this,e,b,g[a]()))})}}),P.forEach(function(b,c){var d=c%2;y.fn[b]=function(){var b,e,f=y.map(arguments,function(c){return b=a(c),"object"==b||"array"==b||null==c?c:X.fragment(c)}),g=this.length>1;return f.length<1?this:this.each(function(a,b){e=d?b:b.parentNode,b=0==c?b.nextSibling:1==c?b.firstChild:2==c?b:null,f.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!e)return y(a).remove();v(e.insertBefore(a,b),function(a){null!=a.nodeName&&"SCRIPT"===a.nodeName.toUpperCase()&&(!a.type||"text/javascript"===a.type)&&!a.src&&window.eval.call(window,a.innerHTML)})})})},y.fn[d?b+"To":"insert"+(c?"Before":"After")]=function(a){return y(a)[b](this),this}}),X.Z.prototype=y.fn,X.uniq=B,X.deserializeValue=u,y.zepto=X,y}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(a){function b(a){return a._zid||(a._zid=m++)}function c(a,c,f,g){if(c=d(c),c.ns)var h=e(c.ns);return(q[b(a)]||[]).filter(function(a){return!(!a||c.e&&a.e!=c.e||c.ns&&!h.test(a.ns)||f&&b(a.fn)!==b(f)||g&&a.sel!=g)})}function d(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function e(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function f(a,b){return a.del&&!s&&a.e in t||!!b}function g(a){return u[a]||s&&t[a]||a}function h(c,e,h,i,k,m,n){var o=b(c),p=q[o]||(q[o]=[]);e.split(/\s/).forEach(function(b){if("ready"==b)return a(document).ready(h);var e=d(b);e.fn=h,e.sel=k,e.e in u&&(h=function(b){var c=b.relatedTarget;return!c||c!==this&&!a.contains(this,c)?e.fn.apply(this,arguments):void 0}),e.del=m;var o=m||h;e.proxy=function(a){if(a=j(a),!a.isImmediatePropagationStopped()){a.data=i;var b=o.apply(c,a._args==l?[a]:[a].concat(a._args));return b===!1&&(a.preventDefault(),a.stopPropagation()),b}},e.i=p.length,p.push(e),"addEventListener"in c&&c.addEventListener(g(e.e),e.proxy,f(e,n))})}function i(a,d,e,h,i){var j=b(a);(d||"").split(/\s/).forEach(function(b){c(a,b,e,h).forEach(function(b){delete q[j][b.i],"removeEventListener"in a&&a.removeEventListener(g(b.e),b.proxy,f(b,i))})})}function j(b,c){return(c||!b.isDefaultPrevented)&&(c||(c=b),a.each(y,function(a,d){var e=c[a];b[a]=function(){return this[d]=v,e&&e.apply(c,arguments)},b[d]=w}),(c.defaultPrevented!==l?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())&&(b.isDefaultPrevented=v)),b}function k(a){var b,c={originalEvent:a};for(b in a)!x.test(b)&&a[b]!==l&&(c[b]=a[b]);return j(c,a)}var l,m=(a.zepto.qsa,1),n=Array.prototype.slice,o=a.isFunction,p=function(a){return"string"==typeof a},q={},r={},s="onfocusin"in window,t={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};r.click=r.mousedown=r.mouseup=r.mousemove="MouseEvents",a.event={add:h,remove:i},a.proxy=function(c,d){if(o(c)){var e=function(){return c.apply(d,arguments)};return e._zid=b(c),e}if(p(d))return a.proxy(c[d],c);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var v=function(){return!0},w=function(){return!1},x=/^([A-Z]|returnValue$|layer[XY]$)/,y={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,d,e,f){var g,j,m=this;return b&&!p(b)?(a.each(b,function(a,b){m.on(a,c,d,b,f)}),m):(!p(c)&&!o(e)&&e!==!1&&(e=d,d=c,c=l),(o(d)||d===!1)&&(e=d,d=l),e===!1&&(e=w),m.each(function(l,m){f&&(g=function(a){return i(m,a.type,e),e.apply(this,arguments)}),c&&(j=function(b){var d,f=a(b.target).closest(c,m).get(0);return f&&f!==m?(d=a.extend(k(b),{currentTarget:f,liveFired:m}),(g||e).apply(f,[d].concat(n.call(arguments,1)))):void 0}),h(m,b,e,d,c,j||g)}))},a.fn.off=function(b,c,d){var e=this;return b&&!p(b)?(a.each(b,function(a,b){e.off(a,c,b)}),e):(!p(c)&&!o(d)&&d!==!1&&(d=c,c=l),d===!1&&(d=w),e.each(function(){i(this,b,d,c)}))},a.fn.trigger=function(b,c){return b=p(b)||a.isPlainObject(b)?a.Event(b):j(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,d){var e,f;return this.each(function(g,h){e=k(p(b)?a.Event(b):b),e._args=d,e.target=h,a.each(c(h,b.type||b),function(a,b){return f=b.proxy(e),e.isImmediatePropagationStopped()?!1:void 0})}),f},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){p(a)||(b=a,a=b.type);var c=document.createEvent(r[a]||"Events"),d=!0;if(b)for(var e in b)"bubbles"==e?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),j(c)}}(Zepto),function(a){function b(b,c,d){var e=a.Event(c);return a(b).trigger(e,d),!e.isDefaultPrevented()}function c(a,c,d,e){return a.global?b(c||s,d,e):void 0}function d(b){b.global&&0===a.active++&&c(b,null,"ajaxStart")}function e(b){b.global&&!--a.active&&c(b,null,"ajaxStop")}function f(a,b){var d=b.context;return b.beforeSend.call(d,a,b)===!1||c(b,d,"ajaxBeforeSend",[a,b])===!1?!1:void c(b,d,"ajaxSend",[a,b])}function g(a,b,d,e){var f=d.context,g="success";d.success.call(f,a,g,b),e&&e.resolveWith(f,[a,g,b]),c(d,f,"ajaxSuccess",[b,d,a]),i(g,b,d)}function h(a,b,d,e,f){var g=e.context;e.error.call(g,d,b,a),f&&f.rejectWith(g,[d,b,a]),c(e,g,"ajaxError",[d,e,a||b]),i(b,d,e)}function i(a,b,d){var f=d.context;d.complete.call(f,b,a),c(d,f,"ajaxComplete",[b,d]),e(d)}function j(){}function k(a){return a&&(a=a.split(";",2)[0]),a&&(a==x?"html":a==w?"json":u.test(a)?"script":v.test(a)&&"xml")||"text"}function l(a,b){return""==b?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function m(b){b.processData&&b.data&&"string"!=a.type(b.data)&&(b.data=a.param(b.data,b.traditional)),b.data&&(!b.type||"GET"==b.type.toUpperCase())&&(b.url=l(b.url,b.data),b.data=void 0)}function n(b,c,d,e){var f=!a.isFunction(c);return{url:b,data:f?c:void 0,success:f?a.isFunction(d)?d:void 0:c,dataType:f?e||d:d}}function o(b,c,d,e){var f,g=a.isArray(c),h=a.isPlainObject(c);a.each(c,function(c,i){f=a.type(i),e&&(c=d?e:e+"["+(h||"object"==f||"array"==f?c:"")+"]"),!e&&g?b.add(i.name,i.value):"array"==f||!d&&"object"==f?o(b,i,d,c):b.add(c,i)})}var p,q,r=0,s=window.document,t=/)<[^<]*)*<\/script>/gi,u=/^(?:text|application)\/javascript/i,v=/^(?:text|application)\/xml/i,w="application/json",x="text/html",y=/^\s*$/;a.active=0,a.ajaxJSONP=function(b,c){if("type"in b){var d,e,i=b.jsonpCallback,j=(a.isFunction(i)?i():i)||"jsonp"+ ++r,k=s.createElement("script"),l=window[j],m=function(b){a(k).triggerHandler("error",b||"abort")},n={abort:m};return c&&c.promise(n),a(k).on("load error",function(f,i){clearTimeout(e),a(k).off().remove(),"error"!=f.type&&d?g(d[0],n,b,c):h(null,i||"error",n,b,c),window[j]=l,d&&a.isFunction(l)&&l(d[0]),l=d=void 0}),f(n,b)===!1?(m("abort"),n):(window[j]=function(){d=arguments},k.src=b.url.replace(/=\?/,"="+j),s.head.appendChild(k),b.timeout>0&&(e=setTimeout(function(){m("timeout")},b.timeout)),n)}return a.ajax(b)},a.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:w,xml:"application/xml, text/xml",html:x,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},a.ajax=function(b){var c=a.extend({},b||{}),e=a.Deferred&&a.Deferred();for(p in a.ajaxSettings)void 0===c[p]&&(c[p]=a.ajaxSettings[p]);d(c),c.crossDomain||(c.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(c.url)&&RegExp.$2!=window.location.host),c.url||(c.url=window.location.toString()),m(c),c.cache===!1&&(c.url=l(c.url,"_="+Date.now()));var i=c.dataType,n=/=\?/.test(c.url);if("jsonp"==i||n)return n||(c.url=l(c.url,c.jsonp?c.jsonp+"=?":c.jsonp===!1?"":"callback=?")),a.ajaxJSONP(c,e);var o,r=c.accepts[i],s={},t=function(a,b){s[a.toLowerCase()]=[a,b]},u=/^([\w-]+:)\/\//.test(c.url)?RegExp.$1:window.location.protocol,v=c.xhr(),w=v.setRequestHeader;if(e&&e.promise(v),c.crossDomain||t("X-Requested-With","XMLHttpRequest"),t("Accept",r||"*/*"),(r=c.mimeType||r)&&(r.indexOf(",")>-1&&(r=r.split(",",2)[0]),v.overrideMimeType&&v.overrideMimeType(r)),(c.contentType||c.contentType!==!1&&c.data&&"GET"!=c.type.toUpperCase())&&t("Content-Type",c.contentType||"application/x-www-form-urlencoded"),c.headers)for(q in c.headers)t(q,c.headers[q]);if(v.setRequestHeader=t,v.onreadystatechange=function(){if(4==v.readyState){v.onreadystatechange=j,clearTimeout(o);var b,d=!1;if(v.status>=200&&v.status<300||304==v.status||0==v.status&&"file:"==u){i=i||k(c.mimeType||v.getResponseHeader("content-type")),b=v.responseText;try{"script"==i?(1,eval)(b):"xml"==i?b=v.responseXML:"json"==i&&(b=y.test(b)?null:a.parseJSON(b))}catch(f){d=f}d?h(d,"parsererror",v,c,e):g(b,v,c,e)}else h(v.statusText||null,v.status?"error":"abort",v,c,e)}},f(v,c)===!1)return v.abort(),h(null,"abort",v,c,e),v;if(c.xhrFields)for(q in c.xhrFields)v[q]=c.xhrFields[q];var x="async"in c?c.async:!0;v.open(c.type,c.url,x,c.username,c.password);for(q in s)w.apply(v,s[q]);return c.timeout>0&&(o=setTimeout(function(){v.onreadystatechange=j,v.abort(),h(null,"timeout",v,c,e)},c.timeout)),v.send(c.data?c.data:null),v},a.get=function(){return a.ajax(n.apply(null,arguments))},a.post=function(){var b=n.apply(null,arguments);return b.type="POST",a.ajax(b)},a.getJSON=function(){var b=n.apply(null,arguments);return b.dataType="json",a.ajax(b)},a.fn.load=function(b,c,d){if(!this.length)return this;var e,f=this,g=b.split(/\s/),h=n(b,c,d),i=h.success;return g.length>1&&(h.url=g[0],e=g[1]),h.success=function(b){f.html(e?a("
    ").html(b.replace(t,"")).find(e):b),i&&i.apply(f,arguments)},a.ajax(h),this};var z=encodeURIComponent;a.param=function(a,b){var c=[];return c.add=function(a,b){this.push(z(a)+"="+z(b))},o(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b,c=[];return a([].slice.call(this.get(0).elements)).each(function(){b=a(this);var d=b.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=d&&"reset"!=d&&"button"!=d&&("radio"!=d&&"checkbox"!=d||this.checked)&&c.push({name:b.attr("name"),value:b.val()})}),c},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){return b=b||[],a.extend(b,a.fn),b.selector=c||"",b.__Z=!0,b},isZ:function(b){return"array"===a.type(b)&&"__Z"in b}});try{getComputedStyle(void 0)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}}(Zepto); \ No newline at end of file diff --git a/build/web/js/main.js b/build/web/js/main.js new file mode 100644 index 0000000..2d7a55b --- /dev/null +++ b/build/web/js/main.js @@ -0,0 +1 @@ +"use strict";$(document).ready(function(){function a(){switch(a.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var b=$c[0].toDataURL();if("sketchy project"==a.type){var d,e=JSON.parse(localStorage.getItem("projects"));e&&e.some(function(b,c){return b.name==a["file name"]?(d=c,!0):!1})?(console.log(d),e[d]={name:a["file name"],data:b,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(e))):e?e.push({name:a["file name"],data:b,points:window.points}):e=[{name:a["file name"],data:b,points:window.points}],localStorage.setItem("projects",JSON.stringify(e))}else window.open(b,"_blank").focus();c.putImageData(window.points.history[window.points.history.last].data,0,0)}function b(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==b.file})[0],d=document.createElement("img");d.src=a.data,d.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(d,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}}yepnope({test:window.mobile,yep:["js/mobile.js","js/libs/color-picker-touch.js"],nope:["js/libs/color-picker.js"]}),window.load=b,window.save=a}); \ No newline at end of file diff --git a/build/web/js/shared.js b/build/web/js/shared.js new file mode 100644 index 0000000..937af65 --- /dev/null +++ b/build/web/js/shared.js @@ -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",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))}); \ No newline at end of file diff --git a/build/web/manifest.webapp b/build/web/manifest.webapp new file mode 100644 index 0000000..f641d16 --- /dev/null +++ b/build/web/manifest.webapp @@ -0,0 +1,31 @@ +{ + "name": "Sketchy Web", + "description": "Free Sketch/Paint app", + "version": "1.2", + "default_locale": "en", + "launch_path": "/Sketchy/Web/index.html", + "icons": { + "16": "/Sketchy/Web/img/icons/icon16.png", + "32": "/Sketchy/Web/img/icons/icon32.png", + "48": "/Sketchy/Web/img/icons/icon48.png", + "60": "/Sketchy/Web/img/icons/icon60.png", + "64": "/Sketchy/Web/img/icons/icon64.png", + "90": "/Sketchy/Web/img/icons/icon90.png", + "120": "/Sketchy/Web/img/icons/icon120.png", + "128": "/Sketchy/Web/img/icons/icon128.png" + }, + "developer": { + "name": "Mahdi Dibaiee", + "url": "https://twitter.com/mdibaiee" + }, + "locales": { + "en": { + "name": "Sketchy Web", + "description": "Free Sketch/Paint app" + }, + "fa": { + "name": "Sketchy Web", + "description": "برنامه‌ی رایگان طراحی/نقاشی" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cfb1c80 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "Sketchy", + "version": "1.2.0", + "description": "Free Firefox Sketch/Paint Tool", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "http://github.com/mdibaiee/Sketchy/" + }, + "devDependecies": { + "grunt": "~0.4.2", + "grunt-contrib-less": "~0.9.0", + "grunt-contrib-uglify": "~0.2.2", + "grunt-contrib-copy": "~0.5.0", + "grunt-contrib-watch": "~0.5.3" + }, + "keywords": [ + "Sketch", + "Firefox", + "Javascript" + ], + "author": "Mahdi Dibaiee", + "license": "GPL V2", + "devDependencies": { + "grunt": "~0.4.2" + } +}