17 lines
24 KiB
JavaScript
17 lines
24 KiB
JavaScript
/*!
|
|
* jquery.zeroclipboard
|
|
* Bind to the `beforecopy`, `copy`, `aftercopy`, and `copy-error` events, custom DOM-like events for clipboard injection generated using jQuery's Special Events API and ZeroClipboard's Core module.
|
|
* Copyright (c) 2014
|
|
* Licensed MIT
|
|
* https://github.com/zeroclipboard/jquery.zeroclipboard
|
|
* v0.2.0
|
|
*/
|
|
!function(e,t,a){"use strict";var n=!!t.ZeroClipboard;/*!
|
|
* 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.1.2
|
|
*/
|
|
!function(e,t){var a,n=e,r=n.document,o=n.navigator,i=n.setTimeout,l=n.encodeURIComponent,s=n.ActiveXObject,c=n.Number.parseInt||n.parseInt,u=n.Number.parseFloat||n.parseFloat,f=n.Number.isNaN||n.isNaN,p=n.Math.round,d=n.Date.now,v=n.Object.keys,y=n.Object.defineProperty,g=n.Object.prototype.hasOwnProperty,b=n.Array.prototype.slice,h=function(e){return b.call(e,0)},m=function(){var e,t,a,n,r,o=h(arguments),i=o[0]||{};for(e=1,t=o.length;e<t;e++)if(null!=(a=o[e]))for(n in a)g.call(a,n)&&(i[n],i!==(r=a[n])&&void 0!==r&&(i[n]=r));return i},w=function(e){var t,a,n,r;if("object"!=typeof e||null==e)t=e;else if("number"==typeof e.length)for(t=[],a=0,n=e.length;a<n;a++)g.call(e,a)&&(t[a]=w(e[a]));else{t={};for(r in e)g.call(e,r)&&(t[r]=w(e[r]))}return t},x=function(e,t){for(var a={},n=0,r=t.length;n<r;n++)t[n]in e&&(a[t[n]]=e[t[n]]);return a},C=function(e,t){var a={};for(var n in e)-1===t.indexOf(n)&&(a[n]=e[n]);return a},D=function(e){if(e)for(var t in e)g.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},E={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,deactivated:null,overdue:null,ready:null},k={},j={},O=null,N={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"}},I={swfPath:function(){var e,t,a,n,o="ZeroClipboard.swf";if(!r.currentScript||!(n=r.currentScript.src)){var i=r.getElementsByTagName("script");if("readyState"in i[0])for(e=i.length;e--&&("interactive"!==i[e].readyState||!(n=i[e].src)););else if("loading"===r.readyState)n=i[i.length-1].src;else{for(e=i.length;e--;){if(!(a=i[e].src)){t=null;break}if(a=a.split("#")[0].split("?")[0],a=a.slice(0,a.lastIndexOf("/")+1),null==t)t=a;else if(t!==a){t=null;break}}null!==t&&(n=t)}}return n&&(o=(n=n.split("#")[0].split("?")[0]).slice(0,n.lastIndexOf("/")+1)+o),o}(),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},_=function(e){if("object"==typeof e&&null!==e)for(var t in e)if(g.call(e,t))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(t))I[t]=e[t];else if(null==E.bridge)if("containerId"===t||"swfObjectId"===t){if(!K(e[t]))throw new Error("The specified `"+t+"` value is not valid as an HTML4 Element ID");I[t]=e[t]}else I[t]=e[t];{if("string"!=typeof e||!e)return w(I);if(g.call(I,e))return I[e]}},L=function(){return{browser:x(o,["userAgent","platform","appName"]),flash:C(E,["bridge"]),zeroclipboard:{version:we.version,config:we.config()}}},S=function(){return!!(E.disabled||E.outdated||E.unavailable||E.deactivated)},F=function(e,t){var a,n,r,o={};if("string"==typeof e&&e)r=e.toLowerCase().split(/\s+/);else if("object"==typeof e&&e&&void 0===t)for(a in e)g.call(e,a)&&"string"==typeof a&&a&&"function"==typeof e[a]&&we.on(a,e[a]);if(r&&r.length){for(a=0,n=r.length;a<n;a++)o[e=r[a].replace(/^on/,"")]=!0,k[e]||(k[e]=[]),k[e].push(t);if(o.ready&&E.ready&&we.emit({type:"ready"}),o.error){var i=["disabled","outdated","unavailable","deactivated","overdue"];for(a=0,n=i.length;a<n;a++)if(!0===E[i[a]]){we.emit({type:"error",name:"flash-"+i[a]});break}}}return we},z=function(e,t){var a,n,r,o,i;if(0===arguments.length)o=v(k);else if("string"==typeof e&&e)o=e.split(/\s+/);else if("object"==typeof e&&e&&void 0===t)for(a in e)g.call(e,a)&&"string"==typeof a&&a&&"function"==typeof e[a]&&we.off(a,e[a]);if(o&&o.length)for(a=0,n=o.length;a<n;a++)if(e=o[a].toLowerCase().replace(/^on/,""),(i=k[e])&&i.length)if(t)for(r=i.indexOf(t);-1!==r;)i.splice(r,1),r=i.indexOf(t,r);else i.length=0;return we},X=function(e){return"string"==typeof e&&e?w(k[e])||null:w(k)},Y=function(e){var t,a,n;if((e=V(e))&&!W(e))return"ready"===e.type&&!0===E.overdue?we.emit({type:"error",name:"flash-overdue"}):(t=m({},e),Q.call(this,t),"copy"===e.type&&(a=(n=oe(j)).data,O=n.formatMap),a)},A=function(){if("boolean"!=typeof E.ready&&(E.ready=!1),!we.isFlashUnusable()&&null===E.bridge){var e=I.flashLoadTimeout;"number"==typeof e&&e>=0&&i(function(){"boolean"!=typeof E.deactivated&&(E.deactivated=!0),!0===E.deactivated&&we.emit({type:"error",name:"flash-deactivated"})},e),E.overdue=!1,ne()}},$=function(){we.clearData(),we.blur(),we.emit("destroy"),re(),we.off()},H=function(e,t){var a;if("object"==typeof e&&e&&void 0===t)a=e,we.clearData();else{if("string"!=typeof e||!e)return;(a={})[e]=t}for(var n in a)"string"==typeof n&&n&&g.call(a,n)&&"string"==typeof a[n]&&a[n]&&(j[n]=a[n])},P=function(e){void 0===e?(D(j),O=null):"string"==typeof e&&g.call(j,e)&&delete j[e]},B=function(e){return void 0===e?w(j):"string"==typeof e&&g.call(j,e)?j[e]:void 0},M=function(e){if(e&&1===e.nodeType){a&&(de(a,I.activeClass),a!==e&&de(a,I.hoverClass)),a=e,pe(e,I.hoverClass);var t=e.getAttribute("title")||I.title;if("string"==typeof t&&t){var n=ae(E.bridge);n&&n.setAttribute("title",t)}var r=!0===I.forceHandCursor||"pointer"===ve(e,"cursor");he(r),be()}},R=function(){var e=ae(E.bridge);e&&(e.removeAttribute("title"),e.style.left="0px",e.style.top="-9999px",e.style.width="1px",e.style.top="1px"),a&&(de(a,I.hoverClass),de(a,I.activeClass),a=null)},Z=function(){return a||null},K=function(e){return"string"==typeof e&&e&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(e)},V=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){m(e,{type:t.toLowerCase(),target:e.target||a||null,relatedTarget:e.relatedTarget||null,currentTarget:E&&E.bridge||null,timeStamp:e.timeStamp||d()||null});var n=N[e.type];return"error"===e.type&&e.name&&n&&(n=n[e.name]),n&&(e.message=n),"ready"===e.type&&m(e,{target:null,version:E.version}),"error"===e.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(e.name)&&m(e,{target:null,minimumVersion:"11.0.0"}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(e.name)&&m(e,{version:E.version})),"copy"===e.type&&(e.clipboardData={setData:we.setData,clearData:we.clearData}),"aftercopy"===e.type&&(e=ie(e,O)),e.target&&!e.relatedTarget&&(e.relatedTarget=U(e.target)),e=q(e)}},U=function(e){var t=e&&e.getAttribute&&e.getAttribute("data-clipboard-target");return t?r.getElementById(t):null},q=function(e){if(e&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(e.type)){var t=e.target,a="_mouseover"===e.type&&e.relatedTarget?e.relatedTarget:void 0,o="_mouseout"===e.type&&e.relatedTarget?e.relatedTarget:void 0,i=ge(t),l=n.screenLeft||n.screenX||0,s=n.screenTop||n.screenY||0,c=r.body.scrollLeft+r.documentElement.scrollLeft,u=r.body.scrollTop+r.documentElement.scrollTop,f=i.left+("number"==typeof e._stageX?e._stageX:0),p=i.top+("number"==typeof e._stageY?e._stageY:0),d=f-c,v=p-u,y=l+d,g=s+v,b="number"==typeof e.movementX?e.movementX:0,h="number"==typeof e.movementY?e.movementY:0;delete e._stageX,delete e._stageY,m(e,{srcElement:t,fromElement:a,toElement:o,screenX:y,screenY:g,pageX:f,pageY:p,clientX:d,clientY:v,x:d,y:v,movementX:b,movementY:h,offsetX:0,offsetY:0,layerX:0,layerY:0})}return e},G=function(e){var t=e&&"string"==typeof e.type&&e.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(t)},J=function(e,t,a,n){n?i(function(){e.apply(t,a)},0):e.apply(t,a)},Q=function(e){if("object"==typeof e&&e&&e.type){var t=G(e),a=k["*"]||[],r=k[e.type]||[],o=a.concat(r);if(o&&o.length){var i,l,s,c,u,f=this;for(i=0,l=o.length;i<l;i++)c=f,"string"==typeof(s=o[i])&&"function"==typeof n[s]&&(s=n[s]),"object"==typeof s&&s&&"function"==typeof s.handleEvent&&(c=s,s=s.handleEvent),"function"==typeof s&&(u=m({},e),J(s,c,[u],t))}return this}},W=function(e){var t=e.target||a||null,n="swf"===e._source;delete e._source;var r=["flash-disabled","flash-outdated","flash-unavailable","flash-deactivated","flash-overdue"];switch(e.type){case"error":-1!==r.indexOf(e.name)&&m(E,{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 o=!0===E.deactivated;m(E,{disabled:!1,outdated:!1,unavailable:!1,deactivated:!1,overdue:o,ready:!o});break;case"copy":var i,l,s=e.relatedTarget;!j["text/html"]&&!j["text/plain"]&&s&&(l=s.value||s.outerHTML||s.innerHTML)&&(i=s.value||s.textContent||s.innerText)?(e.clipboardData.clearData(),e.clipboardData.setData("text/plain",i),l!==i&&e.clipboardData.setData("text/html",l)):!j["text/plain"]&&e.target&&(i=e.target.getAttribute("data-clipboard-text"))&&(e.clipboardData.clearData(),e.clipboardData.setData("text/plain",i));break;case"aftercopy":we.clearData(),t&&t!==fe()&&t.focus&&t.focus();break;case"_mouseover":we.focus(t),!0===I.bubbleEvents&&n&&(t&&t!==e.relatedTarget&&!T(e.relatedTarget,t)&&ee(m({},e,{type:"mouseenter",bubbles:!1,cancelable:!1})),ee(m({},e,{type:"mouseover"})));break;case"_mouseout":we.blur(),!0===I.bubbleEvents&&n&&(t&&t!==e.relatedTarget&&!T(e.relatedTarget,t)&&ee(m({},e,{type:"mouseleave",bubbles:!1,cancelable:!1})),ee(m({},e,{type:"mouseout"})));break;case"_mousedown":pe(t,I.activeClass),!0===I.bubbleEvents&&n&&ee(m({},e,{type:e.type.slice(1)}));break;case"_mouseup":de(t,I.activeClass),!0===I.bubbleEvents&&n&&ee(m({},e,{type:e.type.slice(1)}));break;case"_click":case"_mousemove":!0===I.bubbleEvents&&n&&ee(m({},e,{type:e.type.slice(1)}))}if(/^_(?:click|mouse(?:over|out|down|up|move))$/.test(e.type))return!0},ee=function(e){if(e&&"string"==typeof e.type&&e){var t,a=e.target||null,o=a&&a.ownerDocument||r,i={view:o.defaultView||n,canBubble:!0,cancelable:!0,detail:"click"===e.type?1:0,button:"number"==typeof e.which?e.which-1:"number"==typeof e.button?e.button:o.createEvent?0:1},l=m(i,e);a&&o.createEvent&&a.dispatchEvent&&(l=[l.type,l.canBubble,l.cancelable,l.view,l.detail,l.screenX,l.screenY,l.clientX,l.clientY,l.ctrlKey,l.altKey,l.shiftKey,l.metaKey,l.button,l.relatedTarget],(t=o.createEvent("MouseEvents")).initMouseEvent&&(t.initMouseEvent.apply(t,l),t._source="js",a.dispatchEvent(t)))}},te=function(){var e=r.createElement("div");return e.id=I.containerId,e.className=I.containerClass,e.style.position="absolute",e.style.left="0px",e.style.top="-9999px",e.style.width="1px",e.style.height="1px",e.style.zIndex=""+me(I.zIndex),e},ae=function(e){for(var t=e&&e.parentNode;t&&"OBJECT"===t.nodeName&&t.parentNode;)t=t.parentNode;return t||null},ne=function(){var e,t=E.bridge,a=ae(t);if(!t){var o=ue(n.location.host,I),i="never"===o?"none":"all",l=se(I),s=I.swfPath+le(I.swfPath,I);a=te();var c=r.createElement("div");a.appendChild(c),r.body.appendChild(a);var u=r.createElement("div"),f="activex"===E.pluginType;u.innerHTML='<object id="'+I.swfObjectId+'" name="'+I.swfObjectId+'" width="100%" height="100%" '+(f?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+s+'"')+">"+(f?'<param name="movie" value="'+s+'"/>':"")+'<param name="allowScriptAccess" value="'+o+'"/><param name="allowNetworking" value="'+i+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+l+'"/></object>',t=u.firstChild,u=null,t.ZeroClipboard=we,a.replaceChild(t,c)}return t||((t=r[I.swfObjectId])&&(e=t.length)&&(t=t[e-1]),!t&&a&&(t=a.firstChild)),E.bridge=t||null,t},re=function(){var e=E.bridge;if(e){var t=ae(e);t&&("activex"===E.pluginType&&"readyState"in e?(e.style.display="none",function a(){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 i(a,10)}()):(e.parentNode&&e.parentNode.removeChild(e),t.parentNode&&t.parentNode.removeChild(t))),E.ready=null,E.bridge=null,E.deactivated=null}},oe=function(e){var t={},a={};if("object"==typeof e&&e){for(var n in e)if(n&&g.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],a.text=n;break;case"text/html":case"html":case"air:html":case"flash:html":t.html=e[n],a.html=n;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":t.rtf=e[n],a.rtf=n}return{data:t,formatMap:a}}},ie=function(e,t){if("object"!=typeof e||!e||"object"!=typeof t||!t)return e;var a={};for(var n in e)if(g.call(e,n)){if("success"!==n&&"data"!==n){a[n]=e[n];continue}a[n]={};var r=e[n];for(var o in r)o&&g.call(r,o)&&g.call(t,o)&&(a[n][t[o]]=r[o])}return a},le=function(e,t){return null==t||t&&!0===t.cacheBust?(-1===e.indexOf("?")?"?":"&")+"noCache="+d():""},se=function(e){var t,a,r,o,i="",s=[];if(e.trustedDomains&&("string"==typeof e.trustedDomains?o=[e.trustedDomains]:"object"==typeof e.trustedDomains&&"length"in e.trustedDomains&&(o=e.trustedDomains)),o&&o.length)for(t=0,a=o.length;t<a;t++)if(g.call(o,t)&&o[t]&&"string"==typeof o[t]){if(!(r=ce(o[t])))continue;if("*"===r){s.length=0,s.push(r);break}s.push.apply(s,[r,"//"+r,n.location.protocol+"//"+r])}return s.length&&(i+="trustedOrigins="+l(s.join(","))),!0===e.forceEnhancedClipboard&&(i+=(i?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof e.swfObjectId&&e.swfObjectId&&(i+=(i?"&":"")+"swfObjectId="+l(e.swfObjectId)),i},ce=function(e){if(null==e||""===e)return null;if(""===(e=e.replace(/^\s+|\s+$/g,"")))return null;var t=e.indexOf("//"),a=(e=-1===t?e:e.slice(t+2)).indexOf("/");return(e=-1===a?e:-1===t||0===a?null:e.slice(0,a))&&".swf"===e.slice(-4).toLowerCase()?null:e||null},ue=function(){var e=function(e){var t,a,n,r=[];if("string"==typeof e&&(e=[e]),"object"!=typeof e||!e||"number"!=typeof e.length)return r;for(t=0,a=e.length;t<a;t++)if(g.call(e,t)&&(n=ce(e[t]))){if("*"===n){r.length=0,r.push("*");break}-1===r.indexOf(n)&&r.push(n)}return r};return function(t,a){var n=ce(a.swfPath);null===n&&(n=t);var r=e(a.trustedDomains),o=r.length;if(o>0){if(1===o&&"*"===r[0])return"always";if(-1!==r.indexOf(t))return 1===o&&t===n?"sameDomain":"always"}return"never"}}(),fe=function(){try{return r.activeElement}catch(e){return null}},pe=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 a=(t||"").split(/\s+/);if(1===e.nodeType)if(e.className){for(var n=" "+e.className+" ",r=e.className,o=0,i=a.length;o<i;o++)n.indexOf(" "+a[o]+" ")<0&&(r+=" "+a[o]);e.className=r.replace(/^\s+|\s+$/g,"")}else e.className=t}return e},de=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 a=t.split(/\s+/);if(1===e.nodeType&&e.className){for(var n=(" "+e.className+" ").replace(/[\n\t]/g," "),r=0,o=a.length;r<o;r++)n=n.replace(" "+a[r]+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}}return e},ve=function(e,t){var a=n.getComputedStyle(e,null).getPropertyValue(t);return"cursor"!==t||a&&"auto"!==a||"A"!==e.nodeName?a:"pointer"},ye=function(){var e,t,a,n=1;return"function"==typeof r.body.getBoundingClientRect&&(t=(e=r.body.getBoundingClientRect()).right-e.left,a=r.body.offsetWidth,n=p(t/a*100)/100),n},ge=function(e){var t={left:0,top:0,width:0,height:0};if(e.getBoundingClientRect){var a,o,i,l=e.getBoundingClientRect();"pageXOffset"in n&&"pageYOffset"in n?(a=n.pageXOffset,o=n.pageYOffset):(i=ye(),a=p(r.documentElement.scrollLeft/i),o=p(r.documentElement.scrollTop/i));var s=r.documentElement.clientLeft||0,c=r.documentElement.clientTop||0;t.left=l.left+a-s,t.top=l.top+o-c,t.width="width"in l?l.width:l.right-l.left,t.height="height"in l?l.height:l.bottom-l.top}return t},be=function(){var e;if(a&&(e=ae(E.bridge))){var t=ge(a);m(e.style,{width:t.width+"px",height:t.height+"px",top:t.top+"px",left:t.left+"px",zIndex:""+me(I.zIndex)})}},he=function(e){!0===E.ready&&(E.bridge&&"function"==typeof E.bridge.setHandCursor?E.bridge.setHandCursor(e):E.ready=!1)},me=function(e){if(/^(?:auto|inherit)$/.test(e))return e;var t;return"number"!=typeof e||f(e)?"string"==typeof e&&(t=me(c(e,10))):t=e,"number"==typeof t?t:"auto"};!function(e){function t(e){var t=e.match(/[\d]+/g);return t.length=3,t.join(".")}function a(e){return!!e&&(e=e.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(e)||"chrome.plugin"===e.slice(-13))}function n(e){e&&(l=!0,e.version&&(f=t(e.version)),!f&&e.description&&(f=t(e.description)),e.filename&&(c=a(e.filename)))}var r,i,l=!1,s=!1,c=!1,f="";if(o.plugins&&o.plugins.length)n(o.plugins["Shockwave Flash"]),o.plugins["Shockwave Flash 2.0"]&&(l=!0,f="2.0.0.11");else if(o.mimeTypes&&o.mimeTypes.length)n((i=o.mimeTypes["application/x-shockwave-flash"])&&i.enabledPlugin);else if(void 0!==e){s=!0;try{r=new e("ShockwaveFlash.ShockwaveFlash.7"),l=!0,f=t(r.GetVariable("$version"))}catch(p){try{r=new e("ShockwaveFlash.ShockwaveFlash.6"),l=!0,f="6.0.21"}catch(d){try{r=new e("ShockwaveFlash.ShockwaveFlash"),l=!0,f=t(r.GetVariable("$version"))}catch(v){s=!1}}}}E.disabled=!0!==l,E.outdated=f&&u(f)<u("11.0.0"),E.version=f||"0.0.0",E.pluginType=c?"pepper":s?"activex":l?"netscape":"unknown"}(s);var we=function(){if(!(this instanceof we))return new we;"function"==typeof we._createClient&&we._createClient.apply(this,h(arguments))};y(we,"version",{value:"2.1.2",writable:!1,configurable:!0,enumerable:!0}),we.config=function(){return _.apply(this,h(arguments))},we.state=function(){return L.apply(this,h(arguments))},we.isFlashUnusable=function(){return S.apply(this,h(arguments))},we.on=function(){return F.apply(this,h(arguments))},we.off=function(){return z.apply(this,h(arguments))},we.handlers=function(){return X.apply(this,h(arguments))},we.emit=function(){return Y.apply(this,h(arguments))},we.create=function(){return A.apply(this,h(arguments))},we.destroy=function(){return $.apply(this,h(arguments))},we.setData=function(){return H.apply(this,h(arguments))},we.clearData=function(){return P.apply(this,h(arguments))},we.getData=function(){return B.apply(this,h(arguments))},we.focus=we.activate=function(){return M.apply(this,h(arguments))},we.blur=we.deactivate=function(){return R.apply(this,h(arguments))},we.activeElement=function(){return Z.apply(this,h(arguments))},"function"==typeof define&&define.amd?define(function(){return we}):e.ZeroClipboard=we}(function(){return this||t}()),function(e,t,a){function n(){for(var e,a="",n={},r=t.getSelection(),o=document.createElement("div"),i=0,l=r.rangeCount;i<l;i++)a+=(e=r.getRangeAt(i)).toString(),o.appendChild(e.cloneContents());return n["text/plain"]=a,a.replace(/\s/g,"")&&(n["text/html"]=o.innerHTML),n}function r(e){if("string"!=typeof e||!e)return null;var t,a,n=e;return n=n.replace(/<(?:hr)(?:\s+[^>]*)?\s*[\/]?>/gi,"{\\pard \\brdrb \\brdrs \\brdrw10 \\brsp20 \\par}\n{\\pard\\par}\n"),n=n.replace(/<(?:br)(?:\s+[^>]*)?\s*[\/]?>/gi,"{\\pard\\par}\n"),n=n.replace(/<(?:p|div|section|article)(?:\s+[^>]*)?\s*[\/]>/gi,"{\\pard\\par}\n"),n=n.replace(/<(?:[^>]+)\/>/g,""),n=n.replace(/<a(?:\s+[^>]*)?(?:\s+href=(["'])(?:javascript:void\(0?\);?|#|return false;?|void\(0?\);?|)\1)(?:\s+[^>]*)?>/gi,"{{{\n"),t=n,n=n.replace(/<a(?:\s+[^>]*)?(?:\s+href=(["'])(.+)\1)(?:\s+[^>]*)?>/gi,'{\\field{\\*\\fldinst{HYPERLINK\n "$2"\n}}{\\fldrslt{\\ul\\cf1\n'),a=n!==t,n=n.replace(/<a(?:\s+[^>]*)?>/gi,"{{{\n"),n=n.replace(/<\/a(?:\s+[^>]*)?>/gi,"\n}}}"),n=n.replace(/<(?:b|strong)(?:\s+[^>]*)?>/gi,"{\\b\n"),n=n.replace(/<(?:i|em)(?:\s+[^>]*)?>/gi,"{\\i\n"),n=n.replace(/<(?:u|ins)(?:\s+[^>]*)?>/gi,"{\\ul\n"),n=n.replace(/<(?:strike|del)(?:\s+[^>]*)?>/gi,"{\\strike\n"),n=n.replace(/<sup(?:\s+[^>]*)?>/gi,"{\\super\n"),n=n.replace(/<sub(?:\s+[^>]*)?>/gi,"{\\sub\n"),n=n.replace(/<(?:p|div|section|article)(?:\s+[^>]*)?>/gi,"{\\pard\n"),n=n.replace(/<\/(?:p|div|section|article)(?:\s+[^>]*)?>/gi,"\n\\par}\n"),n=n.replace(/<\/(?:b|strong|i|em|u|ins|strike|del|sup|sub)(?:\s+[^>]*)?>/gi,"\n}"),n=n.replace(/<(?:[^>]+)>/g,""),n="{\\rtf1\\ansi\n"+(a?"{\\colortbl\n;\n\\red0\\green0\\blue255;\n}\n":"")+n+"\n}"}function o(t){var a=e.Event(t.type,e.extend(t,{_source:"swf"}));if(e(t.target).trigger(a),"copy"===a.type){if(!0===e.event.special.copy.options.requirePreventDefault&&!a.isDefaultPrevented()){t.clipboardData.clearData();var o=n();(o["text/plain"]||o["text/html"])&&t.clipboardData.setData(o)}var i=d.getData();if(!0===e.event.special.copy.options.autoConvertHtmlToRtf&&i["text/html"]&&!i["application/rtf"]){var l=r(i["text/html"]);t.clipboardData.setData("application/rtf",l)}}}function i(t){var a=e.Event("copy-error",e.extend(t,{type:"copy-error",_source:"swf"}));e(t.target).trigger(a)}function l(){e.event.props.push("clipboardData"),d.config(e.extend(!0,{autoActivate:!1},v.options)),d.on("beforecopy copy aftercopy",o),d.on("error",i),d.create()}function s(){d.destroy();var t=e.event.props.indexOf("clipboardData");-1!==t&&e.event.props.splice(t,1)}function c(t){f(t),t.target&&t.target!==d.activeElement()&&t.target!==e("#"+d.config("containerId"))[0]&&t.target!==e("#"+d.config("swfObjectId"))[0]&&d.focus(t.target)}function u(t){f(t),t.relatedTarget&&t.relatedTarget!==d.activeElement()&&t.relatedTarget!==e("#"+d.config("containerId"))[0]&&t.relatedTarget!==e("#"+d.config("swfObjectId"))[0]&&d.blur()}function f(e){d.isFlashUnusable()||"js"===e.originalEvent._source||(e.stopImmediatePropagation(),e.preventDefault())}var p=0,d=t.ZeroClipboard,v={add:function(t){0==p++&&l();var a=".zeroclipboard"+(t.namespace?"."+t.namespace:""),n=t.selector,r="zc|{"+n+"}|{"+a+"}|count",o=e(this);"number"!=typeof o.data(r)&&o.data(r,0),0===o.data(r)&&(o.on("mouseenter"+a,n,c),o.on("mouseleave"+a,n,u),o.on("mouseover"+a,n,f),o.on("mouseout"+a,n,f),o.on("mousemove"+a,n,f),o.on("mousedown"+a,n,f),o.on("mouseup"+a,n,f),o.on("click"+a,n,f)),o.data(r,o.data(r)+1)},remove:function(t){var a=".zeroclipboard"+(t.namespace?"."+t.namespace:""),n=t.selector,r="zc|{"+n+"}|{"+a+"}|count",o=e(this);o.data(r,o.data(r)-1),0===o.data(r)&&(o.off("click"+a,n,f),o.off("mouseup"+a,n,f),o.off("mousedown"+a,n,f),o.off("mousemove"+a,n,f),o.off("mouseout"+a,n,f),o.off("mouseover"+a,n,f),o.off("mouseleave"+a,n,u),o.off("mouseenter"+a,n,c),o.removeData(r)),0==--p&&s()},trigger:function(t){if("copy"===t.type){var a=e(this),n="swf"===t._source;delete t._source,n||(a.trigger(e.extend(!0,{},t,{type:"beforecopy"})),a.one("copy",function(){var n={},r=d.getData();e.each(r,function(e){n[e]=!1});var o=e.extend(!0,{},t,{type:"aftercopy",data:e.extend(!0,{},r),success:n});a.trigger(o)}))}},_default:function(){return!0},options:{requirePreventDefault:!0,autoConvertHtmlToRtf:!0,trustedDomains:d.config("trustedDomains"),hoverClass:"hover",activeClass:"active"}};e.event.special.beforecopy=v,e.event.special.copy=v,e.event.special.aftercopy=v,e.event.special["copy-error"]=v}(jQuery,function(){return this||t}()),n||delete t.ZeroClipboard}(jQuery,function(){return this||window}()); |