Theme for twister
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

9 lines
18 KiB

/*!
* ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
* Copyright (c) 2014 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v2.0.0-alpha.1
*/
!function(a){"use strict";var b,c={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,deactivated:null,overdue:null,ready:null},d={},e=0,f={},g=0,h={},i=null,j=null,k=function(){var a,b,c,d,e="ZeroClipboard.swf";if(document.currentScript&&(d=document.currentScript.src));else{var f=document.getElementsByTagName("script");if("readyState"in f[0])for(a=f.length;a--&&("interactive"!==f[a].readyState||!(d=f[a].src)););else if("loading"===document.readyState)d=f[f.length-1].src;else{for(a=f.length;a--;){if(c=f[a].src,!c){b=null;break}if(c=c.split("#")[0].split("?")[0],c=c.slice(0,c.lastIndexOf("/")+1),null==b)b=c;else if(b!==c){b=null;break}}null!==b&&(d=b)}}return d&&(d=d.split("#")[0].split("?")[0],e=d.slice(0,d.lastIndexOf("/")+1)+e),e}(),l=function(){var a=/\-([a-z])/g,b=function(a,b){return b.toUpperCase()};return function(c){return c.replace(a,b)}}(),m=function(b,c){var d,e,f;return a.getComputedStyle?d=a.getComputedStyle(b,null).getPropertyValue(c):(e=l(c),d=b.currentStyle?b.currentStyle[e]:b.style[e]),"cursor"!==c||d&&"auto"!==d||(f=b.tagName.toLowerCase(),"a"!==f)?d:"pointer"},n=function(b){b||(b=a.event);var c;this!==a?c=this:b.target?c=b.target:b.srcElement&&(c=b.srcElement),J.activate(c)},o=function(a,b,c){a&&1===a.nodeType&&(a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c))},p=function(a,b,c){a&&1===a.nodeType&&(a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c))},q=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)||a.classList.add(b),a;if(b&&"string"==typeof b){var c=(b||"").split(/\s+/);if(1===a.nodeType)if(a.className){for(var d=" "+a.className+" ",e=a.className,f=0,g=c.length;g>f;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}else a.className=b}return a},r=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)&&a.classList.remove(b),a;if(b&&"string"==typeof b||void 0===b){var c=(b||"").split(/\s+/);if(1===a.nodeType&&a.className)if(b){for(var d=(" "+a.className+" ").replace(/[\n\t]/g," "),e=0,f=c.length;f>e;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}else a.className=""}return a},s=function(){var a,b,c,d=1;return"function"==typeof document.body.getBoundingClientRect&&(a=document.body.getBoundingClientRect(),b=a.right-a.left,c=document.body.offsetWidth,d=Math.round(b/c*100)/100),d},t=function(b,c){var d={left:0,top:0,width:0,height:0,zIndex:z(c)-1};if(b.getBoundingClientRect){var e,f,g,h=b.getBoundingClientRect();"pageXOffset"in a&&"pageYOffset"in a?(e=a.pageXOffset,f=a.pageYOffset):(g=s(),e=Math.round(document.documentElement.scrollLeft/g),f=Math.round(document.documentElement.scrollTop/g));var i=document.documentElement.clientLeft||0,j=document.documentElement.clientTop||0;d.left=h.left+e-i,d.top=h.top+f-j,d.width="width"in h?h.width:h.right-h.left,d.height="height"in h?h.height:h.bottom-h.top}return d},u=function(a,b){var c=null==b||b&&b.cacheBust===!0&&b.useNoCache===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+(new Date).getTime():""},v=function(b){var c,d,e,f=[],g=[],h=[];if(b.trustedOrigins&&("string"==typeof b.trustedOrigins?g.push(b.trustedOrigins):"object"==typeof b.trustedOrigins&&"length"in b.trustedOrigins&&(g=g.concat(b.trustedOrigins))),b.trustedDomains&&("string"==typeof b.trustedDomains?g.push(b.trustedDomains):"object"==typeof b.trustedDomains&&"length"in b.trustedDomains&&(g=g.concat(b.trustedDomains))),g.length)for(c=0,d=g.length;d>c;c++)if(g.hasOwnProperty(c)&&g[c]&&"string"==typeof g[c]){if(e=D(g[c]),B("Trusted domain: "+e,b.debug),!e)continue;if("*"===e){h=[e];break}h.push.apply(h,[e,"//"+e,a.location.protocol+"//"+e])}return h.length&&f.push("trustedOrigins="+encodeURIComponent(h.join(","))),"string"==typeof b.jsModuleId&&b.jsModuleId&&f.push("jsModuleId="+encodeURIComponent(b.jsModuleId)),f.join("&")},w=function(a,b,c){if("function"==typeof b.indexOf)return b.indexOf(a,c);var d,e=b.length;for("undefined"==typeof c?c=0:0>c&&(c=e+c),d=c;e>d;d++)if(b.hasOwnProperty(d)&&b[d]===a)return d;return-1},x=function(a){if("string"==typeof a)throw new TypeError("ZeroClipboard doesn't accept query strings.");return a.length?a:[a]},y=function(b,c,d,e){e?a.setTimeout(function(){b.apply(c,d)},0):b.apply(c,d)},z=function(a){var b,c;return a&&("number"==typeof a&&a>0?b=a:"string"==typeof a&&(c=parseInt(a,10))&&!isNaN(c)&&c>0&&(b=c)),b||("number"==typeof M.zIndex&&M.zIndex>0?b=M.zIndex:"string"==typeof M.zIndex&&(c=parseInt(M.zIndex,10))&&!isNaN(c)&&c>0&&(b=c)),b||0},A=function(a,b){if(a){var c="`"+a+"` is deprecated. See docs for more info:\n https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md#deprecations";B(c,b)}},B=function(a,b){a&&b!==!1&&"undefined"!=typeof console&&console&&(console.warn||console.log)&&(console.warn?console.warn(a):console.log(a))},C=function(){var a,b,c,d,e,f,g=arguments[0]||{};for(a=1,b=arguments.length;b>a;a++)if(null!=(c=arguments[a]))for(d in c)if(c.hasOwnProperty(d)){if(e=g[d],f=c[d],g===f)continue;void 0!==f&&(g[d]=f)}return g},D=function(a){if(null==a||""===a)return null;if(a=a.replace(/^\s+|\s+$/g,""),""===a)return null;var b=a.indexOf("//");a=-1===b?a:a.slice(b+2);var c=a.indexOf("/");return a=-1===c?a:-1===b||0===c?null:a.slice(0,c),a&&".swf"===a.slice(-4).toLowerCase()?null:a||null},E=function(){var a=function(a,b){var c,d,e;if(null!=a&&"*"!==b[0]&&("string"==typeof a&&(a=[a]),"object"==typeof a&&"length"in a))for(c=0,d=a.length;d>c;c++)if(a.hasOwnProperty(c)&&(e=D(a[c]))){if("*"===e){b.length=0,b.push("*");break}-1===w(e,b)&&b.push(e)}},b={always:"always",samedomain:"sameDomain",never:"never"};return function(c,d){var e,f=d.allowScriptAccess;if("string"==typeof f&&(e=f.toLowerCase())&&/^always|samedomain|never$/.test(e))return b[e];var g=D(d.moviePath);null===g&&(g=c);var h=[];a(d.trustedOrigins,h),a(d.trustedDomains,h);var i=h.length;if(i>0){if(1===i&&"*"===h[0])return"always";if(-1!==w(c,h))return 1===i&&c===g?"sameDomain":"always"}return"never"}}(),F=function(a){if(null==a)return[];if(Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},G=function(a){if(a)for(var b in a)a.hasOwnProperty(b)&&delete a[b];return a},H=function(){try{return document.activeElement}catch(a){}return null},I=function(){function a(a){var b=a.match(/[\d]+/g);return b.length=3,b.join(".")}function b(a){return!!a&&(a=a.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a)||"chrome.plugin"===a.slice(-13))}function d(c){c&&(h=!0,c.version&&(j=a(c.version)),!j&&c.description&&(j=a(c.description)),c.filename&&(k=b(c.filename)))}var e,f,g,h=!1,i=!1,j="",k=!1;if(navigator.plugins&&navigator.plugins.length)e=navigator.plugins["Shockwave Flash"],d(e),navigator.plugins["Shockwave Flash 2.0"]&&(h=!0,j="2.0.0.11");else if(navigator.mimeTypes&&navigator.mimeTypes.length)g=navigator.mimeTypes["application/x-shockwave-flash"],e=g&&g.enabledPlugin,d(e);else if("undefined"!=typeof ActiveXObject){i=!0;try{f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"),h=!0,j=a(f.GetVariable("$version"))}catch(l){try{f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),h=!0,j="6.0.21"}catch(m){try{f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),h=!0,j=a(f.GetVariable("$version"))}catch(n){i=!1}}}}c.disabled=h!==!0,c.outdated=j&&parseFloat(j)<10,c.version=j||"0.0.0",c.pluginType=k?"pepper":i?"activex":h?"netscape":"unknown"};I();var J=function(a,b){if(!(this instanceof J))return new J(a,b);if(this.id=""+e++,f[this.id]={instance:this,elements:[],handlers:{}},a&&this.clip(a),"undefined"!=typeof b&&(A("new ZeroClipboard(elements, options)",M.debug),J.config(b)),this.options=J.config(),"boolean"!=typeof c.ready&&(c.ready=!1),!J.isFlashUnusable()&&null===c.bridge){var d=this,g=M.flashLoadTimeout;"number"==typeof g&&g>=0&&setTimeout(function(){"boolean"!=typeof c.deactivated&&(c.deactivated=!0),c.deactivated===!0&&S.call(d,"deactivatedflash")},g),c.overdue=!1,N()}};J.prototype.setText=function(a){return a&&""!==a&&(d["text/plain"]=a,c.ready===!0&&c.bridge&&"function"==typeof c.bridge.setText?c.bridge.setText(a):c.ready=!1),this},J.prototype.setSize=function(a,b){return c.ready===!0&&c.bridge&&"function"==typeof c.bridge.setSize?c.bridge.setSize(a,b):c.ready=!1,this};var K=function(a){c.ready===!0&&c.bridge&&"function"==typeof c.bridge.setHandCursor?c.bridge.setHandCursor(a):c.ready=!1};J.prototype.destroy=function(){this.unclip(),this.off(),delete f[this.id]};var L=function(){var a,b,c,d=[],e=F(f);for(a=0,b=e.length;b>a;a++)c=f[e[a]].instance,c&&c instanceof J&&d.push(c);return d};J.version="2.0.0-alpha.1";var M={swfPath:k,trustedDomains:a.location.host?[a.location.host]:[],cacheBust:/MSIE/.test(navigator.userAgent)||/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/.test(navigator.userAgent)?!0:!1,forceHandCursor:!1,zIndex:999999999,debug:!1,title:null,autoActivate:!0,flashLoadTimeout:3e4};J.isFlashUnusable=function(){return!!(c.disabled||c.outdated||c.deactivated)},J.config=function(a){"object"==typeof a&&null!==a&&C(M,a);{if("string"!=typeof a||!a){var b={};for(var c in M)M.hasOwnProperty(c)&&(b[c]="object"==typeof M[c]&&null!==M[c]?"length"in M[c]?M[c].slice(0):C({},M[c]):M[c]);return b}if(M.hasOwnProperty(a))return M[a]}},J.destroy=function(){J.deactivate();for(var a in f)if(f.hasOwnProperty(a)&&f[a]){var b=f[a].instance;b&&"function"==typeof b.destroy&&b.destroy()}var d=O(c.bridge);d&&d.parentNode&&(d.parentNode.removeChild(d),c.ready=null,c.bridge=null,c.deactivated=null)},J.activate=function(a){b&&(r(b,M.hoverClass),r(b,M.activeClass)),b=a,q(a,M.hoverClass),P();var d=M.title||a.getAttribute("title");if(d){var e=O(c.bridge);e&&e.setAttribute("title",d)}var f=M.forceHandCursor===!0||"pointer"===m(a,"cursor");K(f)},J.deactivate=function(){var a=O(c.bridge);a&&(a.style.left="0px",a.style.top="-9999px",a.removeAttribute("title")),b&&(r(b,M.hoverClass),r(b,M.activeClass),b=null)};var N=function(){var b,d,e=document.getElementById("global-zeroclipboard-html-bridge");if(!e){var f=J.config();f.jsModuleId="string"==typeof i&&i||"string"==typeof j&&j||null;var g=E(a.location.host,M),h=v(f),k=M.moviePath+u(M.moviePath,M),l=' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="'+k+'"/> <param name="allowScriptAccess" value="'+g+'"/> <param name="scale" value="exactfit"/> <param name="loop" value="false"/> <param name="menu" value="false"/> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff"/> <param name="wmode" value="transparent"/> <param name="flashvars" value="'+h+'"/> <embed src="'+k+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="'+g+'" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+h+'" scale="exactfit"> </embed> </object>';e=document.createElement("div"),e.id="global-zeroclipboard-html-bridge",e.setAttribute("class","global-zeroclipboard-container"),e.style.position="absolute",e.style.left="0px",e.style.top="-9999px",e.style.width="15px",e.style.height="15px",e.style.zIndex=""+z(M.zIndex),document.body.appendChild(e),e.innerHTML=l}b=document["global-zeroclipboard-flash-bridge"],b&&(d=b.length)&&(b=b[d-1]),c.bridge=b||e.children[0].lastElementChild},O=function(a){for(var b=/^OBJECT|EMBED$/,c=a&&a.parentNode;c&&b.test(c.nodeName)&&c.parentNode;)c=c.parentNode;return c||null},P=function(){if(b){var a=t(b,M.zIndex),d=O(c.bridge);d&&(d.style.top=a.top+"px",d.style.left=a.left+"px",d.style.width=a.width+"px",d.style.height=a.height+"px",d.style.zIndex=a.zIndex+1),c.ready===!0&&c.bridge&&"function"==typeof c.bridge.setSize?c.bridge.setSize(a.width,a.height):c.ready=!1}return this};J.prototype.on=function(a,b){var d,e,g,h={},i=f[this.id]&&f[this.id].handlers;if("string"==typeof a&&a)g=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(d in a)a.hasOwnProperty(d)&&"string"==typeof d&&d&&"function"==typeof a[d]&&this.on(d,a[d]);if(g&&g.length){for(d=0,e=g.length;e>d;d++)a=g[d].replace(/^on/,""),h[a]=!0,i[a]||(i[a]=[]),i[a].push(b);h.noflash&&c.disabled&&S.call(this,"noflash"),h.wrongflash&&c.outdated&&S.call(this,"wrongflash"),h.deactivatedflash&&c.deactivated&&S.call(this,"deactivatedflash"),h.overdueflash&&c.overdue&&S.call(this,"overdueflash"),h.load&&c.ready&&S.call(this,"load")}return this},J.prototype.off=function(a,b){var c,d,e,g,h,i=f[this.id]&&f[this.id].handlers;if(0===arguments.length)g=F(i);else if("string"==typeof a&&a)g=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)a.hasOwnProperty(c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(g&&g.length)for(c=0,d=g.length;d>c;c++)if(a=g[c].toLowerCase().replace(/^on/,""),h=i[a],h&&h.length)if(b)for(e=w(b,h);-1!==e;)h.splice(e,1),e=w(b,h,e);else i[a].length=0;return this},J.prototype.handlers=function(a){var b,c=null,d=f[this.id]&&f[this.id].handlers;if(d){if("string"==typeof a&&a)return d[a]?d[a].slice(0):null;c={};for(b in d)d.hasOwnProperty(b)&&d[b]&&(c[b]=d[b].slice(0))}return c};var Q=function(b,c,d,e){var g=f[this.id]&&f[this.id].handlers[b];if(g&&g.length){var h,i,j,k=c||this;for(h=0,i=g.length;i>h;h++)j=g[h],c=k,"string"==typeof j&&"function"==typeof a[j]&&(j=a[j]),"object"==typeof j&&j&&"function"==typeof j.handleEvent&&(c=j,j=j.handleEvent),"function"==typeof j&&y(j,c,d,e)}return this};J.prototype.clip=function(a){a=x(a);for(var b=0;b<a.length;b++)if(a.hasOwnProperty(b)&&a[b]&&1===a[b].nodeType){a[b].zcClippingId?-1===w(this.id,h[a[b].zcClippingId])&&h[a[b].zcClippingId].push(this.id):(a[b].zcClippingId="zcClippingId_"+g++,h[a[b].zcClippingId]=[this.id],M.autoActivate===!0&&o(a[b],"mouseover",n));var c=f[this.id].elements;-1===w(a[b],c)&&c.push(a[b])}return this},J.prototype.unclip=function(a){var b=f[this.id];if(b){var c,d=b.elements;a="undefined"==typeof a?d.slice(0):x(a);for(var e=a.length;e--;)if(a.hasOwnProperty(e)&&a[e]&&1===a[e].nodeType){for(c=0;-1!==(c=w(a[e],d,c));)d.splice(c,1);var g=h[a[e].zcClippingId];if(g){for(c=0;-1!==(c=w(this.id,g,c));)g.splice(c,1);0===g.length&&(M.autoActivate===!0&&p(a[e],"mouseover",n),delete a[e].zcClippingId)}}}return this},J.prototype.elements=function(){var a=f[this.id];return a&&a.elements?a.elements.slice(0):[]};var R=function(a){var b,c,d,e,g,i=[];if(a&&1===a.nodeType&&(b=a.zcClippingId)&&h.hasOwnProperty(b)&&(c=h[b],c&&c.length))for(d=0,e=c.length;e>d;d++)g=f[c[d]].instance,g&&g instanceof J&&i.push(g);return i};M.hoverClass="zeroclipboard-is-hover",M.activeClass="zeroclipboard-is-active",M.trustedOrigins=null,M.allowScriptAccess=null,M.useNoCache=!0,M.moviePath="ZeroClipboard.swf",J.dispatch=function(a,c){if("string"==typeof a&&a){var d=a.toLowerCase().replace(/^on/,"");if(d)for(var e=b&&M.autoActivate===!0?R(b):L(),f=0,g=e.length;g>f;f++)S.call(e[f],d,c)}},J.prototype.setHandCursor=function(a){return A("ZeroClipboard.prototype.setHandCursor",M.debug),a="boolean"==typeof a?a:!!a,K(a),M.forceHandCursor=a,this},J.prototype.reposition=function(){return A("ZeroClipboard.prototype.reposition",M.debug),P()},J.prototype.receiveEvent=function(a,b){if(A("ZeroClipboard.prototype.receiveEvent",M.debug),"string"==typeof a&&a){var c=a.toLowerCase().replace(/^on/,"");c&&S.call(this,c,b)}},J.prototype.setCurrent=function(a){return A("ZeroClipboard.prototype.setCurrent",M.debug),J.activate(a),this},J.prototype.resetBridge=function(){return A("ZeroClipboard.prototype.resetBridge",M.debug),J.deactivate(),this},J.prototype.setTitle=function(a){if(A("ZeroClipboard.prototype.setTitle",M.debug),a=a||M.title||b&&b.getAttribute("title")){var d=O(c.bridge);d&&d.setAttribute("title",a)}return this},J.setDefaults=function(a){A("ZeroClipboard.setDefaults",M.debug),J.config(a)},J.prototype.addEventListener=function(a,b){return A("ZeroClipboard.prototype.addEventListener",M.debug),this.on(a,b)},J.prototype.removeEventListener=function(a,b){return A("ZeroClipboard.prototype.removeEventListener",M.debug),this.off(a,b)},J.prototype.ready=function(){return A("ZeroClipboard.prototype.ready",M.debug),c.ready===!0};var S=function(e,f){f=f||{},e=e.toLowerCase().replace(/^on/,"");var g=b,h=g,i=!0;switch(e){case"load":var j=c.deactivated||c.overdue||null===c.ready||null===c.bridge;if(c.deactivated=!1,j)return c.overdue=!0,S.call(this,"overdueFlash");c.ready=!0,h=null,f.flashVersion=c.version;break;case"noflash":c.ready=!1,h=null;break;case"wrongflash":case"deactivatedflash":case"overdueflash":c.ready=!1,h=null,f.flashVersion=c.version;break;case"mouseover":q(g,M.hoverClass);break;case"mouseout":M.autoActivate===!0&&J.deactivate();break;case"mousedown":q(g,M.activeClass);break;case"mouseup":r(g,M.activeClass);break;case"datarequested":if(g){var k=g.getAttribute("data-clipboard-target"),l=k?document.getElementById(k):null;if(l){var m=l.value||l.textContent||l.innerText;m&&this.setText(m)}else{var n=g.getAttribute("data-clipboard-text");n&&this.setText(n)}}i=!1;break;case"complete":G(d),g&&g!==H()&&g.focus&&g.focus()}h=h||a;var o=[this,f];return Q.call(this,e,h,o,i)};"function"==typeof define&&define.amd?define(["require","exports","module"],function(a,b,c){return i=c&&c.id||null,J}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports&&"function"==typeof a.require?(j=module.id||null,module.exports=J):a.ZeroClipboard=J}(function(){return this}());