zeroclipboard-rails 0.0.12 → 0.0.13

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: b879a3f2eafc0b966f79ae5c8a8cfb3d1ba3b059
4
- data.tar.gz: 360e96d41c41a8316e3b8e04232a9c4749f2008a
3
+ metadata.gz: 42b0ab9281477489a2d8982c0433d1e88c4da338
4
+ data.tar.gz: 446eb6619ca7521ade2a90a750f1ebda0731cf49
5
5
  SHA512:
6
- metadata.gz: 713cbf9b0b6675d416321cf8361208d82407d0199476770aca7f8bfa8379ba66f84af94b522081921a59ee752c6338d182dc4f2f2d83f775f3acc2226c586e34
7
- data.tar.gz: a352420e9022d91ce536ef51db9eeb3cc8dc08ec83f79c4225d496c804cc61296a9ed4c8f6b67a4d25df734c1e1603976ea9750d79be873a0577c5c7e8343eca
6
+ metadata.gz: af77e8addd3e54cb73ecd6d909299d09d96a68af01c3a820407461cfccaf93560cb2c88e35f78d3ff2e8db6133a932850b6963432dd58a29668679d71c74a42d
7
+ data.tar.gz: 7c5fb22bcb434c425cf666f2ca9a57ad97140abee58af346a8fc13ac910ef761d8d6742aa662bb23b1093ea5f59b56d4255e311246cb26a2c0792a08e52cdd22
data/README.md CHANGED
@@ -101,6 +101,9 @@ This gem is merely a wrapper around [ZeroClipboard](https://github.com/zeroclipb
101
101
  |[`0.0.9`](https://rubygems.org/gems/zeroclipboard-rails/versions/0.0.9)|[`1.2.3`](https://github.com/zeroclipboard/ZeroClipboard/tree/v1.2.3)||
102
102
  |[`0.0.10`](https://rubygems.org/gems/zeroclipboard-rails/versions/0.0.10)|[`1.2.3`](https://github.com/zeroclipboard/ZeroClipboard/tree/v1.2.3)||
103
103
  |[`0.0.11`](https://rubygems.org/gems/zeroclipboard-rails/versions/0.0.11)|[`1.3.1`](https://github.com/zeroclipboard/ZeroClipboard/tree/v1.3.1)||
104
+ |[`0.0.12`](https://rubygems.org/gems/zeroclipboard-rails/versions/0.0.12)|[`1.3.1`](https://github.com/zeroclipboard/ZeroClipboard/tree/v1.3.1)|[Fix deprecation warning](https://github.com/zeroclipboard/zeroclipboard-rails/pull/17) - [@markrickert](https://github.com/markrickert)|
105
+ |[`0.0.13`](https://rubygems.org/gems/zeroclipboard-rails/versions/0.0.13)|[`1.3.5`](https://github.com/zeroclipboard/ZeroClipboard/tree/v1.3.5)||
106
+
104
107
 
105
108
 
106
109
  ## Credits
Binary file
@@ -4,9 +4,9 @@
4
4
  * Copyright (c) 2014 Jon Rohan, James M. Greene
5
5
  * Licensed MIT
6
6
  * http://zeroclipboard.org/
7
- * v1.3.1
7
+ * v1.3.5
8
8
  */
9
- (function() {
9
+ (function(window) {
10
10
  "use strict";
11
11
  var currentElement;
12
12
  var flashState = {
@@ -444,6 +444,12 @@
444
444
  }
445
445
  return obj;
446
446
  };
447
+ var _safeActiveElement = function() {
448
+ try {
449
+ return document.activeElement;
450
+ } catch (err) {}
451
+ return null;
452
+ };
447
453
  var _detectFlashSupport = function() {
448
454
  var hasFlash = false;
449
455
  if (typeof flashState.disabled === "boolean") {
@@ -500,22 +506,28 @@
500
506
  ZeroClipboard.prototype.setText = function(newText) {
501
507
  if (newText && newText !== "") {
502
508
  _clipData["text/plain"] = newText;
503
- if (flashState.ready === true && flashState.bridge) {
509
+ if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setText === "function") {
504
510
  flashState.bridge.setText(newText);
505
- } else {}
511
+ } else {
512
+ flashState.ready = false;
513
+ }
506
514
  }
507
515
  return this;
508
516
  };
509
517
  ZeroClipboard.prototype.setSize = function(width, height) {
510
- if (flashState.ready === true && flashState.bridge) {
518
+ if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setSize === "function") {
511
519
  flashState.bridge.setSize(width, height);
512
- } else {}
520
+ } else {
521
+ flashState.ready = false;
522
+ }
513
523
  return this;
514
524
  };
515
525
  var _setHandCursor = function(enabled) {
516
- if (flashState.ready === true && flashState.bridge) {
526
+ if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setHandCursor === "function") {
517
527
  flashState.bridge.setHandCursor(enabled);
518
- } else {}
528
+ } else {
529
+ flashState.ready = false;
530
+ }
519
531
  };
520
532
  ZeroClipboard.prototype.destroy = function() {
521
533
  this.unclip();
@@ -532,7 +544,7 @@
532
544
  }
533
545
  return clients;
534
546
  };
535
- ZeroClipboard.version = "1.3.1";
547
+ ZeroClipboard.version = "1.3.5";
536
548
  var _globalConfig = {
537
549
  swfPath: _swfPath,
538
550
  trustedDomains: window.location.host ? [ window.location.host ] : [],
@@ -664,8 +676,10 @@
664
676
  htmlBridge.style.height = pos.height + "px";
665
677
  htmlBridge.style.zIndex = pos.zIndex + 1;
666
678
  }
667
- if (flashState.ready === true && flashState.bridge) {
679
+ if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setSize === "function") {
668
680
  flashState.bridge.setSize(pos.width, pos.height);
681
+ } else {
682
+ flashState.ready = false;
669
683
  }
670
684
  }
671
685
  return this;
@@ -862,7 +876,7 @@
862
876
  if (typeof eventName === "string" && eventName) {
863
877
  var cleanEventName = eventName.toLowerCase().replace(/^on/, "");
864
878
  if (cleanEventName) {
865
- var clients = currentElement ? _getAllClientsClippedToElement(currentElement) : _getAllClients();
879
+ var clients = currentElement && _globalConfig.autoActivate === true ? _getAllClientsClippedToElement(currentElement) : _getAllClients();
866
880
  for (var i = 0, len = clients.length; i < len; i++) {
867
881
  _receiveEvent.call(clients[i], cleanEventName, args);
868
882
  }
@@ -973,16 +987,18 @@
973
987
  break;
974
988
 
975
989
  case "datarequested":
976
- var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
977
- if (targetEl) {
978
- var textContent = targetEl.value || targetEl.textContent || targetEl.innerText;
979
- if (textContent) {
980
- this.setText(textContent);
981
- }
982
- } else {
983
- var defaultText = element.getAttribute("data-clipboard-text");
984
- if (defaultText) {
985
- this.setText(defaultText);
990
+ if (element) {
991
+ var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
992
+ if (targetEl) {
993
+ var textContent = targetEl.value || targetEl.textContent || targetEl.innerText;
994
+ if (textContent) {
995
+ this.setText(textContent);
996
+ }
997
+ } else {
998
+ var defaultText = element.getAttribute("data-clipboard-text");
999
+ if (defaultText) {
1000
+ this.setText(defaultText);
1001
+ }
986
1002
  }
987
1003
  }
988
1004
  performCallbackAsync = false;
@@ -990,6 +1006,9 @@
990
1006
 
991
1007
  case "complete":
992
1008
  _deleteOwnProperties(_clipData);
1009
+ if (element && element !== _safeActiveElement() && element.focus) {
1010
+ element.focus();
1011
+ }
993
1012
  break;
994
1013
  }
995
1014
  var context = element;
@@ -1001,10 +1020,12 @@
1001
1020
  _amdModuleId = module && module.id || null;
1002
1021
  return ZeroClipboard;
1003
1022
  });
1004
- } else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
1023
+ } else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports && typeof window.require === "function") {
1005
1024
  _cjsModuleId = module.id || null;
1006
1025
  module.exports = ZeroClipboard;
1007
1026
  } else {
1008
1027
  window.ZeroClipboard = ZeroClipboard;
1009
1028
  }
1010
- })();
1029
+ })(function() {
1030
+ return this;
1031
+ }());
@@ -1,5 +1,5 @@
1
1
  module Zeroclipboard
