mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
17 lines
502 KiB
JavaScript
17 lines
502 KiB
JavaScript
|
!function(a,b){function c(a){var b=oa[a]={};return $.each(a.split(ba),function(a,c){b[c]=!0}),b}function d(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(qa,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d||"false"!==d&&("null"===d?null:+d+""===d?+d:pa.test(d)?$.parseJSON(d):d)}catch(f){}$.data(a,c,d)}else d=b}return d}function e(a){var b;for(b in a)if(("data"!==b||!$.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function f(){return!1}function g(){return!0}function h(a){return!a||!a.parentNode||11===a.parentNode.nodeType}function i(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function j(a,b,c){if(b=b||0,$.isFunction(b))return $.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return $.grep(a,function(a,d){return a===b===c});if("string"==typeof b){var d=$.grep(a,function(a){return 1===a.nodeType});if(Ka.test(b))return $.filter(b,d,!c);b=$.filter(b,d)}return $.grep(a,function(a,d){return $.inArray(a,b)>=0===c})}function k(a){var b=Na.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function l(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function m(a,b){if(1===b.nodeType&&$.hasData(a)){var c,d,e,f=$._data(a),g=$._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)$.event.add(b,c,h[c][d])}g.data&&(g.data=$.extend({},g.data))}}function n(a,b){var c;1===b.nodeType&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),$.support.html5Clone&&a.innerHTML&&!$.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Xa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.selected=a.defaultSelected:"input"===c||"textarea"===c?b.defaultValue=a.defaultValue:"script"===c&&b.text!==a.text&&(b.text=a.text),b.removeAttribute($.expando))}function o(a){return"undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function p(a){Xa.test(a.type)&&(a.defaultChecked=a.checked)}function q(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=qb.length;e--;)if(b=qb[e]+c,b in a)return b;return d}function r(a,b){return a=b||a,"none"===$.css(a,"display")||!$.contains(a.ownerDocument,a)}function s(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)c=a[f],c.style&&(e[f]=$._data(c,"olddisplay"),b?(e[f]||"none"!==c.style.display||(c.style.display=""),""===c.style.display&&r(c)&&(e[f]=$._data(c,"olddisplay",w(c.nodeName)))):(d=cb(c,"display"),e[f]||"none"===d||$._data(c,"olddisplay",d)));for(f=0;f<g;f++)c=a[f],c.style&&(b&&"none"!==c.style.display&&""!==c.style.display||(c.style.display=b?e[f]||"":"none"));return a}function t(a,b,c){var d=jb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function u(a,b,c,d){for(var e=c===(d?"border":"content")?4:"width"===b?1:0,f=0;e<4;e+=2)"margin"===c&&(f+=$.css(a,c+pb[e],!0)),d?("content"===c&&(f-=parseFloat(cb(a,"padding"+pb[e]))||0),"margin"!==c&&(f-=parseFloat(cb(a,"border"+pb[e]+"Width"))||0)):(f+=parseFloat(cb(a,"padding"+pb[e]))||0,"padding"!==c&&(f+=parseFloat(cb(a,"border"+pb[e]+"Width"))||0));return f}function v(a,b,c){var d="width"===b?a.offsetWidth:a.offsetHeight,e=!0,f=$.support.boxSizing&&"border-box"===$.css(a,"boxSizing");if(d<=0){if(d=cb(a,b),(d<0||null==d)&&(d=a.style[b]),kb.test(d))return d;e=f&&($.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+u(a,b,c||(f?"border":"content"),e)+"px"}function w(a){if(mb[a])return mb[a];var b=$("<"+a+">").appendTo(P.body),c=b.css("display");return b.remove(),"none"!==c&&""!==c||(db=P.body.appendChild(db||$.extend(P.createElement("iframe"),{frameBorder:0,width:0,height:0})),eb&&db.createElement||(eb=(db.contentWindow||db.contentDocument).document,eb.write("<!doctype html><html><body>"),eb.close()),b=eb.body.appendChild(eb.createElement(a)),c=cb(b,"display"),P.bod
|
||
|
c}})}),$.attrHooks.contenteditable={get:ra.get,set:function(a,b,c){""===b&&(b="false"),ra.set(a,b,c)}}),$.support.hrefNormalized||$.each(["href","src","width","height"],function(a,c){$.attrHooks[c]=$.extend($.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return null===d?b:d}})}),$.support.style||($.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),$.support.optSelected||($.propHooks.selected=$.extend($.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),$.support.enctype||($.propFix.enctype="encoding"),$.support.checkOn||$.each(["radio","checkbox"],function(){$.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}}),$.each(["radio","checkbox"],function(){$.valHooks[this]=$.extend($.valHooks[this],{set:function(a,b){if($.isArray(b))return a.checked=$.inArray($(a).val(),b)>=0}})});var Ba=/^(?:textarea|input|select)$/i,Ca=/^([^\.]*|)(?:\.(.+)|)$/,Da=/(?:^|\s)hover(\.\S+|)\b/,Ea=/^key/,Fa=/^(?:mouse|contextmenu)|click/,Ga=/^(?:focusinfocus|focusoutblur)$/,Ha=function(a){return $.event.special.hover?a:a.replace(Da,"mouseenter$1 mouseleave$1")};$.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q;if(3!==a.nodeType&&8!==a.nodeType&&c&&d&&(g=$._data(a))){for(d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=$.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return"undefined"==typeof $||a&&$.event.triggered===a.type?b:$.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=$.trim(Ha(c)).split(" "),j=0;j<c.length;j++)k=Ca.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),q=$.event.special[l]||{},l=(f?q.delegateType:q.bindType)||l,q=$.event.special[l]||{},n=$.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),p=i[l],p||(p=i[l]=[],p.delegateCount=0,q.setup&&q.setup.call(a,e,m,h)!==!1||(a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h))),q.add&&(q.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?p.splice(p.delegateCount++,0,n):p.push(n),$.event.global[l]=!0;a=null}},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=$.hasData(a)&&$._data(a);if(q&&(m=q.events)){for(b=$.trim(Ha(b||"")).split(" "),f=0;f<b.length;f++)if(g=Ca.exec(b[f])||[],h=i=g[1],j=g[2],h){for(n=$.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l=0;l<o.length;l++)p=o[l],!e&&i!==p.origType||c&&c.guid!==p.guid||j&&!j.test(p.namespace)||d&&d!==p.selector&&("**"!==d||!p.selector)||(o.splice(l--,1),p.selector&&o.delegateCount--,n.remove&&n.remove.call(a,p));0===o.length&&k!==o.length&&(n.teardown&&n.teardown.call(a,j,q.handle)!==!1||$.removeEvent(a,h,q.handle),delete m[h])}else for(h in m)$.event.remove(a,h+b[f],c,d,!0);$.isEmptyObject(m)&&(delete q.handle,$.removeData(a,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,f){if(!e||3!==e.nodeType&&8!==e.nodeType){var g,h,i,j,k,l,m,n,o,p,q=c.type||c,r=[];if(!Ga.test(q+$.event.triggered)&&(q.indexOf("!")>=0&&(q=q.slice(0,-1),h=!0),q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),e&&!$.event.customEvent[q]||$.event.global[q]))if(c="object"==typeof c?c[$.expando]?c:new $.Event(q,c):new $.Event(q),c.type=q,c.isTrigger=!0,c.exclusive=h,c.namespace=r.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l=q.indexOf(":")<0?"on"+q:"",e){if(c.result=b,c.target||(c.target=e),d=null!=d?$.makeArray(d):[],d.unshift(c),m=$.event.special[q]||{},!m.trigger||m.trigger.apply(e,d)!==!1){if(o=[[e,m.bindType||q]],!f&&!m.noBubble&&!$.isWindow(e)){for(p=m.delegateType||q,j=Ga.test(p+q)?e:e.parentNode,k=e;j;j=j.parentNode)o.push([j,p]),k=j;k===(e.ownerDocument||P)&&o.push([k.defaultView||k.parentWindow||a,p])}for(i=0;i<o.length&&!c.isPropagationStopped();i++)j=o[i][0],c.type=o[i][1],n=($._data(j,"events")||{})[c.type]
|
||
|
_a.th=_a.td,$.support.htmlSerialize||(_a._default=[1,"X<div>","</div>"]),$.fn.extend({text:function(a){return $.access(this,function(a){return a===b?$.text(this):this.empty().append((this[0]&&this[0].ownerDocument||P).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if($.isFunction(a))return this.each(function(b){$(this).wrapAll(a.call(this,b))});if(this[0]){var b=$(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return $.isFunction(a)?this.each(function(b){$(this).wrapInner(a.call(this,b))}):this.each(function(){var b=$(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=$.isFunction(a);return this.each(function(c){$(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){$.nodeName(this,"body")||$(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(a,this),"before",this.selector)}},after:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(this,a),"after",this.selector)}},remove:function(a,b){for(var c,d=0;null!=(c=this[d]);d++)a&&!$.filter(a,[c]).length||(b||1!==c.nodeType||($.cleanData(c.getElementsByTagName("*")),$.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)for(1===a.nodeType&&$.cleanData(a.getElementsByTagName("*"));a.firstChild;)a.removeChild(a.firstChild);return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return $.clone(this,a,b)})},html:function(a){return $.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Oa,""):b;if("string"==typeof a&&!Ua.test(a)&&($.support.htmlSerialize||!Wa.test(a))&&($.support.leadingWhitespace||!Pa.test(a))&&!_a[(Ra.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Qa,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},1===c.nodeType&&($.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return h(this[0])?this.length?this.pushStack($($.isFunction(a)?a():a),"replaceWith",a):this:$.isFunction(a)?this.each(function(b){var c=$(this),d=c.html();c.replaceWith(a.call(this,b,d))}):("string"!=typeof a&&(a=$(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;$(this).remove(),b?$(b).before(a):$(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],m=this.length;if(!$.support.checkClone&&m>1&&"string"==typeof j&&Ya.test(j))return this.each(function(){$(this).domManip(a,c,d)});if($.isFunction(j))return this.each(function(e){var f=$(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){if(e=$.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,1===g.childNodes.length&&(g=f),f)for(c=c&&$.nodeName(f,"tr"),h=e.cacheable||m-1;i<m;i++)d.call(c&&$.nodeName(this[i],"table")?l(this[i],"tbody"):this[i],i===h?g:$.clone(g,!0,!0));g=f=null,k.length&&$.each(k,function(a,b){b.src?$.ajax?$.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):$.error("no ajax"):$.globalEval((b.text||b.textContent||b.innerHTML||"").replace($a,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),$.buildFragment=function(a,c,d){var e,f,g,h=a[0];return c=c||P,c=(c[0]
|
||
|
e=b[d]>0,b[d]=0,e)}})}(jQuery),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var c,d=0;null!=(c=b[d]);d++)try{a(c).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?void(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){for(var e,f,g=d.call(arguments,1),h=0,i=g.length;h<i;h++)for(e in g[h])f=g[h][e],g[h].hasOwnProperty(e)&&f!==b&&(a.isPlainObject(f)?c[e]=a.isPlainObject(c[e])?a.widget.extend({},c[e],f):a.widget.extend({},f):c[e]=f);return c},a.widget.bridge=function(c,e){var f=e.prototype.widgetFullName||c;a.fn[c]=function(g){var h="string"==typeof g,i=d.call(arguments,1),j=this;return g=!h&&i.length?a.widget.extend.apply(null,[g].concat(i)):g,h?this.each(function(){var d,e=a.data(this,f);return e?a.isFunction(e[g])&&"_"!==g.charAt(0)?(d=e[g].apply(e,i),d!==e&&d!==b?(j=d&&d.jquery?j.pushStack(d.get()):d,!1):void 0):a.error("no such method '"+g+"' for "+c+" widget instance"):a.error("cannot call methods on "+c+" prior to initialization; attempted to call method '"+g+"'")}):this.each(function(){var b=a.data(this,f);b?b.option(g||{})._init():a.data(this,f,new e(g,this))}),j}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e,f,g,h=c;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof c)if(h={},e=c.split("."),c=e.shift(),e.length){for(f=h[c]=a.widget.extend({},this.options[c]),g=0;g<e.length-1;g++)f[e[g]]=f[e[g]]||{},f=f[e[g]];if(c=e.pop(),d===b)return f[c]===b?null:f[c];f[c]=d}else{if(d===b)return this.options[c]===b?null:this.options[c];h[c]=d}return this._setOptions(h),this},_setOptions:function(a){var b;for(b in a)this._setOption(b,a[b]);return this},_setOption:functi
|
||
|
if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!b){for(this._trigger("beforeStop",a,this._uiHash()),c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}return this.fromOutside=!1,!1}if(b||this._trigger("beforeStop",a,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!b){for(c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}})}(jQuery),function(a){var b=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}}(jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,"click"==this.options.trigger?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):"manual"!=this.options.trigger&&(e="hover"==this.options.trigger?"mouseenter":"focus",f="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);return c.options.delay&&c.options.delay.show?(clearTimeout(this.timeout),c.hoverState="in",void(this.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show))):c.show()},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),c.options.delay&&c.options.delay.hide?(c.hoverState="out",void(this.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide))):c.hide()},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){switch(a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f="function"==typeof this.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight,b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var c=this.tip();return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():c.remove(),this},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-titl
|
||
|
var a=$.namespace("pskl.utils"),b=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};a.Uuid={generate:function(){return"ss-s-s-s-sss".replace(/s/g,function(){return b()})}}}(),function(){var a=$.namespace("pskl.utils"),b={};a.WorkerUtils={createWorker:function(c,d){return b[d]||(b[d]=a.WorkerUtils.createWorkerURL(c)),new Worker(b[d])},createWorkerURL:function(a){var b=[(a+"").replace(/function\s*\(\)\s*\{/,"").replace(/\}[^}]*$/,"")],c=new Blob(b,{type:"application/javascript"});return window.URL.createObjectURL(c)}}}(),function(){var a=$.namespace("pskl.utils");a.Xhr={get:function(b,c,d){var e=a.Xhr.xhr_(b,"GET",c,d);e.send()},post:function(b,c,d,e){var f=a.Xhr.xhr_(b,"POST",d,e),g=new FormData;if("object"==typeof c)for(var h in c)c.hasOwnProperty(h)&&g.append(h,c[h]);f.send(g)},xhr_:function(a,b,c,d){c=c||function(){},d=d||function(){};var e=new XMLHttpRequest;return e.open(b,a,!0),e.onload=function(a){200==this.status?c(this):this.onerror(this,a)},e.onerror=function(a){d(a,this)},e}}}(),function(){var a=$.namespace("pskl.utils");a.Serializer={calculateRequiredBytes:function(a,b){var c=(a.getWidth(),a.getHeight(),a.getDescriptor().name.length),d=a.getDescriptor().description.length,e=(a.getLayers().length,0);e+=8,e+=4,e+=2,e+=2*c,e+=2*d;for(var f=0,g=a.getLayers();f<g.length;f++)e+=10,e+=2*g[f].name.length,e+=b[f].length,e%2==1&&e++;return e},serializePiskel:function(a,b){var c,d,e,f,g,h=[];for(c=0,e=a.getLayers();c<e.length;c++){var i=new pskl.rendering.FramesheetRenderer(e[c].getFrames());f=i.renderAsCanvas().toDataURL().split(",")[1],g=f.length,h.push({uri:f,length:g})}var j=pskl.utils.Serializer.calculateRequiredBytes(a,h),k=new ArrayBuffer(j),l=new Uint8Array(k),m=new Uint16Array(k),n=a.getWidth(),o=a.getHeight(),p=a.getDescriptor().name,q=p.length,r=a.getDescriptor().description,s=r.length;for(m[0]=Constants.MODEL_VERSION,m[1]=n,m[2]=o,m[3]=pskl.app.piskelController.getFPS(),m[4]=q,m[5]=s,m[6]=a.getLayers().length,c=0;c<q;c++)m[7+c]=p.charCodeAt(c);for(c=0;c<s;c++)m[7+q+c]=r.charCodeAt(c);var t=7+q+s;for(c=0,e=a.getLayers();c<e.length;c++){var u=e[c],v=u.getFrames(),w=u.getName(),x=w.length,y=u.getOpacity(),z=v.length;for(f=h[c].uri,g=h[c].length,m[t]=x,m[t+1]=Math.floor(65535*y),m[t+2]=z,m[t+3]=(4294901760&g)>>16>>>0,m[t+4]=(65535&g)>>>0,d=0;d<x;d++)m[t+5+d]=w.charCodeAt(d);for(d=0;d<g;d++)l[2*(t+5+x)+d]=f.charCodeAt(d);t+=Math.ceil(5+x+g/2)}return k}}}(),function(){var a=$.namespace("pskl.utils.serialization");a.Deserializer=function(a,b){this.data_=a,this.callback_=b},a.Deserializer.deserialize=function(b,c){var d;if(b instanceof ArrayBuffer||b instanceof Array){var e=new Uint8Array(b);if("{"==String.fromCharCode(e[0])){b="";for(var f=0;f<e.length;f++)b+=String.fromCharCode(e[f]);b=JSON.parse(b),d=b.modelVersion}else{var g=new Uint16Array(e.buffer);d=g[0]}}else{if("object"!=typeof b)throw"Invalid data for deserializing: "+b;d=b.modelVersion}var h;h=d==Constants.MODEL_VERSION?new a.Deserializer(b,c):2==d?new a.backward.Deserializer_v2(b,c):1==d?new a.backward.Deserializer_v1(b,c):new a.backward.Deserializer_v0(b,c),h.deserialize()},a.Deserializer.prototype.deserialize=function(a){var b,c,d=this.data_,e=new Uint8Array(d),f=new Uint16Array(e.buffer),g=(f[0],f[1]),h=f[2],i=f[3],j=f[4],k=f[5],l=f[6],m="";for(b=0;b<j;b++)m+=String.fromCharCode(f[7+b]);var n="";for(b=0;b<k;b++)n=String.fromCharCode(f[7+j+b]);var o,p=7+j+k,q=[];for(b=0;b<l;b++){o={};var r=f[p],s=f[p+1]/65535,t=f[p+2],u=f[p+3],v=f[p+4],w=v>>>0|u<<16>>>0,x="";for(c=0;c<r;c++)x+=String.fromCharCode(f[p+5+c]);var y="";for(c=0;c<w;c++)y+=String.fromCharCode(e[2*(p+5+r)+c]);y="data:image/png;base64,"+y,p+=Math.ceil(5+r+w/2),o.name=x,o.opacity=s,o.frameCount=t,o.dataUri=y,q.push(o)}var z=new pskl.model.piskel.Descriptor(m,n),A=new pskl.model.Piskel(g,h,z),B=0,C=function(a,b){var c=new Image;c.onload=function(){var c=pskl.utils.LayerUtils.createFramesFromSpritesheet(this,a.frameCount);c.forEach(function(b){a.model.addFrame(b)}),B++,B==l&&b(A,{fps:i})},c.src=a.dataUri};for(b=0;b<l;b++){o=q[b];var D=new pskl.model.Layer(o.name);o.
|
||
|
p||(p=F.getContext("2d"));var b=r.length,c=a.lctFlag?a.lct:h.gct;b>0&&(3===o?p.putImageData(r[n].data,0,0):n=b-1,2===o&&p.clearRect(q.leftPos,q.topPos,q.width,q.height));var d=p.getImageData(a.leftPos,a.topPos,a.width,a.height),e=d.data;a.pixels.forEach(function(a,b){a!==k&&(e[4*b+0]=c[a][0],e[4*b+1]=c[a][1],e[4*b+2]=c[a][2],e[4*b+3]=255)}),p.putImageData(d,a.leftPos,a.topPos),q=a},B={hdr:x,gce:y,img:A,eof:function(a){z(),j=!1,C&&C()},onError:function(a){E&&E()}},C=!1,D=!1,E=!1,F=document.createElement("canvas");return{load:function(b){if(C=b.success,D=b.step,E=b.error,j=!0,s.src.indexOf("data:")!==-1){var c=s.src.substring(s.src.indexOf(",")+1);g=new d(a.atob(c)),u()}else{var e=new XMLHttpRequest;e.overrideMimeType("text/plain; charset=x-user-defined"),e.onload=function(a){g=new d(e.responseText),setTimeout(u,0)},e.onerror=function(){w("xhr")},e.open("GET",s.getAttribute("data-animated-src")||s.src,!0),e.send()}},getFrames:function(){return r}}};a.SuperGif=g}(window),!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZip=a():"undefined"!=typeof global?global.JSZip=a():"undefined"!=typeof self&&(self.JSZip=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,f,g,h,i,j="",k=0;k<a.length;)b=a.charCodeAt(k++),c=a.charCodeAt(k++),e=a.charCodeAt(k++),f=b>>2,g=(3&b)<<4|c>>4,h=(15&c)<<2|e>>6,i=63&e,isNaN(c)?h=i=64:isNaN(e)&&(i=64),j=j+d.charAt(f)+d.charAt(g)+d.charAt(h)+d.charAt(i);return j},c.decode=function(a){var b,c,e,f,g,h,i,j="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)f=d.indexOf(a.charAt(k++)),g=d.indexOf(a.charAt(k++)),h=d.indexOf(a.charAt(k++)),i=d.indexOf(a.charAt(k++)),b=f<<2|g>>4,c=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(b),64!=h&&(j+=String.fromCharCode(c)),64!=i&&(j+=String.fromCharCode(e));return j}},{}],2:[function(a,b){"use strict";function c(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}c.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=c},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\0\0",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":6}],4:[function(a,b){"use strict";function c(){this.data=null,this.length=0,this.index=0}var d=a("./utils");c.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<a||0>a)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return d.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=c},{"./utils":14}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.date=null,c.compression=null},{}],6:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("zlibjs/bin/rawdeflate.min").Zlib,f=a("zlibjs/bin/rawinflate.min").Zlib;c.uncompressInputType=d?"uint8array":"array",c.compressInputTyp
|
||
|
if(q[i]===l&&(q[i]=[]),j=q[i],!(0<t--)){for(;0<j.length&&32768<d-j[0];)j.shift();if(d+3>=e){for(n&&c(n,-1),f=0,g=e-d;g>f;++f)p=b[d+f],r[s++]=p,++u[p];break}0<j.length?(k=h(b,d,j),n?n.length<k.length?(p=b[d-1],r[s++]=p,++u[p],c(k,0)):c(n,-1):k.length<w?n=k:c(k,0)):n?c(n,-1):(p=b[d],r[s++]=p,++u[p])}j.push(d)}return r[s++]=256,u[256]++,a.j=u,a.i=v,o?r.subarray(0,s):r}function h(a,b,c){var d,e,g,h,i,j,k=0,l=a.length;h=0,j=c.length;a:for(;j>h;h++){if(d=c[j-h-1],g=3,k>3){for(i=k;i>3;i--)if(a[d+i-1]!==a[b+i-1])continue a;g=k}for(;258>g&&l>b+g&&a[d+g]===a[b+g];)++g;if(g>k&&(e=d,k=g),258===g)break}return new f(k,b-e)}function i(a,b){var c,e,f,g,h,i=a.length,k=new d(572),l=new(o?Uint8Array:Array)(i);if(!o)for(g=0;i>g;g++)l[g]=0;for(g=0;i>g;++g)0<a[g]&&k.push(g,a[g]);if(c=Array(k.length/2),e=new(o?Uint32Array:Array)(k.length/2),1===c.length)return l[k.pop().index]=1,l;for(g=0,h=k.length/2;h>g;++g)c[g]=k.pop(),e[g]=c[g].value;for(f=j(e,e.length,b),g=0,h=c.length;h>g;++g)l[c[g].index]=f[g];return l}function j(a,b,c){function d(a){var c=n[a][p[a]];c===b?(d(a+1),d(a+1)):--l[c],++p[a]}var e,f,g,h,i,j=new(o?Uint16Array:Array)(c),k=new(o?Uint8Array:Array)(c),l=new(o?Uint8Array:Array)(b),m=Array(c),n=Array(c),p=Array(c),q=(1<<c)-b,r=1<<c-1;for(j[c-1]=b,f=0;c>f;++f)r>q?k[f]=0:(k[f]=1,q-=r),q<<=1,j[c-2-f]=(j[c-1-f]/2|0)+b;for(j[0]=k[0],m[0]=Array(j[0]),n[0]=Array(j[0]),f=1;c>f;++f)j[f]>2*j[f-1]+k[f]&&(j[f]=2*j[f-1]+k[f]),m[f]=Array(j[f]),n[f]=Array(j[f]);for(e=0;b>e;++e)l[e]=c;for(g=0;g<j[c-1];++g)m[c-1][g]=a[g],n[c-1][g]=g;for(e=0;c>e;++e)p[e]=0;for(1===k[c-1]&&(--l[0],++p[c-1]),f=c-2;f>=0;--f){for(h=e=0,i=p[f+1],g=0;g<j[f];g++)h=m[f+1][i]+m[f+1][i+1],h>a[e]?(m[f][g]=h,n[f][g]=b,i+=2):(m[f][g]=a[e],n[f][g]=e,++e);p[f]=0,1===k[f]&&d(f)}return l}function k(a){var b,c,d,e,f=new(o?Uint16Array:Array)(a.length),g=[],h=[],i=0;for(b=0,c=a.length;c>b;b++)g[a[b]]=(0|g[a[b]])+1;for(b=1,c=16;c>=b;b++)h[b]=i,i+=0|g[b],i<<=1;for(b=0,c=a.length;c>b;b++)for(i=h[a[b]],h[a[b]]+=1,d=f[b]=0,e=a[b];e>d;d++)f[b]=f[b]<<1|1&i,i>>>=1;return f}var l=void 0,m=!0,n=this,o="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;b.prototype.a=function(a,b,d){var e,f=this.buffer,g=this.index,h=this.d,i=f[g];if(d&&b>1&&(a=b>8?(u[255&a]<<24|u[a>>>8&255]<<16|u[a>>>16&255]<<8|u[a>>>24&255])>>32-b:u[a]>>8-b),8>b+h)i=i<<b|a,h+=b;else for(e=0;b>e;++e)i=i<<1|a>>b-e-1&1,8===++h&&(h=0,f[g++]=u[i],i=0,g===f.length&&(f=c(this)));f[g]=i,this.buffer=f,this.d=h,this.index=g},b.prototype.finish=function(){var a,b=this.buffer,c=this.index;return 0<this.d&&(b[c]<<=8-this.d,b[c]=u[b[c]],c++),o?a=b.subarray(0,c):(b.length=c,a=b),a};var p,q=new(o?Uint8Array:Array)(256);for(p=0;256>p;++p){for(var r=p,s=r,t=7,r=r>>>1;r;r>>>=1)s<<=1,s|=1&r,--t;q[p]=(s<<t&255)>>>0}var u=q;d.prototype.getParent=function(a){return 2*((a-2)/4|0)},d.prototype.push=function(a,b){var c,d,e,f=this.buffer;for(c=this.length,f[this.length++]=b,f[this.length++]=a;c>0&&(d=this.getParent(c),f[c]>f[d]);)e=f[c],f[c]=f[d],f[d]=e,e=f[c+1],f[c+1]=f[d+1],f[d+1]=e,c=d;return this.length},d.prototype.pop=function(){var a,b,c,d,e,f=this.buffer;for(b=f[0],a=f[1],this.length-=2,f[0]=f[this.length],f[1]=f[this.length+1],e=0;d=2*e+2,!(d>=this.length)&&(d+2<this.length&&f[d+2]>f[d]&&(d+=2),f[d]>f[e]);)c=f[e],f[e]=f[d],f[d]=c,c=f[e+1],f[e+1]=f[d+1],f[d+1]=c,e=d;return{index:a,value:b,length:this.length}};var v,w=2,x=[];for(v=0;288>v;v++)switch(m){case 143>=v:x.push([v+48,8]);break;case 255>=v:x.push([v-144+400,9]);break;case 279>=v:x.push([v-256+0,7]);break;case 287>=v:x.push([v-280+192,8]);break;default:throw"invalid literal: "+v}e.prototype.h=function(){var a,c,d,e,f=this.input;switch(this.e){case 0:for(d=0,e=f.length;e>d;){c=o?f.subarray(d,d+65535):f.slice(d,d+65535),d+=c.length;var h=c,j=d===e,n=l,p=l,q=l,r=l,s=l,t=this.b,u=this.c;if(o){for(t=new Uint8Array(this.b.buffer);t.length<=u+h.length+5;)t=new Uint8Array(t.length<<1);t.set(this.b)}if(n=j?1:0,t[u++]=0|n,p=h.length,q=~p+65536&65535,t[u++]=255&p,t[u++]=p>>>8&255,t[u++]=255&q,t[u++]=q>>>8&255,o)t.set(h,u),u+=h
|
||
|
}function r(a){return a<=1&&(a=100*a+"%"),a}function s(a){a=a.replace(t,"").replace(u,"").toLowerCase();var b=!1;if(B[a])a=B[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=D.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=D.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=D.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=D.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=D.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=D.hex6.exec(a))?{r:n(c[1]),g:n(c[2]),b:n(c[3]),format:b?"name":"hex"}:!!(c=D.hex3.exec(a))&&{r:n(c[1]+""+c[1]),g:n(c[2]+""+c[2]),b:n(c[3]+""+c[3]),format:b?"name":"hex"}}var t=/^[\s,#]+/,u=/\s+$/,v=0,w=Math,x=w.round,y=w.min,z=w.max,A=w.random;b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&("a"===e?d[e]=a[e]:d[e]=r(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return!(!a||!c)&&b(a).toRgbString()==b(c).toRgbString()},b.random=function(){return b.fromRatio({r:A(),g:A(),b:A()})},b.desaturate=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=m(d.s),b(d)},b.saturate=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=m(d.s),b(d)},b.greyscale=function(a){return b.desaturate(a,100)},b.lighten=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=m(d.l),b(d)},b.darken=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=m(d.l),b(d)},b.complement=function(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)},b.triad=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]},b.tetrad=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]},b.splitcomplement=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]},b.analogous=function(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g},b.monochromatic=function(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h},b.readability=function(a,c){var d=b(a).toRgb(),e=b(c).toRgb(),f=(299*d.r+587*d.g+114*d.b)/1e3,g=(299*e.r+587*e.g+114*e.b)/1e3,h=Math.max(d.r,e.r)-Math.min(d.r,e.r)+Math.max(d.g,e.g)-Math.min(d.g,e.g)+Math.max(d.b,e.b)-Math.min(d.b,e.b);return{brightness:Math.abs(f-g),color:h}},b.readable=function(a,c){var d=b.readability(a,c);return d.brightness>125&&d.color>500},b.mostReadable=function(a,c){for(var d=null,e=0,f=!1,g=0;g<c.length;g++){var h=b.readability(a,c[g]),i=h.brightness>125&&h.color>500,j=3*(h.brightness/125)+h.color/500;(i&&!f||i&&f&&j>e||!i&&!f&&j>e)&&(f=i,e=j,d=b(c[g]))}return d};var B=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",li
|
||
|
this.piskelController=a,this.currentSelection=null},a.SelectionManager.prototype.init=function(){$.subscribe(Events.SELECTION_CREATED,$.proxy(this.onSelectionCreated_,this)),$.subscribe(Events.SELECTION_DISMISSED,$.proxy(this.onSelectionDismissed_,this)),$.subscribe(Events.SELECTION_MOVE_REQUEST,$.proxy(this.onSelectionMoved_,this)),$.subscribe(Events.SELECTION_COPY,this.copy.bind(this)),$.subscribe(Events.SELECTION_CUT,this.cut.bind(this)),$.subscribe(Events.SELECTION_PASTE,this.paste.bind(this));var a=pskl.service.keyboard.Shortcuts;pskl.app.shortcutService.registerShortcut(a.SELECTION.PASTE,this.paste.bind(this)),pskl.app.shortcutService.registerShortcut(a.SELECTION.CUT,this.cut.bind(this)),pskl.app.shortcutService.registerShortcut(a.SELECTION.COPY,this.copy.bind(this)),pskl.app.shortcutService.registerShortcut(a.SELECTION.DELETE,this.onDeleteShortcut_.bind(this)),pskl.app.shortcutService.registerShortcut(a.SELECTION.COMMIT,this.commit.bind(this)),$.subscribe(Events.TOOL_SELECTED,$.proxy(this.onToolSelected_,this))},a.SelectionManager.prototype.cleanSelection_=function(){this.currentSelection&&(this.currentSelection.reset(),this.currentSelection=null)},a.SelectionManager.prototype.onToolSelected_=function(a,b){var c=b instanceof pskl.tools.drawing.selection.BaseSelect;c||this.cleanSelection_()},a.SelectionManager.prototype.onSelectionDismissed_=function(a){this.cleanSelection_()},a.SelectionManager.prototype.onDeleteShortcut_=function(a){return!this.currentSelection||void this.erase()},a.SelectionManager.prototype.erase=function(){for(var a=this.currentSelection.pixels,c=this.piskelController.getCurrentFrame(),d=0,e=a.length;d<e;d++)c.setPixel(a[d].col,a[d].row,Constants.TRANSPARENT_COLOR);$.publish(Events.PISKEL_SAVE_STATE,{type:pskl.service.HistoryService.REPLAY,scope:this,replay:{type:b.ERASE,pixels:JSON.parse(JSON.stringify(a.slice(0)))}})},a.SelectionManager.prototype.cut=function(){this.currentSelection&&(this.currentSelection.fillSelectionFromFrame(this.piskelController.getCurrentFrame()),this.erase())},a.SelectionManager.prototype.paste=function(){if(this.currentSelection&&this.currentSelection.hasPastedContent){var a=this.currentSelection.pixels,c=this.piskelController.getCurrentFrame();this.pastePixels_(c,a),$.publish(Events.PISKEL_SAVE_STATE,{type:pskl.service.HistoryService.REPLAY,scope:this,replay:{type:b.PASTE,pixels:JSON.parse(JSON.stringify(a.slice(0)))}})}},a.SelectionManager.prototype.commit=function(){var a=pskl.app.drawingController.currentToolBehavior,b=a instanceof pskl.tools.drawing.selection.BaseSelect;if(b){var c=pskl.app.drawingController.overlayFrame;a.commitSelection(c)}},a.SelectionManager.prototype.replay=function(a,c){c.type===b.PASTE?this.pastePixels_(a,c.pixels):c.type===b.ERASE&&c.pixels.forEach(function(b){a.setPixel(b.col,b.row,Constants.TRANSPARENT_COLOR)})},a.SelectionManager.prototype.pastePixels_=function(a,b){b.forEach(function(b){b.color!==Constants.TRANSPARENT_COLOR&&null!==b.color&&a.setPixel(b.col,b.row,b.color)})},a.SelectionManager.prototype.copy=function(){this.currentSelection&&this.piskelController.getCurrentFrame()&&this.currentSelection.fillSelectionFromFrame(this.piskelController.getCurrentFrame())},a.SelectionManager.prototype.onSelectionCreated_=function(a,b){b?this.currentSelection=b:console.error("No selection provided to SelectionManager")},a.SelectionManager.prototype.onSelectionMoved_=function(a,b,c){this.currentSelection?this.currentSelection.move(b,c):console.error("Bad state: No currentSelection set when trying to move it in SelectionManager")}}(),function(){var a=$.namespace("pskl.selection");a.BaseSelection=function(){this.reset()},a.BaseSelection.prototype.reset=function(){this.pixels=[],this.hasPastedContent=!1},a.BaseSelection.prototype.move=function(a,b){for(var c=[],d=0,e=this.pixels.length;d<e;d++){var f=this.pixels[d];f.col+=a,f.row+=b,c.push(f)}this.pixels=c},a.BaseSelection.prototype.fillSelectionFromFrame=function(a){this.pixels.forEach(function(b){var c=a.getPixel(b.col,b.row);b.color=c||Constants.TRANSPARENT_COLOR}),this.hasPastedContent=!0}
|
||
|
window.setTimeout(function(){this.afterWindowResize_(),this.resetZoom_()}.bind(this),100)},a.DrawingController.prototype.initMouseBehavior=function(){var a=$("body");this.container.mousedown($.proxy(this.onMousedown_,this)),pskl.utils.UserAgent.isChrome||pskl.utils.UserAgent.isIE11?this.container.on("mousewheel",$.proxy(this.onMousewheel_,this)):this.container.on("wheel",$.proxy(this.onMousewheel_,this)),window.addEventListener("mouseup",this.onMouseup_.bind(this)),window.addEventListener("mousemove",this.onMousemove_.bind(this)),window.addEventListener("keyup",this.onKeyup_.bind(this)),window.addEventListener("touchstart",this.onTouchstart_.bind(this)),window.addEventListener("touchmove",this.onTouchmove_.bind(this)),window.addEventListener("touchend",this.onTouchend_.bind(this)),a.contextmenu(this.onCanvasContextMenu_)},a.DrawingController.prototype.startResizeTimer_=function(){this.resizeTimer&&window.clearInterval(this.resizeTimer),this.resizeTimer=window.setTimeout($.proxy(this.afterWindowResize_,this),200)},a.DrawingController.prototype.afterWindowResize_=function(){var a=this.compositeRenderer.getDisplaySize().width;this.compositeRenderer.setDisplaySize(this.getContainerWidth_(),this.getContainerHeight_()),this.centerColumnWrapperHorizontally_();var b=this.compositeRenderer.getDisplaySize().width/a,c=b*this.compositeRenderer.getZoom();this.compositeRenderer.setZoom(c),$.publish(Events.ZOOM_CHANGED)},a.DrawingController.prototype.onUserSettingsChange_=function(a,b,c){b==pskl.UserSettings.SHOW_GRID?console.warn("DrawingController:onUserSettingsChange_ not implemented !"):b!=pskl.UserSettings.ONION_SKIN&&b!=pskl.UserSettings.LAYER_PREVIEW||(this.onionSkinRenderer.clear(),this.onionSkinRenderer.flush(),this.layersRenderer.clear(),this.layersRenderer.flush(),this.render())},a.DrawingController.prototype.onFrameSizeChange_=function(){this.compositeRenderer.setDisplaySize(this.getContainerWidth_(),this.getContainerHeight_()),this.centerColumnWrapperHorizontally_(),this.compositeRenderer.setZoom(this.calculateZoom_()),this.compositeRenderer.setOffset(0,0),$.publish(Events.ZOOM_CHANGED)},a.DrawingController.prototype.onTouchstart_=function(a){this.onMousedown_(a)},a.DrawingController.prototype.onTouchmove_=function(a){this.onMousemove_(a),a.preventDefault()},a.DrawingController.prototype.onTouchend_=function(a){this.onMouseup_(a)},a.DrawingController.prototype.onMousedown_=function(a){$.publish(Events.MOUSE_EVENT,[a,this]);var b=this.piskelController.getCurrentFrame(),c=this.getSpriteCoordinates(a.clientX,a.clientY);a.changedTouches&&a.changedTouches[0]&&(c=this.getSpriteCoordinates(a.changedTouches[0].clientX,a.changedTouches[0].clientY)),this.isClicked=!0,a.button===Constants.MIDDLE_BUTTON?this.dragHandler.startDrag(a.clientX,a.clientY):(this.currentToolBehavior.hideHighlightedPixel(this.overlayFrame),$.publish(Events.TOOL_PRESSED),this.currentToolBehavior.applyToolAt(c.x,c.y,b,this.overlayFrame,a))},a.DrawingController.prototype.onMousemove_=function(a){this._clientX=a.clientX,this._clientY=a.clientY,a.changedTouches&&a.changedTouches[0]&&(this._clientX=a.changedTouches[0].clientX,this._clientY=a.changedTouches[0].clientY);var b=(new Date).getTime();b-this.previousMousemoveTime>Constants.MOUSEMOVE_THROTTLING&&(this.moveTool_(this._clientX,this._clientY,a),this.previousMousemoveTime=b)},a.DrawingController.prototype.onKeyup_=function(a){this.moveTool_(this._clientX,this._clientY,a)},a.DrawingController.prototype.moveTool_=function(a,b,c){var d=this.getSpriteCoordinates(a,b),e=this.piskelController.getCurrentFrame();this.isClicked?pskl.app.mouseStateService.isMiddleButtonPressed()?this.dragHandler.updateDrag(a,b):($.publish(Events.MOUSE_EVENT,[c,this]),this.currentToolBehavior.moveToolAt(0|d.x,0|d.y,e,this.overlayFrame,c)):this.currentToolBehavior.moveUnactiveToolAt(d.x,d.y,e,this.overlayFrame,c),$.publish(Events.CURSOR_MOVED,[d.x,d.y])},a.DrawingController.prototype.onMousewheel_=function(a){var b,c=a.originalEvent;pskl.utils.UserAgent.isChrome?b=c.wheelDeltaY:pskl.utils.UserAgent.isIE11?b=c.wheelDelta:pskl.utils.UserAg
|
||
|
this.minimapEl.style.display="block",this.minimapEl.style.width=Math.min(a.width,d)+"px",this.minimapEl.style.height=Math.min(a.height,c)+"px",this.minimapEl.style.left=Math.max(0,h)+"px",this.minimapEl.style.top=Math.max(0,k)+"px",this.isVisible=!0},a.MinimapController.prototype.getMinimapSize_=function(){var a=this.drawingController.getRenderer().getZoom(),b=this.previewController.getZoom(),c=a/b,d=this.drawingController.getRenderer().getDisplaySize(),e=d.width/c,f=d.height/c;return{width:e,height:f}},a.MinimapController.prototype.getPreviewSize_=function(){var a=this.piskelController.getCurrentFrame(),b=a.getWidth()*this.previewController.getZoom(),c=a.getHeight()*this.previewController.getZoom();return{width:b,height:c}},a.MinimapController.prototype.hideMinimap_=function(){this.minimapEl.style.display="none",this.isVisible=!1},a.MinimapController.prototype.onMinimapMousemove_=function(a){if(this.isVisible&&this.isClicked){var b=this.getCoordinatesCenteredAround_(a.clientX,a.clientY);this.drawingController.setOffset(b.x,b.y)}},a.MinimapController.prototype.onMinimapMousedown_=function(a){this.isClicked=!0},a.MinimapController.prototype.onMinimapMouseup_=function(a){this.isClicked=!1},a.MinimapController.prototype.getCoordinatesCenteredAround_=function(a,b){var c=this.previewController.getCoordinates(a,b),d=this.piskelController.getCurrentFrame().getWidth(),e=this.piskelController.getCurrentFrame().getHeight(),f=d/this.getHorizontalRatio_(),g=e/this.getVerticalRatio_();return{x:c.x-f/2,y:c.y-g/2}},a.MinimapController.prototype.getVerticalRatio_=function(){var a=this.drawingController.getRenderer().getZoom(),b=this.piskelController.getCurrentFrame(),c=b.getHeight()*a,d=this.drawingController.getRenderer().getDisplaySize().height;return c/d},a.MinimapController.prototype.getHorizontalRatio_=function(){var a=this.drawingController.getRenderer().getZoom(),b=this.piskelController.getCurrentFrame(),c=b.getWidth()*a,d=this.drawingController.getRenderer().getDisplaySize().width;return c/d}}(),function(){var a=$.namespace("pskl.controller");a.ToolController=function(){this.tools=[new pskl.tools.drawing.SimplePen,new pskl.tools.drawing.VerticalMirrorPen,new pskl.tools.drawing.PaintBucket,new pskl.tools.drawing.ColorSwap,new pskl.tools.drawing.Eraser,new pskl.tools.drawing.Stroke,new pskl.tools.drawing.Rectangle,new pskl.tools.drawing.Circle,new pskl.tools.drawing.Move,new pskl.tools.drawing.selection.ShapeSelect,new pskl.tools.drawing.selection.RectangleSelect,new pskl.tools.drawing.selection.LassoSelect,new pskl.tools.drawing.Lighten,new pskl.tools.drawing.DitheringTool,new pskl.tools.drawing.ColorPicker],this.toolIconBuilder=new pskl.tools.ToolIconBuilder},a.ToolController.prototype.init=function(){this.createToolsDom_(),this.addKeyboardShortcuts_(),this.selectTool_(this.tools[0]),$("#tool-section").mousedown($.proxy(this.onToolIconClicked_,this)),$.subscribe(Events.SELECT_TOOL,this.onSelectToolEvent_.bind(this)),$.subscribe(Events.SHORTCUTS_CHANGED,this.createToolsDom_.bind(this))},a.ToolController.prototype.activateToolOnStage_=function(a){var b=$("body"),c=b.data("selected-tool-class");c&&(b.removeClass(c),b.removeClass(pskl.tools.drawing.Move.TOOL_ID)),b.addClass(a.toolId),b.data("selected-tool-class",a.toolId)},a.ToolController.prototype.onSelectToolEvent_=function(a,b){var c=this.getToolById_(b);c&&this.selectTool_(c)},a.ToolController.prototype.selectTool_=function(a){this.currentSelectedTool=a,this.activateToolOnStage_(this.currentSelectedTool);var b=$("#tool-section .tool-icon.selected"),c=$("[data-tool-id="+a.toolId+"]");b.removeClass("selected"),c.addClass("selected"),$.publish(Events.TOOL_SELECTED,[a])},a.ToolController.prototype.onToolIconClicked_=function(a){var b=$(a.target),c=b.closest(".tool-icon");if(c.length){var d=c.data().toolId,e=this.getToolById_(d);e&&this.selectTool_(e)}},a.ToolController.prototype.onKeyboardShortcut_=function(a,b){var c=this.getToolById_(a);null!==c&&this.selectTool_(c)},a.ToolController.prototype.getToolById_=function(a){return pskl.utils.Array.find(this.tools,function(b){return b.
|
||
|
g+="static const uint32_t "+c.toLowerCase(),g+="_data["+f+"]["+d*e+"] = {\n";for(var h=0;h<f;h++){var i=this.piskelController.renderFrameAt(h,!0),j=i.getContext("2d"),k=j.getImageData(0,0,d,e),l=k.data;g+="{\n";for(var m=0;m<l.length;m+=4)g+=this.rgbToCHex(l[m],l[m+1],l[m+2],l[m+3]),m!=l.length-4&&(g+=", "),(m+4)%(4*d)===0&&(g+="\n");g+=h!=f-1?"},\n":"}\n"}g+="};\n",pskl.utils.BlobUtils.stringToBlob(g,function(a){pskl.utils.FileUtils.downloadAsFile(a,b)}.bind(this),"application/text")},a.MiscExportController.prototype.getPiskelName_=function(){return this.piskelController.getPiskel().getDescriptor().name},a.MiscExportController.prototype.rgbToCHex=function(a,b,c,d){var e="0x";return e+=("00"+d.toString(16)).substr(-2),e+=("00"+c.toString(16)).substr(-2),e+=("00"+b.toString(16)).substr(-2),e+=("00"+a.toString(16)).substr(-2)},a.MiscExportController.prototype.onDownloadSelectedFrameClick_=function(a){var b=this.piskelController.getCurrentFrameIndex(),c=this.getPiskelName_()+"-"+(b+1)+".png",d=this.piskelController.renderFrameAt(b,!0);pskl.utils.BlobUtils.canvasToBlob(d,function(a){pskl.utils.FileUtils.downloadAsFile(a,c)})}}(),function(){var a=$.namespace("pskl.controller.settings.exportimage"),b={png:{template:"templates/settings/export/png.html",controller:a.PngExportController},gif:{template:"templates/settings/export/gif.html",controller:a.GifExportController},zip:{template:"templates/settings/export/zip.html",controller:a.ZipExportController},misc:{template:"templates/settings/export/misc.html",controller:a.MiscExportController}};a.ExportController=function(a){this.piskelController=a,this.onSizeInputChange_=this.onSizeInputChange_.bind(this)},pskl.utils.inherit(a.ExportController,pskl.controller.settings.AbstractSettingController),a.ExportController.prototype.init=function(){this.scaleInput=document.querySelector(".export-scale .scale-input"),this.addEventListener(this.scaleInput,"change",this.onScaleChange_),this.addEventListener(this.scaleInput,"input",this.onScaleChange_),this.widthInput=document.querySelector(".export-resize .resize-width"),this.heightInput=document.querySelector(".export-resize .resize-height");var a=pskl.UserSettings.get(pskl.UserSettings.EXPORT_SCALE);this.sizeInputWidget=new pskl.widgets.SizeInput({widthInput:this.widthInput,heightInput:this.heightInput,initWidth:this.piskelController.getWidth()*a,initHeight:this.piskelController.getHeight()*a,onChange:this.onSizeInputChange_}),this.onSizeInputChange_(),this.exportPanel=document.querySelector(".export-panel"),this.exportTabs=document.querySelector(".export-tabs"),this.addEventListener(this.exportTabs,"click",this.onTabsClicked_);var b=pskl.UserSettings.get(pskl.UserSettings.EXPORT_TAB);this.selectTab(b)},a.ExportController.prototype.destroy=function(){this.sizeInputWidget.destroy(),this.currentController.destroy(),this.superclass.destroy.call(this)},a.ExportController.prototype.selectTab=function(a){if(b[a]&&this.currentTab!=a){this.currentController&&this.currentController.destroy(),this.exportPanel.innerHTML=pskl.utils.Template.get(b[a].template),this.currentController=new b[a].controller(this.piskelController,this),this.currentController.init(),this.currentTab=a,pskl.UserSettings.set(pskl.UserSettings.EXPORT_TAB,a);var c=this.exportTabs.querySelector(".selected");c&&c.classList.remove("selected"),this.exportTabs.querySelector('[data-tab-id="'+a+'"]').classList.add("selected")}},a.ExportController.prototype.onTabsClicked_=function(a){var b=pskl.utils.Dom.getData(a.target,"tabId");this.selectTab(b)},a.ExportController.prototype.onScaleChange_=function(){var a=parseFloat(this.scaleInput.value);isNaN(a)||(Math.round(this.getExportZoom())!=a&&this.sizeInputWidget.setWidth(this.piskelController.getWidth()*a),pskl.UserSettings.set(pskl.UserSettings.EXPORT_SCALE,a))},a.ExportController.prototype.updateScaleText_=function(a){a=a.toFixed(1);var b=document.querySelector(".export-scale .scale-text");b.innerHTML=a+"x"},a.ExportController.prototype.onSizeInputChange_=function(){var a=this.getExportZoom();isNaN(a)||(this.updateScaleText_(a),$.publish(Eve
|
||
|
a.BrowseLocalController=function(a){},pskl.utils.inherit(a.BrowseLocalController,a.AbstractDialogController),a.BrowseLocalController.prototype.init=function(){this.superclass.init.call(this),this.localStorageItemTemplate_=pskl.utils.Template.get("local-storage-item-template"),this.service_=pskl.app.localStorageService,this.piskelList=$(".local-piskel-list"),this.prevSessionContainer=$(".previous-session"),this.fillLocalPiskelsList_(),this.piskelList.click(this.onPiskelsListClick_.bind(this))},a.BrowseLocalController.prototype.onPiskelsListClick_=function(a){var b=a.target.getAttribute("data-action"),c=a.target.getAttribute("data-name");"load"===b?window.confirm("This will erase your current piskel. Continue ?")&&(this.service_.load(c),this.closeDialog()):"delete"===b&&window.confirm("This will permanently DELETE this piskel from your computer. Continue ?")&&(this.service_.remove(c),this.fillLocalPiskelsList_())},a.BrowseLocalController.prototype.fillLocalPiskelsList_=function(){var a="",b=this.service_.getKeys();b.sort(function(a,b){return a.date<b.date?1:a.date>b.date?-1:0}),b.forEach(function(b){var c=pskl.utils.DateUtils.format(b.date,"{{Y}}/{{M}}/{{D}} {{H}}:{{m}}");a+=pskl.utils.Template.replace(this.localStorageItemTemplate_,{name:b.name,date:c})}.bind(this));var c=this.piskelList.get(0).tBodies[0];c.innerHTML=a}}(),function(){var a=$.namespace("pskl.controller.dialogs"),b="cheatsheet-shortcut-editing";a.CheatsheetController=function(){},pskl.utils.inherit(a.CheatsheetController,a.AbstractDialogController),a.CheatsheetController.prototype.init=function(){this.superclass.init.call(this),this.cheatsheetEl=document.getElementById("cheatsheetContainer"),this.eventTrapInput=document.getElementById("cheatsheetEventTrap"),pskl.utils.Event.addEventListener(".cheatsheet-restore-defaults","click",this.onRestoreDefaultsClick_,this),pskl.utils.Event.addEventListener(this.cheatsheetEl,"click",this.onCheatsheetClick_,this),pskl.utils.Event.addEventListener(this.eventTrapInput,"keydown",this.onEventTrapKeydown_,this),$.subscribe(Events.SHORTCUTS_CHANGED,this.onShortcutsChanged_.bind(this)),this.initMarkup_(),document.querySelector(".cheatsheet-helptext").setAttribute("title",this.getHelptextTitle_())},a.CheatsheetController.prototype.destroy=function(){this.eventTrapInput.blur(),pskl.utils.Event.removeAllEventListeners(),this.cheatsheetEl=null},a.CheatsheetController.prototype.onRestoreDefaultsClick_=function(){window.confirm("Replace all custom shortcuts by the default Piskel shortcuts ?")&&pskl.app.shortcutService.restoreDefaultShortcuts()},a.CheatsheetController.prototype.onShortcutsChanged_=function(){this.initMarkup_()},a.CheatsheetController.prototype.onCheatsheetClick_=function(a){var c=pskl.utils.Dom.getParentWithData(a.target,"shortcutId");if(!c)return void pskl.utils.Dom.removeClass(b);var d=c.dataset.shortcutId,e=pskl.app.shortcutService.getShortcutById(d);c.classList.contains(b)?(pskl.utils.Dom.removeClass(b),this.eventTrapInput.blur()):e.isEditable()&&(pskl.utils.Dom.removeClass(b),c.classList.add(b),this.eventTrapInput.focus())},a.CheatsheetController.prototype.onEventTrapKeydown_=function(a){var c=document.querySelector("."+b);if(c){var d=pskl.service.keyboard.KeyUtils.createKeyFromEvent(a);if(d){var e=pskl.service.keyboard.KeyUtils.stringify(d),f=c.dataset.shortcutId,g=pskl.app.shortcutService.getShortcutById(f);pskl.app.shortcutService.updateShortcut(g,e),c.classList.remove(b),this.eventTrapInput.blur(),a.preventDefault()}}},a.CheatsheetController.prototype.initMarkup_=function(){this.initMarkupForCategory_("TOOL",".cheatsheet-tool-shortcuts",this.getToolIconClass_),this.initMarkupForCategory_("MISC",".cheatsheet-misc-shortcuts"),this.initMarkupForCategory_("COLOR",".cheatsheet-color-shortcuts"),this.initMarkupForCategory_("SELECTION",".cheatsheet-selection-shortcuts"),this.initMarkupForCategory_("STORAGE",".cheatsheet-storage-shortcuts")},a.CheatsheetController.prototype.getToolIconClass_=function(a){return"tool-icon cheatsheet-icon-"+a.getId()},a.CheatsheetController.prototype.initMarkupForCategory_=function(a
|
||
|
this.piskelController.getLayerAt(a.layerIndex)),d=c.getFrameAt(a.frameIndex);b.scope.replay(d,b.replay)}}(),function(){for(var a=$.namespace("pskl.service.color"),b=.1,c=.1,d=.9,e=36,f=10,g=[],h=0;h<f;h++)g.push(h*e);a.ColorSorter=function(){this.colorsHslMap_={}},a.ColorSorter.prototype.sort=function(a){this.colorsHslMap_={},a.forEach(function(a){this.colorsHslMap_[a]=window.tinycolor(a).toHsl()}.bind(this));var f=a.filter(function(a){var b=this.colorsHslMap_[a];return b.l<=c}.bind(this)),h=a.filter(function(a){var b=this.colorsHslMap_[a];return b.l>=d}.bind(this)),i=a.filter(function(a){return h.indexOf(a)===-1&&f.indexOf(a)===-1}).filter(function(a){var c=this.colorsHslMap_[a];return c.s<=b}.bind(this));f=this.sortOnHslProperty_(f,"l"),h=this.sortOnHslProperty_(h,"l"),i=this.sortOnHslProperty_(i,"h");var j=f.concat(h,i),k=a.filter(function(a){return j.indexOf(a)===-1}),l=g.map(function(a){var b=k.filter(function(b){var c=this.colorsHslMap_[b];return c.h>=a&&c.h<a+e}.bind(this));return this.sortRegularColors_(b)}.bind(this));return Array.prototype.concat.apply(j,l)},a.ColorSorter.prototype.sortRegularColors_=function(a){var b=a.sort(function(a,b){var c=this.colorsHslMap_[a],d=this.colorsHslMap_[b],e=Math.abs(c.h-d.h),f=Math.abs(c.s-d.s),g=Math.abs(c.l-d.l);return e<10?f>g?this.compareValues_(c.s,d.s):this.compareValues_(c.l,d.l):this.compareValues_(c.h,d.h)}.bind(this));return b},a.ColorSorter.prototype.sortOnHslProperty_=function(a,b){return a.sort(function(a,c){var d=this.colorsHslMap_[a],e=this.colorsHslMap_[c];return this.compareValues_(d[b],e[b])}.bind(this))},a.ColorSorter.prototype.compareValues_=function(a,b){return a>b?1:a<b?-1:0}}(),function(){var a=$.namespace("pskl.service.palette");a.CurrentColorsPalette=function(){this.name="Current colors",this.id=Constants.CURRENT_COLORS_PALETTE_ID,this.colorSorter=new pskl.service.color.ColorSorter},a.CurrentColorsPalette.prototype.getColors=function(){var a=pskl.app.currentColorsService.getCurrentColors();return a=a.slice(0,Constants.MAX_PALETTE_COLORS),this.colorSorter.sort(a)}}(),function(){var a=$.namespace("pskl.service.palette");a.PaletteService=function(){this.dynamicPalettes=[],this.localStorageService=window.localStorage},a.PaletteService.prototype.getPalettes=function(){var a=this.localStorageService.getItem("piskel.palettes"),b=JSON.parse(a)||[];return b=b.map(function(a){return pskl.model.Palette.fromObject(a)}),this.dynamicPalettes.concat(b)},a.PaletteService.prototype.getPaletteById=function(a){var b=this.getPalettes();return this.findPaletteInArray_(a,b)},a.PaletteService.prototype.savePalette=function(a){var b=this.getPalettes(),c=this.findPaletteInArray_(a.id,b);if(c){var d=b.indexOf(c);b.splice(d,1,a)}else b.push(a);this.savePalettes_(b),$.publish(Events.SHOW_NOTIFICATION,[{content:"Palette "+a.name+" successfully saved !"}]),window.setTimeout($.publish.bind($,Events.HIDE_NOTIFICATION),2e3)},a.PaletteService.prototype.addDynamicPalette=function(a){this.dynamicPalettes.push(a)},a.PaletteService.prototype.deletePaletteById=function(a){var b=this.getPalettes(),c=b.filter(function(b){return b.id!==a});this.savePalettes_(c)},a.PaletteService.prototype.savePalettes_=function(a){a=a.filter(function(a){return this.dynamicPalettes.indexOf(a)===-1}.bind(this)),this.localStorageService.setItem("piskel.palettes",JSON.stringify(a)),$.publish(Events.PALETTE_LIST_UPDATED)},a.PaletteService.prototype.findPaletteInArray_=function(a,b){var c=null;return b.forEach(function(b){b.id===a&&(c=b)}),c}}(),function(){var a=$.namespace("pskl.service.palette");a.PaletteGplWriter=function(a){this.palette=a},a.PaletteGplWriter.prototype.write=function(){var a=[];return a.push("GIMP Palette"),a.push("Name: "+this.palette.name),a.push("Columns: 0"),a.push("#"),this.palette.getColors().forEach(function(b){a.push(this.writeColorLine(b))}.bind(this)),a.push("\r\n"),a.join("\r\n")},a.PaletteGplWriter.prototype.writeColorLine=function(a){var b=window.tinycolor(a),c=b.toRgb(),d=[];return d.push(this.padString(c.r,3)),d.push(this.padString(c.g,3)),d.push(this.padString(c.b,3)),d.push("Unt
|
||
|
this.toolId="tool-pen",this.helpText="Pen tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.PEN,this.previousCol=null,this.previousRow=null,this.pixels=[]},pskl.utils.inherit(a.SimplePen,a.BaseTool),a.SimplePen.prototype.supportsDynamicPenSize=function(){return!0},a.SimplePen.prototype.applyToolAt=function(a,b,c,d,e){this.previousCol=a,this.previousRow=b;var f=this.getToolColor();this.drawUsingPenSize(f,a,b,c,d)},a.SimplePen.prototype.drawUsingPenSize=function(a,b,c,d,e){var f=pskl.app.penSizeService.getPenSize(),g=pskl.PixelUtils.resizePixel(b,c,f);g.forEach(function(b){this.draw(a,b[0],b[1],d,e)}.bind(this))},a.SimplePen.prototype.draw=function(a,b,c,d,e){e.setPixel(b,c,a),a===Constants.TRANSPARENT_COLOR&&d.setPixel(b,c,a),this.pixels.push({col:b,row:c,color:a})},a.SimplePen.prototype.moveToolAt=function(a,b,c,d,e){if(Math.abs(a-this.previousCol)>1||Math.abs(b-this.previousRow)>1)for(var f=pskl.PixelUtils.getLinePixels(a,this.previousCol,b,this.previousRow),g=0,h=f.length;g<h;g++){var i=f[g];this.applyToolAt(i.col,i.row,c,d,e)}else this.applyToolAt(a,b,c,d,e);this.previousCol=a,this.previousRow=b},a.SimplePen.prototype.releaseToolAt=function(a,b,c,d,e){this.setPixelsToFrame_(c,this.pixels),this.raiseSaveStateEvent({pixels:this.pixels.slice(0),color:this.getToolColor()}),this.resetUsedPixels_()},a.SimplePen.prototype.replay=function(a,b){this.setPixelsToFrame_(a,b.pixels,b.color)},a.SimplePen.prototype.setPixelsToFrame_=function(a,b,c){b.forEach(function(b){a.setPixel(b.col,b.row,b.color)})},a.SimplePen.prototype.resetUsedPixels_=function(){this.pixels=[]}}(),function(){var a=$.namespace("pskl.tools.drawing"),b=3;a.Lighten=function(){this.superclass.constructor.call(this),this.toolId="tool-lighten",this.helpText="Lighten",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.LIGHTEN,this.tooltipDescriptors=[{key:"ctrl",description:"Darken"},{key:"shift",description:"Apply only once per pixel"}]},pskl.utils.inherit(a.Lighten,a.SimplePen),a.Lighten.prototype.applyToolAt=function(a,b,c,d,e){this.previousCol=a,this.previousRow=b;var f=pskl.app.penSizeService.getPenSize(),g=pskl.PixelUtils.resizePixel(a,b,f);g.forEach(function(a){var b=this.getModifiedColor_(a[0],a[1],c,d,e);this.draw(b,a[0],a[1],c,d)}.bind(this))},a.Lighten.prototype.getModifiedColor_=function(a,c,d,e,f){var g=e.getPixel(a,c),h=d.getPixel(a,c),i=g!==pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR),j=i?g:h,k=j===pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR);if(k)return Constants.TRANSPARENT_COLOR;var l=f.shiftKey;if(l&&i)return j;var m,n=l?2*b:b,o=pskl.utils.UserAgent.isMac?f.metaKey:f.ctrlKey;return m=o?window.tinycolor.darken(pskl.utils.intToColor(j),n):window.tinycolor.lighten(pskl.utils.intToColor(j),n),m.toHexString()}}(),function(){var a=$.namespace("pskl.tools.drawing");a.VerticalMirrorPen=function(){this.superclass.constructor.call(this),this.toolId="tool-vertical-mirror-pen",this.helpText="Vertical Mirror pen",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.MIRROR_PEN,this.tooltipDescriptors=[{key:"ctrl",description:"Use horizontal axis"},{key:"shift",description:"Use horizontal and vertical axis"}]},pskl.utils.inherit(a.VerticalMirrorPen,a.SimplePen),a.VerticalMirrorPen.prototype.applyToolAt=function(a,b,c,d,e){var f=this.getToolColor();this.drawUsingPenSize(f,a,b,c,d);var g=this.getSymmetricCol_(a,c),h=this.getSymmetricRow_(b,c),i=pskl.utils.UserAgent.isMac?e.metaKey:e.ctrlKey;i||this.drawUsingPenSize(f,g,b,c,d),(e.shiftKey||i)&&this.drawUsingPenSize(f,a,h,c,d),e.shiftKey&&this.drawUsingPenSize(f,g,h,c,d),this.previousCol=a,this.previousRow=b},a.VerticalMirrorPen.prototype.getSymmetricCol_=function(a,b){return b.getWidth()-a-1},a.VerticalMirrorPen.prototype.getSymmetricRow_=function(a,b){return b.getHeight()-a-1}}(),function(){var a=$.namespace("pskl.tools.drawing");a.Eraser=function(){this.superclass.constructor.call(this),this.toolId="tool-eraser",this.helpText="Eraser tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.ERASER},pskl.utils.inherit(a.Eraser,a.SimplePen),a.Eraser.prototype.getToolColor=function(){return Constant
|
||
|
this.drawingLoop.start(),this.initTooltips_();var f=this.getPiskelInitData_();if(f&&f.piskel&&this.loadPiskel_(f.piskel,f.descriptor,f.fps),pskl.devtools&&pskl.devtools.init(),pskl.utils.Environment.detectNodeWebkit()&&pskl.utils.UserAgent.isMac){var g=require("nw.gui"),h=new g.Menu({type:"menubar"});h.createMacBuiltin("Piskel"),g.Window.get().menu=h}},loadPiskel_:function(a){pskl.utils.serialization.Deserializer.deserialize(a,function(a,b){pskl.app.piskelController.setPiskel(a),pskl.app.previewController.setFPS(b.fps)})},getPiskelInitData_:function(){return pskl.appEnginePiskelData_},isLoggedIn:function(){var a=this.getPiskelInitData_();return a&&a.isLoggedIn},initTooltips_:function(){$("body").tooltip({selector:"[rel=tooltip]"})},render:function(a){this.drawingController.render(a),this.previewController.render(a),this.framesListController.render(a)},getFirstFrameAsPng:function(){var a,b=pskl.utils.LayerUtils.mergeFrameAt(this.piskelController.getLayers(),0);return a=b instanceof pskl.model.frame.RenderedFrame?pskl.utils.CanvasUtils.createFromImage(b.getRenderedFrame()):pskl.utils.FrameUtils.toImage(b),a.toDataURL("image/png")},getFramesheetAsPng:function(){var a=new pskl.rendering.PiskelRenderer(this.piskelController),b=a.renderAsCanvas();return b.toDataURL("image/png")}}}();
|