clipboard-rails 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b09898597a3af406c28b645857666d716714f35
4
- data.tar.gz: a455e1a4b57bee0aefe0000506f457a949b8ee6f
3
+ metadata.gz: 077ff103bd6ab5e0fe17a5be37211ed983793776
4
+ data.tar.gz: 3309368552404247f57e5380305a306c4c23612d
5
5
  SHA512:
6
- metadata.gz: e368375edd215bbab622fbfc125f9952e784498e811e5df9d221c595c516b344d29e6cae005f5caba18b39c711eced7988c81250f1f0644c6f5ca23ede41b59f
7
- data.tar.gz: 24848693902f3fa108ff60500cd38f37635b04b4b0e053d208506666249cb3a65980cb2707479e580e243357c57a72fb8d9506148eb08776e2eef23ceb1fa376
6
+ metadata.gz: 8689af10933aac18159d1bd592207996d2e7c1f92386277405d77a40a770c344b962e88c5eebf36f0b443eeb73e7d1bc47d5ff8101bda8c8a2b4d13432be39a5
7
+ data.tar.gz: 5871a35c815fe5c7a69ab8fe881d33097b2ea7b114f75313969cc7968ecbdb823526c6ccd3ec20376f606ba721dd91e3a1f901b0c6dd17902ed8e8ecfe6b6d78
@@ -1,5 +1,5 @@
1
1
  module Clipboard
2
2
  module Rails
3
- VERSION = "1.5.8"
3
+ VERSION = "1.5.9"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * clipboard.js v1.5.8
2
+ * clipboard.js v1.5.9
3
3
  * https://zenorocha.github.io/clipboard.js
4
4
  *
5
5
  * Licensed MIT © Zeno Rocha
