/*!

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

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

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

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

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

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

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

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