forked from extern/egroupware
10 lines
28 KiB
JavaScript
10 lines
28 KiB
JavaScript
/*!
|
|
* 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) 2009-2014 Jon Rohan, James M. Greene
|
|
* Licensed MIT
|
|
* http://zeroclipboard.org/
|
|
* v2.2.0-beta.3
|
|
*/
|
|
!function(a,b){"use strict";var c,d,e,f=a,g=f.document,h=f.navigator,i=f.setTimeout,j=f.clearTimeout,k=f.setInterval,l=f.clearInterval,m=f.getComputedStyle,n=f.encodeURIComponent,o=f.ActiveXObject,p=f.Error,q=f.Number.parseInt||f.parseInt,r=f.Number.parseFloat||f.parseFloat,s=f.Number.isNaN||f.isNaN,t=f.Date.now,u=f.Object.keys,v=f.Object.defineProperty,w=f.Object.prototype.hasOwnProperty,x=f.Array.prototype.slice,y=function(){var a=function(a){return a};if("function"==typeof f.wrap&&"function"==typeof f.unwrap)try{var b=g.createElement("div"),c=f.unwrap(b);1===b.nodeType&&c&&1===c.nodeType&&(a=f.unwrap)}catch(d){}return a}(),z=function(a){return x.call(a,0)},A=function(){var a,c,d,e,f,g,h=z(arguments),i=h[0]||{};for(a=1,c=h.length;c>a;a++)if(null!=(d=h[a]))for(e in d)w.call(d,e)&&(f=i[e],g=d[e],i!==g&&g!==b&&(i[e]=g));return i},B=function(a){var b,c,d,e;if("object"!=typeof a||null==a||"number"==typeof a.nodeType)b=a;else if("number"==typeof a.length)for(b=[],c=0,d=a.length;d>c;c++)w.call(a,c)&&(b[c]=B(a[c]));else{b={};for(e in a)w.call(a,e)&&(b[e]=B(a[e]))}return b},C=function(a,b){for(var c={},d=0,e=b.length;e>d;d++)b[d]in a&&(c[b[d]]=a[b[d]]);return c},D=function(a,b){var c={};for(var d in a)-1===b.indexOf(d)&&(c[d]=a[d]);return c},E=function(a){if(a)for(var b in a)w.call(a,b)&&delete a[b];return a},F=function(a,b){if(a&&1===a.nodeType&&a.ownerDocument&&b&&(1===b.nodeType&&b.ownerDocument&&b.ownerDocument===a.ownerDocument||9===b.nodeType&&!b.ownerDocument&&b===a.ownerDocument))do{if(a===b)return!0;a=a.parentNode}while(a);return!1},G=function(a){var b;return"string"==typeof a&&a&&(b=a.split("#")[0].split("?")[0],b=a.slice(0,a.lastIndexOf("/")+1)),b},H=function(a){var b,c;return"string"==typeof a&&a&&(c=a.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]?b=c[1]:(c=a.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]&&(b=c[1]))),b},I=function(){var a,b;try{throw new p}catch(c){b=c}return b&&(a=b.sourceURL||b.fileName||H(b.stack)),a},J=function(){var a,c,d;if(g.currentScript&&(a=g.currentScript.src))return a;if(c=g.getElementsByTagName("script"),1===c.length)return c[0].src||b;if("readyState"in c[0])for(d=c.length;d--;)if("interactive"===c[d].readyState&&(a=c[d].src))return a;return"loading"===g.readyState&&(a=c[c.length-1].src)?a:(a=I())?a:b},K=function(){var a,c,d,e=g.getElementsByTagName("script");for(a=e.length;a--;){if(!(d=e[a].src)){c=null;break}if(d=G(d),null==c)c=d;else if(c!==d){c=null;break}}return c||b},L=function(){var a=G(J())||K()||"";return a+"ZeroClipboard.swf"},M={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,degraded:null,deactivated:null,overdue:null,ready:null},N="11.0.0",O={},P={},Q=null,R=0,S=0,T={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-degraded":"Flash is unable to preserve data fidelity when communicating with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate.\nThis may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity.","flash-overdue":"Flash communication was established but NOT within the acceptable time limit","version-mismatch":"ZeroClipboard JS version number does not match ZeroClipboard SWF version number","clipboard-error":"At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard","config-mismatch":"ZeroClipboard configuration does not match Flash's reality","swf-not-found":"The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity"}},U={swfPath:L(),trustedDomains:a.location.host?[a.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},V=function(a){if("object"==typeof a&&null!==a)for(var b in a)if(w.call(a,b))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(b))U[b]=a[b];else if(null==M.bridge)if("containerId"===b||"swfObjectId"===b){if(!ib(a[b]))throw new Error("The specified `"+b+"` value is not valid as an HTML4 Element ID");U[b]=a[b]}else U[b]=a[b];{if("string"!=typeof a||!a)return B(U);if(w.call(U,a))return U[a]}},W=function(){return{browser:C(h,["userAgent","platform","appName"]),flash:D(M,["bridge"]),zeroclipboard:{version:Ob.version,config:Ob.config()}}},X=function(){return!!(M.disabled||M.outdated||M.unavailable||M.degraded||M.deactivated)},Y=function(a,d){var e,f,g,h={};if("string"==typeof a&&a)g=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof d)for(e in a)w.call(a,e)&&"string"==typeof e&&e&&"function"==typeof a[e]&&Ob.on(e,a[e]);if(g&&g.length){for(e=0,f=g.length;f>e;e++)a=g[e].replace(/^on/,""),h[a]=!0,O[a]||(O[a]=[]),O[a].push(d);if(h.ready&&M.ready&&Ob.emit({type:"ready"}),h.error){var i=["disabled","outdated","unavailable","degraded","deactivated","overdue"];for(e=0,f=i.length;f>e;e++)if(M[i[e]]===!0){Ob.emit({type:"error",name:"flash-"+i[e]});break}c!==b&&Ob.version!==c&&Ob.emit({type:"error",name:"version-mismatch",jsVersion:Ob.version,swfVersion:c})}}return Ob},Z=function(a,b){var c,d,e,f,g;if(0===arguments.length)f=u(O);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)w.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Ob.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=O[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return Ob},$=function(a){var b;return b="string"==typeof a&&a?B(O[a])||null:B(O)},_=function(a){var b,c,d;return a=jb(a),a&&!pb(a)?"ready"===a.type&&M.overdue===!0?Ob.emit({type:"error",name:"flash-overdue"}):(b=A({},a),ob.call(this,b),"copy"===a.type&&(d=xb(P),c=d.data,Q=d.formatMap),c):void 0},ab=function(){if("boolean"!=typeof M.ready&&(M.ready=!1),!Ob.isFlashUnusable()&&null===M.bridge){var a=U.flashLoadTimeout;"number"==typeof a&&a>=0&&(R=i(function(){"boolean"!=typeof M.deactivated&&(M.deactivated=!0),M.deactivated===!0&&Ob.emit({type:"error",name:"flash-deactivated"})},a)),M.overdue=!1,vb()}},bb=function(){Ob.clearData(),Ob.blur(),Ob.emit("destroy"),wb(),Ob.off()},cb=function(a,b){var c;if("object"==typeof a&&a&&"undefined"==typeof b)c=a,Ob.clearData();else{if("string"!=typeof a||!a)return;c={},c[a]=b}for(var d in c)"string"==typeof d&&d&&w.call(c,d)&&"string"==typeof c[d]&&c[d]&&(P[d]=c[d])},db=function(a){"undefined"==typeof a?(E(P),Q=null):"string"==typeof a&&w.call(P,a)&&delete P[a]},eb=function(a){return"undefined"==typeof a?B(P):"string"==typeof a&&w.call(P,a)?P[a]:void 0},fb=function(a){if(a&&1===a.nodeType){d&&(Fb(d,U.activeClass),d!==a&&Fb(d,U.hoverClass)),d=a,Eb(a,U.hoverClass);var b=a.getAttribute("title")||U.title;if("string"==typeof b&&b){var c=ub(M.bridge);c&&c.setAttribute("title",b)}var e=U.forceHandCursor===!0||"pointer"===Gb(a,"cursor");Lb(e),Kb()}},gb=function(){var a=ub(M.bridge);a&&(a.removeAttribute("title"),a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.top="1px"),d&&(Fb(d,U.hoverClass),Fb(d,U.activeClass),d=null)},hb=function(){return d||null},ib=function(a){return"string"==typeof a&&a&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(a)},jb=function(a){var b;if("string"==typeof a&&a?(b=a,a={}):"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(b=a.type),b){b=b.toLowerCase(),!a.target&&(/^(copy|aftercopy|_click)$/.test(b)||"error"===b&&"clipboard-error"===a.name)&&(a.target=e),A(a,{type:b,target:a.target||d||null,relatedTarget:a.relatedTarget||null,currentTarget:M&&M.bridge||null,timeStamp:a.timeStamp||t()||null});var c=T[a.type];return"error"===a.type&&a.name&&c&&(c=c[a.name]),c&&(a.message=c),"ready"===a.type&&A(a,{target:null,version:M.version}),"error"===a.type&&(/^flash-(disabled|outdated|unavailable|degraded|deactivated|overdue)$/.test(a.name)&&A(a,{target:null,minimumVersion:N}),/^flash-(outdated|unavailable|degraded|deactivated|overdue)$/.test(a.name)&&A(a,{version:M.version})),"copy"===a.type&&(a.clipboardData={setData:Ob.setData,clearData:Ob.clearData}),"aftercopy"===a.type&&(a=yb(a,Q)),a.target&&!a.relatedTarget&&(a.relatedTarget=kb(a.target)),lb(a)}},kb=function(a){var b=a&&a.getAttribute&&a.getAttribute("data-clipboard-target");return b?g.getElementById(b):null},lb=function(a){if(a&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)){var c=a.target,d="_mouseover"===a.type&&a.relatedTarget?a.relatedTarget:b,e="_mouseout"===a.type&&a.relatedTarget?a.relatedTarget:b,h=Hb(c),i=f.screenLeft||f.screenX||0,j=f.screenTop||f.screenY||0,k=g.body.scrollLeft+g.documentElement.scrollLeft,l=g.body.scrollTop+g.documentElement.scrollTop,m=h.left+("number"==typeof a._stageX?a._stageX:0),n=h.top+("number"==typeof a._stageY?a._stageY:0),o=m-k,p=n-l,q=i+o,r=j+p,s="number"==typeof a.movementX?a.movementX:0,t="number"==typeof a.movementY?a.movementY:0;delete a._stageX,delete a._stageY,A(a,{srcElement:c,fromElement:d,toElement:e,screenX:q,screenY:r,pageX:m,pageY:n,clientX:o,clientY:p,x:o,y:p,movementX:s,movementY:t,offsetX:0,offsetY:0,layerX:0,layerY:0})}return a},mb=function(a){var b=a&&"string"==typeof a.type&&a.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(b)},nb=function(a,b,c,d){d?i(function(){a.apply(b,c)},0):a.apply(b,c)},ob=function(a){if("object"==typeof a&&a&&a.type){var b=mb(a),c=O["*"]||[],d=O[a.type]||[],e=c.concat(d);if(e&&e.length){var g,h,i,j,k,l=this;for(g=0,h=e.length;h>g;g++)i=e[g],j=l,"string"==typeof i&&"function"==typeof f[i]&&(i=f[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=A({},a),nb(i,j,[k],b))}return this}},pb=function(a){var b=a.target||d||null,f="swf"===a._source;delete a._source;var g=["flash-disabled","flash-outdated","flash-unavailable","flash-degraded","flash-deactivated","flash-overdue"];switch(a.type){case"error":-1!==g.indexOf(a.name)?A(M,{disabled:"flash-disabled"===a.name,outdated:"flash-outdated"===a.name,unavailable:"flash-unavailable"===a.name,degraded:"flash-degraded"===a.name,deactivated:"flash-deactivated"===a.name,overdue:"flash-overdue"===a.name,ready:!1}):"version-mismatch"===a.name&&(c=a.swfVersion,A(M,{disabled:!1,outdated:!1,unavailable:!1,degraded:!1,deactivated:!1,overdue:!1,ready:!1})),Jb();break;case"ready":c=a.swfVersion;var h=M.deactivated===!0;A(M,{disabled:!1,outdated:!1,unavailable:!1,degraded:!1,deactivated:!1,overdue:h,ready:!h}),Jb();break;case"beforecopy":e=b;break;case"copy":var i,j,k=a.relatedTarget;!P["text/html"]&&!P["text/plain"]&&k&&(j=k.value||k.outerHTML||k.innerHTML)&&(i=k.value||k.textContent||k.innerText)?(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",i),j!==i&&a.clipboardData.setData("text/html",j)):!P["text/plain"]&&a.target&&(i=a.target.getAttribute("data-clipboard-text"))&&(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",i));break;case"aftercopy":qb(a),Ob.clearData(),b&&b!==Db()&&b.focus&&b.focus();break;case"_mouseover":Ob.focus(b),U.bubbleEvents===!0&&f&&(b&&b!==a.relatedTarget&&!F(a.relatedTarget,b)&&rb(A({},a,{type:"mouseenter",bubbles:!1,cancelable:!1})),rb(A({},a,{type:"mouseover"})));break;case"_mouseout":Ob.blur(),U.bubbleEvents===!0&&f&&(b&&b!==a.relatedTarget&&!F(a.relatedTarget,b)&&rb(A({},a,{type:"mouseleave",bubbles:!1,cancelable:!1})),rb(A({},a,{type:"mouseout"})));break;case"_mousedown":Eb(b,U.activeClass),U.bubbleEvents===!0&&f&&rb(A({},a,{type:a.type.slice(1)}));break;case"_mouseup":Fb(b,U.activeClass),U.bubbleEvents===!0&&f&&rb(A({},a,{type:a.type.slice(1)}));break;case"_click":e=null,U.bubbleEvents===!0&&f&&rb(A({},a,{type:a.type.slice(1)}));break;case"_mousemove":U.bubbleEvents===!0&&f&&rb(A({},a,{type:a.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)?!0:void 0},qb=function(a){if(a.errors&&a.errors.length>0){var b=B(a);A(b,{type:"error",name:"clipboard-error"}),delete b.success,i(function(){Ob.emit(b)},0)}},rb=function(a){if(a&&"string"==typeof a.type&&a){var b,c=a.target||null,d=c&&c.ownerDocument||g,e={view:d.defaultView||f,canBubble:!0,cancelable:!0,detail:"click"===a.type?1:0,button:"number"==typeof a.which?a.which-1:"number"==typeof a.button?a.button:d.createEvent?0:1},h=A(e,a);c&&d.createEvent&&c.dispatchEvent&&(h=[h.type,h.canBubble,h.cancelable,h.view,h.detail,h.screenX,h.screenY,h.clientX,h.clientY,h.ctrlKey,h.altKey,h.shiftKey,h.metaKey,h.button,h.relatedTarget],b=d.createEvent("MouseEvents"),b.initMouseEvent&&(b.initMouseEvent.apply(b,h),b._source="js",c.dispatchEvent(b)))}},sb=function(){var a=U.flashLoadTimeout;if("number"==typeof a&&a>=0){var b=Math.min(1e3,a/10),c=U.swfObjectId+"_fallbackContent";S=k(function(){var a=g.getElementById(c);Ib(a)&&(Jb(),M.deactivated=null,Ob.emit({type:"error",name:"swf-not-found"}))},b)}},tb=function(){var a=g.createElement("div");return a.id=U.containerId,a.className=U.containerClass,a.style.position="absolute",a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.height="1px",a.style.zIndex=""+Mb(U.zIndex),a},ub=function(a){for(var b=a&&a.parentNode;b&&"OBJECT"===b.nodeName&&b.parentNode;)b=b.parentNode;return b||null},vb=function(){var a,b=M.bridge,c=ub(b);if(!b){var d=Cb(f.location.host,U),e="never"===d?"none":"all",h=Ab(A({jsVersion:Ob.version},U)),i=U.swfPath+zb(U.swfPath,U);c=tb();var j=g.createElement("div");c.appendChild(j),g.body.appendChild(c);var k=g.createElement("div"),l="activex"===M.pluginType;k.innerHTML='<object id="'+U.swfObjectId+'" name="'+U.swfObjectId+'" width="100%" height="100%" '+(l?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+i+'"')+">"+(l?'<param name="movie" value="'+i+'"/>':"")+'<param name="allowScriptAccess" value="'+d+'"/><param name="allowNetworking" value="'+e+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+h+'"/><div id="'+U.swfObjectId+'_fallbackContent"> </div></object>',b=k.firstChild,k=null,y(b).ZeroClipboard=Ob,c.replaceChild(b,j),sb()}return b||(b=g[U.swfObjectId],b&&(a=b.length)&&(b=b[a-1]),!b&&c&&(b=c.firstChild)),M.bridge=b||null,b},wb=function(){var a=M.bridge;if(a){var d=ub(a);d&&("activex"===M.pluginType&&"readyState"in a?(a.style.display="none",function e(){if(4===a.readyState){for(var b in a)"function"==typeof a[b]&&(a[b]=null);a.parentNode&&a.parentNode.removeChild(a),d.parentNode&&d.parentNode.removeChild(d)}else i(e,10)}()):(a.parentNode&&a.parentNode.removeChild(a),d.parentNode&&d.parentNode.removeChild(d))),Jb(),M.ready=null,M.bridge=null,M.deactivated=null,c=b}},xb=function(a){var b={},c={};if("object"==typeof a&&a){for(var d in a)if(d&&w.call(a,d)&&"string"==typeof a[d]&&a[d])switch(d.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":b.text=a[d],c.text=d;break;case"text/html":case"html":case"air:html":case"flash:html":b.html=a[d],c.html=d;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":b.rtf=a[d],c.rtf=d}return{data:b,formatMap:c}}},yb=function(a,b){if("object"!=typeof a||!a||"object"!=typeof b||!b)return a;var c={};for(var d in a)if(w.call(a,d))if("errors"===d){c[d]=a[d]?a[d].slice():[];for(var e=0,f=c[d].length;f>e;e++)c[d][e].format=b[c[d][e].format]}else if("success"!==d&&"data"!==d)c[d]=a[d];else{c[d]={};var g=a[d];for(var h in g)h&&w.call(g,h)&&w.call(b,h)&&(c[d][b[h]]=g[h])}return c},zb=function(a,b){var c=null==b||b&&b.cacheBust===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+t():""},Ab=function(a){var b,c,d,e,g="",h=[];if(a.trustedDomains&&("string"==typeof a.trustedDomains?e=[a.trustedDomains]:"object"==typeof a.trustedDomains&&"length"in a.trustedDomains&&(e=a.trustedDomains)),e&&e.length)for(b=0,c=e.length;c>b;b++)if(w.call(e,b)&&e[b]&&"string"==typeof e[b]){if(d=Bb(e[b]),!d)continue;if("*"===d){h.length=0,h.push(d);break}h.push.apply(h,[d,"//"+d,f.location.protocol+"//"+d])}return h.length&&(g+="trustedOrigins="+n(h.join(","))),a.forceEnhancedClipboard===!0&&(g+=(g?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof a.swfObjectId&&a.swfObjectId&&(g+=(g?"&":"")+"swfObjectId="+n(a.swfObjectId)),"string"==typeof a.jsVersion&&a.jsVersion&&(g+=(g?"&":"")+"jsVersion="+n(a.jsVersion)),g},Bb=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},Cb=function(){var a=function(a){var b,c,d,e=[];if("string"==typeof a&&(a=[a]),"object"!=typeof a||!a||"number"!=typeof a.length)return e;for(b=0,c=a.length;c>b;b++)if(w.call(a,b)&&(d=Bb(a[b]))){if("*"===d){e.length=0,e.push("*");break}-1===e.indexOf(d)&&e.push(d)}return e};return function(b,c){var d=Bb(c.swfPath);null===d&&(d=b);var e=a(c.trustedDomains),f=e.length;if(f>0){if(1===f&&"*"===e[0])return"always";if(-1!==e.indexOf(b))return 1===f&&b===d?"sameDomain":"always"}return"never"}}(),Db=function(){try{return g.activeElement}catch(a){return null}},Eb=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},Fb=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)&&a.classList.remove(b),a;if("string"==typeof b&&b){var c=b.split(/\s+/);if(1===a.nodeType&&a.className){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,"")}}return a},Gb=function(a,b){var c=m(a,null).getPropertyValue(b);return"cursor"!==b||c&&"auto"!==c||"A"!==a.nodeName?c:"pointer"},Hb=function(a){var b={left:0,top:0,width:0,height:0};if(a.getBoundingClientRect){var c=a.getBoundingClientRect(),d=f.pageXOffset,e=f.pageYOffset,h=g.documentElement.clientLeft||0,i=g.documentElement.clientTop||0,j=0,k=0;if("relative"===Gb(g.body,"position")){var l=g.body.getBoundingClientRect(),m=g.documentElement.getBoundingClientRect();j=l.left-m.left||0,k=l.top-m.top||0}b.left=c.left+d-h-j,b.top=c.top+e-i-k,b.width="width"in c?c.width:c.right-c.left,b.height="height"in c?c.height:c.bottom-c.top}return b},Ib=function(a){if(!a)return!1;var b=m(a,null),c=r(b.height)>0,d=r(b.width)>0,e=r(b.top)>=0,f=r(b.left)>=0,g=c&&d&&e&&f,h=g?null:Hb(a),i="none"!==b.display&&"collapse"!==b.visibility&&(g||!!h&&(c||h.height>0)&&(d||h.width>0)&&(e||h.top>=0)&&(f||h.left>=0));return i},Jb=function(){j(R),R=0,l(S),S=0},Kb=function(){var a;if(d&&(a=ub(M.bridge))){var b=Hb(d);A(a.style,{width:b.width+"px",height:b.height+"px",top:b.top+"px",left:b.left+"px",zIndex:""+Mb(U.zIndex)})}},Lb=function(a){M.ready===!0&&(M.bridge&&"function"==typeof M.bridge.setHandCursor?M.bridge.setHandCursor(a):M.ready=!1)},Mb=function(a){if(/^(?:auto|inherit)$/.test(a))return a;var b;return"number"!=typeof a||s(a)?"string"==typeof a&&(b=Mb(q(a,10))):b=a,"number"==typeof b?b:"auto"},Nb=function(a){function b(a){var b=a.match(/[\d]+/g);return b.length=3,b.join(".")}function c(a){return!!a&&(a=a.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a)||"chrome.plugin"===a.slice(-13))}function d(a){a&&(i=!0,a.version&&(l=b(a.version)),!l&&a.description&&(l=b(a.description)),a.filename&&(k=c(a.filename)))}var e,f,g,i=!1,j=!1,k=!1,l="";if(h.plugins&&h.plugins.length)e=h.plugins["Shockwave Flash"],d(e),h.plugins["Shockwave Flash 2.0"]&&(i=!0,l="2.0.0.11");else if(h.mimeTypes&&h.mimeTypes.length)g=h.mimeTypes["application/x-shockwave-flash"],e=g&&g.enabledPlugin,d(e);else if("undefined"!=typeof a){j=!0;try{f=new a("ShockwaveFlash.ShockwaveFlash.7"),i=!0,l=b(f.GetVariable("$version"))}catch(m){try{f=new a("ShockwaveFlash.ShockwaveFlash.6"),i=!0,l="6.0.21"}catch(n){try{f=new a("ShockwaveFlash.ShockwaveFlash"),i=!0,l=b(f.GetVariable("$version"))}catch(o){j=!1}}}}M.disabled=i!==!0,M.outdated=l&&r(l)<r(N),M.version=l||"0.0.0",M.pluginType=k?"pepper":j?"activex":i?"netscape":"unknown"};Nb(o);var Ob=function(){return this instanceof Ob?void("function"==typeof Ob._createClient&&Ob._createClient.apply(this,z(arguments))):new Ob};v(Ob,"version",{value:"2.2.0-beta.3",writable:!1,configurable:!0,enumerable:!0}),Ob.config=function(){return V.apply(this,z(arguments))},Ob.state=function(){return W.apply(this,z(arguments))},Ob.isFlashUnusable=function(){return X.apply(this,z(arguments))},Ob.on=function(){return Y.apply(this,z(arguments))},Ob.off=function(){return Z.apply(this,z(arguments))},Ob.handlers=function(){return $.apply(this,z(arguments))},Ob.emit=function(){return _.apply(this,z(arguments))},Ob.create=function(){return ab.apply(this,z(arguments))},Ob.destroy=function(){return bb.apply(this,z(arguments))},Ob.setData=function(){return cb.apply(this,z(arguments))},Ob.clearData=function(){return db.apply(this,z(arguments))},Ob.getData=function(){return eb.apply(this,z(arguments))},Ob.focus=Ob.activate=function(){return fb.apply(this,z(arguments))},Ob.blur=Ob.deactivate=function(){return gb.apply(this,z(arguments))},Ob.activeElement=function(){return hb.apply(this,z(arguments))};var Pb=0,Qb={},Rb=0,Sb={},Tb={};A(U,{autoActivate:!0});var Ub=function(a){var b=this;b.id=""+Pb++,Qb[b.id]={instance:b,elements:[],handlers:{}},a&&b.clip(a),Ob.on("*",function(a){return b.emit(a)}),Ob.on("destroy",function(){b.destroy()}),Ob.create()},Vb=function(a,d){var e,f,g,h={},i=Qb[this.id],j=i&&i.handlers;if(!i)throw new Error("Attempted to add new listener(s) to a destroyed ZeroClipboard client instance");if("string"==typeof a&&a)g=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof d)for(e in a)w.call(a,e)&&"string"==typeof e&&e&&"function"==typeof a[e]&&this.on(e,a[e]);if(g&&g.length){for(e=0,f=g.length;f>e;e++)a=g[e].replace(/^on/,""),h[a]=!0,j[a]||(j[a]=[]),j[a].push(d);if(h.ready&&M.ready&&this.emit({type:"ready",client:this}),h.error){var k=["disabled","outdated","unavailable","degraded","deactivated","overdue"];for(e=0,f=k.length;f>e;e++)if(M[k[e]]){this.emit({type:"error",name:"flash-"+k[e],client:this});break}c!==b&&Ob.version!==c&&this.emit({type:"error",name:"version-mismatch",jsVersion:Ob.version,swfVersion:c})}}return this},Wb=function(a,b){var c,d,e,f,g,h=Qb[this.id],i=h&&h.handlers;if(!i)return this;if(0===arguments.length)f=u(i);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)w.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=i[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return this},Xb=function(a){var b=null,c=Qb[this.id]&&Qb[this.id].handlers;return c&&(b="string"==typeof a&&a?c[a]?c[a].slice(0):[]:B(c)),b},Yb=function(a){if(bc.call(this,a)){"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(a=A({},a));var b=A({},jb(a),{client:this});cc.call(this,b)}return this},Zb=function(a){if(!Qb[this.id])throw new Error("Attempted to clip element(s) to a destroyed ZeroClipboard client instance");a=dc(a);for(var b=0;b<a.length;b++)if(w.call(a,b)&&a[b]&&1===a[b].nodeType){a[b].zcClippingId?-1===Sb[a[b].zcClippingId].indexOf(this.id)&&Sb[a[b].zcClippingId].push(this.id):(a[b].zcClippingId="zcClippingId_"+Rb++,Sb[a[b].zcClippingId]=[this.id],U.autoActivate===!0&&ec(a[b]));var c=Qb[this.id]&&Qb[this.id].elements;-1===c.indexOf(a[b])&&c.push(a[b])}return this},$b=function(a){var b=Qb[this.id];if(!b)return this;var c,d=b.elements;a="undefined"==typeof a?d.slice(0):dc(a);for(var e=a.length;e--;)if(w.call(a,e)&&a[e]&&1===a[e].nodeType){for(c=0;-1!==(c=d.indexOf(a[e],c));)d.splice(c,1);var f=Sb[a[e].zcClippingId];if(f){for(c=0;-1!==(c=f.indexOf(this.id,c));)f.splice(c,1);0===f.length&&(U.autoActivate===!0&&fc(a[e]),delete a[e].zcClippingId)}}return this},_b=function(){var a=Qb[this.id];return a&&a.elements?a.elements.slice(0):[]},ac=function(){Qb[this.id]&&(this.unclip(),this.off(),delete Qb[this.id])},bc=function(a){if(!a||!a.type)return!1;if(a.client&&a.client!==this)return!1;var b=Qb[this.id],c=b&&b.elements,d=!!c&&c.length>0,e=!a.target||d&&-1!==c.indexOf(a.target),f=a.relatedTarget&&d&&-1!==c.indexOf(a.relatedTarget),g=a.client&&a.client===this;return b&&(e||f||g)?!0:!1},cc=function(a){var b=Qb[this.id];if("object"==typeof a&&a&&a.type&&b){var c=mb(a),d=b&&b.handlers["*"]||[],e=b&&b.handlers[a.type]||[],g=d.concat(e);if(g&&g.length){var h,i,j,k,l,m=this;for(h=0,i=g.length;i>h;h++)j=g[h],k=m,"string"==typeof j&&"function"==typeof f[j]&&(j=f[j]),"object"==typeof j&&j&&"function"==typeof j.handleEvent&&(k=j,j=j.handleEvent),"function"==typeof j&&(l=A({},a),nb(j,k,[l],c))}}},dc=function(a){return"string"==typeof a&&(a=[]),"number"!=typeof a.length?[a]:a},ec=function(a){if(a&&1===a.nodeType){var b=function(a){(a||(a=f.event))&&("js"!==a._source&&(a.stopImmediatePropagation(),a.preventDefault()),delete a._source)},c=function(c){(c||(c=f.event))&&(b(c),Ob.focus(a))};a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",b,!1),a.addEventListener("mouseenter",b,!1),a.addEventListener("mouseleave",b,!1),a.addEventListener("mousemove",b,!1),Tb[a.zcClippingId]={mouseover:c,mouseout:b,mouseenter:b,mouseleave:b,mousemove:b}}},fc=function(a){if(a&&1===a.nodeType){var b=Tb[a.zcClippingId];if("object"==typeof b&&b){for(var c,d,e=["move","leave","enter","out","over"],f=0,g=e.length;g>f;f++)c="mouse"+e[f],d=b[c],"function"==typeof d&&a.removeEventListener(c,d,!1);delete Tb[a.zcClippingId]}}};Ob._createClient=function(){Ub.apply(this,z(arguments))},Ob.prototype.on=function(){return Vb.apply(this,z(arguments))},Ob.prototype.off=function(){return Wb.apply(this,z(arguments))},Ob.prototype.handlers=function(){return Xb.apply(this,z(arguments))},Ob.prototype.emit=function(){return Yb.apply(this,z(arguments))},Ob.prototype.clip=function(){return Zb.apply(this,z(arguments))},Ob.prototype.unclip=function(){return $b.apply(this,z(arguments))},Ob.prototype.elements=function(){return _b.apply(this,z(arguments))},Ob.prototype.destroy=function(){return ac.apply(this,z(arguments))},Ob.prototype.setText=function(a){if(!Qb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.setData("text/plain",a),this},Ob.prototype.setHtml=function(a){if(!Qb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.setData("text/html",a),this},Ob.prototype.setRichText=function(a){if(!Qb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.setData("application/rtf",a),this},Ob.prototype.setData=function(){if(!Qb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.setData.apply(this,z(arguments)),this},Ob.prototype.clearData=function(){if(!Qb[this.id])throw new Error("Attempted to clear pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.clearData.apply(this,z(arguments)),this},Ob.prototype.getData=function(){if(!Qb[this.id])throw new Error("Attempted to get pending clipboard data from a destroyed ZeroClipboard client instance");return Ob.getData.apply(this,z(arguments))},"function"==typeof define&&define.amd?define(function(){return Ob}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Ob:a.ZeroClipboard=Ob}(function(){return this||window}());
|