@@ -350,406 +350,387 @@ E.prototype = {
350
350
  module.exports = E;
351
351
 
352
352
  },{}],8:[function(require,module,exports){
353
- 'use strict';
354
-
355
- exports.__esModule = true;
356
-
357
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
358
-
359
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
360
-
361
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
362
-
363
- var _select = require('select');
364
-
365
- var _select2 = _interopRequireDefault(_select);
366
-
367
- /**
368
- * Inner class which performs selection from either `text` or `target`
369
- * properties and then executes copy or cut operations.
370
- */
371
-
372
- var ClipboardAction = (function () {
373
- /**
374
- * @param {Object} options
375
- */
376
-
377
- function ClipboardAction(options) {
378
- _classCallCheck(this, ClipboardAction);
379
-
380
- this.resolveOptions(options);
381
- this.initSelection();
353
+ (function (global, factory) {
354
+ if (typeof define === "function" && define.amd) {
355
+ define(['module', 'select'], factory);
356
+ } else if (typeof exports !== "undefined") {
357
+ factory(module, require('select'));
358
+ } else {
359
+ var mod = {
360
+ exports: {}
361
+ };
362
+ factory(mod, global.select);
363
+ global.clipboardAction = mod.exports;
382
364
  }
365
+ })(this, function (module, _select) {
366
+ 'use strict';
383
367
 
384
- /**
385
- * Defines base properties passed from constructor.
386
- * @param {Object} options
387
- */
368
+ var _select2 = _interopRequireDefault(_select);
388
369
 
389
- ClipboardAction.prototype.resolveOptions = function resolveOptions() {
390
- var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
391
-
392
- this.action = options.action;
393
- this.emitter = options.emitter;
394
- this.target = options.target;
395
- this.text = options.text;
396
- this.trigger = options.trigger;
370
+ function _interopRequireDefault(obj) {
371
+ return obj && obj.__esModule ? obj : {
372
+ default: obj
373
+ };
374
+ }
397
375
 
398
- this.selectedText = '';
376
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
377
+ return typeof obj;
378
+ } : function (obj) {
379
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
399
380
  };
400
381
 
401
- /**
402
- * Decides which selection strategy is going to be applied based
403
- * on the existence of `text` and `target` properties.
404
- */
382
+ function _classCallCheck(instance, Constructor) {
383
+ if (!(instance instanceof Constructor)) {
384
+ throw new TypeError("Cannot call a class as a function");
385
+ }
386
+ }
405
387
 
406
- ClipboardAction.prototype.initSelection = function initSelection() {
407
- if (this.text && this.target) {
408
- throw new Error('Multiple attributes declared, use either "target" or "text"');
409
- } else if (this.text) {
410
- this.selectFake();
411
- } else if (this.target) {
412
- this.selectTarget();
413
- } else {
414
- throw new Error('Missing required attributes, use either "target" or "text"');
388
+ var _createClass = function () {
389
+ function defineProperties(target, props) {
390
+ for (var i = 0; i < props.length; i++) {
391
+ var descriptor = props[i];
392
+ descriptor.enumerable = descriptor.enumerable || false;
393
+ descriptor.configurable = true;
394
+ if ("value" in descriptor) descriptor.writable = true;
395
+ Object.defineProperty(target, descriptor.key, descriptor);
396
+ }
415
397
  }
416
- };
417
398
 
418
- /**
419
- * Creates a fake textarea element, sets its value from `text` property,
420
- * and makes a selection on it.
421
- */
399
+ return function (Constructor, protoProps, staticProps) {
400
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
401
+ if (staticProps) defineProperties(Constructor, staticProps);
402
+ return Constructor;
403
+ };
404
+ }();
422
405
 
423
- ClipboardAction.prototype.selectFake = function selectFake() {
424
- var _this = this;
406
+ var ClipboardAction = function () {
407
+ /**
408
+ * @param {Object} options
409
+ */
425
410
 
426
- var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
411
+ function ClipboardAction(options) {
412
+ _classCallCheck(this, ClipboardAction);
427
413
 
428
- this.removeFake();
414
+ this.resolveOptions(options);
415
+ this.initSelection();
416
+ }
429
417
 
430
- this.fakeHandler = document.body.addEventListener('click', function () {
431
- return _this.removeFake();
432
- });
418
+ /**
419
+ * Defines base properties passed from constructor.
420
+ * @param {Object} options
421
+ */
433
422
 
434
- this.fakeElem = document.createElement('textarea');
435
- // Prevent zooming on iOS
436
- this.fakeElem.style.fontSize = '12pt';
437
- // Reset box model
438
- this.fakeElem.style.border = '0';
439
- this.fakeElem.style.padding = '0';
440
- this.fakeElem.style.margin = '0';
441
- // Move element out of screen horizontally
442
- this.fakeElem.style.position = 'absolute';
443
- this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
444
- // Move element to the same position vertically
445
- this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
446
- this.fakeElem.setAttribute('readonly', '');
447
- this.fakeElem.value = this.text;
448
-
449
- document.body.appendChild(this.fakeElem);
450
-
451
- this.selectedText = _select2['default'](this.fakeElem);
452
- this.copyText();
453
- };
454
423
 
455
- /**
456
- * Only removes the fake element after another click event, that way
457
- * a user can hit `Ctrl+C` to copy because selection still exists.
458
- */
424
+ ClipboardAction.prototype.resolveOptions = function resolveOptions() {
425
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
459
426
 
460
- ClipboardAction.prototype.removeFake = function removeFake() {
461
- if (this.fakeHandler) {
462
- document.body.removeEventListener('click');
463
- this.fakeHandler = null;
464
- }
427
+ this.action = options.action;
428
+ this.emitter = options.emitter;
429
+ this.target = options.target;
430
+ this.text = options.text;
431
+ this.trigger = options.trigger;
465
432
 
466
- if (this.fakeElem) {
467
- document.body.removeChild(this.fakeElem);
468
- this.fakeElem = null;
469
- }
470
- };
433
+ this.selectedText = '';
434
+ };
471
435
 
472
- /**
473
- * Selects the content from element passed on `target` property.
474
- */
436
+ ClipboardAction.prototype.initSelection = function initSelection() {
437
+ if (this.text && this.target) {
438
+ throw new Error('Multiple attributes declared, use either "target" or "text"');
439
+ } else if (this.text) {
440
+ this.selectFake();
441
+ } else if (this.target) {
442
+ this.selectTarget();
443
+ } else {
444
+ throw new Error('Missing required attributes, use either "target" or "text"');
445
+ }
446
+ };
475
447
 
476
- ClipboardAction.prototype.selectTarget = function selectTarget() {
477
- this.selectedText = _select2['default'](this.target);
478
- this.copyText();
479
- };
448
+ ClipboardAction.prototype.selectFake = function selectFake() {
449
+ var _this = this;
480
450
 
481
- /**
482
- * Executes the copy operation based on the current selection.
483
- */
451
+ var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
484
452
 
485
- ClipboardAction.prototype.copyText = function copyText() {
486
- var succeeded = undefined;
453
+ this.removeFake();
487
454
 
488
- try {
489
- succeeded = document.execCommand(this.action);
490
- } catch (err) {
491
- succeeded = false;
492
- }
455
+ this.fakeHandler = document.body.addEventListener('click', function () {
456
+ return _this.removeFake();
457
+ });
493
458
 
494
- this.handleResult(succeeded);
495
- };
459
+ this.fakeElem = document.createElement('textarea');
460
+ // Prevent zooming on iOS
461
+ this.fakeElem.style.fontSize = '12pt';
462
+ // Reset box model
463
+ this.fakeElem.style.border = '0';
464
+ this.fakeElem.style.padding = '0';
465
+ this.fakeElem.style.margin = '0';
466
+ // Move element out of screen horizontally
467
+ this.fakeElem.style.position = 'fixed';
468
+ this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
469
+ // Move element to the same position vertically
470
+ this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
471
+ this.fakeElem.setAttribute('readonly', '');
472
+ this.fakeElem.value = this.text;
473
+
474
+ document.body.appendChild(this.fakeElem);
475
+
476
+ this.selectedText = (0, _select2.default)(this.fakeElem);
477
+ this.copyText();
478
+ };
479
+
480
+ ClipboardAction.prototype.removeFake = function removeFake() {
481
+ if (this.fakeHandler) {
482
+ document.body.removeEventListener('click');
483
+ this.fakeHandler = null;
484
+ }
496
485
 
497
- /**
498
- * Fires an event based on the copy operation result.
499
- * @param {Boolean} succeeded
500
- */
486
+ if (this.fakeElem) {
487
+ document.body.removeChild(this.fakeElem);
488
+ this.fakeElem = null;
489
+ }
490
+ };
501
491
 
502
- ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
503
- if (succeeded) {
504
- this.emitter.emit('success', {
505
- action: this.action,
506
- text: this.selectedText,
507
- trigger: this.trigger,
508
- clearSelection: this.clearSelection.bind(this)
509
- });
510
- } else {
511
- this.emitter.emit('error', {
512
- action: this.action,
513
- trigger: this.trigger,
514
- clearSelection: this.clearSelection.bind(this)
515
- });
516
- }
517
- };
492
+ ClipboardAction.prototype.selectTarget = function selectTarget() {
493
+ this.selectedText = (0, _select2.default)(this.target);
494
+ this.copyText();
495
+ };
518
496
 
519
- /**
520
- * Removes current selection and focus from `target` element.
521
- */
497
+ ClipboardAction.prototype.copyText = function copyText() {
498
+ var succeeded = undefined;
522
499
 
523
- ClipboardAction.prototype.clearSelection = function clearSelection() {
524
- if (this.target) {
525
- this.target.blur();
526
- }
500
+ try {
501
+ succeeded = document.execCommand(this.action);
502
+ } catch (err) {
503
+ succeeded = false;
504
+ }
527
505
 
528
- window.getSelection().removeAllRanges();
529
- };
506
+ this.handleResult(succeeded);
507
+ };
508
+
509
+ ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
510
+ if (succeeded) {
511
+ this.emitter.emit('success', {
512
+ action: this.action,
513
+ text: this.selectedText,
514
+ trigger: this.trigger,
515
+ clearSelection: this.clearSelection.bind(this)
516
+ });
517
+ } else {
518
+ this.emitter.emit('error', {
519
+ action: this.action,
520
+ trigger: this.trigger,
521
+ clearSelection: this.clearSelection.bind(this)
522
+ });
523
+ }
524
+ };
530
525
 
531
- /**
532
- * Sets the `action` to be performed which can be either 'copy' or 'cut'.
533
- * @param {String} action
534
- */
526
+ ClipboardAction.prototype.clearSelection = function clearSelection() {
527
+ if (this.target) {
528
+ this.target.blur();
529
+ }
535
530
 
536
- /**
537
- * Destroy lifecycle.
538
- */
531
+ window.getSelection().removeAllRanges();
532
+ };
539
533
 
540
- ClipboardAction.prototype.destroy = function destroy() {
541
- this.removeFake();
542
- };
534
+ ClipboardAction.prototype.destroy = function destroy() {
535
+ this.removeFake();
536
+ };
543
537
 
544
- _createClass(ClipboardAction, [{
545
- key: 'action',
546
- set: function set() {
547
- var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
538
+ _createClass(ClipboardAction, [{
539
+ key: 'action',
540
+ set: function set() {
541
+ var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0];
548
542
 
549
- this._action = action;
543
+ this._action = action;
550
544
 
551
- if (this._action !== 'copy' && this._action !== 'cut') {
552
- throw new Error('Invalid "action" value, use either "copy" or "cut"');
545
+ if (this._action !== 'copy' && this._action !== 'cut') {
546
+ throw new Error('Invalid "action" value, use either "copy" or "cut"');
547
+ }
548
+ },
549
+ get: function get() {
550
+ return this._action;
553
551
  }
554
- },
555
-
556
- /**
557
- * Gets the `action` property.
558
- * @return {String}
559
- */
560
- get: function get() {
561
- return this._action;
562
- }
563
-
564
- /**
565
- * Sets the `target` property using an element
566
- * that will be have its content copied.
567
- * @param {Element} target
568
- */
569
- }, {
570
- key: 'target',
571
- set: function set(target) {
572
- if (target !== undefined) {
573
- if (target && typeof target === 'object' && target.nodeType === 1) {
574
- this._target = target;
575
- } else {
576
- throw new Error('Invalid "target" value, use a valid Element');
552
+ }, {
553
+ key: 'target',
554
+ set: function set(target) {
555
+ if (target !== undefined) {
556
+ if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
557
+ this._target = target;
558
+ } else {
559
+ throw new Error('Invalid "target" value, use a valid Element');
560
+ }
577
561
  }
562
+ },
563
+ get: function get() {
564
+ return this._target;
578
565
  }
579
- },
566
+ }]);
580
567
 
581
- /**
582
- * Gets the `target` property.
583
- * @return {String|HTMLElement}
584
- */
585
- get: function get() {
586
- return this._target;
587
- }
588
- }]);
589
-
590
- return ClipboardAction;
591
- })();
568
+ return ClipboardAction;
569
+ }();
592
570
 
593
- exports['default'] = ClipboardAction;
594
- module.exports = exports['default'];
571
+ module.exports = ClipboardAction;
572
+ });
595
573
 
596
574
  },{"select":6}],9:[function(require,module,exports){
597
- 'use strict';
598
-
599
- exports.__esModule = true;
600
-
601
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
602
-
603
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
604
-
605
- function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
575
+ (function (global, factory) {
576
+ if (typeof define === "function" && define.amd) {
577
+ define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
578
+ } else if (typeof exports !== "undefined") {
579
+ factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
580
+ } else {
581
+ var mod = {
582
+ exports: {}
583
+ };
584
+ factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
585
+ global.clipboard = mod.exports;
586
+ }
587
+ })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
588
+ 'use strict';
606
589
 
607
- var _clipboardAction = require('./clipboard-action');
590
+ var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
608
591
 
609
- var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
592
+ var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
610
593
 
611
- var _tinyEmitter = require('tiny-emitter');
594
+ var _goodListener2 = _interopRequireDefault(_goodListener);
612
595
 
613
- var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
596
+ function _interopRequireDefault(obj) {
597
+ return obj && obj.__esModule ? obj : {
598
+ default: obj
599
+ };
600
+ }
614
601
 
615
- var _goodListener = require('good-listener');
602
+ function _classCallCheck(instance, Constructor) {
603
+ if (!(instance instanceof Constructor)) {
604
+ throw new TypeError("Cannot call a class as a function");
605
+ }
606
+ }
616
607
 
617
- var _goodListener2 = _interopRequireDefault(_goodListener);
608
+ function _possibleConstructorReturn(self, call) {
609
+ if (!self) {
610
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
611
+ }
618
612
 
619
- /**
620
- * Base class which takes one or more elements, adds event listeners to them,
621
- * and instantiates a new `ClipboardAction` on each click.
622
- */
613
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
614
+ }
623
615
 
624
- var Clipboard = (function (_Emitter) {
625
- _inherits(Clipboard, _Emitter);
616
+ function _inherits(subClass, superClass) {
617
+ if (typeof superClass !== "function" && superClass !== null) {
618
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
619
+ }
626
620
 
627
- /**
628
- * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
629
- * @param {Object} options
630
- */
621
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
622
+ constructor: {
623
+ value: subClass,
624
+ enumerable: false,
625
+ writable: true,
626
+ configurable: true
627
+ }
628
+ });
629
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
630
+ }
631
631
 
632
- function Clipboard(trigger, options) {
633
- _classCallCheck(this, Clipboard);
632
+ var Clipboard = function (_Emitter) {
633
+ _inherits(Clipboard, _Emitter);
634
634
 
635
- _Emitter.call(this);
635
+ /**
636
+ * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
637
+ * @param {Object} options
638
+ */
636
639
 
637
- this.resolveOptions(options);
638
- this.listenClick(trigger);
639
- }
640
+ function Clipboard(trigger, options) {
641
+ _classCallCheck(this, Clipboard);
640
642
 
641
- /**
642
- * Helper function to retrieve attribute value.
643
- * @param {String} suffix
644
- * @param {Element} element
645
- */
643
+ var _this = _possibleConstructorReturn(this, _Emitter.call(this));
646
644
 
647
- /**
648
- * Defines if attributes would be resolved using internal setter functions
649
- * or custom functions that were passed in the constructor.
650
- * @param {Object} options
651
- */
645
+ _this.resolveOptions(options);
646
+ _this.listenClick(trigger);
647
+ return _this;
648
+ }
652
649
 
653
- Clipboard.prototype.resolveOptions = function resolveOptions() {
654
- var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
650
+ /**
651
+ * Defines if attributes would be resolved using internal setter functions
652
+ * or custom functions that were passed in the constructor.
653
+ * @param {Object} options
654
+ */
655
655
 
656
- this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
657
- this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
658
- this.text = typeof options.text === 'function' ? options.text : this.defaultText;
659
- };
660
656
 
661
- /**
662
- * Adds a click event listener to the passed trigger.
663
- * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
664
- */
657
+ Clipboard.prototype.resolveOptions = function resolveOptions() {
658
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
665
659
 
666
- Clipboard.prototype.listenClick = function listenClick(trigger) {
667
- var _this = this;
660
+ this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
661
+ this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
662
+ this.text = typeof options.text === 'function' ? options.text : this.defaultText;
663
+ };
668
664
 
669
- this.listener = _goodListener2['default'](trigger, 'click', function (e) {
670
- return _this.onClick(e);
671
- });
672
- };
665
+ Clipboard.prototype.listenClick = function listenClick(trigger) {
666
+ var _this2 = this;
673
667
 
674
- /**
675
- * Defines a new `ClipboardAction` on each click event.
676
- * @param {Event} e
677
- */
668
+ this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
669
+ return _this2.onClick(e);
670
+ });
671
+ };
678
672
 
679
- Clipboard.prototype.onClick = function onClick(e) {
680
- var trigger = e.delegateTarget || e.currentTarget;
673
+ Clipboard.prototype.onClick = function onClick(e) {
674
+ var trigger = e.delegateTarget || e.currentTarget;
681
675
 
682
- if (this.clipboardAction) {
683
- this.clipboardAction = null;
684
- }
676
+ if (this.clipboardAction) {
677
+ this.clipboardAction = null;
678
+ }
685
679
 
686
- this.clipboardAction = new _clipboardAction2['default']({
687
- action: this.action(trigger),
688
- target: this.target(trigger),
689
- text: this.text(trigger),
690
- trigger: trigger,
691
- emitter: this
692
- });
693
- };
680
+ this.clipboardAction = new _clipboardAction2.default({
681
+ action: this.action(trigger),
682
+ target: this.target(trigger),
683
+ text: this.text(trigger),
684
+ trigger: trigger,
685
+ emitter: this
686
+ });
687
+ };
694
688
 
695
- /**
696
- * Default `action` lookup function.
697
- * @param {Element} trigger
698
- */
689
+ Clipboard.prototype.defaultAction = function defaultAction(trigger) {
690
+ return getAttributeValue('action', trigger);
691
+ };
699
692
 
700
- Clipboard.prototype.defaultAction = function defaultAction(trigger) {
701
- return getAttributeValue('action', trigger);
702
- };
693
+ Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
694
+ var selector = getAttributeValue('target', trigger);
703
695
 
704
- /**
705
- * Default `target` lookup function.
706
- * @param {Element} trigger
707
- */
696
+ if (selector) {
697
+ return document.querySelector(selector);
698
+ }
699
+ };
708
700
 
709
- Clipboard.prototype.defaultTarget = function defaultTarget(trigger) {
710
- var selector = getAttributeValue('target', trigger);
701
+ Clipboard.prototype.defaultText = function defaultText(trigger) {
702
+ return getAttributeValue('text', trigger);
703
+ };
711
704
 
712
- if (selector) {
713
- return document.querySelector(selector);
714
- }
715
- };
705
+ Clipboard.prototype.destroy = function destroy() {
706
+ this.listener.destroy();
716
707
 
717
- /**
718
- * Default `text` lookup function.
719
- * @param {Element} trigger
720
- */
708
+ if (this.clipboardAction) {
709
+ this.clipboardAction.destroy();
710
+ this.clipboardAction = null;
711
+ }
712
+ };
721
713
 
722
- Clipboard.prototype.defaultText = function defaultText(trigger) {
723
- return getAttributeValue('text', trigger);
724
- };
714
+ return Clipboard;
715
+ }(_tinyEmitter2.default);
725
716
 
