heavens_door 0.2.3 → 0.3.0

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
  SHA256:
3
- metadata.gz: 7bafabc4c6a83620e6535b77efac4640cf28cd445bd7a69309175e95b01949d5
4
- data.tar.gz: b9f9332628b192958d21e4ff80c2e58414e540081b2fed1ca6b3bcad26783aea
3
+ metadata.gz: 565dd1e19224191e1e7d6643a4de6319b5fd4e716cc4a19848a29f24fda86c3c
4
+ data.tar.gz: 35941fbcef05fc35f843e620b7e4b32e537c027fe41684ad2fdfc1fce1442cc8
5
5
  SHA512:
6
- metadata.gz: 9044a453e0369ef70e28268c38366ed34b91b2af0532038b3f0b5da8dc46ebbbd4e402bbb953da1d29fd496570d9a981e9c3750bd15c7509be45013781d36613
7
- data.tar.gz: 7a8ba86be8a921af4353a8dd6f9f894a408449f9beda2fb64905703502d294bbb2a8754143b82992daa6f6a1472188ba59f13f5c1a369909722fbe33b052cb09
6
+ metadata.gz: 7bc0a6fb9e7fe768ca04c161f4fe3bb6a21c21a2a2e54d3e1083fb08312d36811a273ca356657eb06ebaba5794a1b210092352ff537490698cd1616e8320daa4
7
+ data.tar.gz: 7c95472f8989d84c00eee533792747fd3c010f4aa3dda8ef8f40ab4eeb291efc412b9d5018c92003c1073fcad89c350729e4fa70955c3ea8c3a28975b3e0b5c6
@@ -37,11 +37,29 @@
37
37
  });
38
38
 
39
39
  copyButton.addEventListener('click', () => {
40
- navigator.clipboard.writeText(sessionStorage.heavensDoor)
41
- .catch(err => {
42
- console.error('Could not copy text: ', err);
43
- alert(sessionStorage.heavensDoor);
44
- });
40
+ if (navigator.clipboard) {
41
+ navigator.clipboard.writeText(sessionStorage.heavensDoor)
42
+ .catch(err => {
43
+ console.error('Could not copy text: ', err);
44
+ alert(sessionStorage.heavensDoor);
45
+ });
46
+ } else {
47
+ const dummyElement = document.createElement('span');
48
+ dummyElement.style.whiteSpace = 'pre'
49
+ dummyElement.textContent = sessionStorage.heavensDoor;
50
+ document.body.appendChild(dummyElement)
51
+
52
+ const selection = window.getSelection();
53
+ selection.removeAllRanges()
54
+ const range = document.createRange()
55
+ range.selectNode(dummyElement)
56
+ selection.addRange(range)
57
+
58
+ document.execCommand('copy');
59
+
60
+ selection.removeAllRanges()
61
+ document.body.removeChild(dummyElement)
62
+ }
45
63
  });
46
64
 
47
65
  if (sessionStorage.heavensDoor) {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HeavensDoor
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heavens_door
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler