/*!

* 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) 2013 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v1.2.1
*/
(function() {
"use strict";
var _camelizeCssPropName = function() {
var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
return group.toUpperCase();
};
return function(prop) {
return prop.replace(matcherRegex, replacerFn);
};
}();
var _getStyle = function(el, prop) {
var value, camelProp, tagName, possiblePointers, i, len;
if (window.getComputedStyle) {
value = window.getComputedStyle(el, null).getPropertyValue(prop);
} else {
camelProp = _camelizeCssPropName(prop);
if (el.currentStyle) {
value = el.currentStyle[camelProp];
} else {
value = el.style[camelProp];
}
}
if (prop === "cursor") {
if (!value || value === "auto") {
tagName = el.tagName.toLowerCase();
possiblePointers = [ "a" ];
for (i = 0, len = possiblePointers.length; i < len; i++) {
if (tagName === possiblePointers[i]) {
return "pointer";
}
}
}
}
return value;
};
var _elementMouseOver = function(event) {
if (!ZeroClipboard.prototype._singleton) return;
if (!event) {
event = window.event;
}
var target;
if (this !== window) {
target = this;
} else if (event.target) {
target = event.target;
} else if (event.srcElement) {
target = event.srcElement;
}
ZeroClipboard.prototype._singleton.setCurrent(target);
};

className = className. var _addClass = function(element. } }. func).replace(/^\s+|\s+$/g. } if (value && typeof value === "string") { var classNames = (value || ""). return element. value) { if (element. func) { if (element. var _removeClass = function(element. } else { var className = " " + element.detachEvent) { element. . }. " ").addEventListener(method. false). } else { element. var _removeEventHandler = function(element.removeClass(value).length.removeEventListener(method. method. c++) { if (className.addClass(value). c++) { className = className.addClass) { element. for (var c = 0. func. ""). if (element. } if (value && typeof value === "string" || value === undefined) { var classNames = (value || "").className + " ").replace(/[\n\t]/g.nodeType === 1 && element.className) { if (value) { var className = (" " + element.nodeType === 1) { if (!element.split(/\s+/). } } element.className = value. } }. cl = classNames.attachEvent) { element.className = "".indexOf(" " + classNames[c] + " ") < 0) { setClass += " " + classNames[c].addEventListener) { element.className) { element.className. method. var _addEventHandler = function(element. setClass = element. } } } return element. value) { if (element. ""). c < cl.detachEvent("on" + method. } else if (element. }. false).length. } element.replace(/^\s+|\s+$/g. " ").removeEventListener) { element.className = setClass.attachEvent("on" + method.className + " ".removeClass) { element. } else if (element. for (var c = 0. cl = classNames. return element.split(/\s+/). func). } } } return element. if (element. func. c < cl. func) { if (element.replace(" " + classNames[c] + " ".

leftBorderWidth. var _noCache = function(path. logicalWidth. pageYOffset = Math. zIndex: 999999999 }. } }.documentElement.left. var zi = _getStyle(obj.height = "height" in rect ? rect.getBoundingClientRect().documentElement.round(document. zoomFactor = Math.trustedOrigins) { .width : rect.zIndex = parseInt(zi.left.body.body.clientLeft || 0. "z-index").useNoCache === false).height : rect.documentElement. if (typeof document. var _vars = function(options) { var str = []. } else if (typeof options.pageXOffset.width = "width" in rect ? rect.trustedOrigins).round(physicalWidth / logicalWidth * 100) / 100. info. zoomFactor = 1.topBorderWidth. var _getZoomFactor = function() { var rect.top = rect. 10). if ("pageXOffset" in window && "pageYOffset" in window) { pageXOffset = window. if (useNoCache) { return (path.top + pageYOffset . info. }.right . } if (obj.left + pageXOffset . pageYOffset. } else { zoomFactor = _getZoomFactor(). options) { var useNoCache = !(options && options. height: 0.pageYOffset.trustedOrigins === "object" && "length" in options. info.clientTop || 0. var _getDOMObjectPosition = function(obj) { var info = { left: 0. var topBorderWidth = document.trustedOrigins) { if (typeof options.documentElement. info.indexOf("?") === -1 ? "?" : "&") + "nocache=" + new Date(). var pageXOffset. } var leftBorderWidth = document.body.getTime(). top: 0. if (options. }. } return info.getBoundingClientRect().push(options. logicalWidth = document.rect.left = rect. physicalWidth = rect.bottom . zoomFactor. physicalWidth.trustedOrigins === "string") { origins.getBoundingClientRect) { var rect = obj. } else { return "".right .scrollLeft / zoomFactor).offsetWidth.top. } return zoomFactor. pageXOffset = Math.getBoundingClientRect === "function") { rect = document. if (zi && zi !== "auto") { info. width: 0. var origins = []. pageYOffset = window.scrollTop / zoomFactor).round(document.rect.rect.

var ZeroClipboard = function(elements.concat(options. } if (typeof options.length) { str.cjsModuleId) { str.push(options. } if (typeof options. } }.handlers = {}. var _inArray = function(elem."))). var _dispatchCallback = function(func.prototype. for (var kd in _defaults) this.trustedDomains) { origins = origins. origins = origins.detectFlashSupport()) _bridge().length. 0). }."). this. } else { func. } } if (origins._singleton || this).trustedDomains === "object" && "length" in options.amdModuleId) { str.concat(options.trustedDomains).join("&"). element. var _prepGlue = function(elements) { if (typeof elements === "string") throw new TypeError("ZeroClipboard doesn't accept query strings. args.prototype.prototype. }.glue(elements). } for (var i = 0.trustedDomains === "string") { origins. this. options) { if (elements) (ZeroClipboard.call(element._singleton = this. instance._singleton. instance.amdModuleId)).indexOf) { return array. args). ZeroClipboard.options[ko] = options[ko].length) return [ elements ].amdModuleId === "string" && options. } } if (options.setTimeout(function() { func.indexOf(elem). }.join(". } else if (typeof options.call(element.prototype.push("trustedOrigins=" + encodeURIComponent(origins. i++) { if (array[i] === elem) { return i._singleton) return ZeroClipboard. }. if (ZeroClipboard. async) { if (async) { window.trustedDomains).push("amdModuleId=" + encodeURIComponent(options. if (!elements.options = {}. instance. return elements. } } return -1. }.options[kd] = _defaults[kd]. length = array.trustedDomains) { if (typeof options. } return str.push("cjsModuleId=" + encodeURIComponent(options.trustedOrigins). array) { if (array. if (ZeroClipboard.cjsModuleId === "string" && options. args). .cjsModuleId)). i < length. for (var ko in options) this.

var currentElement.setHandCursor(enabled).ready()) this.parentNode.text = newText.prototype._singleton. ZeroClipboard. enabled). allowScriptAccess: "sameDomain". useHandCursor).1".flashBridge. ZeroClipboard. }.setHandCursor = function(enabled) { enabled = typeof enabled === "boolean" ? enabled : !!enabled. ZeroClipboard. if (this. text: null. var _setHandCursor = function(enabled) { if (this.call(this._singleton.setText = function(newText) { if (newText && newText !== "") { this.getAttribute("title").2. }. ZeroClipboard.setText(newText). forceHandCursor: false }. ZeroClipboard. }.detectFlashSupport = function() { . hoverClass: "zeroclipboard-is-hover". }. }.setDefaults = function(options) { for (var ko in options) _defaults[ko] = options[ko].prototype.destroy = function() { ZeroClipboard. if (titleAttr) { this.version = "1. this. return this. delete ZeroClipboard. activeClass: "zeroclipboard-is-active". ZeroClipboard.call(this.prototype. _setHandCursor.setSize(width. }.forceHandCursor = enabled. return this.setSize = function(width. var _defaults = { moviePath: "ZeroClipboard.htmlBridge.flashBridge.prototype. this. var titleAttr = element._singleton.options.setTitle = function(newTitle) { if (newTitle && newTitle !== "") this.options.options. height). } return this.flashBridge.forceHandCursor === true || _getStyle(element. ZeroClipboard.swf".reposition(). }. ZeroClipboard. ZeroClipboard.ready()) this.prototype.removeChild(bridge). _setHandCursor. gluedElements = []. trustedOrigins: null. return this. } var useHandCursor = this.unglue(gluedElements).prototype. newTitle).htmlBridge. height) { if (this.prototype.ready()) this. }.setCurrent = function(element) { currentElement = element.prototype.setAttribute("title". useNoCache: true. return this. bridge. "cursor") === "pointer". var bridge = ZeroClipboard.setTitle(titleAttr).

width = "15px". for (var ko in client.height = "15px". document. if (!container) { var opts = {}. } client. var _bridge = function() { var client = ZeroClipboard.style. container. var _amdModuleId = null. }. false).moviePath + _noCache(client. client.moviePath + _noCache(client.style. var html = ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8- 444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="' + client.options.amdModuleId = _amdModuleId.options.zIndex = "9999".ShockwaveFlash")) { hasFlash = true.resetBridge = function() { .createElement("div"). opts. if (typeof ActiveXObject === "function") { try { if (new ActiveXObject("ShockwaveFlash. "global-zeroclipboard-container"). opts.htmlBridge = container. container. } return hasFlash._singleton.options.prototype. }.options[ko]. } } catch (error) {} } if (!hasFlash && navigator. client.style. container. container. container.options) + '"/> <param name="allowScriptAccess" value="' + client.style.style. container.prototype.setAttribute("class".options) opts[ko] = client.moviePath. var _cjsModuleId = null. container.allowScriptAccess + '"/> <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="' + flashvars + '"/> <embed src="' + client. container.getElementById("global-zeroclipboard-html-bridge").options.options) + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global- zeroclipboard-flash-bridge" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.mimeTypes["application/x-shockwave-flash"]) { hasFlash = true. var flashvars = _vars(opts).moviePath. ZeroClipboard. container = document.position = "absolute".body.flashBridge = document["global-zeroclipboard-flash-bridge"] || container.options.top = "-9999px".com/go/getflashplayer" flashvars="' + flashvars + '" scale="exactfit"> </embed> </object>'.lastElementChild. container.left = "-9999px". container.appendChild(container).id = "global-zeroclipboard-html-bridge".style. client.setAttribute("data-clipboard-ready".innerHTML = html.macromedia.cjsModuleId = _cjsModuleId.children[0]. var hasFlash = false. var container = document.

setSize(pos.zIndex + 1.toString().htmlBridge.addEventListener = ZeroClipboard.style.height = pos. var element = currentElement. this. for (var event in this.receiveEvent = function(eventName.htmlBridge. }. args).prototype. null). ZeroClipboard.handlers[event] === func) { delete this. ZeroClipboard. this.options.detectFlashSupport()) { this.width = pos.ready = function() { var ready = this. "").left + "px". ZeroClipboard. this. if (!this. this.receiveEvent("onNoFlash".style.htmlBridge.split(/\s/g)._singleton.off = function(eventName. currentElement = null.replace(/^on/. }.text = null. ""). i++) { eventName = events[i].on = function(eventName.htmlBridge.left = pos. _removeClass(currentElement.activeClass).".handlers) { if (event === eventName && this. return ready === "true" || ready === true. return this.top = "-9999px".replace(".").style. this.prototype.height + "px". this.replace(/^on/. this.flashVersion. i++) { eventName = events[i].removeAttribute("data-clipboard-text").receiveEvent(eventName. ZeroClipboard.noflash && !ZeroClipboard. ""). ". ZeroClipboard.handlers[eventName] = func.reposition = function() { if (!currentElement) return false. func) { var events = eventName.htmlBridge.toLowerCase().width. this.toString().prototype. switch (eventName) { case "load": if (args && parseFloat(args.style.prototype. i < events.prototype.removeEventListener = ZeroClipboard. } } } return this.left = "-9999px".removeAttribute("title").dispatch = function(eventName.length. for (var i = 0. return this.handlers[eventName]) this.style.toLowerCase().toLowerCase().prototype.options.replace(/^on/.prototype.htmlBridge. ZeroClipboard.prototype.htmlBridge. for (var i = 0.prototype.toString(). this. }.on. this. } if (this.replace(/[^0- . this. func) { var events = eventName.htmlBridge.width + "px".getAttribute("data-clipboard-ready").length. this.height). }.prototype.style.htmlBridge. } return this.zIndex = pos. pos. i < events. args) { eventName = eventName.off. var pos = _getDOMObjectPosition(currentElement).style.htmlBridge.handlers[event].top + "px". }.handlers.top = pos.split(/\s/g). ZeroClipboard. }. var performCallbackAsync = true. ZeroClipboard. args) { ZeroClipboard.

this. } else { var defaultText = element.prototype. gluedElements) == -1) { gluedElements.getAttribute("data-clipboard-text").options.receiveEvent("onWrongFlash". break. i < elements.resetBridge().hoverClass).htmlBridge.options.glue = function(elements) { elements = _prepGlue(elements). this. { flashVersion: args. "")) < 10) { this.options. performCallbackAsync). break.]/gi.text = null. return. case "datarequested": var targetId = element. for (var i = 0.activeClass). case "mouseover": _addClass(element. case "mousedown": _addClass(element. } } }. break. } if (this. if (targetEl) { var textContent = targetEl. break.setText(textContent). } if (typeof func === "function") { _dispatchCallback(func.getAttribute("data-clipboard-target").handlers[eventName]) { var func = this.push(elements[i]).value || targetEl. case "mouseout": _removeClass(element. true). break. targetEl = ! targetId ? null : document. } performCallbackAsync = false.hoverClass). this.activeClass).9\.innerText. element. this. case "mouseup": _removeClass(element. if (typeof func === "string" && typeof window[func] === "function") { func = window[func].length. break. break.options. args.setAttribute("data-clipboard-ready". this.options. . i++) { if (_inArray(elements[i]. ZeroClipboard.getElementById(targetId).setText(defaultText). } this.textContent || targetEl.flashVersion }). this. if (defaultText) this. case "complete": this. if (textContent) this.handlers[eventName].

if (arrayIndex != -1) gluedElements. } } return this. } else if (typeof module === "object" && module && typeof module.exports === "object" && module. _elementMouseOver). 1).prototype.amd) { define([ "require". ZeroClipboard. _elementMouseOver).id || null. }. gluedElements). module) { _amdModuleId = module && module. } })(). for (var i = 0. i < elements. "module" ]. exports. _addEventHandler(elements[i]. i++) { _removeEventHandler(elements[i]. if (typeof define === "function" && define.ZeroClipboard = ZeroClipboard. .exports = ZeroClipboard. } else { window. "exports". module.exports) { _cjsModuleId = module. } return this. var arrayIndex = _inArray(elements[i]. function(require. "mouseover".id || null. }.splice(arrayIndex. "mouseover". return ZeroClipboard.unglue = function(elements) { elements = _prepGlue(elements).length. }).