/*!jQuery Knob*/ /** * Downward compatible, touchable dial * * Version: 1.2.0 (15/07/2012) * Requires: jQuery v1.7+ * * Copyright (c) 2012 Anthony Terrien * Under MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Thanks to vor, eskimoblood, spiffistan, FabrizioC */ (function($) { /** * Kontrol library */ "use strict"; /** * Check canvas support */ var elem = document.createElement('canvas'); if(!elem.getContext || !elem.getContext('2d')) return $.fn.knob = $.noop; /** * Definition of globals and core */ var k = {}, // kontrol max = Math.max, min = Math.min; k.c = {}; k.c.d = $(document); k.c.t = function (e) { return e.originalEvent.touches.length - 1; }; /** * Kontrol Object * * Definition of an abstract UI control * * Each concrete component must call this one. * * k.o.call(this); * */ k.o = function () { var s = this; this.o = null; // array of options this.$ = null; // jQuery wrapped element this.i = null; // mixed HTMLInputElement or array of HTMLInputElement this.g = null; // 2D graphics context for 'pre-rendering' this.v = null; // value ; mixed array or integer this.cv = null; // change value ; not commited value this.x = 0; // canvas x position this.y = 0; // canvas y position this.$c = null; // jQuery canvas element this.c = null; // rendered canvas context this.t = 0; // touches index this.isInit = false; this.fgColor = null; // main color this.pColor = null; // previous color this.dH = null; // draw hook this.cH = null; // change hook this.eH = null; // cancel hook this.rH = null; // release hook this.run = function () { var cf = function (e, conf) { var k; for (k in conf) { s.o[k] = conf[k]; } s.init(); s._configure() ._draw(); }; if(this.$.data('kontroled')) return; this.$.data('kontroled', true); this.extend(); this.o = $.extend( { // Config min : this.$.data('min') || 0, max : this.$.data('max') || 100, stopper : true, readOnly : this.$.data('readonly'), // UI cursor : (this.$.data('cursor') === true && 30) || this.$.data('cursor') || 0, thickness : this.$.data('thickness') || 0.35, lineCap : this.$.data('linecap') || 'butt', width : this.$.data('width') || 200, height : this.$.data('height') || 200, displayInput : this.$.data('displayinput') == null || this.$.data('displayinput'), displayPrevious : this.$.data('displayprevious'), fgColor : this.$.data('fgcolor') || '#87CEEB', inputColor: this.$.data('inputcolor') || this.$.data('fgcolor') || '#87CEEB', inline : false, step : this.$.data('step') || 1, // Hooks draw : null, // function () {} change : null, // function (value) {} cancel : null, // function () {} release : null // function (value) {} }, this.o ); // routing value if(this.$.is('fieldset')) { // fieldset = array of integer this.v = {}; this.i = this.$.find('input') this.i.each(function(k) { var $this = $(this); s.i[k] = $this; s.v[k] = $this.val(); $this.bind( 'change' , function () { var val = {}; val[k] = $this.val(); s.val(val); } ); }); this.$.find('legend').remove(); } else { // input = integer this.i = this.$; this.v = this.$.val(); (this.v == '') && (this.v = this.o.min); this.$.bind( 'change' , function () { s.val(s._validate(s.$.val())); } ); } (!this.o.displayInput) && this.$.hide(); this.$c = $(''); this.c = this.$c[0].getContext("2d"); this.$ .wrap($('
')) .before(this.$c); if (this.v instanceof Object) { this.cv = {}; this.copy(this.v, this.cv); } else { this.cv = this.v; } this.$ .bind("configure", cf) .parent() .bind("configure", cf); this._listen() ._configure() ._xy() .init(); this.isInit = true; this._draw(); return this; }; this._draw = function () { // canvas pre-rendering var d = true, c = document.createElement('canvas'); c.width = s.o.width; c.height = s.o.height; s.g = c.getContext('2d'); s.clear(); s.dH && (d = s.dH()); (d !== false) && s.draw(); s.c.drawImage(c, 0, 0); c = null; }; this._touch = function (e) { var touchMove = function (e) { var v = s.xy2val( e.originalEvent.touches[s.t].pageX, e.originalEvent.touches[s.t].pageY ); if (v == s.cv) return; if ( s.cH && (s.cH(v) === false) ) return; s.change(s._validate(v)); s._draw(); }; // get touches index this.t = k.c.t(e); // First touch touchMove(e); // Touch events listeners k.c.d .bind("touchmove.k", touchMove) .bind( "touchend.k" , function () { k.c.d.unbind('touchmove.k touchend.k'); if ( s.rH && (s.rH(s.cv) === false) ) return; s.val(s.cv); } ); return this; }; this._mouse = function (e) { var mouseMove = function (e) { var v = s.xy2val(e.pageX, e.pageY); if (v == s.cv) return; if ( s.cH && (s.cH(v) === false) ) return; s.change(s._validate(v)); s._draw(); }; // First click mouseMove(e); // Mouse events listeners k.c.d .bind("mousemove.k", mouseMove) .bind( // Escape key cancel current change "keyup.k" , function (e) { if (e.keyCode === 27) { k.c.d.unbind("mouseup.k mousemove.k keyup.k"); if ( s.eH && (s.eH() === false) ) return; s.cancel(); } } ) .bind( "mouseup.k" , function (e) { k.c.d.unbind('mousemove.k mouseup.k keyup.k'); if ( s.rH && (s.rH(s.cv) === false) ) return; s.val(s.cv); } ); return this; }; this._xy = function () { var o = this.$c.offset(); this.x = o.left; this.y = o.top; return this; }; this._listen = function () { if (!this.o.readOnly) { this.$c .bind( "mousedown" , function (e) { e.preventDefault(); s._xy()._mouse(e); } ) .bind( "touchstart" , function (e) { e.preventDefault(); s._xy()._touch(e); } ); this.listen(); } else { this.$.attr('readonly', 'readonly'); } return this; }; this._configure = function () { // Hooks if (this.o.draw) this.dH = this.o.draw; if (this.o.change) this.cH = this.o.change; if (this.o.cancel) this.eH = this.o.cancel; if (this.o.release) this.rH = this.o.release; if (this.o.displayPrevious) { this.pColor = this.h2rgba(this.o.fgColor, "0.4"); this.fgColor = this.h2rgba(this.o.fgColor, "0.6"); } else { this.fgColor = this.o.fgColor; } return this; }; this._clear = function () { this.$c[0].width = this.$c[0].width; }; this._validate = function(v) { return (~~ (((v < 0) ? -0.5 : 0.5) + (v/this.o.step))) * this.o.step; }; // Abstract methods this.listen = function () {}; // on start, one time this.extend = function () {}; // each time configure triggered this.init = function () {}; // each time configure triggered this.change = function (v) {}; // on change this.val = function (v) {}; // on release this.xy2val = function (x, y) {}; // this.draw = function () {}; // on change / on release this.clear = function () { this._clear(); }; // Utils this.h2rgba = function (h, a) { var rgb; h = h.substring(1,7) rgb = [parseInt(h.substring(0,2),16) ,parseInt(h.substring(2,4),16) ,parseInt(h.substring(4,6),16)]; return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")"; }; this.copy = function (f, t) { for (var i in f) { t[i] = f[i]; } }; }; /** * k.Dial */ k.Dial = function () { k.o.call(this); this.startAngle = null; this.xy = null; this.radius = null; this.lineWidth = null; this.cursorExt = null; this.w2 = null; this.PI2 = 2*Math.PI; this.extend = function () { this.o = $.extend( { bgColor : this.$.data('bgcolor') || '#EEEEEE', angleOffset : this.$.data('angleoffset') || 0, angleArc : this.$.data('anglearc') || 360, inline : true }, this.o ); }; this.val = function (v) { if (null != v) { this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v; this.v = this.cv; this.$.val(this.v); this._draw(); } else { return this.v; } }; this.xy2val = function (x, y) { var a, ret; a = Math.atan2( x - (this.x + this.w2) , - (y - this.y - this.w2) ) - this.angleOffset; if(this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) { // if isset angleArc option, set to min if .5 under min a = 0; } else if (a < 0) { a += this.PI2; } ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc)) + this.o.min; this.o.stopper && (ret = max(min(ret, this.o.max), this.o.min)); return ret; }; this.listen = function () { // bind MouseWheel var s = this, mw = function (e) { e.preventDefault(); var ori = e.originalEvent ,deltaX = ori.detail || ori.wheelDeltaX ,deltaY = ori.detail || ori.wheelDeltaY ,v = parseInt(s.$.val()) + (deltaX>0 || deltaY>0 ? s.o.step : deltaX<0 || deltaY<0 ? -s.o.step : 0); if ( s.cH && (s.cH(v) === false) ) return; s.val(v); } , kval, to, m = 1, kv = {37:-s.o.step, 38:s.o.step, 39:s.o.step, 40:-s.o.step}; this.$ .bind( "keydown" ,function (e) { var kc = e.keyCode; // numpad support if(kc >= 96 && kc <= 105) { kc = e.keyCode = kc - 48; } kval = parseInt(String.fromCharCode(kc)); if (isNaN(kval)) { (kc !== 13) // enter && (kc !== 8) // bs && (kc !== 9) // tab && (kc !== 189) // - && e.preventDefault(); // arrows if ($.inArray(kc,[37,38,39,40]) > -1) { e.preventDefault(); var v = parseInt(s.$.val()) + kv[kc] * m; s.o.stopper && (v = max(min(v, s.o.max), s.o.min)); s.change(v); s._draw(); // long time keydown speed-up to = window.setTimeout( function () { m*=2; } ,30 ); } } } ) .bind( "keyup" ,function (e) { if (isNaN(kval)) { if (to) { window.clearTimeout(to); to = null; m = 1; s.val(s.$.val()); } } else { // kval postcond (s.$.val() > s.o.max && s.$.val(s.o.max)) || (s.$.val() < s.o.min && s.$.val(s.o.min)); } } ); this.$c.bind("mousewheel DOMMouseScroll", mw); this.$.bind("mousewheel DOMMouseScroll", mw) }; this.init = function () { if ( this.v < this.o.min || this.v > this.o.max ) this.v = this.o.min; this.$.val(this.v); this.w2 = this.o.width / 2; this.cursorExt = this.o.cursor / 100; this.xy = this.w2; this.lineWidth = this.xy * this.o.thickness; this.lineCap = this.o.lineCap; this.radius = this.xy - this.lineWidth / 2; this.o.angleOffset && (this.o.angleOffset = isNaN(this.o.angleOffset) ? 0 : this.o.angleOffset); this.o.angleArc && (this.o.angleArc = isNaN(this.o.angleArc) ? this.PI2 : this.o.angleArc); // deg to rad this.angleOffset = this.o.angleOffset * Math.PI / 180; this.angleArc = this.o.angleArc * Math.PI / 180; // compute start and end angles this.startAngle = 1.5 * Math.PI + this.angleOffset; this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc; var s = max( String(Math.abs(this.o.max)).length , String(Math.abs(this.o.min)).length , 2 ) + 2; this.o.displayInput && this.i.css({ 'width' : ((this.o.width / 2 + 4) >> 0) + 'px' ,'height' : ((this.o.width / 3) >> 0) + 'px' ,'position' : 'absolute' ,'vertical-align' : 'middle' ,'margin-top' : ((this.o.width / 3) >> 0) + 'px' ,'margin-left' : '-' + ((this.o.width * 3 / 4 + 2) >> 0) + 'px' ,'border' : 0 ,'background' : 'none' ,'font' : 'bold ' + ((this.o.width / s) >> 0) + 'px Arial' ,'text-align' : 'center' ,'color' : this.o.inputColor || this.o.fgColor ,'padding' : '0px' ,'-webkit-appearance': 'none' }) || this.i.css({ 'width' : '0px' ,'visibility' : 'hidden' }); }; this.change = function (v) { this.cv = v; this.$.val(v); }; this.angle = function (v) { return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min); }; this.draw = function () { var c = this.g, // context a = this.angle(this.cv) // Angle , sat = this.startAngle // Start angle , eat = sat + a // End angle , sa, ea // Previous angles , r = 1; c.lineWidth = this.lineWidth; c.lineCap = this.lineCap; this.o.cursor && (sat = eat - this.cursorExt) && (eat = eat + this.cursorExt); c.beginPath(); c.strokeStyle = this.o.bgColor; c.arc(this.xy, this.xy, this.radius, this.endAngle, this.startAngle, true); c.stroke(); if (this.o.displayPrevious) { ea = this.startAngle + this.angle(this.v); sa = this.startAngle; this.o.cursor && (sa = ea - this.cursorExt) && (ea = ea + this.cursorExt); c.beginPath(); c.strokeStyle = this.pColor; c.arc(this.xy, this.xy, this.radius, sa, ea, false); c.stroke(); r = (this.cv == this.v); } c.beginPath(); c.strokeStyle = r ? this.o.fgColor : this.fgColor ; c.arc(this.xy, this.xy, this.radius, sat, eat, false); c.stroke(); }; this.cancel = function () { this.val(this.v); }; }; $.fn.dial = $.fn.knob = function (o) { return this.each( function () { var d = new k.Dial(); d.o = o; d.$ = $(this); d.run(); } ).parent(); }; })(jQuery); !function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; (function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a= b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;ah[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com", /^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+ s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/, q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d= c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"], O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-", /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/], ["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}), ["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q, hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]); p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="
"+a+"
";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1}); return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); (function() { var App, mod, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; App = App || {}; App.init = function() { var mouseDemo; $.notify.defaults({ className: 'success' }); App.codeRunner(); App.posChooser(); $(document).on('click', "a[data-download]", function(e) { var name, url; if ($.compile) { url = $(this).attr('href'); name = $(this).attr('data-name') || 'lib'; $.compile.fetch(name, url).download(name); ga('send', 'event', 'download', name); e.preventDefault(); return false; } return true; }); mouseDemo = $(".demo-mouse"); return $('.summary').hover(function() { return mouseDemo.addClass("over"); }, function() { return mouseDemo.removeClass("over"); }); }; $(App.init); App = window.App = App || {}; window.BuildController = function($scope, $timeout) { var elem, getStyleName; $scope.premadeStyles = [ { name: "bootstrap" }, { name: "metro", css: true, global: true, test: function(text) { return { title: 'Email Notification', text: 'You received an e-mail from your boss. You should read it right now!', image: "" }; } } ]; $(".build-tool-loading").hide(); $(".build-tool-toggle").show(); App.buildTool = $scope; $scope.settings = { minify: false, "default": null }; $scope.styles = []; $scope.addStyle = function(code, premade) { var style; style = { active: true, code: code, premade: premade }; $scope.styles.push(style); if (!$scope.settings["default"]) { return $scope.settings["default"] = style; } }; $scope.loadStyle = function() { var baseUrl, style; style = $scope.premadeStyle; if (!style) { return; } $scope.premadeStyle = null; baseUrl = "dist/styles/" + style.name + "/notify-" + style.name; $.ajax({ url: "" + baseUrl + ".js", dataType: 'text', success: function(js) { if (style.css) { return $.ajax({ url: "" + baseUrl + ".css", dataType: 'text', success: function(css) { css = css.replace(/(.+)$/mg, '"$1\\n"+'); $scope.addStyle("" + js + "\n$.notify.insertCSS(\n" + css + "\"\");", style); return $scope.$digest(); } }); } else { $scope.addStyle(js, style); return $scope.$digest(); } } }); }; $scope.premadeStyle = $scope.premadeStyles[0]; $scope.loadStyle(); $scope.toggle = function() { $(".build-tool-toggle").toggleClass('active'); return $(".build-tool").toggle(400); }; elem = $(".build-tool-toggle").click($scope.toggle); $scope.active = function(scope, prop) { return scope[prop] = !scope[prop]; }; $scope.useDefault = function(style) { return $scope.settings["default"] = style; }; $scope["delete"] = function(i) { return $scope.styles.splice(i, 1); }; getStyleName = function(style) { var m; if (!(style != null ? style.code : void 0)) { return null; } m = style.code.match(/\$\.notify\.addStyle\('(["\w-]+)'/); if (!m) { m = style.code.match(/\$\.notify\.addStyle\("(['\w-]+)"/); } if (!m) { return null; } return m[1]; }; $scope.test = function(event, style, global) { var className, classes, code, contentText, e, name, notifyStyle, obj, rand, testBtn, _ref; testBtn = $(event.target); contentText = testBtn.parent().parent().find('.code'); code = style.code; if (!code) { contentText.notify("No code", "error"); return; } name = getStyleName(style); if (!name) { contentText.notify("Style name not found", "error"); } if (code !== style.lastEval) { try { eval(code); style.lastEval = code; } catch (_error) { e = _error; contentText.notify(e, "error"); return; } } notifyStyle = $.notify.getStyle(name); if (!notifyStyle) { testBtn.notify("No style added", "error"); return; } classes = Object.keys(notifyStyle.classes); rand = Math.floor(Math.random() * classes.length); className = classes[rand]; obj = className === 'base' ? 'no class' : "'" + className + "'"; if ((_ref = style.premade) != null ? _ref.test : void 0) { obj = style.premade.test(obj); } try { if (global) { return $.notify(obj, { style: name, className: className }); } else { return testBtn.notify(obj, { style: name, className: className }); } } catch (_error) { e = _error; testBtn.notify(e, "error"); } }; return $scope.build = function() { var c, done, names, styles; if ($scope.building) { return; } $scope.building = true; done = function() { ga('send', 'event', 'download', 'notify-custom.js'); $scope.building = false; return $scope.$digest(); }; c = $.compile.fetch('core', 'dist/notify.js').set('set-defaults', "$.notify.defaults({\n style: \"" + (getStyleName($scope.settings["default"])) + "\"\n});"); names = {}; styles = []; $.each($scope.styles, function(i, s) { var name; if (!s.active) { return; } name = getStyleName(s); if (!name) { return; } if (names[name]) { $.notify("Skipping style '" + name + "' as it already exists", "warn"); return; } names[name] = 1; name = "style-" + i + "-" + name; styles.push(name); return c.set(name, s.code); }); c.run('concat', { src: ['core', 'set-defaults'].concat(styles), dest: 'result' }); if ($scope.settings.minify) { return c.run('uglify', { src: 'result', dest: 'result-min' }).download('result-min', 'notify-custom.min.js').get('result-min', done); } else { return c.download('result', 'notify-custom.js').get('result', done); } }; }; App = App || {}; App.codeRunner = function() { var addCSS, ranSnippet, runSnippet; prettyPrint(); addCSS = function(e) { var pre; pre = $(this); return $.notify.insertCSS(pre.text()); }; ranSnippet = false; runSnippet = function(e) { var pre; if (e && e.type === 'click') { ranSnippet = true; } pre = $(this); pre.addClass('running'); eval(pre.text()); setTimeout(function() { return pre.removeClass('running'); }, 500); return null; }; setTimeout(function() { if (!ranSnippet) { return $.notify('Tip: You can run the code snippets by clicking them', { className: 'info', position: 'b l' }); } }, 30 * 1000); $(document).on('click', '.prettyprint.runnable', runSnippet); $(".prettyprint.auto-run").each(runSnippet); $(".prettyprint.auto-add").each(addCSS); $.notify.addStyle('gswg', { html: "
\n
\n
\n
\n
Checkout
\n
Getting Started with Grunt: The JavaScript Task Runner
\n
Get the first chapter for free!
\n
\n \n \n \n \n
\n
\n
\n
" }); $(document).on('click', '.notifyjs-gswg-base button', function() { return $(this).trigger('notify-hide'); }); return setTimeout(function() { return $.notify("http://gswg.io", { position: 'b r', style: 'gswg', autoHideDelay: 10 * 1000, clickToHide: false }); }, 15 * 1000); }; App = App || {}; mod = function(v, m) { return (v < 0 ? m : 0) + v % m; }; App.posChooser = function() { var currPos, currType, hPos, mPos, open, p1, p2, p2s, positions, vPos, _i, _j, _len, _len1; if (/MSIE (\d)/.test(window.navigator.userAgent) && parseInt(RegExp.$1, 10) < 8) { return; } positions = []; mPos = ['top', 'right', 'bottom', 'left']; vPos = ['top', 'middle', 'bottom']; hPos = ['left', 'center', 'right']; for (_i = 0, _len = mPos.length; _i < _len; _i++) { p1 = mPos[_i]; p2s = __indexOf.call(vPos, p1) >= 0 ? hPos : vPos; if (p1 === 'bottom' || p1 === 'left') { p2s.reverse(); } for (_j = 0, _len1 = p2s.length; _j < _len1; _j++) { p2 = p2s[_j]; positions.push("" + p1 + " " + p2); } } currPos = 'top left'; currType = 'elem'; open = function() { var opts; opts = { position: currPos }; if (currType === 'elem') { return $(".pos-chooser-demo").notify("" + currPos, opts); } else { return $.notify("" + currPos, opts); } }; $(".pos-chooser").knob({ stopper: false, change: function(val) { val = mod(val, positions.length); currPos = positions[val]; return open(); } }); $(".pos-chooser").siblings().first().addClass(".pos-chooser-dial"); return $(document).on('click', 'input[name=pos-type]', function() { currType = $(this).val(); return open(); }); }; }).call(this);