+
+
<%= simple_markup(@latest_version.info) %>
-
<%= t '.bundler_header' %>
- <%= @latest_version.to_bundler %>
<%= render :partial => "rubygems/clippy", :locals => { :embed => "github_clippy", :text => @latest_version.to_bundler } %>
-
<%= t '.install' %>
- <%= @latest_version.to_install %>
<%= render :partial => "rubygems/clippy", :locals => { :embed => "github_clippy", :text => @latest_version.to_install } %>
-
+
+ <% else %>
+
+
<%= t('.yanked_notice', :more_info_link => link_to(t('.yank_info_link_text'), "http://help.rubygems.org/faqs/gemcutter/removing-a-published-rubygem")).html_safe %>
+
+ <% end %>
+
+ <% if @versions.present? %>
+
+
+
<%= t '.versions_header' %>:
+
+ <%= render @versions %>
+
+ <% if show_all_versions_link?(@rubygem) %>
+ <%= link_to t('.show_all_versions', :count => @rubygem.versions.count), rubygem_versions_url(@rubygem), :class => "gem__see-all-versions t-link--gray t-link--has-arrow" %>
+ <% end %>
+
+
+ <% end %>
+
+ <%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.runtime } %>
+ <%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.development } %>
-
+ <% if @latest_version.requirements.present? %>
+
+
<%= t '.requirements_header' %>:
+
+ <% Array(@latest_version.requirements).each do |requirement| %>
+
<%= requirement %>
+ <% end %>
+
+
+ <% end %>
+
+
+ <% if @latest_version.indexed %>
<% if @latest_version.authors.present? %>
-
-
<%= t '.authors_header' %>:
-
-
+
<%= t '.authors_header' %>:
+
<% end %>
<% if @rubygem.owners.present? %>
-
-
<%= t '.owners_header' %>:
-
- <%= links_to_owners(@rubygem) %>
-
+
<%= t '.owners_header' %>:
+
+ <%= links_to_owners(@rubygem) %>
<% end %>
-
-
-
-
- <% if @latest_version.licenses.present? %>
-
-
<%= t '.licenses_header' %>:
-
-
- <% end %>
-
-
-
- <% else %>
-
-
<%= t('.yanked_notice', :more_info_link => link_to(t('.yank_info_link_text'), "http://help.rubygems.org/faqs/gemcutter/removing-a-published-rubygem")).html_safe %>
-
- <% end %>
+ <% end %>
+
@@ -88,15 +94,43 @@
Required Ruby Version:
-
+
<% if @latest_version.ruby_version %>
<%= @latest_version.ruby_version %>
<% else %>
None
<% end %>
-
+
+ <% if @latest_version.indexed %>
+
+ <%= t '.licenses_header' %>:
+
+ <%= formatted_licenses @latest_version.licenses %>
+
+
+
+
+ <%= t '.bundler_header' %>:
+
+ <%= @latest_version.to_bundler %>
+ =
+ Copy to clipboard
+ Copied!
+
+
+
+ <%= t '.install' %>:
+
+ <%= @latest_version.to_install %>
+ =
+ Copy to clipboard
+ Copied!
+
+
+ <% end %>
+
<%= t '.links.header' %>:
<%= link_to t('edit'), edit_rubygem_path(@rubygem), :class => "gem__link t-list__item", :id => "edit" if @rubygem.owned_by?(current_user) %>
@@ -125,35 +159,12 @@
-->
-
-
- <% if @versions.present? %>
-
-
-
<%= t '.versions_header' %>:
-
- <%= render @versions %>
-
- <% if show_all_versions_link?(@rubygem) %>
- <%= link_to t('.show_all_versions', :count => @rubygem.versions.count), rubygem_versions_url(@rubygem), :class => "gem__see-all-versions t-link--gray t-link--has-arrow" %>
- <% end %>
-
-
- <% end %>
-
- <%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.runtime } %>
- <%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.development } %>
-
- <% if @latest_version.requirements.present? %>
-
-
<%= t '.requirements_header' %>:
-
- <% Array(@latest_version.requirements).each do |requirement| %>
-
<%= requirement %>
- <% end %>
-
-
- <% end %>
-
<% end %>
+
+<%= javascript_include_tag "ZeroClipboard" %>
+
+
diff --git a/public/favicon.icns b/public/favicon.icns
new file mode 100644
index 00000000000..3efe83f6b62
Binary files /dev/null and b/public/favicon.icns differ
diff --git a/public/favicon.ico b/public/favicon.ico
index 83440009187..739c5db6bd4 100644
Binary files a/public/favicon.ico and b/public/favicon.ico differ
diff --git a/public/favicon.png b/public/favicon.png
deleted file mode 100644
index 2fc6bcdd307..00000000000
Binary files a/public/favicon.png and /dev/null differ
diff --git a/public/fluid-icon.png b/public/fluid-icon.png
deleted file mode 100644
index 26ef8e3e308..00000000000
Binary files a/public/fluid-icon.png and /dev/null differ
diff --git a/public/javascripts/ZeroClipboard.js b/public/javascripts/ZeroClipboard.js
new file mode 100644
index 00000000000..3e5f4e8d7c4
--- /dev/null
+++ b/public/javascripts/ZeroClipboard.js
@@ -0,0 +1,2399 @@
+/*!
+ * 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.2.0-beta.2
+ */
+(function(window, undefined) {
+ "use strict";
+ /**
+ * Store references to critically important global functions that may be
+ * overridden on certain web pages.
+ */
+ var _window = window, _document = _window.document, _navigator = _window.navigator, _setTimeout = _window.setTimeout, _clearTimeout = _window.clearTimeout, _encodeURIComponent = _window.encodeURIComponent, _ActiveXObject = _window.ActiveXObject, _Error = _window.Error, _parseInt = _window.Number.parseInt || _window.parseInt, _parseFloat = _window.Number.parseFloat || _window.parseFloat, _isNaN = _window.Number.isNaN || _window.isNaN, _round = _window.Math.round, _now = _window.Date.now, _keys = _window.Object.keys, _defineProperty = _window.Object.defineProperty, _hasOwn = _window.Object.prototype.hasOwnProperty, _slice = _window.Array.prototype.slice, _unwrap = function() {
+ var unwrapper = function(el) {
+ return el;
+ };
+ if (typeof _window.wrap === "function" && typeof _window.unwrap === "function") {
+ try {
+ var div = _document.createElement("div");
+ var unwrappedDiv = _window.unwrap(div);
+ if (div.nodeType === 1 && unwrappedDiv && unwrappedDiv.nodeType === 1) {
+ unwrapper = _window.unwrap;
+ }
+ } catch (e) {}
+ }
+ return unwrapper;
+ }();
+ /**
+ * Convert an `arguments` object into an Array.
+ *
+ * @returns The arguments as an Array
+ * @private
+ */
+ var _args = function(argumentsObj) {
+ return _slice.call(argumentsObj, 0);
+ };
+ /**
+ * Shallow-copy the owned, enumerable properties of one object over to another, similar to jQuery's `$.extend`.
+ *
+ * @returns The target object, augmented
+ * @private
+ */
+ var _extend = function() {
+ var i, len, arg, prop, src, copy, args = _args(arguments), target = args[0] || {};
+ for (i = 1, len = args.length; i < len; i++) {
+ if ((arg = args[i]) != null) {
+ for (prop in arg) {
+ if (_hasOwn.call(arg, prop)) {
+ src = target[prop];
+ copy = arg[prop];
+ if (target !== copy && copy !== undefined) {
+ target[prop] = copy;
+ }
+ }
+ }
+ }
+ }
+ return target;
+ };
+ /**
+ * Return a deep copy of the source object or array.
+ *
+ * @returns Object or Array
+ * @private
+ */
+ var _deepCopy = function(source) {
+ var copy, i, len, prop;
+ if (typeof source !== "object" || source == null) {
+ copy = source;
+ } else if (typeof source.length === "number") {
+ copy = [];
+ for (i = 0, len = source.length; i < len; i++) {
+ if (_hasOwn.call(source, i)) {
+ copy[i] = _deepCopy(source[i]);
+ }
+ }
+ } else {
+ copy = {};
+ for (prop in source) {
+ if (_hasOwn.call(source, prop)) {
+ copy[prop] = _deepCopy(source[prop]);
+ }
+ }
+ }
+ return copy;
+ };
+ /**
+ * Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to keep.
+ * The inverse of `_omit`, mostly. The big difference is that these properties do NOT need to be enumerable to
+ * be kept.
+ *
+ * @returns A new filtered object.
+ * @private
+ */
+ var _pick = function(obj, keys) {
+ var newObj = {};
+ for (var i = 0, len = keys.length; i < len; i++) {
+ if (keys[i] in obj) {
+ newObj[keys[i]] = obj[keys[i]];
+ }
+ }
+ return newObj;
+ };
+ /**
+ * Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to omit.
+ * The inverse of `_pick`.
+ *
+ * @returns A new filtered object.
+ * @private
+ */
+ var _omit = function(obj, keys) {
+ var newObj = {};
+ for (var prop in obj) {
+ if (keys.indexOf(prop) === -1) {
+ newObj[prop] = obj[prop];
+ }
+ }
+ return newObj;
+ };
+ /**
+ * Remove all owned, enumerable properties from an object.
+ *
+ * @returns The original object without its owned, enumerable properties.
+ * @private
+ */
+ var _deleteOwnProperties = function(obj) {
+ if (obj) {
+ for (var prop in obj) {
+ if (_hasOwn.call(obj, prop)) {
+ delete obj[prop];
+ }
+ }
+ }
+ return obj;
+ };
+ /**
+ * Determine if an element is contained within another element.
+ *
+ * @returns Boolean
+ * @private
+ */
+ var _containedBy = function(el, ancestorEl) {
+ if (el && el.nodeType === 1 && el.ownerDocument && ancestorEl && (ancestorEl.nodeType === 1 && ancestorEl.ownerDocument && ancestorEl.ownerDocument === el.ownerDocument || ancestorEl.nodeType === 9 && !ancestorEl.ownerDocument && ancestorEl === el.ownerDocument)) {
+ do {
+ if (el === ancestorEl) {
+ return true;
+ }
+ el = el.parentNode;
+ } while (el);
+ }
+ return false;
+ };
+ /**
+ * Get the URL path's parent directory.
+ *
+ * @returns String or `undefined`
+ * @private
+ */
+ var _getDirPathOfUrl = function(url) {
+ var dir;
+ if (typeof url === "string" && url) {
+ dir = url.split("#")[0].split("?")[0];
+ dir = url.slice(0, url.lastIndexOf("/") + 1);
+ }
+ return dir;
+ };
+ /**
+ * Get the current script's URL by throwing an `Error` and analyzing it.
+ *
+ * @returns String or `undefined`
+ * @private
+ */
+ var _getCurrentScriptUrlFromErrorStack = function(stack) {
+ var url, matches;
+ if (typeof stack === "string" && stack) {
+ matches = stack.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/);
+ if (matches && matches[1]) {
+ url = matches[1];
+ } else {
+ matches = stack.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/);
+ if (matches && matches[1]) {
+ url = matches[1];
+ }
+ }
+ }
+ return url;
+ };
+ /**
+ * Get the current script's URL by throwing an `Error` and analyzing it.
+ *
+ * @returns String or `undefined`
+ * @private
+ */
+ var _getCurrentScriptUrlFromError = function() {
+ var url, err;
+ try {
+ throw new _Error();
+ } catch (e) {
+ err = e;
+ }
+ if (err) {
+ url = err.sourceURL || err.fileName || _getCurrentScriptUrlFromErrorStack(err.stack);
+ }
+ return url;
+ };
+ /**
+ * Get the current script's URL.
+ *
+ * @returns String or `undefined`
+ * @private
+ */
+ var _getCurrentScriptUrl = function() {
+ var jsPath, scripts, i;
+ if (_document.currentScript && (jsPath = _document.currentScript.src)) {
+ return jsPath;
+ }
+ scripts = _document.getElementsByTagName("script");
+ if (scripts.length === 1) {
+ return scripts[0].src || undefined;
+ }
+ if ("readyState" in scripts[0]) {
+ for (i = scripts.length; i--; ) {
+ if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
+ return jsPath;
+ }
+ }
+ }
+ if (_document.readyState === "loading" && (jsPath = scripts[scripts.length - 1].src)) {
+ return jsPath;
+ }
+ if (jsPath = _getCurrentScriptUrlFromError()) {
+ return jsPath;
+ }
+ return undefined;
+ };
+ /**
+ * Get the unanimous parent directory of ALL script tags.
+ * If any script tags are either (a) inline or (b) from differing parent
+ * directories, this method must return `undefined`.
+ *
+ * @returns String or `undefined`
+ * @private
+ */
+ var _getUnanimousScriptParentDir = function() {
+ var i, jsDir, jsPath, scripts = _document.getElementsByTagName("script");
+ for (i = scripts.length; i--; ) {
+ if (!(jsPath = scripts[i].src)) {
+ jsDir = null;
+ break;
+ }
+ jsPath = _getDirPathOfUrl(jsPath);
+ if (jsDir == null) {
+ jsDir = jsPath;
+ } else if (jsDir !== jsPath) {
+ jsDir = null;
+ break;
+ }
+ }
+ return jsDir || undefined;
+ };
+ /**
+ * Get the presumed location of the "ZeroClipboard.swf" file, based on the location
+ * of the executing JavaScript file (e.g. "ZeroClipboard.js", etc.).
+ *
+ * @returns String
+ * @private
+ */
+ var _getDefaultSwfPath = function() {
+ var jsDir = _getDirPathOfUrl(_getCurrentScriptUrl()) || _getUnanimousScriptParentDir() || "";
+ return jsDir + "ZeroClipboard.swf";
+ };
+ /**
+ * Keep track of the state of the Flash object.
+ * @private
+ */
+ var _flashState = {
+ bridge: null,
+ version: "0.0.0",
+ pluginType: "unknown",
+ disabled: null,
+ outdated: null,
+ unavailable: null,
+ degraded: null,
+ deactivated: null,
+ overdue: null,
+ ready: null
+ };
+ /**
+ * The minimum Flash Player version required to use ZeroClipboard completely.
+ * @readonly
+ * @private
+ */
+ var _minimumFlashVersion = "11.0.0";
+ /**
+ * The ZeroClipboard library version number, as reported by Flash, at the time the SWF was compiled.
+ */
+ var _zcSwfVersion;
+ /**
+ * Keep track of all event listener registrations.
+ * @private
+ */
+ var _handlers = {};
+ /**
+ * Keep track of the currently activated element.
+ * @private
+ */
+ var _currentElement;
+ /**
+ * Keep track of the element that was activated when a `copy` process started.
+ * @private
+ */
+ var _copyTarget;
+ /**
+ * Keep track of data for the pending clipboard transaction.
+ * @private
+ */
+ var _clipData = {};
+ /**
+ * Keep track of data formats for the pending clipboard transaction.
+ * @private
+ */
+ var _clipDataFormatMap = null;
+ /**
+ * Keep track of the flash availability check timeout
+ * @private
+ */
+ var _flashCheckTimeout = 0;
+ /**
+ * The `message` store for events
+ * @private
+ */
+ var _eventMessages = {
+ 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",
+ "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"
+ }
+ };
+ /**
+ * ZeroClipboard configuration defaults for the Core module.
+ * @private
+ */
+ var _globalConfig = {
+ swfPath: _getDefaultSwfPath(),
+ trustedDomains: window.location.host ? [ window.location.host ] : [],
+ cacheBust: true,
+ forceEnhancedClipboard: false,
+ flashLoadTimeout: 3e4,
+ autoActivate: true,
+ bubbleEvents: true,
+ containerId: "global-zeroclipboard-html-bridge",
+ containerClass: "global-zeroclipboard-container",
+ swfObjectId: "global-zeroclipboard-flash-bridge",
+ hoverClass: "zeroclipboard-is-hover",
+ activeClass: "zeroclipboard-is-active",
+ forceHandCursor: false,
+ title: null,
+ zIndex: 999999999
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.config`.
+ * @private
+ */
+ var _config = function(options) {
+ if (typeof options === "object" && options !== null) {
+ for (var prop in options) {
+ if (_hasOwn.call(options, prop)) {
+ if (/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(prop)) {
+ _globalConfig[prop] = options[prop];
+ } else if (_flashState.bridge == null) {
+ if (prop === "containerId" || prop === "swfObjectId") {
+ if (_isValidHtml4Id(options[prop])) {
+ _globalConfig[prop] = options[prop];
+ } else {
+ throw new Error("The specified `" + prop + "` value is not valid as an HTML4 Element ID");
+ }
+ } else {
+ _globalConfig[prop] = options[prop];
+ }
+ }
+ }
+ }
+ }
+ if (typeof options === "string" && options) {
+ if (_hasOwn.call(_globalConfig, options)) {
+ return _globalConfig[options];
+ }
+ return;
+ }
+ return _deepCopy(_globalConfig);
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.state`.
+ * @private
+ */
+ var _state = function() {
+ return {
+ browser: _pick(_navigator, [ "userAgent", "platform", "appName" ]),
+ flash: _omit(_flashState, [ "bridge" ]),
+ zeroclipboard: {
+ version: ZeroClipboard.version,
+ config: ZeroClipboard.config()
+ }
+ };
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.isFlashUnusable`.
+ * @private
+ */
+ var _isFlashUnusable = function() {
+ return !!(_flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.degraded || _flashState.deactivated);
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.on`.
+ * @private
+ */
+ var _on = function(eventType, listener) {
+ var i, len, events, added = {};
+ if (typeof eventType === "string" && eventType) {
+ events = eventType.toLowerCase().split(/\s+/);
+ } else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
+ for (i in eventType) {
+ if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
+ ZeroClipboard.on(i, eventType[i]);
+ }
+ }
+ }
+ if (events && events.length) {
+ for (i = 0, len = events.length; i < len; i++) {
+ eventType = events[i].replace(/^on/, "");
+ added[eventType] = true;
+ if (!_handlers[eventType]) {
+ _handlers[eventType] = [];
+ }
+ _handlers[eventType].push(listener);
+ }
+ if (added.ready && _flashState.ready) {
+ ZeroClipboard.emit({
+ type: "ready"
+ });
+ }
+ if (added.error) {
+ var flashErrorTypes = [ "disabled", "outdated", "unavailable", "degraded", "deactivated", "overdue" ];
+ for (i = 0, len = flashErrorTypes.length; i < len; i++) {
+ if (_flashState[flashErrorTypes[i]] === true) {
+ ZeroClipboard.emit({
+ type: "error",
+ name: "flash-" + flashErrorTypes[i]
+ });
+ break;
+ }
+ }
+ if (_zcSwfVersion !== undefined && ZeroClipboard.version !== _zcSwfVersion) {
+ this.emit({
+ type: "error",
+ name: "version-mismatch",
+ jsVersion: ZeroClipboard.version,
+ swfVersion: _zcSwfVersion
+ });
+ }
+ }
+ }
+ return ZeroClipboard;
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.off`.
+ * @private
+ */
+ var _off = function(eventType, listener) {
+ var i, len, foundIndex, events, perEventHandlers;
+ if (arguments.length === 0) {
+ events = _keys(_handlers);
+ } else if (typeof eventType === "string" && eventType) {
+ events = eventType.split(/\s+/);
+ } else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
+ for (i in eventType) {
+ if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
+ ZeroClipboard.off(i, eventType[i]);
+ }
+ }
+ }
+ if (events && events.length) {
+ for (i = 0, len = events.length; i < len; i++) {
+ eventType = events[i].toLowerCase().replace(/^on/, "");
+ perEventHandlers = _handlers[eventType];
+ if (perEventHandlers && perEventHandlers.length) {
+ if (listener) {
+ foundIndex = perEventHandlers.indexOf(listener);
+ while (foundIndex !== -1) {
+ perEventHandlers.splice(foundIndex, 1);
+ foundIndex = perEventHandlers.indexOf(listener, foundIndex);
+ }
+ } else {
+ perEventHandlers.length = 0;
+ }
+ }
+ }
+ }
+ return ZeroClipboard;
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.handlers`.
+ * @private
+ */
+ var _listeners = function(eventType) {
+ var copy;
+ if (typeof eventType === "string" && eventType) {
+ copy = _deepCopy(_handlers[eventType]) || null;
+ } else {
+ copy = _deepCopy(_handlers);
+ }
+ return copy;
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.emit`.
+ * @private
+ */
+ var _emit = function(event) {
+ var eventCopy, returnVal, tmp;
+ event = _createEvent(event);
+ if (!event) {
+ return;
+ }
+ if (_preprocessEvent(event)) {
+ return;
+ }
+ if (event.type === "ready" && _flashState.overdue === true) {
+ return ZeroClipboard.emit({
+ type: "error",
+ name: "flash-overdue"
+ });
+ }
+ eventCopy = _extend({}, event);
+ _dispatchCallbacks.call(this, eventCopy);
+ if (event.type === "copy") {
+ tmp = _mapClipDataToFlash(_clipData);
+ returnVal = tmp.data;
+ _clipDataFormatMap = tmp.formatMap;
+ }
+ return returnVal;
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.create`.
+ * @private
+ */
+ var _create = function() {
+ if (typeof _flashState.ready !== "boolean") {
+ _flashState.ready = false;
+ }
+ if (!ZeroClipboard.isFlashUnusable() && _flashState.bridge === null) {
+ var maxWait = _globalConfig.flashLoadTimeout;
+ if (typeof maxWait === "number" && maxWait >= 0) {
+ _flashCheckTimeout = _setTimeout(function() {
+ if (typeof _flashState.deactivated !== "boolean") {
+ _flashState.deactivated = true;
+ }
+ if (_flashState.deactivated === true) {
+ ZeroClipboard.emit({
+ type: "error",
+ name: "flash-deactivated"
+ });
+ }
+ }, maxWait);
+ }
+ _flashState.overdue = false;
+ _embedSwf();
+ }
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.destroy`.
+ * @private
+ */
+ var _destroy = function() {
+ ZeroClipboard.clearData();
+ ZeroClipboard.blur();
+ ZeroClipboard.emit("destroy");
+ _unembedSwf();
+ ZeroClipboard.off();
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.setData`.
+ * @private
+ */
+ var _setData = function(format, data) {
+ var dataObj;
+ if (typeof format === "object" && format && typeof data === "undefined") {
+ dataObj = format;
+ ZeroClipboard.clearData();
+ } else if (typeof format === "string" && format) {
+ dataObj = {};
+ dataObj[format] = data;
+ } else {
+ return;
+ }
+ for (var dataFormat in dataObj) {
+ if (typeof dataFormat === "string" && dataFormat && _hasOwn.call(dataObj, dataFormat) && typeof dataObj[dataFormat] === "string" && dataObj[dataFormat]) {
+ _clipData[dataFormat] = dataObj[dataFormat];
+ }
+ }
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.clearData`.
+ * @private
+ */
+ var _clearData = function(format) {
+ if (typeof format === "undefined") {
+ _deleteOwnProperties(_clipData);
+ _clipDataFormatMap = null;
+ } else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
+ delete _clipData[format];
+ }
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.getData`.
+ * @private
+ */
+ var _getData = function(format) {
+ if (typeof format === "undefined") {
+ return _deepCopy(_clipData);
+ } else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
+ return _clipData[format];
+ }
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.focus`/`ZeroClipboard.activate`.
+ * @private
+ */
+ var _focus = function(element) {
+ if (!(element && element.nodeType === 1)) {
+ return;
+ }
+ if (_currentElement) {
+ _removeClass(_currentElement, _globalConfig.activeClass);
+ if (_currentElement !== element) {
+ _removeClass(_currentElement, _globalConfig.hoverClass);
+ }
+ }
+ _currentElement = element;
+ _addClass(element, _globalConfig.hoverClass);
+ var newTitle = element.getAttribute("title") || _globalConfig.title;
+ if (typeof newTitle === "string" && newTitle) {
+ var htmlBridge = _getHtmlBridge(_flashState.bridge);
+ if (htmlBridge) {
+ htmlBridge.setAttribute("title", newTitle);
+ }
+ }
+ var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
+ _setHandCursor(useHandCursor);
+ _reposition();
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.blur`/`ZeroClipboard.deactivate`.
+ * @private
+ */
+ var _blur = function() {
+ var htmlBridge = _getHtmlBridge(_flashState.bridge);
+ if (htmlBridge) {
+ htmlBridge.removeAttribute("title");
+ htmlBridge.style.left = "0px";
+ htmlBridge.style.top = "-9999px";
+ htmlBridge.style.width = "1px";
+ htmlBridge.style.top = "1px";
+ }
+ if (_currentElement) {
+ _removeClass(_currentElement, _globalConfig.hoverClass);
+ _removeClass(_currentElement, _globalConfig.activeClass);
+ _currentElement = null;
+ }
+ };
+ /**
+ * The underlying implementation of `ZeroClipboard.activeElement`.
+ * @private
+ */
+ var _activeElement = function() {
+ return _currentElement || null;
+ };
+ /**
+ * Check if a value is a valid HTML4 `ID` or `Name` token.
+ * @private
+ */
+ var _isValidHtml4Id = function(id) {
+ return typeof id === "string" && id && /^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(id);
+ };
+ /**
+ * Create or update an `event` object, based on the `eventType`.
+ * @private
+ */
+ var _createEvent = function(event) {
+ var eventType;
+ if (typeof event === "string" && event) {
+ eventType = event;
+ event = {};
+ } else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
+ eventType = event.type;
+ }
+ if (!eventType) {
+ return;
+ }
+ if (!event.target && /^(copy|aftercopy|_click)$/.test(eventType.toLowerCase())) {
+ event.target = _copyTarget;
+ }
+ _extend(event, {
+ type: eventType.toLowerCase(),
+ target: event.target || _currentElement || null,
+ relatedTarget: event.relatedTarget || null,
+ currentTarget: _flashState && _flashState.bridge || null,
+ timeStamp: event.timeStamp || _now() || null
+ });
+ var msg = _eventMessages[event.type];
+ if (event.type === "error" && event.name && msg) {
+ msg = msg[event.name];
+ }
+ if (msg) {
+ event.message = msg;
+ }
+ if (event.type === "ready") {
+ _extend(event, {
+ target: null,
+ version: _flashState.version
+ });
+ }
+ if (event.type === "error") {
+ if (/^flash-(disabled|outdated|unavailable|degraded|deactivated|overdue)$/.test(event.name)) {
+ _extend(event, {
+ target: null,
+ minimumVersion: _minimumFlashVersion
+ });
+ }
+ if (/^flash-(outdated|unavailable|degraded|deactivated|overdue)$/.test(event.name)) {
+ _extend(event, {
+ version: _flashState.version
+ });
+ }
+ }
+ if (event.type === "copy") {
+ event.clipboardData = {
+ setData: ZeroClipboard.setData,
+ clearData: ZeroClipboard.clearData
+ };
+ }
+ if (event.type === "aftercopy") {
+ event = _mapClipResultsFromFlash(event, _clipDataFormatMap);
+ }
+ if (event.target && !event.relatedTarget) {
+ event.relatedTarget = _getRelatedTarget(event.target);
+ }
+ event = _addMouseData(event);
+ return event;
+ };
+ /**
+ * Get a relatedTarget from the target's `data-clipboard-target` attribute
+ * @private
+ */
+ var _getRelatedTarget = function(targetEl) {
+ var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
+ return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
+ };
+ /**
+ * Add element and position data to `MouseEvent` instances
+ * @private
+ */
+ var _addMouseData = function(event) {
+ if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
+ var srcElement = event.target;
+ var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
+ var toElement = event.type === "_mouseout" && event.relatedTarget ? event.relatedTarget : undefined;
+ var pos = _getDOMObjectPosition(srcElement);
+ var screenLeft = _window.screenLeft || _window.screenX || 0;
+ var screenTop = _window.screenTop || _window.screenY || 0;
+ var scrollLeft = _document.body.scrollLeft + _document.documentElement.scrollLeft;
+ var scrollTop = _document.body.scrollTop + _document.documentElement.scrollTop;
+ var pageX = pos.left + (typeof event._stageX === "number" ? event._stageX : 0);
+ var pageY = pos.top + (typeof event._stageY === "number" ? event._stageY : 0);
+ var clientX = pageX - scrollLeft;
+ var clientY = pageY - scrollTop;
+ var screenX = screenLeft + clientX;
+ var screenY = screenTop + clientY;
+ var moveX = typeof event.movementX === "number" ? event.movementX : 0;
+ var moveY = typeof event.movementY === "number" ? event.movementY : 0;
+ delete event._stageX;
+ delete event._stageY;
+ _extend(event, {
+ srcElement: srcElement,
+ fromElement: fromElement,
+ toElement: toElement,
+ screenX: screenX,
+ screenY: screenY,
+ pageX: pageX,
+ pageY: pageY,
+ clientX: clientX,
+ clientY: clientY,
+ x: clientX,
+ y: clientY,
+ movementX: moveX,
+ movementY: moveY,
+ offsetX: 0,
+ offsetY: 0,
+ layerX: 0,
+ layerY: 0
+ });
+ }
+ return event;
+ };
+ /**
+ * Determine if an event's registered handlers should be execute synchronously or asynchronously.
+ *
+ * @returns {boolean}
+ * @private
+ */
+ var _shouldPerformAsync = function(event) {
+ var eventType = event && typeof event.type === "string" && event.type || "";
+ return !/^(?:(?:before)?copy|destroy)$/.test(eventType);
+ };
+ /**
+ * Control if a callback should be executed asynchronously or not.
+ *
+ * @returns `undefined`
+ * @private
+ */
+ var _dispatchCallback = function(func, context, args, async) {
+ if (async) {
+ _setTimeout(function() {
+ func.apply(context, args);
+ }, 0);
+ } else {
+ func.apply(context, args);
+ }
+ };
+ /**
+ * Handle the actual dispatching of events to client instances.
+ *
+ * @returns `undefined`
+ * @private
+ */
+ var _dispatchCallbacks = function(event) {
+ if (!(typeof event === "object" && event && event.type)) {
+ return;
+ }
+ var async = _shouldPerformAsync(event);
+ var wildcardTypeHandlers = _handlers["*"] || [];
+ var specificTypeHandlers = _handlers[event.type] || [];
+ var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
+ if (handlers && handlers.length) {
+ var i, len, func, context, eventCopy, originalContext = this;
+ for (i = 0, len = handlers.length; i < len; i++) {
+ func = handlers[i];
+ context = originalContext;
+ if (typeof func === "string" && typeof _window[func] === "function") {
+ func = _window[func];
+ }
+ if (typeof func === "object" && func && typeof func.handleEvent === "function") {
+ context = func;
+ func = func.handleEvent;
+ }
+ if (typeof func === "function") {
+ eventCopy = _extend({}, event);
+ _dispatchCallback(func, context, [ eventCopy ], async);
+ }
+ }
+ }
+ return this;
+ };
+ /**
+ * Preprocess any special behaviors, reactions, or state changes after receiving this event.
+ * Executes only once per event emitted, NOT once per client.
+ * @private
+ */
+ var _preprocessEvent = function(event) {
+ var element = event.target || _currentElement || null;
+ var sourceIsSwf = event._source === "swf";
+ delete event._source;
+ var flashErrorNames = [ "flash-disabled", "flash-outdated", "flash-unavailable", "flash-degraded", "flash-deactivated", "flash-overdue" ];
+ switch (event.type) {
+ case "error":
+ if (flashErrorNames.indexOf(event.name) !== -1) {
+ _extend(_flashState, {
+ disabled: event.name === "flash-disabled",
+ outdated: event.name === "flash-outdated",
+ unavailable: event.name === "flash-unavailable",
+ degraded: event.name === "flash-degraded",
+ deactivated: event.name === "flash-deactivated",
+ overdue: event.name === "flash-overdue",
+ ready: false
+ });
+ } else if (event.name === "version-mismatch") {
+ _zcSwfVersion = event.swfVersion;
+ _extend(_flashState, {
+ disabled: false,
+ outdated: false,
+ unavailable: false,
+ degraded: false,
+ deactivated: false,
+ overdue: false,
+ ready: false
+ });
+ }
+ _clearTimeout(_flashCheckTimeout);
+ _flashCheckTimeout = 0;
+ break;
+
+ case "ready":
+ _zcSwfVersion = event.swfVersion;
+ var wasDeactivated = _flashState.deactivated === true;
+ _extend(_flashState, {
+ disabled: false,
+ outdated: false,
+ unavailable: false,
+ degraded: false,
+ deactivated: false,
+ overdue: wasDeactivated,
+ ready: !wasDeactivated
+ });
+ _clearTimeout(_flashCheckTimeout);
+ _flashCheckTimeout = 0;
+ break;
+
+ case "beforecopy":
+ _copyTarget = element;
+ break;
+
+ case "copy":
+ var textContent, htmlContent, targetEl = event.relatedTarget;
+ if (!(_clipData["text/html"] || _clipData["text/plain"]) && targetEl && (htmlContent = targetEl.value || targetEl.outerHTML || targetEl.innerHTML) && (textContent = targetEl.value || targetEl.textContent || targetEl.innerText)) {
+ event.clipboardData.clearData();
+ event.clipboardData.setData("text/plain", textContent);
+ if (htmlContent !== textContent) {
+ event.clipboardData.setData("text/html", htmlContent);
+ }
+ } else if (!_clipData["text/plain"] && event.target && (textContent = event.target.getAttribute("data-clipboard-text"))) {
+ event.clipboardData.clearData();
+ event.clipboardData.setData("text/plain", textContent);
+ }
+ break;
+
+ case "aftercopy":
+ ZeroClipboard.clearData();
+ if (element && element !== _safeActiveElement() && element.focus) {
+ element.focus();
+ }
+ break;
+
+ case "_mouseover":
+ ZeroClipboard.focus(element);
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
+ _fireMouseEvent(_extend({}, event, {
+ type: "mouseenter",
+ bubbles: false,
+ cancelable: false
+ }));
+ }
+ _fireMouseEvent(_extend({}, event, {
+ type: "mouseover"
+ }));
+ }
+ break;
+
+ case "_mouseout":
+ ZeroClipboard.blur();
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
+ _fireMouseEvent(_extend({}, event, {
+ type: "mouseleave",
+ bubbles: false,
+ cancelable: false
+ }));
+ }
+ _fireMouseEvent(_extend({}, event, {
+ type: "mouseout"
+ }));
+ }
+ break;
+
+ case "_mousedown":
+ _addClass(element, _globalConfig.activeClass);
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ _fireMouseEvent(_extend({}, event, {
+ type: event.type.slice(1)
+ }));
+ }
+ break;
+
+ case "_mouseup":
+ _removeClass(element, _globalConfig.activeClass);
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ _fireMouseEvent(_extend({}, event, {
+ type: event.type.slice(1)
+ }));
+ }
+ break;
+
+ case "_click":
+ _copyTarget = null;
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ _fireMouseEvent(_extend({}, event, {
+ type: event.type.slice(1)
+ }));
+ }
+ break;
+
+ case "_mousemove":
+ if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
+ _fireMouseEvent(_extend({}, event, {
+ type: event.type.slice(1)
+ }));
+ }
+ break;
+ }
+ if (/^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
+ return true;
+ }
+ };
+ /**
+ * Dispatch a synthetic MouseEvent.
+ *
+ * @returns `undefined`
+ * @private
+ */
+ var _fireMouseEvent = function(event) {
+ if (!(event && typeof event.type === "string" && event)) {
+ return;
+ }
+ var e, target = event.target || null, doc = target && target.ownerDocument || _document, defaults = {
+ view: doc.defaultView || _window,
+ canBubble: true,
+ cancelable: true,
+ detail: event.type === "click" ? 1 : 0,
+ button: typeof event.which === "number" ? event.which - 1 : typeof event.button === "number" ? event.button : doc.createEvent ? 0 : 1
+ }, args = _extend(defaults, event);
+ if (!target) {
+ return;
+ }
+ if (doc.createEvent && target.dispatchEvent) {
+ args = [ args.type, args.canBubble, args.cancelable, args.view, args.detail, args.screenX, args.screenY, args.clientX, args.clientY, args.ctrlKey, args.altKey, args.shiftKey, args.metaKey, args.button, args.relatedTarget ];
+ e = doc.createEvent("MouseEvents");
+ if (e.initMouseEvent) {
+ e.initMouseEvent.apply(e, args);
+ e._source = "js";
+ target.dispatchEvent(e);
+ }
+ }
+ };
+ /**
+ * Create the HTML bridge element to embed the Flash object into.
+ * @private
+ */
+ var _createHtmlBridge = function() {
+ var container = _document.createElement("div");
+ container.id = _globalConfig.containerId;
+ container.className = _globalConfig.containerClass;
+ container.style.position = "absolute";
+ container.style.left = "0px";
+ container.style.top = "-9999px";
+ container.style.width = "1px";
+ container.style.height = "1px";
+ container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
+ return container;
+ };
+ /**
+ * Get the HTML element container that wraps the Flash bridge object/element.
+ * @private
+ */
+ var _getHtmlBridge = function(flashBridge) {
+ var htmlBridge = flashBridge && flashBridge.parentNode;
+ while (htmlBridge && htmlBridge.nodeName === "OBJECT" && htmlBridge.parentNode) {
+ htmlBridge = htmlBridge.parentNode;
+ }
+ return htmlBridge || null;
+ };
+ /**
+ * Create the SWF object.
+ *
+ * @returns The SWF object reference.
+ * @private
+ */
+ var _embedSwf = function() {
+ var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
+ if (!flashBridge) {
+ var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
+ var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
+ var flashvars = _vars(_extend({
+ jsVersion: ZeroClipboard.version
+ }, _globalConfig));
+ var swfUrl = _globalConfig.swfPath + _cacheBust(_globalConfig.swfPath, _globalConfig);
+ container = _createHtmlBridge();
+ var divToBeReplaced = _document.createElement("div");
+ container.appendChild(divToBeReplaced);
+ _document.body.appendChild(container);
+ var tmpDiv = _document.createElement("div");
+ var oldIE = _flashState.pluginType === "activex";
+ tmpDiv.innerHTML = '