diff --git a/dist/css/style.css b/dist/css/style.css index c9f28ea..802140b 100755 --- a/dist/css/style.css +++ b/dist/css/style.css @@ -128,6 +128,20 @@ body { fill: rgba(255, 255, 255, 0.85); } +#share_link { + width: 23px; + height: 23px; + padding: 3px; + position: absolute; + top: 5px; + right: 65px; + opacity: .4; +} + +#share_link:hover{ + opacity: 1; +} + input:focus, input:active { outline: none; } diff --git a/dist/js/main.js b/dist/js/main.js index 93379e6..38bd345 100644 --- a/dist/js/main.js +++ b/dist/js/main.js @@ -3398,16 +3398,25 @@ var jscolor = { jscolor.install(); - - - - - ;(function(window) { 'use strict'; + if ('replaceState' in history) { // Yay, supported! + window.replaceHash = function(newhash) { + if ((''+newhash).charAt(0) !== '#') newhash = '#' + newhash; + history.replaceState('', '', newhash); + } + } else { + var hash = location.hash; + window.replaceHash = function(newhash) { + if (location.hash !== hash) history.back(); + location.hash = newhash; + }; + + } + // General functions function extend( a, b ) { @@ -3512,6 +3521,7 @@ jscolor.install(); bgColor = document.getElementById('bg-color'), pointsOp = document.getElementById('points-op'), exportCode = document.getElementById('export_code'), + shareLink = document.getElementById('share_link'), generatedCode = document.getElementById('generated_code'), popupCode = document.getElementById('popup-code'), popupQ = document.getElementById('popup-q'), @@ -3673,6 +3683,8 @@ jscolor.install(); obj.bg = bgColor.value; // console.log(obj) localStorage.setItem('value', JSON.stringify(obj)); + shareLink.setAttribute('href', '#code=' + btoa(JSON.stringify(obj))); + replaceHash('#code=' + btoa(JSON.stringify(obj))) } diff --git a/dist/js/main.min.js b/dist/js/main.min.js index 35f437d..4ba9897 100644 --- a/dist/js/main.min.js +++ b/dist/js/main.min.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";var n,r,o=e,i=o.document,a=o.navigator,s=o.setTimeout,l=o.encodeURIComponent,c=o.ActiveXObject,u=o.Error,d=o.Number.parseInt||o.parseInt,p=o.Number.parseFloat||o.parseFloat,f=o.Number.isNaN||o.isNaN,h=o.Math.round,m=o.Date.now,g=o.Object.keys,y=o.Object.defineProperty,v=o.Object.prototype.hasOwnProperty,b=o.Array.prototype.slice,w=function(){var e=function(e){return e};if("function"==typeof o.wrap&&"function"==typeof o.unwrap)try{var t=i.createElement("div"),n=o.unwrap(t);1===t.nodeType&&n&&1===n.nodeType&&(e=o.unwrap)}catch(r){}return e}(),k=function(e){return b.call(e,0)},x=function(){var e,n,r,o,i,a,s=k(arguments),l=s[0]||{};for(e=1,n=s.length;n>e;e++)if(null!=(r=s[e]))for(o in r)v.call(r,o)&&(i=l[o],a=r[o],l!==a&&a!==t&&(l[o]=a));return l},C=function(e){var t,n,r,o;if("object"!=typeof e||null==e)t=e;else if("number"==typeof e.length)for(t=[],n=0,r=e.length;r>n;n++)v.call(e,n)&&(t[n]=C(e[n]));else{t={};for(o in e)v.call(e,o)&&(t[o]=C(e[o]))}return t},j=function(e,t){for(var n={},r=0,o=t.length;o>r;r++)t[r]in e&&(n[t[r]]=e[t[r]]);return n},E=function(e,t){var n={};for(var r in e)-1===t.indexOf(r)&&(n[r]=e[r]);return n},I=function(e){if(e)for(var t in e)v.call(e,t)&&delete e[t];return e},T=function(e,t){if(e&&1===e.nodeType&&e.ownerDocument&&t&&(1===t.nodeType&&t.ownerDocument&&t.ownerDocument===e.ownerDocument||9===t.nodeType&&!t.ownerDocument&&t===e.ownerDocument))do{if(e===t)return!0;e=e.parentNode}while(e);return!1},L=function(e){var t;return"string"==typeof e&&e&&(t=e.split("#")[0].split("?")[0],t=e.slice(0,e.lastIndexOf("/")+1)),t},M=function(e){var t,n;return"string"==typeof e&&e&&(n=e.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),n&&n[1]?t=n[1]:(n=e.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),n&&n[1]&&(t=n[1]))),t},S=function(){var e,t;try{throw new u}catch(n){t=n}return t&&(e=t.sourceURL||t.fileName||M(t.stack)),e},B=function(){var e,n,r;if(i.currentScript&&(e=i.currentScript.src))return e;if(n=i.getElementsByTagName("script"),1===n.length)return n[0].src||t;if("readyState"in n[0])for(r=n.length;r--;)if("interactive"===n[r].readyState&&(e=n[r].src))return e;return"loading"===i.readyState&&(e=n[n.length-1].src)?e:(e=S())?e:t},A=function(){var e,n,r,o=i.getElementsByTagName("script");for(e=o.length;e--;){if(!(r=o[e].src)){n=null;break}if(r=L(r),null==n)n=r;else if(n!==r){n=null;break}}return n||t},_=function(){var e=L(B())||A()||"";return e+"ZeroClipboard.swf"},D={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,deactivated:null,overdue:null,ready:null},O="11.0.0",F={},H={},N=null,q={ready:"Flash communication is established",error:{"flash-disabled":"Flash is disabled or not installed","flash-outdated":"Flash is too outdated to support ZeroClipboard","flash-unavailable":"Flash is unable to communicate bidirectionally with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate","flash-overdue":"Flash communication was established but NOT within the acceptable time limit"}},X={swfPath:_(),trustedDomains:e.location.host?[e.location.host]:[],cacheBust:!0,forceEnhancedClipboard:!1,flashLoadTimeout:3e4,autoActivate:!0,bubbleEvents:!0,containerId:"global-zeroclipboard-html-bridge",containerClass:"global-zeroclipboard-container",swfObjectId:"global-zeroclipboard-flash-bridge",hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",forceHandCursor:!1,title:null,zIndex:999999999},Y=function(e){if("object"==typeof e&&null!==e)for(var t in e)if(v.call(e,t))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(t))X[t]=e[t];else if(null==D.bridge)if("containerId"===t||"swfObjectId"===t){if(!nt(e[t]))throw new Error("The specified `"+t+"` value is not valid as an HTML4 Element ID");X[t]=e[t]}else X[t]=e[t];{if("string"!=typeof e||!e)return C(X);if(v.call(X,e))return X[e]}},z=function(){return{browser:j(a,["userAgent","platform","appName"]),flash:E(D,["bridge"]),zeroclipboard:{version:Bt.version,config:Bt.config()}}},P=function(){return!!(D.disabled||D.outdated||D.unavailable||D.deactivated)},R=function(e,t){var n,r,o,i={};if("string"==typeof e&&e)o=e.toLowerCase().split(/\s+/);else if("object"==typeof e&&e&&"undefined"==typeof t)for(n in e)v.call(e,n)&&"string"==typeof n&&n&&"function"==typeof e[n]&&Bt.on(n,e[n]);if(o&&o.length){for(n=0,r=o.length;r>n;n++)e=o[n].replace(/^on/,""),i[e]=!0,F[e]||(F[e]=[]),F[e].push(t);if(i.ready&&D.ready&&Bt.emit({type:"ready"}),i.error){var a=["disabled","outdated","unavailable","deactivated","overdue"];for(n=0,r=a.length;r>n;n++)if(D[a[n]]===!0){Bt.emit({type:"error",name:"flash-"+a[n]});break}}}return Bt},V=function(e,t){var n,r,o,i,a;if(0===arguments.length)i=g(F);else if("string"==typeof e&&e)i=e.split(/\s+/);else if("object"==typeof e&&e&&"undefined"==typeof t)for(n in e)v.call(e,n)&&"string"==typeof n&&n&&"function"==typeof e[n]&&Bt.off(n,e[n]);if(i&&i.length)for(n=0,r=i.length;r>n;n++)if(e=i[n].toLowerCase().replace(/^on/,""),a=F[e],a&&a.length)if(t)for(o=a.indexOf(t);-1!==o;)a.splice(o,1),o=a.indexOf(t,o);else a.length=0;return Bt},$=function(e){var t;return t="string"==typeof e&&e?C(F[e])||null:C(F)},G=function(e){var t,n,r;return e=rt(e),e&&!ct(e)?"ready"===e.type&&D.overdue===!0?Bt.emit({type:"error",name:"flash-overdue"}):(t=x({},e),lt.call(this,t),"copy"===e.type&&(r=mt(H),n=r.data,N=r.formatMap),n):void 0},U=function(){if("boolean"!=typeof D.ready&&(D.ready=!1),!Bt.isFlashUnusable()&&null===D.bridge){var e=X.flashLoadTimeout;"number"==typeof e&&e>=0&&s(function(){"boolean"!=typeof D.deactivated&&(D.deactivated=!0),D.deactivated===!0&&Bt.emit({type:"error",name:"flash-deactivated"})},e),D.overdue=!1,ft()}},W=function(){Bt.clearData(),Bt.blur(),Bt.emit("destroy"),ht(),Bt.off()},Z=function(e,t){var n;if("object"==typeof e&&e&&"undefined"==typeof t)n=e,Bt.clearData();else{if("string"!=typeof e||!e)return;n={},n[e]=t}for(var r in n)"string"==typeof r&&r&&v.call(n,r)&&"string"==typeof n[r]&&n[r]&&(H[r]=n[r])},J=function(e){"undefined"==typeof e?(I(H),N=null):"string"==typeof e&&v.call(H,e)&&delete H[e]},K=function(e){return"undefined"==typeof e?C(H):"string"==typeof e&&v.call(H,e)?H[e]:void 0},Q=function(e){if(e&&1===e.nodeType){n&&(Ct(n,X.activeClass),n!==e&&Ct(n,X.hoverClass)),n=e,xt(e,X.hoverClass);var t=e.getAttribute("title")||X.title;if("string"==typeof t&&t){var r=pt(D.bridge);r&&r.setAttribute("title",t)}var o=X.forceHandCursor===!0||"pointer"===jt(e,"cursor");Lt(o),Tt()}},et=function(){var e=pt(D.bridge);e&&(e.removeAttribute("title"),e.style.left="0px",e.style.top="-9999px",e.style.width="1px",e.style.top="1px"),n&&(Ct(n,X.hoverClass),Ct(n,X.activeClass),n=null)},tt=function(){return n||null},nt=function(e){return"string"==typeof e&&e&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(e)},rt=function(e){var t;if("string"==typeof e&&e?(t=e,e={}):"object"==typeof e&&e&&"string"==typeof e.type&&e.type&&(t=e.type),t){!e.target&&/^(copy|aftercopy|_click)$/.test(t.toLowerCase())&&(e.target=r),x(e,{type:t.toLowerCase(),target:e.target||n||null,relatedTarget:e.relatedTarget||null,currentTarget:D&&D.bridge||null,timeStamp:e.timeStamp||m()||null});var o=q[e.type];return"error"===e.type&&e.name&&o&&(o=o[e.name]),o&&(e.message=o),"ready"===e.type&&x(e,{target:null,version:D.version}),"error"===e.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(e.name)&&x(e,{target:null,minimumVersion:O}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(e.name)&&x(e,{version:D.version})),"copy"===e.type&&(e.clipboardData={setData:Bt.setData,clearData:Bt.clearData}),"aftercopy"===e.type&&(e=gt(e,N)),e.target&&!e.relatedTarget&&(e.relatedTarget=ot(e.target)),e=it(e)}},ot=function(e){var t=e&&e.getAttribute&&e.getAttribute("data-clipboard-target");return t?i.getElementById(t):null},it=function(e){if(e&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(e.type)){var n=e.target,r="_mouseover"===e.type&&e.relatedTarget?e.relatedTarget:t,a="_mouseout"===e.type&&e.relatedTarget?e.relatedTarget:t,s=It(n),l=o.screenLeft||o.screenX||0,c=o.screenTop||o.screenY||0,u=i.body.scrollLeft+i.documentElement.scrollLeft,d=i.body.scrollTop+i.documentElement.scrollTop,p=s.left+("number"==typeof e._stageX?e._stageX:0),f=s.top+("number"==typeof e._stageY?e._stageY:0),h=p-u,m=f-d,g=l+h,y=c+m,v="number"==typeof e.movementX?e.movementX:0,b="number"==typeof e.movementY?e.movementY:0;delete e._stageX,delete e._stageY,x(e,{srcElement:n,fromElement:r,toElement:a,screenX:g,screenY:y,pageX:p,pageY:f,clientX:h,clientY:m,x:h,y:m,movementX:v,movementY:b,offsetX:0,offsetY:0,layerX:0,layerY:0})}return e},at=function(e){var t=e&&"string"==typeof e.type&&e.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(t)},st=function(e,t,n,r){r?s(function(){e.apply(t,n)},0):e.apply(t,n)},lt=function(e){if("object"==typeof e&&e&&e.type){var t=at(e),n=F["*"]||[],r=F[e.type]||[],i=n.concat(r);if(i&&i.length){var a,s,l,c,u,d=this;for(a=0,s=i.length;s>a;a++)l=i[a],c=d,"string"==typeof l&&"function"==typeof o[l]&&(l=o[l]),"object"==typeof l&&l&&"function"==typeof l.handleEvent&&(c=l,l=l.handleEvent),"function"==typeof l&&(u=x({},e),st(l,c,[u],t))}return this}},ct=function(e){var t=e.target||n||null,o="swf"===e._source;delete e._source;var i=["flash-disabled","flash-outdated","flash-unavailable","flash-deactivated","flash-overdue"];switch(e.type){case"error":-1!==i.indexOf(e.name)&&x(D,{disabled:"flash-disabled"===e.name,outdated:"flash-outdated"===e.name,unavailable:"flash-unavailable"===e.name,deactivated:"flash-deactivated"===e.name,overdue:"flash-overdue"===e.name,ready:!1});break;case"ready":var a=D.deactivated===!0;x(D,{disabled:!1,outdated:!1,unavailable:!1,deactivated:!1,overdue:a,ready:!a});break;case"beforecopy":r=t;break;case"copy":var s,l,c=e.relatedTarget;!H["text/html"]&&!H["text/plain"]&&c&&(l=c.value||c.outerHTML||c.innerHTML)&&(s=c.value||c.textContent||c.innerText)?(e.clipboardData.clearData(),e.clipboardData.setData("text/plain",s),l!==s&&e.clipboardData.setData("text/html",l)):!H["text/plain"]&&e.target&&(s=e.target.getAttribute("data-clipboard-text"))&&(e.clipboardData.clearData(),e.clipboardData.setData("text/plain",s));break;case"aftercopy":Bt.clearData(),t&&t!==kt()&&t.focus&&t.focus();break;case"_mouseover":Bt.focus(t),X.bubbleEvents===!0&&o&&(t&&t!==e.relatedTarget&&!T(e.relatedTarget,t)&&ut(x({},e,{type:"mouseenter",bubbles:!1,cancelable:!1})),ut(x({},e,{type:"mouseover"})));break;case"_mouseout":Bt.blur(),X.bubbleEvents===!0&&o&&(t&&t!==e.relatedTarget&&!T(e.relatedTarget,t)&&ut(x({},e,{type:"mouseleave",bubbles:!1,cancelable:!1})),ut(x({},e,{type:"mouseout"})));break;case"_mousedown":xt(t,X.activeClass),X.bubbleEvents===!0&&o&&ut(x({},e,{type:e.type.slice(1)}));break;case"_mouseup":Ct(t,X.activeClass),X.bubbleEvents===!0&&o&&ut(x({},e,{type:e.type.slice(1)}));break;case"_click":r=null,X.bubbleEvents===!0&&o&&ut(x({},e,{type:e.type.slice(1)}));break;case"_mousemove":X.bubbleEvents===!0&&o&&ut(x({},e,{type:e.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(e.type)?!0:void 0},ut=function(e){if(e&&"string"==typeof e.type&&e){var t,n=e.target||null,r=n&&n.ownerDocument||i,a={view:r.defaultView||o,canBubble:!0,cancelable:!0,detail:"click"===e.type?1:0,button:"number"==typeof e.which?e.which-1:"number"==typeof e.button?e.button:r.createEvent?0:1},s=x(a,e);n&&r.createEvent&&n.dispatchEvent&&(s=[s.type,s.canBubble,s.cancelable,s.view,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget],t=r.createEvent("MouseEvents"),t.initMouseEvent&&(t.initMouseEvent.apply(t,s),t._source="js",n.dispatchEvent(t)))}},dt=function(){var e=i.createElement("div");return e.id=X.containerId,e.className=X.containerClass,e.style.position="absolute",e.style.left="0px",e.style.top="-9999px",e.style.width="1px",e.style.height="1px",e.style.zIndex=""+Mt(X.zIndex),e},pt=function(e){for(var t=e&&e.parentNode;t&&"OBJECT"===t.nodeName&&t.parentNode;)t=t.parentNode;return t||null},ft=function(){var e,t=D.bridge,n=pt(t);if(!t){var r=wt(o.location.host,X),a="never"===r?"none":"all",s=vt(X),l=X.swfPath+yt(X.swfPath,X);n=dt();var c=i.createElement("div");n.appendChild(c),i.body.appendChild(n);var u=i.createElement("div"),d="activex"===D.pluginType;u.innerHTML='"+(d?'':"")+'',t=u.firstChild,u=null,w(t).ZeroClipboard=Bt,n.replaceChild(t,c)}return t||(t=i[X.swfObjectId],t&&(e=t.length)&&(t=t[e-1]),!t&&n&&(t=n.firstChild)),D.bridge=t||null,t},ht=function(){var e=D.bridge;if(e){var t=pt(e);t&&("activex"===D.pluginType&&"readyState"in e?(e.style.display="none",function n(){if(4===e.readyState){for(var r in e)"function"==typeof e[r]&&(e[r]=null);e.parentNode&&e.parentNode.removeChild(e),t.parentNode&&t.parentNode.removeChild(t)}else s(n,10)}()):(e.parentNode&&e.parentNode.removeChild(e),t.parentNode&&t.parentNode.removeChild(t))),D.ready=null,D.bridge=null,D.deactivated=null}},mt=function(e){var t={},n={};if("object"==typeof e&&e){for(var r in e)if(r&&v.call(e,r)&&"string"==typeof e[r]&&e[r])switch(r.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":t.text=e[r],n.text=r;break;case"text/html":case"html":case"air:html":case"flash:html":t.html=e[r],n.html=r;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":t.rtf=e[r],n.rtf=r}return{data:t,formatMap:n}}},gt=function(e,t){if("object"!=typeof e||!e||"object"!=typeof t||!t)return e;var n={};for(var r in e)if(v.call(e,r)){if("success"!==r&&"data"!==r){n[r]=e[r];continue}n[r]={};var o=e[r];for(var i in o)i&&v.call(o,i)&&v.call(t,i)&&(n[r][t[i]]=o[i])}return n},yt=function(e,t){var n=null==t||t&&t.cacheBust===!0;return n?(-1===e.indexOf("?")?"?":"&")+"noCache="+m():""},vt=function(e){var t,n,r,i,a="",s=[];if(e.trustedDomains&&("string"==typeof e.trustedDomains?i=[e.trustedDomains]:"object"==typeof e.trustedDomains&&"length"in e.trustedDomains&&(i=e.trustedDomains)),i&&i.length)for(t=0,n=i.length;n>t;t++)if(v.call(i,t)&&i[t]&&"string"==typeof i[t]){if(r=bt(i[t]),!r)continue;if("*"===r){s.length=0,s.push(r);break}s.push.apply(s,[r,"//"+r,o.location.protocol+"//"+r])}return s.length&&(a+="trustedOrigins="+l(s.join(","))),e.forceEnhancedClipboard===!0&&(a+=(a?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof e.swfObjectId&&e.swfObjectId&&(a+=(a?"&":"")+"swfObjectId="+l(e.swfObjectId)),a},bt=function(e){if(null==e||""===e)return null;if(e=e.replace(/^\s+|\s+$/g,""),""===e)return null;var t=e.indexOf("//");e=-1===t?e:e.slice(t+2);var n=e.indexOf("/");return e=-1===n?e:-1===t||0===n?null:e.slice(0,n),e&&".swf"===e.slice(-4).toLowerCase()?null:e||null},wt=function(){var e=function(e){var t,n,r,o=[];if("string"==typeof e&&(e=[e]),"object"!=typeof e||!e||"number"!=typeof e.length)return o;for(t=0,n=e.length;n>t;t++)if(v.call(e,t)&&(r=bt(e[t]))){if("*"===r){o.length=0,o.push("*");break}-1===o.indexOf(r)&&o.push(r)}return o};return function(t,n){var r=bt(n.swfPath);null===r&&(r=t);var o=e(n.trustedDomains),i=o.length;if(i>0){if(1===i&&"*"===o[0])return"always";if(-1!==o.indexOf(t))return 1===i&&t===r?"sameDomain":"always"}return"never"}}(),kt=function(){try{return i.activeElement}catch(e){return null}},xt=function(e,t){if(!e||1!==e.nodeType)return e;if(e.classList)return e.classList.contains(t)||e.classList.add(t),e;if(t&&"string"==typeof t){var n=(t||"").split(/\s+/);if(1===e.nodeType)if(e.className){for(var r=" "+e.className+" ",o=e.className,i=0,a=n.length;a>i;i++)r.indexOf(" "+n[i]+" ")<0&&(o+=" "+n[i]);e.className=o.replace(/^\s+|\s+$/g,"")}else e.className=t}return e},Ct=function(e,t){if(!e||1!==e.nodeType)return e;if(e.classList)return e.classList.contains(t)&&e.classList.remove(t),e;if("string"==typeof t&&t){var n=t.split(/\s+/);if(1===e.nodeType&&e.className){for(var r=(" "+e.className+" ").replace(/[\n\t]/g," "),o=0,i=n.length;i>o;o++)r=r.replace(" "+n[o]+" "," ");e.className=r.replace(/^\s+|\s+$/g,"")}}return e},jt=function(e,t){var n=o.getComputedStyle(e,null).getPropertyValue(t);return"cursor"!==t||n&&"auto"!==n||"A"!==e.nodeName?n:"pointer"},Et=function(){var e,t,n,r=1;return"function"==typeof i.body.getBoundingClientRect&&(e=i.body.getBoundingClientRect(),t=e.right-e.left,n=i.body.offsetWidth,r=h(t/n*100)/100),r},It=function(e){var t={left:0,top:0,width:0,height:0};if(e.getBoundingClientRect){var n,r,a,s=e.getBoundingClientRect();"pageXOffset"in o&&"pageYOffset"in o?(n=o.pageXOffset,r=o.pageYOffset):(a=Et(),n=h(i.documentElement.scrollLeft/a),r=h(i.documentElement.scrollTop/a));var l=i.documentElement.clientLeft||0,c=i.documentElement.clientTop||0;t.left=s.left+n-l,t.top=s.top+r-c,t.width="width"in s?s.width:s.right-s.left,t.height="height"in s?s.height:s.bottom-s.top}return t},Tt=function(){var e;if(n&&(e=pt(D.bridge))){var t=It(n);x(e.style,{width:t.width+"px",height:t.height+"px",top:t.top+"px",left:t.left+"px",zIndex:""+Mt(X.zIndex)})}},Lt=function(e){D.ready===!0&&(D.bridge&&"function"==typeof D.bridge.setHandCursor?D.bridge.setHandCursor(e):D.ready=!1)},Mt=function(e){if(/^(?:auto|inherit)$/.test(e))return e;var t;return"number"!=typeof e||f(e)?"string"==typeof e&&(t=Mt(d(e,10))):t=e,"number"==typeof t?t:"auto"},St=function(e){function t(e){var t=e.match(/[\d]+/g);return t.length=3,t.join(".")}function n(e){return!!e&&(e=e.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(e)||"chrome.plugin"===e.slice(-13))}function r(e){e&&(l=!0,e.version&&(d=t(e.version)),!d&&e.description&&(d=t(e.description)),e.filename&&(u=n(e.filename)))}var o,i,s,l=!1,c=!1,u=!1,d="";if(a.plugins&&a.plugins.length)o=a.plugins["Shockwave Flash"],r(o),a.plugins["Shockwave Flash 2.0"]&&(l=!0,d="2.0.0.11");else if(a.mimeTypes&&a.mimeTypes.length)s=a.mimeTypes["application/x-shockwave-flash"],o=s&&s.enabledPlugin,r(o);else if("undefined"!=typeof e){c=!0;try{i=new e("ShockwaveFlash.ShockwaveFlash.7"),l=!0,d=t(i.GetVariable("$version"))}catch(f){try{i=new e("ShockwaveFlash.ShockwaveFlash.6"),l=!0,d="6.0.21"}catch(h){try{i=new e("ShockwaveFlash.ShockwaveFlash"),l=!0,d=t(i.GetVariable("$version"))}catch(m){c=!1}}}}D.disabled=l!==!0,D.outdated=d&&p(d)n;n++)e=o[n].replace(/^on/,""),i[e]=!0,a[e]||(a[e]=[]),a[e].push(t);if(i.ready&&D.ready&&this.emit({type:"ready",client:this}),i.error){var s=["disabled","outdated","unavailable","deactivated","overdue"];for(n=0,r=s.length;r>n;n++)if(D[s[n]]){this.emit({type:"error",name:"flash-"+s[n],client:this});break}}}return this},qt=function(e,t){var n,r,o,i,a,s=_t[this.id]&&_t[this.id].handlers;if(0===arguments.length)i=g(s);else if("string"==typeof e&&e)i=e.split(/\s+/);else if("object"==typeof e&&e&&"undefined"==typeof t)for(n in e)v.call(e,n)&&"string"==typeof n&&n&&"function"==typeof e[n]&&this.off(n,e[n]);if(i&&i.length)for(n=0,r=i.length;r>n;n++)if(e=i[n].toLowerCase().replace(/^on/,""),a=s[e],a&&a.length)if(t)for(o=a.indexOf(t);-1!==o;)a.splice(o,1),o=a.indexOf(t,o);else a.length=0;return this},Xt=function(e){var t=null,n=_t[this.id]&&_t[this.id].handlers;return n&&(t="string"==typeof e&&e?n[e]?n[e].slice(0):[]:C(n)),t},Yt=function(e){if($t.call(this,e)){"object"==typeof e&&e&&"string"==typeof e.type&&e.type&&(e=x({},e));var t=x({},rt(e),{client:this});Gt.call(this,t)}return this},zt=function(e){e=Ut(e);for(var t=0;t0,r=!e.target||n&&-1!==t.indexOf(e.target),o=e.relatedTarget&&n&&-1!==t.indexOf(e.relatedTarget),i=e.client&&e.client===this;return r||o||i?!0:!1},Gt=function(e){if("object"==typeof e&&e&&e.type){var t=at(e),n=_t[this.id]&&_t[this.id].handlers["*"]||[],r=_t[this.id]&&_t[this.id].handlers[e.type]||[],i=n.concat(r);if(i&&i.length){var a,s,l,c,u,d=this;for(a=0,s=i.length;s>a;a++)l=i[a],c=d,"string"==typeof l&&"function"==typeof o[l]&&(l=o[l]),"object"==typeof l&&l&&"function"==typeof l.handleEvent&&(c=l,l=l.handleEvent),"function"==typeof l&&(u=x({},e),st(l,c,[u],t))}return this}},Ut=function(e){return"string"==typeof e&&(e=[]),"number"!=typeof e.length?[e]:e},Wt=function(e){if(e&&1===e.nodeType){var t=function(e){(e||(e=o.event))&&("js"!==e._source&&(e.stopImmediatePropagation(),e.preventDefault()),delete e._source)},n=function(n){(n||(n=o.event))&&(t(n),Bt.focus(e))};e.addEventListener("mouseover",n,!1),e.addEventListener("mouseout",t,!1),e.addEventListener("mouseenter",t,!1),e.addEventListener("mouseleave",t,!1),e.addEventListener("mousemove",t,!1),Ft[e.zcClippingId]={mouseover:n,mouseout:t,mouseenter:t,mouseleave:t,mousemove:t}}},Zt=function(e){if(e&&1===e.nodeType){var t=Ft[e.zcClippingId];if("object"==typeof t&&t){for(var n,r,o=["move","leave","enter","out","over"],i=0,a=o.length;a>i;i++)n="mouse"+o[i],r=t[n],"function"==typeof r&&e.removeEventListener(n,r,!1);delete Ft[e.zcClippingId]}}};Bt._createClient=function(){Ht.apply(this,k(arguments))},Bt.prototype.on=function(){return Nt.apply(this,k(arguments))},Bt.prototype.off=function(){return qt.apply(this,k(arguments))},Bt.prototype.handlers=function(){return Xt.apply(this,k(arguments))},Bt.prototype.emit=function(){return Yt.apply(this,k(arguments))},Bt.prototype.clip=function(){return zt.apply(this,k(arguments))},Bt.prototype.unclip=function(){return Pt.apply(this,k(arguments))},Bt.prototype.elements=function(){return Rt.apply(this,k(arguments))},Bt.prototype.destroy=function(){return Vt.apply(this,k(arguments))},Bt.prototype.setText=function(e){return Bt.setData("text/plain",e),this},Bt.prototype.setHtml=function(e){return Bt.setData("text/html",e),this},Bt.prototype.setRichText=function(e){return Bt.setData("application/rtf",e),this},Bt.prototype.setData=function(){return Bt.setData.apply(this,k(arguments)),this},Bt.prototype.clearData=function(){return Bt.clearData.apply(this,k(arguments)),this},Bt.prototype.getData=function(){return Bt.getData.apply(this,k(arguments))},"function"==typeof define&&define.amd?define(function(){return Bt}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Bt:e.ZeroClipboard=Bt}(function(){return this||window}()),function(){var e=function(e,t,n){return t+"-"+n.toLowerCase()},t=function(t,n){return window.getComputedStyle?(n=n.replace(/([a-z])([A-Z])/,e),window.getComputedStyle(t,null).getPropertyValue(n)):t.currentStyle?t.currentStyle[n]:t.style[n]},n=function(e,n){var r,o=100,i={pixel:"px",percent:"%",inch:"in",cm:"cm",mm:"mm",point:"pt",pica:"pc",em:"em",ex:"ex"},a={},s={},l=t(e,n),c=l.match(/\d+/);if(null===c)throw"Invalid property value returned";c=c[0];var u=l.match(/\D+$/);u=null==u?i.pixel:u[0];var d;for(r in i)if(i[r]==u){d=r;break}if(!d)throw"Unit not found in map";var p=document.createElement("div");p.style.overflow="hidden",p.style.visibility="hidden",e.parentElement.appendChild(p);for(r in i)p.style.width=o+i[r],a[r]=o/p.offsetWidth;for(r in i)s[r]=c*a[r]*a[d];return e.parentElement.removeChild(p),s};window.getUnits=this.getUnits=n}();var jscolor={dir:"",bindClass:"color",binding:!0,preloading:!0,install:function(){jscolor.addEvent(window,"load",jscolor.init)},init:function(){jscolor.binding&&jscolor.bind(),jscolor.preloading&&jscolor.preload()},getDir:function(){if(!jscolor.dir){var e=jscolor.detectDir();jscolor.dir=e!==!1?e:"jscolor/"}return jscolor.dir},detectDir:function(){for(var e=location.href,t=document.getElementsByTagName("base"),n=0;nu[t]&&-l[t]+o[t]+s[t]/2>u[t]/2&&o[t]+s[t]-d[t]>=0?o[t]+s[t]-d[t]:o[t],-l[n]+o[n]+s[n]+d[n]-p+p*r>u[n]?-l[n]+o[n]+s[n]/2>u[n]/2&&o[n]+s[n]-p-p*r>=0?o[n]+s[n]-p-p*r:o[n]+s[n]-p+p*r:o[n]+s[n]-p+p*r>=0?o[n]+s[n]-p+p*r:o[n]+s[n]-p-p*r];else var f=[o[t],o[n]+s[n]-p+p*r];i(f[t],f[n])}},this.importColor=function(){b?this.adjust?!this.required&&/^\s*$/.test(b.value)?(b.value="",w.style.backgroundImage=w.jscStyle.backgroundImage,w.style.backgroundColor=w.jscStyle.backgroundColor,w.style.color=w.jscStyle.color,this.exportColor(j|E)):this.fromString(b.value)||this.exportColor():this.fromString(b.value,j)||(w.style.backgroundImage=w.jscStyle.backgroundImage,w.style.backgroundColor=w.jscStyle.backgroundColor,w.style.color=w.jscStyle.color,this.exportColor(j|E)):this.exportColor()},this.exportColor=function(e){if(!(e&j)&&b){var t=this.toString();this.caps&&(t=t.toUpperCase()),this.hash&&(t="#"+t),b.value=t}e&E||!w||(w.style.backgroundImage="none",w.style.backgroundColor="#"+this.toString(),w.style.color=.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]<.5?"#FFF":"#000"),e&I||!c()||s(),e&T||!c()||l()},this.fromHSV=function(e,t,n,o){null!==e&&(e=Math.max(0,this.minH,Math.min(6,this.maxH,e))),null!==t&&(t=Math.max(0,this.minS,Math.min(1,this.maxS,t))),null!==n&&(n=Math.max(0,this.minV,Math.min(1,this.maxV,n))),this.rgb=r(null===e?this.hsv[0]:this.hsv[0]=e,null===t?this.hsv[1]:this.hsv[1]=t,null===n?this.hsv[2]:this.hsv[2]=n),this.exportColor(o)},this.fromRGB=function(e,t,o,i){null!==e&&(e=Math.max(0,Math.min(1,e))),null!==t&&(t=Math.max(0,Math.min(1,t))),null!==o&&(o=Math.max(0,Math.min(1,o)));var a=n(null===e?this.rgb[0]:e,null===t?this.rgb[1]:t,null===o?this.rgb[2]:o);null!==a[0]&&(this.hsv[0]=Math.max(0,this.minH,Math.min(6,this.maxH,a[0]))),0!==a[2]&&(this.hsv[1]=null===a[1]?null:Math.max(0,this.minS,Math.min(1,this.maxS,a[1]))),this.hsv[2]=null===a[2]?null:Math.max(0,this.minV,Math.min(1,this.maxV,a[2]));var s=r(this.hsv[0],this.hsv[1],this.hsv[2]);this.rgb[0]=s[0],this.rgb[1]=s[1],this.rgb[2]=s[2],this.exportColor(i)},this.fromString=function(e,t){var n=e.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);return n?(6===n[1].length?this.fromRGB(parseInt(n[1].substr(0,2),16)/255,parseInt(n[1].substr(2,2),16)/255,parseInt(n[1].substr(4,2),16)/255,t):this.fromRGB(parseInt(n[1].charAt(0)+n[1].charAt(0),16)/255,parseInt(n[1].charAt(1)+n[1].charAt(1),16)/255,parseInt(n[1].charAt(2)+n[1].charAt(2),16)/255,t),!0):!1},this.toString=function(){return(256|Math.round(255*this.rgb[0])).toString(16).substr(1)+(256|Math.round(255*this.rgb[1])).toString(16).substr(1)+(256|Math.round(255*this.rgb[2])).toString(16).substr(1)};var g=this,y="hvs"===this.pickerMode.toLowerCase()?1:0,v=!1,b=jscolor.fetchElement(this.valueElement),w=jscolor.fetchElement(this.styleElement),k=!1,x=!1,C={},j=1,E=2,I=4,T=8;if(jscolor.addEvent(e,"focus",function(){g.pickerOnfocus&&g.showPicker()}),jscolor.addEvent(e,"blur",function(){v?v=!1:window.setTimeout(function(){v||u(),v=!1},0)}),b){var L=function(){g.fromString(b.value,j),h()};jscolor.addEvent(b,"keyup",L),jscolor.addEvent(b,"input",L),jscolor.addEvent(b,"blur",d),b.setAttribute("autocomplete","off")}switch(w&&(w.jscStyle={backgroundImage:w.style.backgroundImage,backgroundColor:w.style.backgroundColor,color:w.style.color}),y){case 0:jscolor.requireImage("hs.png");break;case 1:jscolor.requireImage("hv.png")}jscolor.requireImage("cross.gif"),jscolor.requireImage("arrow.gif"),this.importColor()}};jscolor.install(),function(e){"use strict";function t(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function n(e,t,n){for(var r=0,o=e.length;o>r;r++)if(e[r][n]===t)return r;return-1}function r(e){var t=document.createElement("div");if(t.style.color=e,!t.style.color)return null;document.head.appendChild(t);var n=getComputedStyle(t).color;if(document.head.removeChild(t),!n)return null;n.match(/\((\d+), (\d+), (\d+)/);return n}function o(){for(var e=[],t=0;t-1}function a(e,t){var n=document.getElementById(t),r=document.getElementById(e);n.value=r.value}function s(e,t){switch(e){case"w":return(100*t/M).toFixed(2)+"%";case"h":return(100*t/S).toFixed(2)+"%";default:return}}function l(e,n){this.q=e,this.options=t({},this.options),t(this.options,n),this._init()}function c(e,t,n,r,o){this.name=e,this.posX=t,this.posY=n,this.colour=r,this.deep=o}function u(){L=[],[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.addEventListener("dragstart",d,!1),L.push(new c(e.id,s("w",e.offsetLeft),s("h",e.offsetTop),e.dataset.colour,e.dataset.deep))}),m(),h(O.value)}function d(t){var n=e.getComputedStyle(t.target,null);E=[t.target.id,parseInt(n.getPropertyValue("left"),10)-t.clientX,parseInt(n.getPropertyValue("top"),10)-t.clientY],t.dataTransfer.setData("text/plain",E),document.getElementById("r_"+t.target.id).classList.add("current")}function p(e){var t=document.getElementById(E[0]);return t.style.left=s("w",e.clientX),t.style.top=s("h",e.clientY),e.preventDefault(),!1}function f(e){var t=document.getElementById(E[0]);t.style.left=s("w",e.clientX),t.style.top=s("h",e.clientY);for(var n=0;n=0;e--){var t=_.insertRow(0);t.setAttribute("id","r_"+L[e].name);var n=t.insertCell(0);n.setAttribute("class","c_name");var r=t.insertCell(1);r.setAttribute("class","c_posX");var o=t.insertCell(2);o.setAttribute("class","c_posY");var i=t.insertCell(3);i.setAttribute("class","c_colour");var s=t.insertCell(4);s.setAttribute("class","c_deep-slider");var l=t.insertCell(5);l.setAttribute("class","c_deep-value");var c=t.insertCell(6);c.setAttribute("class","c_del");var u=t.insertCell(7);u.setAttribute("class","c_up"),n.innerHTML=L[e].name,r.innerHTML=L[e].posX,o.innerHTML=L[e].posY;var d=document.createElement("input");d.setAttribute("id","col_"+L[e].name),d.setAttribute("type","text"),d.setAttribute("class","color {adjust:false,hash:true,caps:false,pickerFaceColor:'transparent',pickerFace:3,pickerBorder:0,pickerInsetColor:'black'} input_colour"),d.setAttribute("value",L[e].colour),new jscolor.color(d,{adjust:!1,hash:!0,caps:!1,pickerFaceColor:"transparent",pickerFace:3,pickerBorder:0,pickerInsetColor:"black"}),i.appendChild(d),v();var p=document.createElement("button");p.setAttribute("class","del_item"),p.setAttribute("data-del",L[e].name),p.innerHTML='',c.appendChild(p),b();var f=document.createElement("input");f.setAttribute("id","slider_"+L[e].name),f.setAttribute("type","range"),f.setAttribute("min","1"),f.setAttribute("max","100"),f.setAttribute("value",parseInt(L[e].deep)),s.appendChild(f);var h=document.createElement("input");h.setAttribute("id","value_"+L[e].name),h.setAttribute("type","number"),h.setAttribute("min","1"),h.setAttribute("max","100"),h.setAttribute("pattern","[0-9]"),h.setAttribute("size","2"),l.appendChild(h),a("slider_"+L[e].name,"value_"+L[e].name),y();var m=document.createElement("button");m.setAttribute("class","up_item"),m.setAttribute("data-level",e),m.innerHTML='',u.appendChild(m),g()}}function g(){document.querySelector(".up_item").onclick=function(){x(this.dataset.level)}}function y(){document.querySelector("[id*=value_]").onchange=function(){var e=this.id.replace("value_","");this.value>100&&(this.value=100),a(this.id,"slider_"+e),document.getElementById(e).dataset.deep=this.value+"%";var t=n(L,e,"name");t>-1&&(L[t].deep=this.value+"%"),h(O.value)},document.querySelector("[id*=value_]").addEventListener("keypress",function(e){(e.which<48||e.which>57)&&e.preventDefault()}),document.querySelector("[id*=slider_]").onchange=function(){var e=this.id.replace("slider_","");a(this.id,"value_"+e),document.getElementById(e).dataset.deep=this.value+"%";var t=n(L,e,"name");t>-1&&(L[t].deep=this.value+"%"),h(O.value)}}function v(){document.querySelector("[id*=col_]").onchange=function(){var e=this.id.replace("col_","");document.getElementById(e).dataset.colour=this.value;var t=n(L,e,"name");t>-1&&(L[t].colour=this.value),h(O.value)}}function b(){document.querySelector(".del_item").onclick=function(){k(this.dataset.del)}}function w(){for(var e=0;e-1&&L.splice(o,1),0===L.length&&(D.checked=!1,document.querySelector(".points").classList.add("empty")),m(),h(O.value)}function x(e){e>0&&(L.move(e,e-1),m(),h(O.value))}function C(){var e,t=document.createElement("span");t.setAttribute("draggable","true"),L.length>0?e=o()+1:(e=1,document.querySelector(".points").classList.remove("empty")),t.setAttribute("id","d"+e),i(F,"hide")?t.setAttribute("class","dragme hide"):t.setAttribute("class","dragme");var n=""!==A.value&&null!==r(A.value)?A.value:"rgba(255,255,255,0.5)";A.value="",t.setAttribute("data-colour",n),t.setAttribute("data-deep","100%"),T.appendChild(t),t.addEventListener("dragstart",d,!1),L.push(new c(t.id,(100*t.offsetLeft/M).toFixed(2)+"%",(100*t.offsetTop/S).toFixed(2)+"%",n,"100%")),m(),h(O.value)}function j(){var e=new Object;e.html="",e.css="body, html { height:100%; overflow:hidden; } \nbody { \n background-image:"+I+";\n}",e.js="// draGGradients by @elrumordelaluz http://elrumordelaluz.github.io/draGGradients/",e.css_prefix_free="true",e.title="draGGradients: generated radial-gradient",e.description="Pen from draGGradients by @elrumordelaluz http://elrumordelaluz.github.io/draGGradients/";var t=new Array;t[0]="html",t[1]="css",t[3]="js",t[4]="css_prefix_free",t[5]="title",t[6]="description";var n=JSON.stringify(e,t," ");document.getElementById("cdpn-data").value=n}Array.prototype.move=function(e,t){for(;0>e;)e+=this.length;for(;0>t;)t+=this.length;if(t>=this.length)for(var n=t-this.length;n--+1;)this.push(void 0);return this.splice(t,0,this.splice(e,1)[0]),this};var E,I,T=document.getElementById("canvas"),L=[],M=T.offsetWidth,S=T.offsetHeight,B=document.getElementById("add_point"),A=document.getElementById("set_colour"),_=document.getElementById("coords"),D=document.getElementById("open_config"),O=document.getElementById("bg-color"),F=document.getElementById("points-op"),H=document.getElementById("export_code"),N=document.getElementById("generated_code"),q=document.getElementById("popup-code"),X=document.getElementById("popup-q"),Y=document.getElementById("q-opener");l.prototype._init=function(){[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.parentElement.removeChild(e)});for(var e=1,t=this.q<15?this.q:15;t>=e;e++){var n=document.createElement("span");n.setAttribute("draggable","true");var r=e;document.querySelector(".points").classList.remove("empty");var o="d"+r;n.setAttribute("id",o),n.setAttribute("class","dragme"),this.options[o]instanceof Object?(n.setAttribute("data-colour",this.options[o].color||"rgba(255,255,255,0.5)"),n.setAttribute("data-deep",this.options[o].deep||"100%"),n.style.left=this.options[o].left,n.style.top=this.options[o].top):(n.setAttribute("data-colour","rgba(255,255,255,0.5)"),n.setAttribute("data-deep","100%")),T.appendChild(n)}this.options.bg&&(O.value=this.options.bg,O.style.backgroundColor=this.options.bg),u()},c.prototype.getInfo=function(){return this.name+" ("+this.posX+","+this.posY+") - "+this.colour+" - "+this.deep},document.addEventListener("DOMContentLoaded",function(){document.body.onkeyup=function(e){27==e.keyCode&&(D.checked=D.checked===!0?!1:!0,i(q,"open")&&q.classList.remove("open"),i(X,"open")&&X.classList.remove("open"))},F.onclick=function(){[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.classList.toggle("hide")}),this.classList.toggle("hide")},O.onchange=function(){h(this.value)},e.onresize=function(){M=T.offsetWidth,S=T.offsetHeight},B.onclick=C,H.onclick=function(){i(X,"open")&&X.classList.remove("open"),q.classList.toggle("open")},Y.onclick=function(){i(q,"open")&&q.classList.remove("open"),X.classList.toggle("open")},T.addEventListener("dragover",p,!1),T.addEventListener("drop",f,!1)});var z=new ZeroClipboard(N);z.on("ready",function(){z.on("aftercopy",function(){N.classList.add("copied")})}),e.RadialGradients=l,e.init=u}(window); \ No newline at end of file +!function(e,t){"use strict";var r,n,o=e,i=o.document,a=o.navigator,s=o.setTimeout,l=o.encodeURIComponent,c=o.ActiveXObject,u=o.Error,d=o.Number.parseInt||o.parseInt,p=o.Number.parseFloat||o.parseFloat,f=o.Number.isNaN||o.isNaN,h=o.Math.round,m=o.Date.now,g=o.Object.keys,y=o.Object.defineProperty,v=o.Object.prototype.hasOwnProperty,b=o.Array.prototype.slice,w=function(){var e=function(e){return e};if("function"==typeof o.wrap&&"function"==typeof o.unwrap)try{var t=i.createElement("div"),r=o.unwrap(t);1===t.nodeType&&r&&1===r.nodeType&&(e=o.unwrap)}catch(n){}return e}(),k=function(e){return b.call(e,0)},x=function(){var e,r,n,o,i,a,s=k(arguments),l=s[0]||{};for(e=1,r=s.length;e=0&&s(function(){"boolean"!=typeof D.deactivated&&(D.deactivated=!0),D.deactivated===!0&&Be.emit({type:"error",name:"flash-deactivated"})},e),D.overdue=!1,fe()}},W=function(){Be.clearData(),Be.blur(),Be.emit("destroy"),he(),Be.off()},Z=function(e,t){var r;if("object"==typeof e&&e&&"undefined"==typeof t)r=e,Be.clearData();else{if("string"!=typeof e||!e)return;r={},r[e]=t}for(var n in r)"string"==typeof n&&n&&v.call(r,n)&&"string"==typeof r[n]&&r[n]&&(F[n]=r[n])},J=function(e){"undefined"==typeof e?(I(F),N=null):"string"==typeof e&&v.call(F,e)&&delete F[e]},K=function(e){return"undefined"==typeof e?C(F):"string"==typeof e&&v.call(F,e)?F[e]:void 0},Q=function(e){if(e&&1===e.nodeType){r&&(Ce(r,X.activeClass),r!==e&&Ce(r,X.hoverClass)),r=e,xe(e,X.hoverClass);var t=e.getAttribute("title")||X.title;if("string"==typeof t&&t){var n=pe(D.bridge);n&&n.setAttribute("title",t)}var o=X.forceHandCursor===!0||"pointer"===je(e,"cursor");Te(o),Se()}},ee=function(){var e=pe(D.bridge);e&&(e.removeAttribute("title"),e.style.left="0px",e.style.top="-9999px",e.style.width="1px",e.style.top="1px"),r&&(Ce(r,X.hoverClass),Ce(r,X.activeClass),r=null)},te=function(){return r||null},re=function(e){return"string"==typeof e&&e&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(e)},ne=function(e){var t;if("string"==typeof e&&e?(t=e,e={}):"object"==typeof e&&e&&"string"==typeof e.type&&e.type&&(t=e.type),t){!e.target&&/^(copy|aftercopy|_click)$/.test(t.toLowerCase())&&(e.target=n),x(e,{type:t.toLowerCase(),target:e.target||r||null,relatedTarget:e.relatedTarget||null,currentTarget:D&&D.bridge||null,timeStamp:e.timeStamp||m()||null});var o=q[e.type];return"error"===e.type&&e.name&&o&&(o=o[e.name]),o&&(e.message=o),"ready"===e.type&&x(e,{target:null,version:D.version}),"error"===e.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(e.name)&&x(e,{target:null,minimumVersion:O}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(e.name)&&x(e,{version:D.version})),"copy"===e.type&&(e.clipboardData={setData:Be.setData,clearData:Be.clearData}),"aftercopy"===e.type&&(e=ge(e,N)),e.target&&!e.relatedTarget&&(e.relatedTarget=oe(e.target)),e=ie(e)}},oe=function(e){var t=e&&e.getAttribute&&e.getAttribute("data-clipboard-target");return t?i.getElementById(t):null},ie=function(e){if(e&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(e.type)){var r=e.target,n="_mouseover"===e.type&&e.relatedTarget?e.relatedTarget:t,a="_mouseout"===e.type&&e.relatedTarget?e.relatedTarget:t,s=Ie(r),l=o.screenLeft||o.screenX||0,c=o.screenTop||o.screenY||0,u=i.body.scrollLeft+i.documentElement.scrollLeft,d=i.body.scrollTop+i.documentElement.scrollTop,p=s.left+("number"==typeof e._stageX?e._stageX:0),f=s.top+("number"==typeof e._stageY?e._stageY:0),h=p-u,m=f-d,g=l+h,y=c+m,v="number"==typeof e.movementX?e.movementX:0,b="number"==typeof e.movementY?e.movementY:0;delete e._stageX,delete e._stageY,x(e,{srcElement:r,fromElement:n,toElement:a,screenX:g,screenY:y,pageX:p,pageY:f,clientX:h,clientY:m,x:h,y:m,movementX:v,movementY:b,offsetX:0,offsetY:0,layerX:0,layerY:0})}return e},ae=function(e){var t=e&&"string"==typeof e.type&&e.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(t)},se=function(e,t,r,n){n?s(function(){e.apply(t,r)},0):e.apply(t,r)},le=function(e){if("object"==typeof e&&e&&e.type){var t=ae(e),r=H["*"]||[],n=H[e.type]||[],i=r.concat(n);if(i&&i.length){var a,s,l,c,u,d=this;for(a=0,s=i.length;a"+(d?'':"")+'',t=u.firstChild,u=null,w(t).ZeroClipboard=Be,r.replaceChild(t,c)}return t||(t=i[X.swfObjectId],t&&(e=t.length)&&(t=t[e-1]),!t&&r&&(t=r.firstChild)),D.bridge=t||null,t},he=function(){var e=D.bridge;if(e){var t=pe(e);t&&("activex"===D.pluginType&&"readyState"in e?(e.style.display="none",function r(){if(4===e.readyState){for(var n in e)"function"==typeof e[n]&&(e[n]=null);e.parentNode&&e.parentNode.removeChild(e),t.parentNode&&t.parentNode.removeChild(t)}else s(r,10)}()):(e.parentNode&&e.parentNode.removeChild(e),t.parentNode&&t.parentNode.removeChild(t))),D.ready=null,D.bridge=null,D.deactivated=null}},me=function(e){var t={},r={};if("object"==typeof e&&e){for(var n in e)if(n&&v.call(e,n)&&"string"==typeof e[n]&&e[n])switch(n.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":t.text=e[n],r.text=n;break;case"text/html":case"html":case"air:html":case"flash:html":t.html=e[n],r.html=n;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":t.rtf=e[n],r.rtf=n}return{data:t,formatMap:r}}},ge=function(e,t){if("object"!=typeof e||!e||"object"!=typeof t||!t)return e;var r={};for(var n in e)if(v.call(e,n)){if("success"!==n&&"data"!==n){r[n]=e[n];continue}r[n]={};var o=e[n];for(var i in o)i&&v.call(o,i)&&v.call(t,i)&&(r[n][t[i]]=o[i])}return r},ye=function(e,t){var r=null==t||t&&t.cacheBust===!0;return r?(e.indexOf("?")===-1?"?":"&")+"noCache="+m():""},ve=function(e){var t,r,n,i,a="",s=[];if(e.trustedDomains&&("string"==typeof e.trustedDomains?i=[e.trustedDomains]:"object"==typeof e.trustedDomains&&"length"in e.trustedDomains&&(i=e.trustedDomains)),i&&i.length)for(t=0,r=i.length;t0){if(1===i&&"*"===o[0])return"always";if(o.indexOf(t)!==-1)return 1===i&&t===n?"sameDomain":"always"}return"never"}}(),ke=function(){try{return i.activeElement}catch(e){return null}},xe=function(e,t){if(!e||1!==e.nodeType)return e;if(e.classList)return e.classList.contains(t)||e.classList.add(t),e;if(t&&"string"==typeof t){var r=(t||"").split(/\s+/);if(1===e.nodeType)if(e.className){for(var n=" "+e.className+" ",o=e.className,i=0,a=r.length;i0,n=!e.target||r&&t.indexOf(e.target)!==-1,o=e.relatedTarget&&r&&t.indexOf(e.relatedTarget)!==-1,i=e.client&&e.client===this;return!!(n||o||i)},Ge=function(e){if("object"==typeof e&&e&&e.type){var t=ae(e),r=_e[this.id]&&_e[this.id].handlers["*"]||[],n=_e[this.id]&&_e[this.id].handlers[e.type]||[],i=r.concat(n);if(i&&i.length){var a,s,l,c,u,d=this;for(a=0,s=i.length;au[t]&&-l[t]+o[t]+s[t]/2>u[t]/2&&o[t]+s[t]-d[t]>=0?o[t]+s[t]-d[t]:o[t],-l[r]+o[r]+s[r]+d[r]-p+p*n>u[r]?-l[r]+o[r]+s[r]/2>u[r]/2&&o[r]+s[r]-p-p*n>=0?o[r]+s[r]-p-p*n:o[r]+s[r]-p+p*n:o[r]+s[r]-p+p*n>=0?o[r]+s[r]-p+p*n:o[r]+s[r]-p-p*n];else var f=[o[t],o[r]+s[r]-p+p*n];i(f[t],f[r])}},this.importColor=function(){b?this.adjust?!this.required&&/^\s*$/.test(b.value)?(b.value="",w.style.backgroundImage=w.jscStyle.backgroundImage,w.style.backgroundColor=w.jscStyle.backgroundColor,w.style.color=w.jscStyle.color,this.exportColor(j|E)):this.fromString(b.value)||this.exportColor():this.fromString(b.value,j)||(w.style.backgroundImage=w.jscStyle.backgroundImage,w.style.backgroundColor=w.jscStyle.backgroundColor,w.style.color=w.jscStyle.color,this.exportColor(j|E)):this.exportColor()},this.exportColor=function(e){if(!(e&j)&&b){var t=this.toString();this.caps&&(t=t.toUpperCase()),this.hash&&(t="#"+t),b.value=t}e&E||!w||(w.style.backgroundImage="none",w.style.backgroundColor="#"+this.toString(),w.style.color=.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]<.5?"#FFF":"#000"),e&I||!c()||s(),e&S||!c()||l()},this.fromHSV=function(e,t,r,o){null!==e&&(e=Math.max(0,this.minH,Math.min(6,this.maxH,e))),null!==t&&(t=Math.max(0,this.minS,Math.min(1,this.maxS,t))),null!==r&&(r=Math.max(0,this.minV,Math.min(1,this.maxV,r))),this.rgb=n(null===e?this.hsv[0]:this.hsv[0]=e,null===t?this.hsv[1]:this.hsv[1]=t,null===r?this.hsv[2]:this.hsv[2]=r),this.exportColor(o)},this.fromRGB=function(e,t,o,i){null!==e&&(e=Math.max(0,Math.min(1,e))),null!==t&&(t=Math.max(0,Math.min(1,t))),null!==o&&(o=Math.max(0,Math.min(1,o)));var a=r(null===e?this.rgb[0]:e,null===t?this.rgb[1]:t,null===o?this.rgb[2]:o);null!==a[0]&&(this.hsv[0]=Math.max(0,this.minH,Math.min(6,this.maxH,a[0]))),0!==a[2]&&(this.hsv[1]=null===a[1]?null:Math.max(0,this.minS,Math.min(1,this.maxS,a[1]))),this.hsv[2]=null===a[2]?null:Math.max(0,this.minV,Math.min(1,this.maxV,a[2]));var s=n(this.hsv[0],this.hsv[1],this.hsv[2]);this.rgb[0]=s[0],this.rgb[1]=s[1],this.rgb[2]=s[2],this.exportColor(i)},this.fromString=function(e,t){var r=e.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);return!!r&&(6===r[1].length?this.fromRGB(parseInt(r[1].substr(0,2),16)/255,parseInt(r[1].substr(2,2),16)/255,parseInt(r[1].substr(4,2),16)/255,t):this.fromRGB(parseInt(r[1].charAt(0)+r[1].charAt(0),16)/255,parseInt(r[1].charAt(1)+r[1].charAt(1),16)/255,parseInt(r[1].charAt(2)+r[1].charAt(2),16)/255,t),!0)},this.toString=function(){return(256|Math.round(255*this.rgb[0])).toString(16).substr(1)+(256|Math.round(255*this.rgb[1])).toString(16).substr(1)+(256|Math.round(255*this.rgb[2])).toString(16).substr(1)};var g=this,y="hvs"===this.pickerMode.toLowerCase()?1:0,v=!1,b=jscolor.fetchElement(this.valueElement),w=jscolor.fetchElement(this.styleElement),k=!1,x=!1,C={},j=1,E=2,I=4,S=8;if(jscolor.addEvent(e,"focus",function(){g.pickerOnfocus&&g.showPicker()}),jscolor.addEvent(e,"blur",function(){v?v=!1:window.setTimeout(function(){v||u(),v=!1},0)}),b){var T=function(){g.fromString(b.value,j),h()};jscolor.addEvent(b,"keyup",T),jscolor.addEvent(b,"input",T),jscolor.addEvent(b,"blur",d),b.setAttribute("autocomplete","off")}switch(w&&(w.jscStyle={backgroundImage:w.style.backgroundImage,backgroundColor:w.style.backgroundColor,color:w.style.color}),y){case 0:jscolor.requireImage("hs.png");break;case 1:jscolor.requireImage("hv.png")}jscolor.requireImage("cross.gif"),jscolor.requireImage("arrow.gif"),this.importColor()}};jscolor.install(),function(e){"use strict";function t(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function r(e,t,r){for(var n=0,o=e.length;n-1}function a(e,t){var r=document.getElementById(t),n=document.getElementById(e);r.value=n.value}function s(e,t){switch(e){case"w":return(100*t/M).toFixed(2)+"%";case"h":return(100*t/B).toFixed(2)+"%";default:return}}function l(e,r){this.q=e,this.options=t({},this.options),t(this.options,r),this._init()}function c(e,t,r,n,o){this.name=e,this.posX=t,this.posY=r,this.colour=n,this.deep=o}function u(){L=[],[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.addEventListener("dragstart",d,!1),L.push(new c(e.id,s("w",e.offsetLeft),s("h",e.offsetTop),e.dataset.colour,e.dataset.deep))}),m(),h(H.value)}function d(t){var r=e.getComputedStyle(t.target,null);I=[t.target.id,parseInt(r.getPropertyValue("left"),10)-t.clientX,parseInt(r.getPropertyValue("top"),10)-t.clientY],t.dataTransfer.setData("text/plain",I),document.getElementById("r_"+t.target.id).classList.add("current")}function p(e){var t=document.getElementById(I[0]);return t.style.left=s("w",e.clientX),t.style.top=s("h",e.clientY),e.preventDefault(),!1}function f(e){var t=document.getElementById(I[0]);t.style.left=s("w",e.clientX),t.style.top=s("h",e.clientY);for(var r=0;r=0;e--){var t=D.insertRow(0);t.setAttribute("id","r_"+L[e].name);var r=t.insertCell(0);r.setAttribute("class","c_name");var n=t.insertCell(1);n.setAttribute("class","c_posX");var o=t.insertCell(2);o.setAttribute("class","c_posY");var i=t.insertCell(3);i.setAttribute("class","c_colour");var s=t.insertCell(4);s.setAttribute("class","c_deep-slider");var l=t.insertCell(5);l.setAttribute("class","c_deep-value");var c=t.insertCell(6);c.setAttribute("class","c_del");var u=t.insertCell(7);u.setAttribute("class","c_up"),r.innerHTML=L[e].name,n.innerHTML=L[e].posX,o.innerHTML=L[e].posY;var d=document.createElement("input");d.setAttribute("id","col_"+L[e].name),d.setAttribute("type","text"),d.setAttribute("class","color {adjust:false,hash:true,caps:false,pickerFaceColor:'transparent',pickerFace:3,pickerBorder:0,pickerInsetColor:'black'} input_colour"),d.setAttribute("value",L[e].colour),new jscolor.color(d,{adjust:!1,hash:!0,caps:!1,pickerFaceColor:"transparent",pickerFace:3,pickerBorder:0,pickerInsetColor:"black"}),i.appendChild(d),v();var p=document.createElement("button");p.setAttribute("class","del_item"),p.setAttribute("data-del",L[e].name),p.innerHTML='',c.appendChild(p),b();var f=document.createElement("input");f.setAttribute("id","slider_"+L[e].name),f.setAttribute("type","range"),f.setAttribute("min","1"),f.setAttribute("max","100"),f.setAttribute("value",parseInt(L[e].deep)),s.appendChild(f);var h=document.createElement("input");h.setAttribute("id","value_"+L[e].name),h.setAttribute("type","number"),h.setAttribute("min","1"),h.setAttribute("max","100"),h.setAttribute("pattern","[0-9]"),h.setAttribute("size","2"),l.appendChild(h),a("slider_"+L[e].name,"value_"+L[e].name),y();var m=document.createElement("button");m.setAttribute("class","up_item"),m.setAttribute("data-level",e),m.innerHTML='',u.appendChild(m),g()}}function g(){document.querySelector(".up_item").onclick=function(){x(this.dataset.level)}}function y(){document.querySelector("[id*=value_]").onchange=function(){var e=this.id.replace("value_","");this.value>100&&(this.value=100),a(this.id,"slider_"+e),document.getElementById(e).dataset.deep=this.value+"%";var t=r(L,e,"name");t>-1&&(L[t].deep=this.value+"%"),h(H.value)},document.querySelector("[id*=value_]").addEventListener("keypress",function(e){(e.which<48||e.which>57)&&e.preventDefault()}),document.querySelector("[id*=slider_]").onchange=function(){var e=this.id.replace("slider_","");a(this.id,"value_"+e),document.getElementById(e).dataset.deep=this.value+"%";var t=r(L,e,"name");t>-1&&(L[t].deep=this.value+"%"),h(H.value)}}function v(){document.querySelector("[id*=col_]").onchange=function(){var e=this.id.replace("col_","");document.getElementById(e).dataset.colour=this.value;var t=r(L,e,"name");t>-1&&(L[t].colour=this.value),h(H.value)}}function b(){document.querySelector(".del_item").onclick=function(){k(this.dataset.del)}}function w(){for(var e=0;e-1&&L.splice(o,1),0===L.length&&(O.checked=!1,document.querySelector(".points").classList.add("empty")),m(),h(H.value)}function x(e){e>0&&(L.move(e,e-1),m(),h(H.value))}function C(){var e,t=document.createElement("span");t.setAttribute("draggable","true"),L.length>0?e=o()+1:(e=1,document.querySelector(".points").classList.remove("empty")),t.setAttribute("id","d"+e),i(F,"hide")?t.setAttribute("class","dragme hide"):t.setAttribute("class","dragme");var r=""!==_.value&&null!==n(_.value)?_.value:"rgba(255,255,255,0.5)";_.value="",t.setAttribute("data-colour",r),t.setAttribute("data-deep","100%"),T.appendChild(t),t.addEventListener("dragstart",d,!1),L.push(new c(t.id,(100*t.offsetLeft/M).toFixed(2)+"%",(100*t.offsetTop/B).toFixed(2)+"%",r,"100%")),m(),h(H.value)}function j(){var e=new Object;e.html="",e.css="body, html { height:100%; overflow:hidden; } \nbody { \n\tbackground-image:"+S+";\n}",e.js="// draGGradients by @elrumordelaluz http://elrumordelaluz.github.io/draGGradients/",e.css_prefix_free="true",e.title="draGGradients: generated radial-gradient",e.description="Pen from draGGradients by @elrumordelaluz http://elrumordelaluz.github.io/draGGradients/";var t=new Array;t[0]="html",t[1]="css",t[3]="js",t[4]="css_prefix_free",t[5]="title",t[6]="description";var r=JSON.stringify(e,t,"\t");document.getElementById("cdpn-data").value=r}if("replaceState"in history)e.replaceHash=function(e){"#"!==(""+e).charAt(0)&&(e="#"+e),history.replaceState("","",e)};else{var E=location.hash;e.replaceHash=function(e){location.hash!==E&&history.back(),location.hash=e}}Array.prototype.move=function(e,t){for(;e<0;)e+=this.length;for(;t<0;)t+=this.length;if(t>=this.length)for(var r=t-this.length;r--+1;)this.push(void 0);return this.splice(t,0,this.splice(e,1)[0]),this};var I,S,T=document.getElementById("canvas"),L=[],M=T.offsetWidth,B=T.offsetHeight,A=document.getElementById("add_point"),_=document.getElementById("set_colour"),D=document.getElementById("coords"),O=document.getElementById("open_config"),H=document.getElementById("bg-color"),F=document.getElementById("points-op"),N=document.getElementById("export_code"),q=document.getElementById("share_link"),X=document.getElementById("generated_code"),Y=document.getElementById("popup-code"),z=document.getElementById("popup-q"),P=document.getElementById("q-opener");l.prototype._init=function(){[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.parentElement.removeChild(e)});for(var e=1,t=this.q<15?this.q:15;e<=t;e++){var r=document.createElement("span");r.setAttribute("draggable","true");var n=e;document.querySelector(".points").classList.remove("empty");var o="d"+n;r.setAttribute("id",o),r.setAttribute("class","dragme"),this.options[o]instanceof Object?(r.setAttribute("data-colour",this.options[o].color||"rgba(255,255,255,0.5)"),r.setAttribute("data-deep",this.options[o].deep||"100%"),r.style.left=this.options[o].left,r.style.top=this.options[o].top):(r.setAttribute("data-colour","rgba(255,255,255,0.5)"),r.setAttribute("data-deep","100%")),T.appendChild(r)}this.options.bg&&(H.value=this.options.bg,H.style.backgroundColor=this.options.bg),u()},c.prototype.getInfo=function(){return this.name+" ("+this.posX+","+this.posY+") - "+this.colour+" - "+this.deep},document.addEventListener("DOMContentLoaded",function(){document.body.onkeyup=function(e){27==e.keyCode&&(O.checked===!0?O.checked=!1:O.checked=!0,i(Y,"open")&&Y.classList.remove("open"),i(z,"open")&&z.classList.remove("open"))},F.onclick=function(){[].forEach.call(document.querySelectorAll(".dragme"),function(e){e.classList.toggle("hide")}),this.classList.toggle("hide")},H.onchange=function(){h(this.value)},e.onresize=function(e){M=T.offsetWidth,B=T.offsetHeight},A.onclick=C,N.onclick=function(){i(z,"open")&&z.classList.remove("open"),Y.classList.toggle("open")},P.onclick=function(){i(Y,"open")&&Y.classList.remove("open"),z.classList.toggle("open")},T.addEventListener("dragover",p,!1),T.addEventListener("drop",f,!1)});var R=new ZeroClipboard(X);R.on("ready",function(e){R.on("aftercopy",function(e){X.classList.add("copied")})}),e.RadialGradients=l,e.init=u}(window); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index c541e99..ab6bad0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -22,7 +22,7 @@ gulp.task('styles', function(){ gulp.task('scripts', function(){ - return gulp.src('src/scripts/**/*.js') + return gulp.src(['src/scripts/ZeroClipboard.js', 'src/scripts/**/*.js']) .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(concat('main.js')) diff --git a/index.html b/index.html index ff9003b..c40c963 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,9 @@ + + +