Release v1.5.13

This commit is contained in:
Zeno Rocha 2016-10-16 22:44:03 -07:00
parent fce625f151
commit 26a9e9d56c
No known key found for this signature in database
GPG Key ID: 7BEB4BBA4108C63F
5 changed files with 145 additions and 87 deletions

View File

@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "1.5.12",
"version": "1.5.13",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"license": "MIT",
"main": "dist/clipboard.js",

222
dist/clipboard.js vendored
View File

@ -1,23 +1,124 @@
/*!
* clipboard.js v1.5.12
* clipboard.js v1.5.13
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var matches = require('matches-selector')
module.exports = function (element, selector, checkYoSelf) {
var parent = checkYoSelf ? element : element.parentNode
while (parent && parent !== document) {
if (matches(parent, selector)) return parent;
parent = parent.parentNode
}
}
/**
* Module Dependencies
*/
},{"matches-selector":5}],2:[function(require,module,exports){
var closest = require('closest');
try {
var matches = require('matches-selector')
} catch (err) {
var matches = require('component-matches-selector')
}
/**
* Export `closest`
*/
module.exports = closest
/**
* Closest
*
* @param {Element} el
* @param {String} selector
* @param {Element} scope (optional)
*/
function closest (el, selector, scope) {
scope = scope || document.documentElement;
// walk up the dom
while (el && el !== scope) {
if (matches(el, selector)) return el;
el = el.parentNode;
}
// check scope for match
return matches(el, selector) ? el : null;
}
},{"component-matches-selector":2,"matches-selector":2}],2:[function(require,module,exports){
/**
* Module dependencies.
*/
try {
var query = require('query');
} catch (err) {
var query = require('component-query');
}
/**
* Element prototype.
*/
var proto = Element.prototype;
/**
* Vendor function.
*/
var vendor = proto.matches
|| proto.webkitMatchesSelector
|| proto.mozMatchesSelector
|| proto.msMatchesSelector
|| proto.oMatchesSelector;
/**
* Expose `match()`.
*/
module.exports = match;
/**
* Match `el` to `selector`.
*
* @param {Element} el
* @param {String} selector
* @return {Boolean}
* @api public
*/
function match(el, selector) {
if (!el || el.nodeType !== 1) return false;
if (vendor) return vendor.call(el, selector);
var nodes = query.all(selector, el.parentNode);
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i] == el) return true;
}
return false;
}
},{"component-query":3,"query":3}],3:[function(require,module,exports){
function one(selector, el) {
return el.querySelector(selector);
}
exports = module.exports = function(selector, el){
el = el || document;
return one(selector, el);
};
exports.all = function(selector, el){
el = el || document;
return el.querySelectorAll(selector);
};
exports.engine = function(obj){
if (!obj.one) throw new Error('.one callback required');
if (!obj.all) throw new Error('.all callback required');
one = obj.one;
exports.all = obj.all;
return exports;
};
},{}],4:[function(require,module,exports){
var closest = require('component-closest');
/**
* Delegates event to a selector.
@ -62,7 +163,7 @@ function listener(element, selector, type, callback) {
module.exports = delegate;
},{"closest":1}],3:[function(require,module,exports){
},{"component-closest":1}],5:[function(require,module,exports){
/**
* Check if argument is a HTML element.
*
@ -113,7 +214,7 @@ exports.fn = function(value) {
return type === '[object Function]';
};
},{}],4:[function(require,module,exports){
},{}],6:[function(require,module,exports){
var is = require('./is');
var delegate = require('delegate');
@ -210,52 +311,16 @@ function listenSelector(selector, type, callback) {
module.exports = listen;
},{"./is":3,"delegate":2}],5:[function(require,module,exports){
/**
* Element prototype.
*/
var proto = Element.prototype;
/**
* Vendor function.
*/
var vendor = proto.matchesSelector
|| proto.webkitMatchesSelector
|| proto.mozMatchesSelector
|| proto.msMatchesSelector
|| proto.oMatchesSelector;
/**
* Expose `match()`.
*/
module.exports = match;
/**
* Match `el` to `selector`.
*
* @param {Element} el
* @param {String} selector
* @return {Boolean}
* @api public
*/
function match(el, selector) {
if (vendor) return vendor.call(el, selector);
var nodes = el.parentNode.querySelectorAll(selector);
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i] == el) return true;
}
return false;
}
},{}],6:[function(require,module,exports){
},{"./is":5,"delegate":4}],7:[function(require,module,exports){
function select(element) {
var selectedText;
if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
if (element.nodeName === 'SELECT') {
element.focus();
selectedText = element.value;
}
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
element.focus();
element.setSelectionRange(0, element.value.length);
@ -281,14 +346,14 @@ function select(element) {
module.exports = select;
},{}],7:[function(require,module,exports){
},{}],8:[function(require,module,exports){
function E () {
// Keep this empty so it's easier to inherit from
// Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
}
E.prototype = {
on: function (name, callback, ctx) {
on: function (name, callback, ctx) {
var e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({
@ -349,7 +414,7 @@ E.prototype = {
module.exports = E;
},{}],8:[function(require,module,exports){
},{}],9:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['module', 'select'], factory);
@ -407,7 +472,6 @@ module.exports = E;
/**
* @param {Object} options
*/
function ClipboardAction(options) {
_classCallCheck(this, ClipboardAction);
@ -464,7 +528,10 @@ module.exports = E;
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
// Move element to the same position vertically
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
this.fakeElem.style.top = yPosition + 'px';
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;
@ -493,7 +560,7 @@ module.exports = E;
};
ClipboardAction.prototype.copyText = function copyText() {
var succeeded = undefined;
var succeeded = void 0;
try {
succeeded = document.execCommand(this.action);
@ -505,20 +572,12 @@ module.exports = E;
};
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
if (succeeded) {
this.emitter.emit('success', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
} else {
this.emitter.emit('error', {
action: this.action,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
}
this.emitter.emit(succeeded ? 'success' : 'error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
};
ClipboardAction.prototype.clearSelection = function clearSelection() {
@ -577,7 +636,7 @@ module.exports = E;
module.exports = ClipboardAction;
});
},{"select":6}],9:[function(require,module,exports){
},{"select":7}],10:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
@ -642,7 +701,6 @@ module.exports = E;
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
* @param {Object} options
*/
function Clipboard(trigger, options) {
_classCallCheck(this, Clipboard);
@ -738,5 +796,5 @@ module.exports = E;
module.exports = Clipboard;
});
},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
},{"./clipboard-action":9,"good-listener":6,"tiny-emitter":8}]},{},[10])(10)
});

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
Package.describe({
name: "zenorocha:clipboard",
summary: "Modern copy to clipboard. No Flash. Just 2kb.",
version: "1.5.12",
version: "1.5.13",
git: "https://github.com/zenorocha/clipboard.js"
});

View File

@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "1.5.12",
"version": "1.5.13",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"repository": "zenorocha/clipboard.js",
"license": "MIT",