mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Merge pull request #16 from mauriciosoares/feature/umd-support
Adds UMD support
This commit is contained in:
commit
ffb2b3fcd9
173
dist/clipboard.js
vendored
173
dist/clipboard.js
vendored
@ -1,52 +1,4 @@
|
||||
(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
|
||||
}
|
||||
}
|
||||
|
||||
},{"matches-selector":4}],2:[function(require,module,exports){
|
||||
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
|
||||
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
|
||||
prefix = bind !== 'addEventListener' ? 'on' : '';
|
||||
|
||||
/**
|
||||
* Bind `el` event `type` to `fn`.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {String} type
|
||||
* @param {Function} fn
|
||||
* @param {Boolean} capture
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.bind = function(el, type, fn, capture){
|
||||
el[bind](prefix + type, fn, capture || false);
|
||||
return fn;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind `el` event `type`'s callback `fn`.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {String} type
|
||||
* @param {Function} fn
|
||||
* @param {Boolean} capture
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.unbind = function(el, type, fn, capture){
|
||||
el[unbind](prefix + type, fn, capture || false);
|
||||
return fn;
|
||||
};
|
||||
},{}],3:[function(require,module,exports){
|
||||
(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){
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
@ -98,47 +50,95 @@ exports.unbind = function(el, type, fn, capture){
|
||||
event.unbind(el, type, fn, capture);
|
||||
};
|
||||
|
||||
},{"closest":1,"component-event":2}],4:[function(require,module,exports){
|
||||
},{"closest":2,"component-event":4}],2:[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
|
||||
}
|
||||
}
|
||||
|
||||
},{"matches-selector":3}],3:[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;
|
||||
}
|
||||
},{}],4:[function(require,module,exports){
|
||||
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
|
||||
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
|
||||
prefix = bind !== 'addEventListener' ? 'on' : '';
|
||||
|
||||
/**
|
||||
* 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`.
|
||||
* Bind `el` event `type` to `fn`.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {String} selector
|
||||
* @return {Boolean}
|
||||
* @param {String} type
|
||||
* @param {Function} fn
|
||||
* @param {Boolean} capture
|
||||
* @return {Function}
|
||||
* @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;
|
||||
}
|
||||
exports.bind = function(el, type, fn, capture){
|
||||
el[bind](prefix + type, fn, capture || false);
|
||||
return fn;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind `el` event `type`'s callback `fn`.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @param {String} type
|
||||
* @param {Function} fn
|
||||
* @param {Boolean} capture
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.unbind = function(el, type, fn, capture){
|
||||
el[unbind](prefix + type, fn, capture || false);
|
||||
return fn;
|
||||
};
|
||||
},{}],5:[function(require,module,exports){
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
@ -415,7 +415,6 @@ exports['default'] = ClipboardAction;
|
||||
module.exports = exports['default'];
|
||||
|
||||
},{}],7:[function(require,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
@ -536,9 +535,7 @@ var Clipboard = (function (_Emitter) {
|
||||
})(_tinyEmitter2['default']);
|
||||
|
||||
exports['default'] = Clipboard;
|
||||
|
||||
global.Clipboard = Clipboard;
|
||||
module.exports = exports['default'];
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./clipboard-action":6,"delegate-events":3,"tiny-emitter":5}]},{},[7]);
|
||||
},{"./clipboard-action":6,"delegate-events":1,"tiny-emitter":5}]},{},[7])(7)
|
||||
});
|
2
dist/clipboard.min.js
vendored
2
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -28,7 +28,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"publish": "npm run build && npm run minify",
|
||||
"build": "browserify src/clipboard.js -t [babelify --loose all] -o dist/clipboard.js",
|
||||
"build": "browserify src/clipboard.js -s Clipboard -t [babelify --loose all] -o dist/clipboard.js",
|
||||
"minify": "uglify -s dist/clipboard.js -o dist/clipboard.min.js",
|
||||
"test": "karma start --single-run"
|
||||
}
|
||||
|
@ -83,5 +83,3 @@ class Clipboard extends Emitter {
|
||||
}
|
||||
|
||||
export default Clipboard;
|
||||
|
||||
global.Clipboard = Clipboard;
|
||||
|
Loading…
Reference in New Issue
Block a user