2
2
  module Rails
3
- VERSION = "0.0.12"
3
+ VERSION = "0.0.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeroclipboard-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Wenz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-06 00:00:00.000000000 Z
12
+ date: 2014-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -32,14 +32,14 @@ executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - lib/zeroclipboard-rails.rb
36
- - lib/zeroclipboard-rails/version.rb
37
- - app/assets/javascripts/zeroclipboard/ZeroClipboard.js
38
- - app/assets/javascripts/zeroclipboard/asset-path.js.erb
39
- - app/assets/javascripts/zeroclipboard.js
40
- - app/assets/images/ZeroClipboard.swf
41
35
  - LICENSE
42
36
  - README.md
37
+ - app/assets/images/ZeroClipboard.swf
38
+ - app/assets/javascripts/zeroclipboard.js
39
+ - app/assets/javascripts/zeroclipboard/ZeroClipboard.js
40
+ - app/assets/javascripts/zeroclipboard/asset-path.js.erb
41
+ - lib/zeroclipboard-rails.rb
42
+ - lib/zeroclipboard-rails/version.rb
43
43
  homepage: https://github.com/zeroclipboard/zeroclipboard-rails
44
44
  licenses:
45
45
  - MIT
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.0.14
63
+ rubygems_version: 2.2.2
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Adds the Javascript ZeroClipboard libary to Rails