clipboard-rails 1.5.10 → 1.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clipboard/rails/version.rb +1 -1
- data/vendor/assets/javascripts/clipboard.js +142 -82
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 646a03bc972a12e9b0fb6a03246af0e21110bd2d
|
4
|
+
data.tar.gz: e1149425bd891bcdf2990fc2bf7d6d05ee68a98d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531b45ab1167fd0134a961257cba3374a52d67d6cf0da2493988f86156641db30c6390928626b8fe4228b1d140ead8b2f4aa9963531c23bd77be91d96f1446a8
|
7
|
+
data.tar.gz: 004605312e2e345d080d71a4bed28d32b7206c3ea1e801bbd2dc0d7094f23772e5fbe218c8bbed76d14e5d474faccbd2e6019ecfd458ddc6e959320d9a444eb2
|
@@ -1,23 +1,124 @@
|
|
1
1
|
/*!
|
2
|
-
* clipboard.js v1.5.
|
2
|
+
* clipboard.js v1.5.13
|
3
3
|
* https://zenorocha.github.io/clipboard.js
|
4
4
|
*
|
5
5
|
* Licensed MIT © Zeno Rocha
|
6
6
|
*/
|
7
7
|
(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){
|
8
|
-
|
8
|
+
/**
|
9
|
+
* Module Dependencies
|
10
|
+
*/
|
11
|
+
|
12
|
+
try {
|
13
|
+
var matches = require('matches-selector')
|
14
|
+
} catch (err) {
|
15
|
+
var matches = require('component-matches-selector')
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Export `closest`
|
20
|
+
*/
|
21
|
+
|
22
|
+
module.exports = closest
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Closest
|
26
|
+
*
|
27
|
+
* @param {Element} el
|
28
|
+
* @param {String} selector
|
29
|
+
* @param {Element} scope (optional)
|
30
|
+
*/
|
31
|
+
|
32
|
+
function closest (el, selector, scope) {
|
33
|
+
scope = scope || document.documentElement;
|
34
|
+
|
35
|
+
// walk up the dom
|
36
|
+
while (el && el !== scope) {
|
37
|
+
if (matches(el, selector)) return el;
|
38
|
+
el = el.parentNode;
|
39
|
+
}
|
40
|
+
|
41
|
+
// check scope for match
|
42
|
+
return matches(el, selector) ? el : null;
|
43
|
+
}
|
44
|
+
|
45
|
+
},{"component-matches-selector":2,"matches-selector":2}],2:[function(require,module,exports){
|
46
|
+
/**
|
47
|
+
* Module dependencies.
|
48
|
+
*/
|
49
|
+
|
50
|
+
try {
|
51
|
+
var query = require('query');
|
52
|
+
} catch (err) {
|
53
|
+
var query = require('component-query');
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Element prototype.
|
58
|
+
*/
|
59
|
+
|
60
|
+
var proto = Element.prototype;
|
9
61
|
|
10
|
-
|
11
|
-
|
62
|
+
/**
|
63
|
+
* Vendor function.
|
64
|
+
*/
|
65
|
+
|
66
|
+
var vendor = proto.matches
|
67
|
+
|| proto.webkitMatchesSelector
|
68
|
+
|| proto.mozMatchesSelector
|
69
|
+
|| proto.msMatchesSelector
|
70
|
+
|| proto.oMatchesSelector;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Expose `match()`.
|
74
|
+
*/
|
75
|
+
|
76
|
+
module.exports = match;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Match `el` to `selector`.
|
80
|
+
*
|
81
|
+
* @param {Element} el
|
82
|
+
* @param {String} selector
|
83
|
+
* @return {Boolean}
|
84
|
+
* @api public
|
85
|
+
*/
|
12
86
|
|
13
|
-
|
14
|
-
|
15
|
-
|
87
|
+
function match(el, selector) {
|
88
|
+
if (!el || el.nodeType !== 1) return false;
|
89
|
+
if (vendor) return vendor.call(el, selector);
|
90
|
+
var nodes = query.all(selector, el.parentNode);
|
91
|
+
for (var i = 0; i < nodes.length; ++i) {
|
92
|
+
if (nodes[i] == el) return true;
|
16
93
|
}
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
|
97
|
+
},{"component-query":3,"query":3}],3:[function(require,module,exports){
|
98
|
+
function one(selector, el) {
|
99
|
+
return el.querySelector(selector);
|
17
100
|
}
|
18
101
|
|
19
|
-
|
20
|
-
|
102
|
+
exports = module.exports = function(selector, el){
|
103
|
+
el = el || document;
|
104
|
+
return one(selector, el);
|
105
|
+
};
|
106
|
+
|
107
|
+
exports.all = function(selector, el){
|
108
|
+
el = el || document;
|
109
|
+
return el.querySelectorAll(selector);
|
110
|
+
};
|
111
|
+
|
112
|
+
exports.engine = function(obj){
|
113
|
+
if (!obj.one) throw new Error('.one callback required');
|
114
|
+
if (!obj.all) throw new Error('.all callback required');
|
115
|
+
one = obj.one;
|
116
|
+
exports.all = obj.all;
|
117
|
+
return exports;
|
118
|
+
};
|
119
|
+
|
120
|
+
},{}],4:[function(require,module,exports){
|
121
|
+
var closest = require('component-closest');
|
21
122
|
|
22
123
|
/**
|
23
124
|
* Delegates event to a selector.
|
@@ -62,7 +163,7 @@ function listener(element, selector, type, callback) {
|
|
62
163
|
|
63
164
|
module.exports = delegate;
|
64
165
|
|
65
|
-
},{"closest":1}],
|
166
|
+
},{"component-closest":1}],5:[function(require,module,exports){
|
66
167
|
/**
|
67
168
|
* Check if argument is a HTML element.
|
68
169
|
*
|
@@ -113,7 +214,7 @@ exports.fn = function(value) {
|
|
113
214
|
return type === '[object Function]';
|
114
215
|
};
|
115
216
|
|
116
|
-
},{}],
|
217
|
+
},{}],6:[function(require,module,exports){
|
117
218
|
var is = require('./is');
|
118
219
|
var delegate = require('delegate');
|
119
220
|
|
@@ -210,52 +311,16 @@ function listenSelector(selector, type, callback) {
|
|
210
311
|
|
211
312
|
module.exports = listen;
|
212
313
|
|
213
|
-
},{"./is":
|
214
|
-
|
215
|
-
/**
|
216
|
-
* Element prototype.
|
217
|
-
*/
|
218
|
-
|
219
|
-
var proto = Element.prototype;
|
220
|
-
|
221
|
-
/**
|
222
|
-
* Vendor function.
|
223
|
-
*/
|
224
|
-
|
225
|
-
var vendor = proto.matchesSelector
|
226
|
-
|| proto.webkitMatchesSelector
|
227
|
-
|| proto.mozMatchesSelector
|
228
|
-
|| proto.msMatchesSelector
|
229
|
-
|| proto.oMatchesSelector;
|
230
|
-
|
231
|
-
/**
|
232
|
-
* Expose `match()`.
|
233
|
-
*/
|
234
|
-
|
235
|
-
module.exports = match;
|
236
|
-
|
237
|
-
/**
|
238
|
-
* Match `el` to `selector`.
|
239
|
-
*
|
240
|
-
* @param {Element} el
|
241
|
-
* @param {String} selector
|
242
|
-
* @return {Boolean}
|
243
|
-
* @api public
|
244
|
-
*/
|
245
|
-
|
246
|
-
function match(el, selector) {
|
247
|
-
if (vendor) return vendor.call(el, selector);
|
248
|
-
var nodes = el.parentNode.querySelectorAll(selector);
|
249
|
-
for (var i = 0; i < nodes.length; ++i) {
|
250
|
-
if (nodes[i] == el) return true;
|
251
|
-
}
|
252
|
-
return false;
|
253
|
-
}
|
254
|
-
},{}],6:[function(require,module,exports){
|
314
|
+
},{"./is":5,"delegate":4}],7:[function(require,module,exports){
|
255
315
|
function select(element) {
|
256
316
|
var selectedText;
|
257
317
|
|
258
|
-
if (element.nodeName === '
|
318
|
+
if (element.nodeName === 'SELECT') {
|
319
|
+
element.focus();
|
320
|
+
|
321
|
+
selectedText = element.value;
|
322
|
+
}
|
323
|
+
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
259
324
|
element.focus();
|
260
325
|
element.setSelectionRange(0, element.value.length);
|
261
326
|
|
@@ -281,14 +346,14 @@ function select(element) {
|
|
281
346
|
|
282
347
|
module.exports = select;
|
283
348
|
|
284
|
-
},{}],
|
349
|
+
},{}],8:[function(require,module,exports){
|
285
350
|
function E () {
|
286
|
-
|
351
|
+
// Keep this empty so it's easier to inherit from
|
287
352
|
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
288
353
|
}
|
289
354
|
|
290
355
|
E.prototype = {
|
291
|
-
|
356
|
+
on: function (name, callback, ctx) {
|
292
357
|
var e = this.e || (this.e = {});
|
293
358
|
|
294
359
|
(e[name] || (e[name] = [])).push({
|
@@ -349,7 +414,7 @@ E.prototype = {
|
|
349
414
|
|
350
415
|
module.exports = E;
|
351
416
|
|
352
|
-
},{}],
|
417
|
+
},{}],9:[function(require,module,exports){
|
353
418
|
(function (global, factory) {
|
354
419
|
if (typeof define === "function" && define.amd) {
|
355
420
|
define(['module', 'select'], factory);
|
@@ -407,7 +472,6 @@ module.exports = E;
|
|
407
472
|
/**
|
408
473
|
* @param {Object} options
|
409
474
|
*/
|
410
|
-
|
411
475
|
function ClipboardAction(options) {
|
412
476
|
_classCallCheck(this, ClipboardAction);
|
413
477
|
|
@@ -448,9 +512,10 @@ module.exports = E;
|
|
448
512
|
|
449
513
|
this.removeFake();
|
450
514
|
|
451
|
-
this.
|
515
|
+
this.fakeHandlerCallback = function () {
|
452
516
|
return _this.removeFake();
|
453
|
-
}
|
517
|
+
};
|
518
|
+
this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
|
454
519
|
|
455
520
|
this.fakeElem = document.createElement('textarea');
|
456
521
|
// Prevent zooming on iOS
|
@@ -460,10 +525,13 @@ module.exports = E;
|
|
460
525
|
this.fakeElem.style.padding = '0';
|
461
526
|
this.fakeElem.style.margin = '0';
|
462
527
|
// Move element out of screen horizontally
|
463
|
-
this.fakeElem.style.position = '
|
528
|
+
this.fakeElem.style.position = 'absolute';
|
464
529
|
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
465
530
|
// Move element to the same position vertically
|
466
|
-
|
531
|
+
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
532
|
+
this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
|
533
|
+
this.fakeElem.style.top = yPosition + 'px';
|
534
|
+
|
467
535
|
this.fakeElem.setAttribute('readonly', '');
|
468
536
|
this.fakeElem.value = this.text;
|
469
537
|
|
@@ -475,8 +543,9 @@ module.exports = E;
|
|
475
543
|
|
476
544
|
ClipboardAction.prototype.removeFake = function removeFake() {
|
477
545
|
if (this.fakeHandler) {
|
478
|
-
document.body.removeEventListener('click');
|
546
|
+
document.body.removeEventListener('click', this.fakeHandlerCallback);
|
479
547
|
this.fakeHandler = null;
|
548
|
+
this.fakeHandlerCallback = null;
|
480
549
|
}
|
481
550
|
|
482
551
|
if (this.fakeElem) {
|
@@ -491,7 +560,7 @@ module.exports = E;
|
|
491
560
|
};
|
492
561
|
|
493
562
|
ClipboardAction.prototype.copyText = function copyText() {
|
494
|
-
var succeeded =
|
563
|
+
var succeeded = void 0;
|
495
564
|
|
496
565
|
try {
|
497
566
|
succeeded = document.execCommand(this.action);
|
@@ -503,20 +572,12 @@ module.exports = E;
|
|
503
572
|
};
|
504
573
|
|
505
574
|
ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
|
506
|
-
|
507
|
-
this.
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
});
|
513
|
-
} else {
|
514
|
-
this.emitter.emit('error', {
|
515
|
-
action: this.action,
|
516
|
-
trigger: this.trigger,
|
517
|
-
clearSelection: this.clearSelection.bind(this)
|
518
|
-
});
|
519
|
-
}
|
575
|
+
this.emitter.emit(succeeded ? 'success' : 'error', {
|
576
|
+
action: this.action,
|
577
|
+
text: this.selectedText,
|
578
|
+
trigger: this.trigger,
|
579
|
+
clearSelection: this.clearSelection.bind(this)
|
580
|
+
});
|
520
581
|
};
|
521
582
|
|
522
583
|
ClipboardAction.prototype.clearSelection = function clearSelection() {
|
@@ -575,7 +636,7 @@ module.exports = E;
|
|
575
636
|
module.exports = ClipboardAction;
|
576
637
|
});
|
577
638
|
|
578
|
-
},{"select":
|
639
|
+
},{"select":7}],10:[function(require,module,exports){
|
579
640
|
(function (global, factory) {
|
580
641
|
if (typeof define === "function" && define.amd) {
|
581
642
|
define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
|
@@ -640,7 +701,6 @@ module.exports = E;
|
|
640
701
|
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
641
702
|
* @param {Object} options
|
642
703
|
*/
|
643
|
-
|
644
704
|
function Clipboard(trigger, options) {
|
645
705
|
_classCallCheck(this, Clipboard);
|
646
706
|
|
@@ -736,5 +796,5 @@ module.exports = E;
|
|
736
796
|
module.exports = Clipboard;
|
737
797
|
});
|
738
798
|
|
739
|
-
},{"./clipboard-action":
|
799
|
+
},{"./clipboard-action":9,"good-listener":6,"tiny-emitter":8}]},{},[10])(10)
|
740
800
|
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipboard-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohammed Sadiq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|