726
717
  /**
727
- * Destroy lifecycle.
718
+ * Helper function to retrieve attribute value.
719
+ * @param {String} suffix
720
+ * @param {Element} element
728
721
  */
722
+ function getAttributeValue(suffix, element) {
723
+ var attribute = 'data-clipboard-' + suffix;
729
724
 
730
- Clipboard.prototype.destroy = function destroy() {
731
- this.listener.destroy();
732
-
733
- if (this.clipboardAction) {
734
- this.clipboardAction.destroy();
735
- this.clipboardAction = null;
725
+ if (!element.hasAttribute(attribute)) {
726
+ return;
736
727
  }
737
- };
738
-
739
- return Clipboard;
740
- })(_tinyEmitter2['default']);
741
728
 
742
- exports['default'] = Clipboard;
743
- function getAttributeValue(suffix, element) {
744
- var attribute = 'data-clipboard-' + suffix;
745
-
746
- if (!element.hasAttribute(attribute)) {
747
- return;
729
+ return element.getAttribute(attribute);
748
730
  }
749
731
 
750
- return element.getAttribute(attribute);
751
- }
752
- module.exports = exports['default'];
732
+ module.exports = Clipboard;
733
+ });
753
734
 
754
735
  },{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)
755
- });
736
+ });
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.8
4
+ version: 1.5.9
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-02-06 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.5.1
84
+ rubygems_version: 2.5.2
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: ''