copy_tuner_client 0.4.9 → 0.4.10
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -8
- data/app/assets/javascripts/copyray.js +961 -888
- data/copy_tuner_client.gemspec +0 -1
- data/lib/copy_tuner_client/cache.rb +4 -4
- data/lib/copy_tuner_client/copyray_middleware.rb +1 -1
- data/lib/copy_tuner_client/version.rb +1 -1
- data/lib/tasks/copy_tuner_client_tasks.rake +1 -1
- data/package-lock.json +1719 -1118
- data/package.json +15 -12
- data/rollup.config.js +5 -3
- data/spec/copy_tuner_client/cache_spec.rb +30 -32
- data/spec/copy_tuner_client/client_spec.rb +3 -5
- data/spec/copy_tuner_client/configuration_spec.rb +20 -18
- data/spec/copy_tuner_client/i18n_backend_spec.rb +5 -7
- data/spec/copy_tuner_client/poller_spec.rb +4 -5
- data/spec/copy_tuner_client/prefixed_logger_spec.rb +1 -3
- data/spec/copy_tuner_client/process_guard_spec.rb +12 -13
- data/spec/copy_tuner_client/request_sync_spec.rb +19 -17
- data/spec/copy_tuner_client_spec.rb +3 -4
- data/spec/spec_helper.rb +0 -2
- data/spec/support/fake_client.rb +13 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61aa74274a245b69cde8eb43ed26d9b4d5696005
|
4
|
+
data.tar.gz: c680e03badd13031ebc4bdc1f7cd069da05ed448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e629a82d95b98b134f2ceae2db73b43239af4478ed48024df036d63e143b0b5de443aed71e15be20a9eec4798210a555b1b5267dcfdc7b1edaca8250688cf6
|
7
|
+
data.tar.gz: 71ae27b8375680700d71d1bf8a2b51be9464a0dbaf43e4955724f36ce35fec8fb133f089c1253e6d24a321b98412dec282b45893d29bcb6e0d434ffe4a2d7a65
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
copy_tuner_client (0.4.
|
4
|
+
copy_tuner_client (0.4.10)
|
5
5
|
i18n (>= 0.5.0)
|
6
6
|
json
|
7
7
|
|
@@ -53,8 +53,6 @@ GEM
|
|
53
53
|
childprocess (>= 0.3.6)
|
54
54
|
cucumber (>= 1.1.1)
|
55
55
|
rspec-expectations (>= 2.7.0)
|
56
|
-
bourne (1.6.0)
|
57
|
-
mocha (~> 1.1)
|
58
56
|
builder (3.2.3)
|
59
57
|
childprocess (0.6.3)
|
60
58
|
ffi (~> 1.0, >= 1.0.11)
|
@@ -83,14 +81,11 @@ GEM
|
|
83
81
|
nokogiri (>= 1.5.9)
|
84
82
|
mail (2.6.4)
|
85
83
|
mime-types (>= 1.16, < 4)
|
86
|
-
metaclass (0.0.4)
|
87
84
|
mime-types (3.1)
|
88
85
|
mime-types-data (~> 3.2015)
|
89
86
|
mime-types-data (3.2016.0521)
|
90
87
|
mini_portile2 (2.3.0)
|
91
88
|
minitest (5.10.1)
|
92
|
-
mocha (1.2.1)
|
93
|
-
metaclass (~> 0.0.1)
|
94
89
|
multi_json (1.12.1)
|
95
90
|
multi_test (0.1.2)
|
96
91
|
nokogiri (1.8.2)
|
@@ -175,7 +170,6 @@ PLATFORMS
|
|
175
170
|
DEPENDENCIES
|
176
171
|
appraisal (~> 2.1)
|
177
172
|
aruba (~> 0.6.0)
|
178
|
-
bourne
|
179
173
|
copy_tuner_client!
|
180
174
|
cucumber (~> 1.3.16)
|
181
175
|
rails (~> 4.2.6)
|
@@ -189,4 +183,4 @@ DEPENDENCIES
|
|
189
183
|
yard
|
190
184
|
|
191
185
|
BUNDLED WITH
|
192
|
-
1.16.
|
186
|
+
1.16.3
|
@@ -1,996 +1,1069 @@
|
|
1
1
|
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var KEY_CANCEL = 3;
|
5
|
+
var KEY_HELP = 6;
|
6
|
+
var KEY_BACK_SPACE = 8;
|
7
|
+
var KEY_TAB = 9;
|
8
|
+
var KEY_CLEAR = 12;
|
9
|
+
var KEY_RETURN = 13;
|
10
|
+
var KEY_ENTER = 14;
|
11
|
+
var KEY_SHIFT = 16;
|
12
|
+
var KEY_CONTROL = 17;
|
13
|
+
var KEY_ALT = 18;
|
14
|
+
var KEY_PAUSE = 19;
|
15
|
+
var KEY_CAPS_LOCK = 20;
|
16
|
+
var KEY_ESCAPE = 27;
|
17
|
+
var KEY_SPACE = 32;
|
18
|
+
var KEY_PAGE_UP = 33;
|
19
|
+
var KEY_PAGE_DOWN = 34;
|
20
|
+
var KEY_END = 35;
|
21
|
+
var KEY_HOME = 36;
|
22
|
+
var KEY_LEFT = 37;
|
23
|
+
var KEY_UP = 38;
|
24
|
+
var KEY_RIGHT = 39;
|
25
|
+
var KEY_DOWN = 40;
|
26
|
+
var KEY_PRINTSCREEN = 44;
|
27
|
+
var KEY_INSERT = 45;
|
28
|
+
var KEY_DELETE = 46;
|
29
|
+
var KEY_0 = 48;
|
30
|
+
var KEY_1 = 49;
|
31
|
+
var KEY_2 = 50;
|
32
|
+
var KEY_3 = 51;
|
33
|
+
var KEY_4 = 52;
|
34
|
+
var KEY_5 = 53;
|
35
|
+
var KEY_6 = 54;
|
36
|
+
var KEY_7 = 55;
|
37
|
+
var KEY_8 = 56;
|
38
|
+
var KEY_9 = 57;
|
39
|
+
var KEY_SEMICOLON = 59;
|
40
|
+
var KEY_EQUALS = 61;
|
41
|
+
var KEY_A = 65;
|
42
|
+
var KEY_B = 66;
|
43
|
+
var KEY_C = 67;
|
44
|
+
var KEY_D = 68;
|
45
|
+
var KEY_E = 69;
|
46
|
+
var KEY_F = 70;
|
47
|
+
var KEY_G = 71;
|
48
|
+
var KEY_H = 72;
|
49
|
+
var KEY_I = 73;
|
50
|
+
var KEY_J = 74;
|
51
|
+
var KEY_K = 75;
|
52
|
+
var KEY_L = 76;
|
53
|
+
var KEY_M = 77;
|
54
|
+
var KEY_N = 78;
|
55
|
+
var KEY_O = 79;
|
56
|
+
var KEY_P = 80;
|
57
|
+
var KEY_Q = 81;
|
58
|
+
var KEY_R = 82;
|
59
|
+
var KEY_S = 83;
|
60
|
+
var KEY_T = 84;
|
61
|
+
var KEY_U = 85;
|
62
|
+
var KEY_V = 86;
|
63
|
+
var KEY_W = 87;
|
64
|
+
var KEY_X = 88;
|
65
|
+
var KEY_Y = 89;
|
66
|
+
var KEY_Z = 90;
|
67
|
+
var KEY_CONTEXT_MENU = 93;
|
68
|
+
var KEY_NUMPAD0 = 96;
|
69
|
+
var KEY_NUMPAD1 = 97;
|
70
|
+
var KEY_NUMPAD2 = 98;
|
71
|
+
var KEY_NUMPAD3 = 99;
|
72
|
+
var KEY_NUMPAD4 = 100;
|
73
|
+
var KEY_NUMPAD5 = 101;
|
74
|
+
var KEY_NUMPAD6 = 102;
|
75
|
+
var KEY_NUMPAD7 = 103;
|
76
|
+
var KEY_NUMPAD8 = 104;
|
77
|
+
var KEY_NUMPAD9 = 105;
|
78
|
+
var KEY_MULTIPLY = 106;
|
79
|
+
var KEY_ADD = 107;
|
80
|
+
var KEY_SEPARATOR = 108;
|
81
|
+
var KEY_SUBTRACT = 109;
|
82
|
+
var KEY_DECIMAL = 110;
|
83
|
+
var KEY_DIVIDE = 111;
|
84
|
+
var KEY_F1 = 112;
|
85
|
+
var KEY_F2 = 113;
|
86
|
+
var KEY_F3 = 114;
|
87
|
+
var KEY_F4 = 115;
|
88
|
+
var KEY_F5 = 116;
|
89
|
+
var KEY_F6 = 117;
|
90
|
+
var KEY_F7 = 118;
|
91
|
+
var KEY_F8 = 119;
|
92
|
+
var KEY_F9 = 120;
|
93
|
+
var KEY_F10 = 121;
|
94
|
+
var KEY_F11 = 122;
|
95
|
+
var KEY_F12 = 123;
|
96
|
+
var KEY_F13 = 124;
|
97
|
+
var KEY_F14 = 125;
|
98
|
+
var KEY_F15 = 126;
|
99
|
+
var KEY_F16 = 127;
|
100
|
+
var KEY_F17 = 128;
|
101
|
+
var KEY_F18 = 129;
|
102
|
+
var KEY_F19 = 130;
|
103
|
+
var KEY_F20 = 131;
|
104
|
+
var KEY_F21 = 132;
|
105
|
+
var KEY_F22 = 133;
|
106
|
+
var KEY_F23 = 134;
|
107
|
+
var KEY_F24 = 135;
|
108
|
+
var KEY_NUM_LOCK = 144;
|
109
|
+
var KEY_SCROLL_LOCK = 145;
|
110
|
+
var KEY_COMMA = 188;
|
111
|
+
var KEY_PERIOD = 190;
|
112
|
+
var KEY_SLASH = 191;
|
113
|
+
var KEY_BACK_QUOTE = 192;
|
114
|
+
var KEY_OPEN_BRACKET = 219;
|
115
|
+
var KEY_BACK_SLASH = 220;
|
116
|
+
var KEY_CLOSE_BRACKET = 221;
|
117
|
+
var KEY_QUOTE = 222;
|
118
|
+
var KEY_META = 224;
|
119
|
+
|
120
|
+
var KeyCode = {
|
121
|
+
KEY_CANCEL: KEY_CANCEL,
|
122
|
+
KEY_HELP: KEY_HELP,
|
123
|
+
KEY_BACK_SPACE: KEY_BACK_SPACE,
|
124
|
+
KEY_TAB: KEY_TAB,
|
125
|
+
KEY_CLEAR: KEY_CLEAR,
|
126
|
+
KEY_RETURN: KEY_RETURN,
|
127
|
+
KEY_ENTER: KEY_ENTER,
|
128
|
+
KEY_SHIFT: KEY_SHIFT,
|
129
|
+
KEY_CONTROL: KEY_CONTROL,
|
130
|
+
KEY_ALT: KEY_ALT,
|
131
|
+
KEY_PAUSE: KEY_PAUSE,
|
132
|
+
KEY_CAPS_LOCK: KEY_CAPS_LOCK,
|
133
|
+
KEY_ESCAPE: KEY_ESCAPE,
|
134
|
+
KEY_SPACE: KEY_SPACE,
|
135
|
+
KEY_PAGE_UP: KEY_PAGE_UP,
|
136
|
+
KEY_PAGE_DOWN: KEY_PAGE_DOWN,
|
137
|
+
KEY_END: KEY_END,
|
138
|
+
KEY_HOME: KEY_HOME,
|
139
|
+
KEY_LEFT: KEY_LEFT,
|
140
|
+
KEY_UP: KEY_UP,
|
141
|
+
KEY_RIGHT: KEY_RIGHT,
|
142
|
+
KEY_DOWN: KEY_DOWN,
|
143
|
+
KEY_PRINTSCREEN: KEY_PRINTSCREEN,
|
144
|
+
KEY_INSERT: KEY_INSERT,
|
145
|
+
KEY_DELETE: KEY_DELETE,
|
146
|
+
KEY_0: KEY_0,
|
147
|
+
KEY_1: KEY_1,
|
148
|
+
KEY_2: KEY_2,
|
149
|
+
KEY_3: KEY_3,
|
150
|
+
KEY_4: KEY_4,
|
151
|
+
KEY_5: KEY_5,
|
152
|
+
KEY_6: KEY_6,
|
153
|
+
KEY_7: KEY_7,
|
154
|
+
KEY_8: KEY_8,
|
155
|
+
KEY_9: KEY_9,
|
156
|
+
KEY_SEMICOLON: KEY_SEMICOLON,
|
157
|
+
KEY_EQUALS: KEY_EQUALS,
|
158
|
+
KEY_A: KEY_A,
|
159
|
+
KEY_B: KEY_B,
|
160
|
+
KEY_C: KEY_C,
|
161
|
+
KEY_D: KEY_D,
|
162
|
+
KEY_E: KEY_E,
|
163
|
+
KEY_F: KEY_F,
|
164
|
+
KEY_G: KEY_G,
|
165
|
+
KEY_H: KEY_H,
|
166
|
+
KEY_I: KEY_I,
|
167
|
+
KEY_J: KEY_J,
|
168
|
+
KEY_K: KEY_K,
|
169
|
+
KEY_L: KEY_L,
|
170
|
+
KEY_M: KEY_M,
|
171
|
+
KEY_N: KEY_N,
|
172
|
+
KEY_O: KEY_O,
|
173
|
+
KEY_P: KEY_P,
|
174
|
+
KEY_Q: KEY_Q,
|
175
|
+
KEY_R: KEY_R,
|
176
|
+
KEY_S: KEY_S,
|
177
|
+
KEY_T: KEY_T,
|
178
|
+
KEY_U: KEY_U,
|
179
|
+
KEY_V: KEY_V,
|
180
|
+
KEY_W: KEY_W,
|
181
|
+
KEY_X: KEY_X,
|
182
|
+
KEY_Y: KEY_Y,
|
183
|
+
KEY_Z: KEY_Z,
|
184
|
+
KEY_CONTEXT_MENU: KEY_CONTEXT_MENU,
|
185
|
+
KEY_NUMPAD0: KEY_NUMPAD0,
|
186
|
+
KEY_NUMPAD1: KEY_NUMPAD1,
|
187
|
+
KEY_NUMPAD2: KEY_NUMPAD2,
|
188
|
+
KEY_NUMPAD3: KEY_NUMPAD3,
|
189
|
+
KEY_NUMPAD4: KEY_NUMPAD4,
|
190
|
+
KEY_NUMPAD5: KEY_NUMPAD5,
|
191
|
+
KEY_NUMPAD6: KEY_NUMPAD6,
|
192
|
+
KEY_NUMPAD7: KEY_NUMPAD7,
|
193
|
+
KEY_NUMPAD8: KEY_NUMPAD8,
|
194
|
+
KEY_NUMPAD9: KEY_NUMPAD9,
|
195
|
+
KEY_MULTIPLY: KEY_MULTIPLY,
|
196
|
+
KEY_ADD: KEY_ADD,
|
197
|
+
KEY_SEPARATOR: KEY_SEPARATOR,
|
198
|
+
KEY_SUBTRACT: KEY_SUBTRACT,
|
199
|
+
KEY_DECIMAL: KEY_DECIMAL,
|
200
|
+
KEY_DIVIDE: KEY_DIVIDE,
|
201
|
+
KEY_F1: KEY_F1,
|
202
|
+
KEY_F2: KEY_F2,
|
203
|
+
KEY_F3: KEY_F3,
|
204
|
+
KEY_F4: KEY_F4,
|
205
|
+
KEY_F5: KEY_F5,
|
206
|
+
KEY_F6: KEY_F6,
|
207
|
+
KEY_F7: KEY_F7,
|
208
|
+
KEY_F8: KEY_F8,
|
209
|
+
KEY_F9: KEY_F9,
|
210
|
+
KEY_F10: KEY_F10,
|
211
|
+
KEY_F11: KEY_F11,
|
212
|
+
KEY_F12: KEY_F12,
|
213
|
+
KEY_F13: KEY_F13,
|
214
|
+
KEY_F14: KEY_F14,
|
215
|
+
KEY_F15: KEY_F15,
|
216
|
+
KEY_F16: KEY_F16,
|
217
|
+
KEY_F17: KEY_F17,
|
218
|
+
KEY_F18: KEY_F18,
|
219
|
+
KEY_F19: KEY_F19,
|
220
|
+
KEY_F20: KEY_F20,
|
221
|
+
KEY_F21: KEY_F21,
|
222
|
+
KEY_F22: KEY_F22,
|
223
|
+
KEY_F23: KEY_F23,
|
224
|
+
KEY_F24: KEY_F24,
|
225
|
+
KEY_NUM_LOCK: KEY_NUM_LOCK,
|
226
|
+
KEY_SCROLL_LOCK: KEY_SCROLL_LOCK,
|
227
|
+
KEY_COMMA: KEY_COMMA,
|
228
|
+
KEY_PERIOD: KEY_PERIOD,
|
229
|
+
KEY_SLASH: KEY_SLASH,
|
230
|
+
KEY_BACK_QUOTE: KEY_BACK_QUOTE,
|
231
|
+
KEY_OPEN_BRACKET: KEY_OPEN_BRACKET,
|
232
|
+
KEY_BACK_SLASH: KEY_BACK_SLASH,
|
233
|
+
KEY_CLOSE_BRACKET: KEY_CLOSE_BRACKET,
|
234
|
+
KEY_QUOTE: KEY_QUOTE,
|
235
|
+
KEY_META: KEY_META
|
236
|
+
};
|
150
237
|
|
151
|
-
var
|
238
|
+
var keycodeJs = KeyCode;
|
152
239
|
|
153
|
-
var isMac = navigator.platform.toUpperCase().indexOf('MAC') !== -1;
|
240
|
+
var isMac = navigator.platform.toUpperCase().indexOf('MAC') !== -1;
|
154
241
|
|
155
|
-
var isVisible = function isVisible(element) {
|
156
|
-
|
157
|
-
};
|
242
|
+
var isVisible = function isVisible(element) {
|
243
|
+
return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length);
|
244
|
+
};
|
158
245
|
|
159
|
-
var getOffset = function getOffset(elment) {
|
160
|
-
|
246
|
+
var getOffset = function getOffset(elment) {
|
247
|
+
var box = elment.getBoundingClientRect();
|
161
248
|
|
162
|
-
|
163
|
-
|
164
|
-
|
249
|
+
return {
|
250
|
+
top: box.top + (window.pageYOffset - document.documentElement.clientTop),
|
251
|
+
left: box.left + (window.pageXOffset - document.documentElement.clientLeft)
|
252
|
+
};
|
165
253
|
};
|
166
|
-
};
|
167
254
|
|
168
|
-
var computeBoundingBox = function computeBoundingBox(element) {
|
169
|
-
|
170
|
-
|
171
|
-
|
255
|
+
var computeBoundingBox = function computeBoundingBox(element) {
|
256
|
+
if (!isVisible(element)) {
|
257
|
+
return null;
|
258
|
+
}
|
172
259
|
|
173
|
-
|
174
|
-
|
175
|
-
|
260
|
+
var boxFrame = getOffset(element);
|
261
|
+
boxFrame.right = boxFrame.left + element.offsetWidth;
|
262
|
+
boxFrame.bottom = boxFrame.top + element.offsetHeight;
|
176
263
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
264
|
+
return {
|
265
|
+
left: boxFrame.left,
|
266
|
+
top: boxFrame.top,
|
267
|
+
width: boxFrame.right - boxFrame.left,
|
268
|
+
height: boxFrame.bottom - boxFrame.top
|
269
|
+
};
|
182
270
|
};
|
183
|
-
};
|
184
271
|
|
185
|
-
var classCallCheck = function (instance, Constructor) {
|
186
|
-
|
187
|
-
|
188
|
-
}
|
189
|
-
};
|
190
|
-
|
191
|
-
var createClass = function () {
|
192
|
-
function defineProperties(target, props) {
|
193
|
-
for (var i = 0; i < props.length; i++) {
|
194
|
-
var descriptor = props[i];
|
195
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
196
|
-
descriptor.configurable = true;
|
197
|
-
if ("value" in descriptor) descriptor.writable = true;
|
198
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
272
|
+
var classCallCheck = function (instance, Constructor) {
|
273
|
+
if (!(instance instanceof Constructor)) {
|
274
|
+
throw new TypeError("Cannot call a class as a function");
|
199
275
|
}
|
200
|
-
}
|
201
|
-
|
202
|
-
return function (Constructor, protoProps, staticProps) {
|
203
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
204
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
205
|
-
return Constructor;
|
206
276
|
};
|
207
|
-
}();
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
277
|
|
278
|
+
var createClass = function () {
|
279
|
+
function defineProperties(target, props) {
|
280
|
+
for (var i = 0; i < props.length; i++) {
|
281
|
+
var descriptor = props[i];
|
282
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
283
|
+
descriptor.configurable = true;
|
284
|
+
if ("value" in descriptor) descriptor.writable = true;
|
285
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
286
|
+
}
|
287
|
+
}
|
224
288
|
|
289
|
+
return function (Constructor, protoProps, staticProps) {
|
290
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
291
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
292
|
+
return Constructor;
|
293
|
+
};
|
294
|
+
}();
|
225
295
|
|
296
|
+
var slicedToArray = function () {
|
297
|
+
function sliceIterator(arr, i) {
|
298
|
+
var _arr = [];
|
299
|
+
var _n = true;
|
300
|
+
var _d = false;
|
301
|
+
var _e = undefined;
|
226
302
|
|
303
|
+
try {
|
304
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
305
|
+
_arr.push(_s.value);
|
227
306
|
|
307
|
+
if (i && _arr.length === i) break;
|
308
|
+
}
|
309
|
+
} catch (err) {
|
310
|
+
_d = true;
|
311
|
+
_e = err;
|
312
|
+
} finally {
|
313
|
+
try {
|
314
|
+
if (!_n && _i["return"]) _i["return"]();
|
315
|
+
} finally {
|
316
|
+
if (_d) throw _e;
|
317
|
+
}
|
318
|
+
}
|
228
319
|
|
320
|
+
return _arr;
|
321
|
+
}
|
229
322
|
|
323
|
+
return function (arr, i) {
|
324
|
+
if (Array.isArray(arr)) {
|
325
|
+
return arr;
|
326
|
+
} else if (Symbol.iterator in Object(arr)) {
|
327
|
+
return sliceIterator(arr, i);
|
328
|
+
} else {
|
329
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
330
|
+
}
|
331
|
+
};
|
332
|
+
}();
|
230
333
|
|
334
|
+
var ZINDEX = 2000000000;
|
231
335
|
|
336
|
+
var Specimen = function () {
|
337
|
+
function Specimen(element, key, callback) {
|
338
|
+
classCallCheck(this, Specimen);
|
232
339
|
|
340
|
+
this.element = element;
|
341
|
+
this.key = key;
|
342
|
+
this.callback = callback;
|
343
|
+
}
|
233
344
|
|
345
|
+
createClass(Specimen, [{
|
346
|
+
key: 'show',
|
347
|
+
value: function show() {
|
348
|
+
var _this = this;
|
234
349
|
|
235
|
-
|
236
|
-
|
237
|
-
var _arr = [];
|
238
|
-
var _n = true;
|
239
|
-
var _d = false;
|
240
|
-
var _e = undefined;
|
350
|
+
this.box = this.makeBox();
|
351
|
+
if (this.box === null) return;
|
241
352
|
|
242
|
-
|
243
|
-
|
244
|
-
|
353
|
+
this.box.addEventListener('click', function () {
|
354
|
+
_this.callback(_this.key);
|
355
|
+
});
|
245
356
|
|
246
|
-
|
357
|
+
document.body.appendChild(this.box);
|
247
358
|
}
|
248
|
-
}
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
359
|
+
}, {
|
360
|
+
key: 'remove',
|
361
|
+
value: function remove() {
|
362
|
+
if (!this.box) {
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
this.box.remove();
|
366
|
+
this.box = null;
|
256
367
|
}
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
var ZINDEX = 2000000000;
|
274
|
-
|
275
|
-
var Specimen = function () {
|
276
|
-
function Specimen(element, key, callback) {
|
277
|
-
classCallCheck(this, Specimen);
|
278
|
-
|
279
|
-
this.element = element;
|
280
|
-
this.key = key;
|
281
|
-
this.callback = callback;
|
282
|
-
}
|
283
|
-
|
284
|
-
createClass(Specimen, [{
|
285
|
-
key: 'show',
|
286
|
-
value: function show() {
|
287
|
-
var _this = this;
|
368
|
+
}, {
|
369
|
+
key: 'makeBox',
|
370
|
+
value: function makeBox() {
|
371
|
+
var box = document.createElement('div');
|
372
|
+
box.classList.add('copyray-specimen');
|
373
|
+
box.classList.add('Specimen');
|
374
|
+
|
375
|
+
var bounds = computeBoundingBox(this.element);
|
376
|
+
if (bounds === null) return null;
|
377
|
+
|
378
|
+
Object.keys(bounds).forEach(function (key) {
|
379
|
+
var value = bounds[key];
|
380
|
+
box.style[key] = value + 'px';
|
381
|
+
});
|
382
|
+
box.style.zIndex = ZINDEX;
|
288
383
|
|
289
|
-
|
290
|
-
|
384
|
+
var _getComputedStyle = getComputedStyle(this.element),
|
385
|
+
position = _getComputedStyle.position,
|
386
|
+
top = _getComputedStyle.top,
|
387
|
+
left = _getComputedStyle.left;
|
291
388
|
|
292
|
-
|
293
|
-
|
294
|
-
|
389
|
+
if (position === 'fixed') {
|
390
|
+
this.box.style.position = 'fixed';
|
391
|
+
this.box.style.top = top + 'px';
|
392
|
+
this.box.style.left = left + 'px';
|
393
|
+
}
|
295
394
|
|
296
|
-
|
297
|
-
|
298
|
-
}, {
|
299
|
-
key: 'remove',
|
300
|
-
value: function remove() {
|
301
|
-
if (!this.box) {
|
302
|
-
return;
|
395
|
+
box.appendChild(this.makeLabel());
|
396
|
+
return box;
|
303
397
|
}
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
box.classList.add('Specimen');
|
313
|
-
|
314
|
-
var bounds = computeBoundingBox(this.element);
|
315
|
-
if (bounds === null) return null;
|
316
|
-
|
317
|
-
Object.keys(bounds).forEach(function (key) {
|
318
|
-
var value = bounds[key];
|
319
|
-
box.style[key] = value + 'px';
|
320
|
-
});
|
321
|
-
box.style.zIndex = ZINDEX;
|
322
|
-
|
323
|
-
var _getComputedStyle = getComputedStyle(this.element),
|
324
|
-
position = _getComputedStyle.position,
|
325
|
-
top = _getComputedStyle.top,
|
326
|
-
left = _getComputedStyle.left;
|
327
|
-
|
328
|
-
if (position === 'fixed') {
|
329
|
-
this.box.style.position = 'fixed';
|
330
|
-
this.box.style.top = top + 'px';
|
331
|
-
this.box.style.left = left + 'px';
|
398
|
+
}, {
|
399
|
+
key: 'makeLabel',
|
400
|
+
value: function makeLabel() {
|
401
|
+
var div = document.createElement('div');
|
402
|
+
div.classList.add('copyray-specimen-handle');
|
403
|
+
div.classList.add('Specimen');
|
404
|
+
div.textContent = this.key;
|
405
|
+
return div;
|
332
406
|
}
|
407
|
+
}]);
|
408
|
+
return Specimen;
|
409
|
+
}();
|
410
|
+
|
411
|
+
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
412
|
+
|
413
|
+
/**
|
414
|
+
* lodash (Custom Build) <https://lodash.com/>
|
415
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
416
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
417
|
+
* Released under MIT license <https://lodash.com/license>
|
418
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
419
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
420
|
+
*/
|
421
|
+
|
422
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
423
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
424
|
+
|
425
|
+
/** Used as references for various `Number` constants. */
|
426
|
+
var NAN = 0 / 0;
|
427
|
+
|
428
|
+
/** `Object#toString` result references. */
|
429
|
+
var symbolTag = '[object Symbol]';
|
430
|
+
|
431
|
+
/** Used to match leading and trailing whitespace. */
|
432
|
+
var reTrim = /^\s+|\s+$/g;
|
433
|
+
|
434
|
+
/** Used to detect bad signed hexadecimal string values. */
|
435
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
436
|
+
|
437
|
+
/** Used to detect binary string values. */
|
438
|
+
var reIsBinary = /^0b[01]+$/i;
|
439
|
+
|
440
|
+
/** Used to detect octal string values. */
|
441
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
442
|
+
|
443
|
+
/** Built-in method references without a dependency on `root`. */
|
444
|
+
var freeParseInt = parseInt;
|
445
|
+
|
446
|
+
/** Detect free variable `global` from Node.js. */
|
447
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
448
|
+
|
449
|
+
/** Detect free variable `self`. */
|
450
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
451
|
+
|
452
|
+
/** Used as a reference to the global object. */
|
453
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
454
|
+
|
455
|
+
/** Used for built-in method references. */
|
456
|
+
var objectProto = Object.prototype;
|
457
|
+
|
458
|
+
/**
|
459
|
+
* Used to resolve the
|
460
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
461
|
+
* of values.
|
462
|
+
*/
|
463
|
+
var objectToString = objectProto.toString;
|
464
|
+
|
465
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
466
|
+
var nativeMax = Math.max,
|
467
|
+
nativeMin = Math.min;
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
471
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
472
|
+
*
|
473
|
+
* @static
|
474
|
+
* @memberOf _
|
475
|
+
* @since 2.4.0
|
476
|
+
* @category Date
|
477
|
+
* @returns {number} Returns the timestamp.
|
478
|
+
* @example
|
479
|
+
*
|
480
|
+
* _.defer(function(stamp) {
|
481
|
+
* console.log(_.now() - stamp);
|
482
|
+
* }, _.now());
|
483
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
484
|
+
*/
|
485
|
+
var now = function() {
|
486
|
+
return root.Date.now();
|
487
|
+
};
|
333
488
|
|
334
|
-
|
335
|
-
|
489
|
+
/**
|
490
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
491
|
+
* milliseconds have elapsed since the last time the debounced function was
|
492
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
493
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
494
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
495
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
496
|
+
* with the last arguments provided to the debounced function. Subsequent
|
497
|
+
* calls to the debounced function return the result of the last `func`
|
498
|
+
* invocation.
|
499
|
+
*
|
500
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
501
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
502
|
+
* is invoked more than once during the `wait` timeout.
|
503
|
+
*
|
504
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
505
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
506
|
+
*
|
507
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
508
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
509
|
+
*
|
510
|
+
* @static
|
511
|
+
* @memberOf _
|
512
|
+
* @since 0.1.0
|
513
|
+
* @category Function
|
514
|
+
* @param {Function} func The function to debounce.
|
515
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
516
|
+
* @param {Object} [options={}] The options object.
|
517
|
+
* @param {boolean} [options.leading=false]
|
518
|
+
* Specify invoking on the leading edge of the timeout.
|
519
|
+
* @param {number} [options.maxWait]
|
520
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
521
|
+
* @param {boolean} [options.trailing=true]
|
522
|
+
* Specify invoking on the trailing edge of the timeout.
|
523
|
+
* @returns {Function} Returns the new debounced function.
|
524
|
+
* @example
|
525
|
+
*
|
526
|
+
* // Avoid costly calculations while the window size is in flux.
|
527
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
528
|
+
*
|
529
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
530
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
531
|
+
* 'leading': true,
|
532
|
+
* 'trailing': false
|
533
|
+
* }));
|
534
|
+
*
|
535
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
536
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
537
|
+
* var source = new EventSource('/stream');
|
538
|
+
* jQuery(source).on('message', debounced);
|
539
|
+
*
|
540
|
+
* // Cancel the trailing debounced invocation.
|
541
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
542
|
+
*/
|
543
|
+
function debounce(func, wait, options) {
|
544
|
+
var lastArgs,
|
545
|
+
lastThis,
|
546
|
+
maxWait,
|
547
|
+
result,
|
548
|
+
timerId,
|
549
|
+
lastCallTime,
|
550
|
+
lastInvokeTime = 0,
|
551
|
+
leading = false,
|
552
|
+
maxing = false,
|
553
|
+
trailing = true;
|
554
|
+
|
555
|
+
if (typeof func != 'function') {
|
556
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
336
557
|
}
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
div.textContent = this.key;
|
344
|
-
return div;
|
558
|
+
wait = toNumber(wait) || 0;
|
559
|
+
if (isObject(options)) {
|
560
|
+
leading = !!options.leading;
|
561
|
+
maxing = 'maxWait' in options;
|
562
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
563
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
345
564
|
}
|
346
|
-
}]);
|
347
|
-
return Specimen;
|
348
|
-
}();
|
349
|
-
|
350
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
351
|
-
|
352
|
-
/** Used as references for various `Number` constants. */
|
353
|
-
var NAN = 0 / 0;
|
354
|
-
|
355
|
-
/** `Object#toString` result references. */
|
356
|
-
var symbolTag = '[object Symbol]';
|
357
|
-
|
358
|
-
/** Used to match leading and trailing whitespace. */
|
359
|
-
var reTrim = /^\s+|\s+$/g;
|
360
|
-
|
361
|
-
/** Used to detect bad signed hexadecimal string values. */
|
362
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
363
|
-
|
364
|
-
/** Used to detect binary string values. */
|
365
|
-
var reIsBinary = /^0b[01]+$/i;
|
366
|
-
|
367
|
-
/** Used to detect octal string values. */
|
368
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
369
|
-
|
370
|
-
/** Built-in method references without a dependency on `root`. */
|
371
|
-
var freeParseInt = parseInt;
|
372
|
-
|
373
|
-
/** Detect free variable `global` from Node.js. */
|
374
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
375
|
-
|
376
|
-
/** Detect free variable `self`. */
|
377
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
378
|
-
|
379
|
-
/** Used as a reference to the global object. */
|
380
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
381
|
-
|
382
|
-
/** Used for built-in method references. */
|
383
|
-
var objectProto = Object.prototype;
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Used to resolve the
|
387
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
388
|
-
* of values.
|
389
|
-
*/
|
390
|
-
var objectToString = objectProto.toString;
|
391
|
-
|
392
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
393
|
-
var nativeMax = Math.max;
|
394
|
-
var nativeMin = Math.min;
|
395
|
-
|
396
|
-
/**
|
397
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
398
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
399
|
-
*
|
400
|
-
* @static
|
401
|
-
* @memberOf _
|
402
|
-
* @since 2.4.0
|
403
|
-
* @category Date
|
404
|
-
* @returns {number} Returns the timestamp.
|
405
|
-
* @example
|
406
|
-
*
|
407
|
-
* _.defer(function(stamp) {
|
408
|
-
* console.log(_.now() - stamp);
|
409
|
-
* }, _.now());
|
410
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
411
|
-
*/
|
412
|
-
var now = function() {
|
413
|
-
return root.Date.now();
|
414
|
-
};
|
415
|
-
|
416
|
-
/**
|
417
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
418
|
-
* milliseconds have elapsed since the last time the debounced function was
|
419
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
420
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
421
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
422
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
423
|
-
* with the last arguments provided to the debounced function. Subsequent
|
424
|
-
* calls to the debounced function return the result of the last `func`
|
425
|
-
* invocation.
|
426
|
-
*
|
427
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
428
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
429
|
-
* is invoked more than once during the `wait` timeout.
|
430
|
-
*
|
431
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
432
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
433
|
-
*
|
434
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
435
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
436
|
-
*
|
437
|
-
* @static
|
438
|
-
* @memberOf _
|
439
|
-
* @since 0.1.0
|
440
|
-
* @category Function
|
441
|
-
* @param {Function} func The function to debounce.
|
442
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
443
|
-
* @param {Object} [options={}] The options object.
|
444
|
-
* @param {boolean} [options.leading=false]
|
445
|
-
* Specify invoking on the leading edge of the timeout.
|
446
|
-
* @param {number} [options.maxWait]
|
447
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
448
|
-
* @param {boolean} [options.trailing=true]
|
449
|
-
* Specify invoking on the trailing edge of the timeout.
|
450
|
-
* @returns {Function} Returns the new debounced function.
|
451
|
-
* @example
|
452
|
-
*
|
453
|
-
* // Avoid costly calculations while the window size is in flux.
|
454
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
455
|
-
*
|
456
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
457
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
458
|
-
* 'leading': true,
|
459
|
-
* 'trailing': false
|
460
|
-
* }));
|
461
|
-
*
|
462
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
463
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
464
|
-
* var source = new EventSource('/stream');
|
465
|
-
* jQuery(source).on('message', debounced);
|
466
|
-
*
|
467
|
-
* // Cancel the trailing debounced invocation.
|
468
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
469
|
-
*/
|
470
|
-
function debounce(func, wait, options) {
|
471
|
-
var lastArgs,
|
472
|
-
lastThis,
|
473
|
-
maxWait,
|
474
|
-
result,
|
475
|
-
timerId,
|
476
|
-
lastCallTime,
|
477
|
-
lastInvokeTime = 0,
|
478
|
-
leading = false,
|
479
|
-
maxing = false,
|
480
|
-
trailing = true;
|
481
|
-
|
482
|
-
if (typeof func != 'function') {
|
483
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
484
|
-
}
|
485
|
-
wait = toNumber(wait) || 0;
|
486
|
-
if (isObject(options)) {
|
487
|
-
leading = !!options.leading;
|
488
|
-
maxing = 'maxWait' in options;
|
489
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
490
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
491
|
-
}
|
492
565
|
|
493
|
-
|
494
|
-
|
495
|
-
|
566
|
+
function invokeFunc(time) {
|
567
|
+
var args = lastArgs,
|
568
|
+
thisArg = lastThis;
|
496
569
|
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
570
|
+
lastArgs = lastThis = undefined;
|
571
|
+
lastInvokeTime = time;
|
572
|
+
result = func.apply(thisArg, args);
|
573
|
+
return result;
|
574
|
+
}
|
502
575
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
576
|
+
function leadingEdge(time) {
|
577
|
+
// Reset any `maxWait` timer.
|
578
|
+
lastInvokeTime = time;
|
579
|
+
// Start the timer for the trailing edge.
|
580
|
+
timerId = setTimeout(timerExpired, wait);
|
581
|
+
// Invoke the leading edge.
|
582
|
+
return leading ? invokeFunc(time) : result;
|
583
|
+
}
|
511
584
|
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
585
|
+
function remainingWait(time) {
|
586
|
+
var timeSinceLastCall = time - lastCallTime,
|
587
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
588
|
+
result = wait - timeSinceLastCall;
|
516
589
|
|
517
|
-
|
518
|
-
|
590
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
591
|
+
}
|
519
592
|
|
520
|
-
|
521
|
-
|
522
|
-
|
593
|
+
function shouldInvoke(time) {
|
594
|
+
var timeSinceLastCall = time - lastCallTime,
|
595
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
523
596
|
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
597
|
+
// Either this is the first call, activity has stopped and we're at the
|
598
|
+
// trailing edge, the system time has gone backwards and we're treating
|
599
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
600
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
601
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
602
|
+
}
|
530
603
|
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
604
|
+
function timerExpired() {
|
605
|
+
var time = now();
|
606
|
+
if (shouldInvoke(time)) {
|
607
|
+
return trailingEdge(time);
|
608
|
+
}
|
609
|
+
// Restart the timer.
|
610
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
535
611
|
}
|
536
|
-
// Restart the timer.
|
537
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
538
|
-
}
|
539
612
|
|
540
|
-
|
541
|
-
|
613
|
+
function trailingEdge(time) {
|
614
|
+
timerId = undefined;
|
542
615
|
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
616
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
617
|
+
// debounced at least once.
|
618
|
+
if (trailing && lastArgs) {
|
619
|
+
return invokeFunc(time);
|
620
|
+
}
|
621
|
+
lastArgs = lastThis = undefined;
|
622
|
+
return result;
|
547
623
|
}
|
548
|
-
lastArgs = lastThis = undefined;
|
549
|
-
return result;
|
550
|
-
}
|
551
624
|
|
552
|
-
|
553
|
-
|
554
|
-
|
625
|
+
function cancel() {
|
626
|
+
if (timerId !== undefined) {
|
627
|
+
clearTimeout(timerId);
|
628
|
+
}
|
629
|
+
lastInvokeTime = 0;
|
630
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
555
631
|
}
|
556
|
-
lastInvokeTime = 0;
|
557
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
558
|
-
}
|
559
632
|
|
560
|
-
|
561
|
-
|
562
|
-
|
633
|
+
function flush() {
|
634
|
+
return timerId === undefined ? result : trailingEdge(now());
|
635
|
+
}
|
563
636
|
|
564
|
-
|
565
|
-
|
566
|
-
|
637
|
+
function debounced() {
|
638
|
+
var time = now(),
|
639
|
+
isInvoking = shouldInvoke(time);
|
567
640
|
|
568
|
-
|
569
|
-
|
570
|
-
|
641
|
+
lastArgs = arguments;
|
642
|
+
lastThis = this;
|
643
|
+
lastCallTime = time;
|
571
644
|
|
572
|
-
|
573
|
-
|
574
|
-
|
645
|
+
if (isInvoking) {
|
646
|
+
if (timerId === undefined) {
|
647
|
+
return leadingEdge(lastCallTime);
|
648
|
+
}
|
649
|
+
if (maxing) {
|
650
|
+
// Handle invocations in a tight loop.
|
651
|
+
timerId = setTimeout(timerExpired, wait);
|
652
|
+
return invokeFunc(lastCallTime);
|
653
|
+
}
|
575
654
|
}
|
576
|
-
if (
|
577
|
-
// Handle invocations in a tight loop.
|
655
|
+
if (timerId === undefined) {
|
578
656
|
timerId = setTimeout(timerExpired, wait);
|
579
|
-
return invokeFunc(lastCallTime);
|
580
657
|
}
|
658
|
+
return result;
|
581
659
|
}
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
return result;
|
586
|
-
}
|
587
|
-
debounced.cancel = cancel;
|
588
|
-
debounced.flush = flush;
|
589
|
-
return debounced;
|
590
|
-
}
|
591
|
-
|
592
|
-
/**
|
593
|
-
* Checks if `value` is the
|
594
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
595
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
596
|
-
*
|
597
|
-
* @static
|
598
|
-
* @memberOf _
|
599
|
-
* @since 0.1.0
|
600
|
-
* @category Lang
|
601
|
-
* @param {*} value The value to check.
|
602
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
603
|
-
* @example
|
604
|
-
*
|
605
|
-
* _.isObject({});
|
606
|
-
* // => true
|
607
|
-
*
|
608
|
-
* _.isObject([1, 2, 3]);
|
609
|
-
* // => true
|
610
|
-
*
|
611
|
-
* _.isObject(_.noop);
|
612
|
-
* // => true
|
613
|
-
*
|
614
|
-
* _.isObject(null);
|
615
|
-
* // => false
|
616
|
-
*/
|
617
|
-
function isObject(value) {
|
618
|
-
var type = typeof value;
|
619
|
-
return !!value && (type == 'object' || type == 'function');
|
620
|
-
}
|
621
|
-
|
622
|
-
/**
|
623
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
624
|
-
* and has a `typeof` result of "object".
|
625
|
-
*
|
626
|
-
* @static
|
627
|
-
* @memberOf _
|
628
|
-
* @since 4.0.0
|
629
|
-
* @category Lang
|
630
|
-
* @param {*} value The value to check.
|
631
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
632
|
-
* @example
|
633
|
-
*
|
634
|
-
* _.isObjectLike({});
|
635
|
-
* // => true
|
636
|
-
*
|
637
|
-
* _.isObjectLike([1, 2, 3]);
|
638
|
-
* // => true
|
639
|
-
*
|
640
|
-
* _.isObjectLike(_.noop);
|
641
|
-
* // => false
|
642
|
-
*
|
643
|
-
* _.isObjectLike(null);
|
644
|
-
* // => false
|
645
|
-
*/
|
646
|
-
function isObjectLike(value) {
|
647
|
-
return !!value && typeof value == 'object';
|
648
|
-
}
|
649
|
-
|
650
|
-
/**
|
651
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
652
|
-
*
|
653
|
-
* @static
|
654
|
-
* @memberOf _
|
655
|
-
* @since 4.0.0
|
656
|
-
* @category Lang
|
657
|
-
* @param {*} value The value to check.
|
658
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
659
|
-
* @example
|
660
|
-
*
|
661
|
-
* _.isSymbol(Symbol.iterator);
|
662
|
-
* // => true
|
663
|
-
*
|
664
|
-
* _.isSymbol('abc');
|
665
|
-
* // => false
|
666
|
-
*/
|
667
|
-
function isSymbol(value) {
|
668
|
-
return typeof value == 'symbol' ||
|
669
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
670
|
-
}
|
671
|
-
|
672
|
-
/**
|
673
|
-
* Converts `value` to a number.
|
674
|
-
*
|
675
|
-
* @static
|
676
|
-
* @memberOf _
|
677
|
-
* @since 4.0.0
|
678
|
-
* @category Lang
|
679
|
-
* @param {*} value The value to process.
|
680
|
-
* @returns {number} Returns the number.
|
681
|
-
* @example
|
682
|
-
*
|
683
|
-
* _.toNumber(3.2);
|
684
|
-
* // => 3.2
|
685
|
-
*
|
686
|
-
* _.toNumber(Number.MIN_VALUE);
|
687
|
-
* // => 5e-324
|
688
|
-
*
|
689
|
-
* _.toNumber(Infinity);
|
690
|
-
* // => Infinity
|
691
|
-
*
|
692
|
-
* _.toNumber('3.2');
|
693
|
-
* // => 3.2
|
694
|
-
*/
|
695
|
-
function toNumber(value) {
|
696
|
-
if (typeof value == 'number') {
|
697
|
-
return value;
|
698
|
-
}
|
699
|
-
if (isSymbol(value)) {
|
700
|
-
return NAN;
|
701
|
-
}
|
702
|
-
if (isObject(value)) {
|
703
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
704
|
-
value = isObject(other) ? (other + '') : other;
|
705
|
-
}
|
706
|
-
if (typeof value != 'string') {
|
707
|
-
return value === 0 ? value : +value;
|
660
|
+
debounced.cancel = cancel;
|
661
|
+
debounced.flush = flush;
|
662
|
+
return debounced;
|
708
663
|
}
|
709
|
-
value = value.replace(reTrim, '');
|
710
|
-
var isBinary = reIsBinary.test(value);
|
711
|
-
return (isBinary || reIsOctal.test(value))
|
712
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
713
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
714
|
-
}
|
715
664
|
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
665
|
+
/**
|
666
|
+
* Checks if `value` is the
|
667
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
668
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
669
|
+
*
|
670
|
+
* @static
|
671
|
+
* @memberOf _
|
672
|
+
* @since 0.1.0
|
673
|
+
* @category Lang
|
674
|
+
* @param {*} value The value to check.
|
675
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
676
|
+
* @example
|
677
|
+
*
|
678
|
+
* _.isObject({});
|
679
|
+
* // => true
|
680
|
+
*
|
681
|
+
* _.isObject([1, 2, 3]);
|
682
|
+
* // => true
|
683
|
+
*
|
684
|
+
* _.isObject(_.noop);
|
685
|
+
* // => true
|
686
|
+
*
|
687
|
+
* _.isObject(null);
|
688
|
+
* // => false
|
689
|
+
*/
|
690
|
+
function isObject(value) {
|
691
|
+
var type = typeof value;
|
692
|
+
return !!value && (type == 'object' || type == 'function');
|
732
693
|
}
|
733
694
|
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
695
|
+
/**
|
696
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
697
|
+
* and has a `typeof` result of "object".
|
698
|
+
*
|
699
|
+
* @static
|
700
|
+
* @memberOf _
|
701
|
+
* @since 4.0.0
|
702
|
+
* @category Lang
|
703
|
+
* @param {*} value The value to check.
|
704
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
705
|
+
* @example
|
706
|
+
*
|
707
|
+
* _.isObjectLike({});
|
708
|
+
* // => true
|
709
|
+
*
|
710
|
+
* _.isObjectLike([1, 2, 3]);
|
711
|
+
* // => true
|
712
|
+
*
|
713
|
+
* _.isObjectLike(_.noop);
|
714
|
+
* // => false
|
715
|
+
*
|
716
|
+
* _.isObjectLike(null);
|
717
|
+
* // => false
|
718
|
+
*/
|
719
|
+
function isObjectLike(value) {
|
720
|
+
return !!value && typeof value == 'object';
|
721
|
+
}
|
738
722
|
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
723
|
+
/**
|
724
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
725
|
+
*
|
726
|
+
* @static
|
727
|
+
* @memberOf _
|
728
|
+
* @since 4.0.0
|
729
|
+
* @category Lang
|
730
|
+
* @param {*} value The value to check.
|
731
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
732
|
+
* @example
|
733
|
+
*
|
734
|
+
* _.isSymbol(Symbol.iterator);
|
735
|
+
* // => true
|
736
|
+
*
|
737
|
+
* _.isSymbol('abc');
|
738
|
+
* // => false
|
739
|
+
*/
|
740
|
+
function isSymbol(value) {
|
741
|
+
return typeof value == 'symbol' ||
|
742
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
743
|
+
}
|
744
744
|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
745
|
+
/**
|
746
|
+
* Converts `value` to a number.
|
747
|
+
*
|
748
|
+
* @static
|
749
|
+
* @memberOf _
|
750
|
+
* @since 4.0.0
|
751
|
+
* @category Lang
|
752
|
+
* @param {*} value The value to process.
|
753
|
+
* @returns {number} Returns the number.
|
754
|
+
* @example
|
755
|
+
*
|
756
|
+
* _.toNumber(3.2);
|
757
|
+
* // => 3.2
|
758
|
+
*
|
759
|
+
* _.toNumber(Number.MIN_VALUE);
|
760
|
+
* // => 5e-324
|
761
|
+
*
|
762
|
+
* _.toNumber(Infinity);
|
763
|
+
* // => Infinity
|
764
|
+
*
|
765
|
+
* _.toNumber('3.2');
|
766
|
+
* // => 3.2
|
767
|
+
*/
|
768
|
+
function toNumber(value) {
|
769
|
+
if (typeof value == 'number') {
|
770
|
+
return value;
|
752
771
|
}
|
753
|
-
|
754
|
-
|
755
|
-
value: function hide() {
|
756
|
-
this.element.classList.add(HIDDEN_CLASS);
|
772
|
+
if (isSymbol(value)) {
|
773
|
+
return NAN;
|
757
774
|
}
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
this.logMenuElement.classList.remove(HIDDEN_CLASS);
|
775
|
+
if (isObject(value)) {
|
776
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
777
|
+
value = isObject(other) ? (other + '') : other;
|
762
778
|
}
|
763
|
-
|
764
|
-
|
765
|
-
value: function toggleLogMenu() {
|
766
|
-
this.logMenuElement.classList.toggle(HIDDEN_CLASS);
|
779
|
+
if (typeof value != 'string') {
|
780
|
+
return value === 0 ? value : +value;
|
767
781
|
}
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
782
|
+
value = value.replace(reTrim, '');
|
783
|
+
var isBinary = reIsBinary.test(value);
|
784
|
+
return (isBinary || reIsOctal.test(value))
|
785
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
786
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
787
|
+
}
|
772
788
|
|
773
|
-
|
774
|
-
div.setAttribute('id', 'copy-tuner-bar-log-menu');
|
775
|
-
div.classList.add(HIDDEN_CLASS);
|
789
|
+
var lodash_debounce = debounce;
|
776
790
|
|
777
|
-
|
778
|
-
var tbody = document.createElement('tbody');
|
779
|
-
tbody.classList.remove('is-not-initialized');
|
791
|
+
var HIDDEN_CLASS = 'copy-tuner-hidden';
|
780
792
|
|
781
|
-
|
782
|
-
|
793
|
+
var CopytunerBar = function () {
|
794
|
+
function CopytunerBar(element, data, callback) {
|
795
|
+
classCallCheck(this, CopytunerBar);
|
783
796
|
|
784
|
-
|
785
|
-
|
786
|
-
|
797
|
+
this.element = element;
|
798
|
+
this.data = data;
|
799
|
+
this.callback = callback;
|
800
|
+
this.searchBoxElement = element.querySelector('.js-copy-tuner-bar-search');
|
801
|
+
this.logMenuElement = this.makeLogMenu();
|
802
|
+
this.element.appendChild(this.logMenuElement);
|
787
803
|
|
788
|
-
|
789
|
-
|
790
|
-
var td2 = document.createElement('td');
|
791
|
-
td2.textContent = value;
|
792
|
-
var tr = document.createElement('tr');
|
793
|
-
tr.classList.add('copy-tuner-bar-log-menu__row');
|
794
|
-
tr.dataset.key = key;
|
804
|
+
this.addHandler();
|
805
|
+
}
|
795
806
|
|
796
|
-
|
797
|
-
|
807
|
+
createClass(CopytunerBar, [{
|
808
|
+
key: 'addHandler',
|
809
|
+
value: function addHandler() {
|
810
|
+
var _this = this;
|
798
811
|
|
799
|
-
|
812
|
+
var openLogButton = this.element.querySelector('.js-copy-tuner-bar-open-log');
|
813
|
+
openLogButton.addEventListener('click', function (event) {
|
814
|
+
event.preventDefault();
|
815
|
+
_this.toggleLogMenu();
|
800
816
|
});
|
801
817
|
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
818
|
+
this.searchBoxElement.addEventListener('input', lodash_debounce(this.onKeyup.bind(this), 250));
|
819
|
+
}
|
820
|
+
}, {
|
821
|
+
key: 'show',
|
822
|
+
value: function show() {
|
823
|
+
this.element.classList.remove(HIDDEN_CLASS);
|
824
|
+
this.searchBoxElement.focus();
|
825
|
+
}
|
826
|
+
}, {
|
827
|
+
key: 'hide',
|
828
|
+
value: function hide() {
|
829
|
+
this.element.classList.add(HIDDEN_CLASS);
|
830
|
+
}
|
831
|
+
}, {
|
832
|
+
key: 'showLogMenu',
|
833
|
+
value: function showLogMenu() {
|
834
|
+
this.logMenuElement.classList.remove(HIDDEN_CLASS);
|
835
|
+
}
|
836
|
+
}, {
|
837
|
+
key: 'toggleLogMenu',
|
838
|
+
value: function toggleLogMenu() {
|
839
|
+
this.logMenuElement.classList.toggle(HIDDEN_CLASS);
|
840
|
+
}
|
841
|
+
}, {
|
842
|
+
key: 'makeLogMenu',
|
843
|
+
value: function makeLogMenu() {
|
844
|
+
var _this2 = this;
|
845
|
+
|
846
|
+
var div = document.createElement('div');
|
847
|
+
div.setAttribute('id', 'copy-tuner-bar-log-menu');
|
848
|
+
div.classList.add(HIDDEN_CLASS);
|
849
|
+
|
850
|
+
var table = document.createElement('table');
|
851
|
+
var tbody = document.createElement('tbody');
|
852
|
+
tbody.classList.remove('is-not-initialized');
|
853
|
+
|
854
|
+
Object.keys(this.data).sort().forEach(function (key) {
|
855
|
+
var value = _this2.data[key];
|
856
|
+
|
857
|
+
if (value === '') {
|
858
|
+
return;
|
859
|
+
}
|
860
|
+
|
861
|
+
var td1 = document.createElement('td');
|
862
|
+
td1.textContent = key;
|
863
|
+
var td2 = document.createElement('td');
|
864
|
+
td2.textContent = value;
|
865
|
+
var tr = document.createElement('tr');
|
866
|
+
tr.classList.add('copy-tuner-bar-log-menu__row');
|
867
|
+
tr.dataset.key = key;
|
868
|
+
|
869
|
+
tr.addEventListener('click', function (_ref) {
|
870
|
+
var currentTarget = _ref.currentTarget;
|
871
|
+
|
872
|
+
_this2.callback(currentTarget.dataset.key);
|
873
|
+
});
|
874
|
+
|
875
|
+
tr.appendChild(td1);
|
876
|
+
tr.appendChild(td2);
|
877
|
+
tbody.appendChild(tr);
|
878
|
+
});
|
806
879
|
|
807
|
-
|
808
|
-
|
880
|
+
table.appendChild(tbody);
|
881
|
+
div.appendChild(table);
|
809
882
|
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
883
|
+
return div;
|
884
|
+
}
|
885
|
+
}, {
|
886
|
+
key: 'onKeyup',
|
887
|
+
value: function onKeyup(_ref2) {
|
888
|
+
var target = _ref2.target;
|
816
889
|
|
817
|
-
|
818
|
-
|
890
|
+
var keyword = target.value.trim();
|
891
|
+
this.showLogMenu();
|
819
892
|
|
820
|
-
|
893
|
+
var rows = Array.from(this.logMenuElement.getElementsByTagName('tr'));
|
821
894
|
|
822
|
-
|
823
|
-
|
824
|
-
|
895
|
+
rows.forEach(function (row) {
|
896
|
+
var isShow = keyword === '' || Array.from(row.getElementsByTagName('td')).some(function (td) {
|
897
|
+
return td.textContent.includes(keyword);
|
898
|
+
});
|
899
|
+
row.classList.toggle(HIDDEN_CLASS, !isShow);
|
825
900
|
});
|
826
|
-
|
827
|
-
|
901
|
+
}
|
902
|
+
}]);
|
903
|
+
return CopytunerBar;
|
904
|
+
}();
|
905
|
+
|
906
|
+
var findBlurbs = function findBlurbs() {
|
907
|
+
var filterNone = function filterNone() {
|
908
|
+
return NodeFilter.FILTER_ACCEPT;
|
909
|
+
};
|
910
|
+
|
911
|
+
var iterator = document.createNodeIterator(document.body, NodeFilter.SHOW_COMMENT, filterNone, false);
|
912
|
+
|
913
|
+
var comments = [];
|
914
|
+
var curNode = void 0;
|
915
|
+
// eslint-disable-next-line no-cond-assign
|
916
|
+
while (curNode = iterator.nextNode()) {
|
917
|
+
comments.push(curNode);
|
828
918
|
}
|
829
|
-
}]);
|
830
|
-
return CopytunerBar;
|
831
|
-
}();
|
832
919
|
|
833
|
-
|
834
|
-
|
835
|
-
|
920
|
+
return comments.filter(function (comment) {
|
921
|
+
return comment.nodeValue.startsWith('COPYRAY');
|
922
|
+
}).map(function (comment) {
|
923
|
+
var _comment$nodeValue$ma = comment.nodeValue.match(/^COPYRAY (\S*)$/),
|
924
|
+
_comment$nodeValue$ma2 = slicedToArray(_comment$nodeValue$ma, 2),
|
925
|
+
key = _comment$nodeValue$ma2[1];
|
926
|
+
|
927
|
+
var element = comment.parentNode;
|
928
|
+
return { key: key, element: element };
|
929
|
+
});
|
836
930
|
};
|
837
931
|
|
838
|
-
var
|
932
|
+
var Copyray = function () {
|
933
|
+
function Copyray(baseUrl, data) {
|
934
|
+
classCallCheck(this, Copyray);
|
839
935
|
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
936
|
+
this.baseUrl = baseUrl;
|
937
|
+
this.data = data;
|
938
|
+
this.isShowing = false;
|
939
|
+
this.specimens = [];
|
940
|
+
this.overlay = this.makeOverlay();
|
941
|
+
this.toggleButton = this.makeToggleButton();
|
942
|
+
this.boundOpen = this.open.bind(this);
|
846
943
|
|
847
|
-
|
848
|
-
|
849
|
-
}).map(function (comment) {
|
850
|
-
var _comment$nodeValue$ma = comment.nodeValue.match(/^COPYRAY (\S*)$/),
|
851
|
-
_comment$nodeValue$ma2 = slicedToArray(_comment$nodeValue$ma, 2),
|
852
|
-
key = _comment$nodeValue$ma2[1];
|
853
|
-
|
854
|
-
var element = comment.parentNode;
|
855
|
-
return { key: key, element: element };
|
856
|
-
});
|
857
|
-
};
|
858
|
-
|
859
|
-
var Copyray = function () {
|
860
|
-
function Copyray(baseUrl, data) {
|
861
|
-
classCallCheck(this, Copyray);
|
862
|
-
|
863
|
-
this.baseUrl = baseUrl;
|
864
|
-
this.data = data;
|
865
|
-
this.isShowing = false;
|
866
|
-
this.specimens = [];
|
867
|
-
this.overlay = this.makeOverlay();
|
868
|
-
this.toggleButton = this.makeToggleButton();
|
869
|
-
this.boundOpen = this.open.bind(this);
|
870
|
-
|
871
|
-
this.copyTunerBar = new CopytunerBar(document.getElementById('copy-tuner-bar'), this.data, this.boundOpen);
|
872
|
-
}
|
944
|
+
this.copyTunerBar = new CopytunerBar(document.getElementById('copy-tuner-bar'), this.data, this.boundOpen);
|
945
|
+
}
|
873
946
|
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
947
|
+
createClass(Copyray, [{
|
948
|
+
key: 'show',
|
949
|
+
value: function show() {
|
950
|
+
this.reset();
|
878
951
|
|
879
|
-
|
880
|
-
|
952
|
+
document.body.appendChild(this.overlay);
|
953
|
+
this.makeSpecimens();
|
881
954
|
|
882
|
-
|
883
|
-
|
884
|
-
|
955
|
+
this.specimens.forEach(function (specimen) {
|
956
|
+
specimen.show();
|
957
|
+
});
|
885
958
|
|
886
|
-
|
887
|
-
|
888
|
-
}
|
889
|
-
}, {
|
890
|
-
key: 'hide',
|
891
|
-
value: function hide() {
|
892
|
-
this.overlay.remove();
|
893
|
-
this.reset();
|
894
|
-
this.copyTunerBar.hide();
|
895
|
-
this.isShowing = false;
|
896
|
-
}
|
897
|
-
}, {
|
898
|
-
key: 'toggle',
|
899
|
-
value: function toggle() {
|
900
|
-
if (this.isShowing) {
|
901
|
-
this.hide();
|
902
|
-
} else {
|
903
|
-
this.show();
|
959
|
+
this.copyTunerBar.show();
|
960
|
+
this.isShowing = true;
|
904
961
|
}
|
905
|
-
}
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
962
|
+
}, {
|
963
|
+
key: 'hide',
|
964
|
+
value: function hide() {
|
965
|
+
this.overlay.remove();
|
966
|
+
this.reset();
|
967
|
+
this.copyTunerBar.hide();
|
968
|
+
this.isShowing = false;
|
969
|
+
}
|
970
|
+
}, {
|
971
|
+
key: 'toggle',
|
972
|
+
value: function toggle() {
|
973
|
+
if (this.isShowing) {
|
974
|
+
this.hide();
|
975
|
+
} else {
|
976
|
+
this.show();
|
977
|
+
}
|
978
|
+
}
|
979
|
+
}, {
|
980
|
+
key: 'open',
|
981
|
+
value: function open(key) {
|
982
|
+
var url = this.baseUrl + '/blurbs/' + key + '/edit';
|
983
|
+
window.open(url, null, 'width=700, height=600');
|
984
|
+
}
|
985
|
+
}, {
|
986
|
+
key: 'makeSpecimens',
|
987
|
+
value: function makeSpecimens() {
|
988
|
+
var _this = this;
|
916
989
|
|
917
|
-
|
918
|
-
|
919
|
-
|
990
|
+
findBlurbs().forEach(function (_ref) {
|
991
|
+
var element = _ref.element,
|
992
|
+
key = _ref.key;
|
920
993
|
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
994
|
+
_this.specimens.push(new Specimen(element, key, _this.boundOpen));
|
995
|
+
});
|
996
|
+
}
|
997
|
+
}, {
|
998
|
+
key: 'makeToggleButton',
|
999
|
+
value: function makeToggleButton() {
|
1000
|
+
var _this2 = this;
|
928
1001
|
|
929
|
-
|
1002
|
+
var element = document.createElement('a');
|
930
1003
|
|
931
|
-
|
932
|
-
|
933
|
-
|
1004
|
+
element.addEventListener('click', function () {
|
1005
|
+
_this2.show();
|
1006
|
+
});
|
934
1007
|
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1008
|
+
element.classList.add('copyray-toggle-button');
|
1009
|
+
element.classList.add('hidden-on-mobile');
|
1010
|
+
element.textContent = 'Open CopyTuner';
|
1011
|
+
document.body.appendChild(element);
|
939
1012
|
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
}();
|
964
|
-
|
965
|
-
var start = function start() {
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
1013
|
+
return element;
|
1014
|
+
}
|
1015
|
+
}, {
|
1016
|
+
key: 'makeOverlay',
|
1017
|
+
value: function makeOverlay() {
|
1018
|
+
var _this3 = this;
|
1019
|
+
|
1020
|
+
var div = document.createElement('div');
|
1021
|
+
div.setAttribute('id', 'copyray-overlay');
|
1022
|
+
div.addEventListener('click', function () {
|
1023
|
+
return _this3.hide();
|
1024
|
+
});
|
1025
|
+
return div;
|
1026
|
+
}
|
1027
|
+
}, {
|
1028
|
+
key: 'reset',
|
1029
|
+
value: function reset() {
|
1030
|
+
this.specimens.forEach(function (specimen) {
|
1031
|
+
specimen.remove();
|
1032
|
+
});
|
1033
|
+
}
|
1034
|
+
}]);
|
1035
|
+
return Copyray;
|
1036
|
+
}();
|
1037
|
+
|
1038
|
+
var start = function start() {
|
1039
|
+
var dataElement = document.getElementById('copy-tuner-data');
|
1040
|
+
var copyTunerUrl = dataElement.dataset.copyTunerUrl;
|
1041
|
+
var data = JSON.parse(document.getElementById('copy-tuner-data').dataset.copyTunerTranslationLog);
|
1042
|
+
var copyray = new Copyray(copyTunerUrl, data);
|
1043
|
+
|
1044
|
+
document.addEventListener('keydown', function (event) {
|
1045
|
+
if (copyray.isShowing && event.keyCode === keycodeJs.KEY_ESCAPE) {
|
1046
|
+
copyray.hide();
|
1047
|
+
return;
|
1048
|
+
}
|
976
1049
|
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
1050
|
+
if ((isMac && event.metaKey || !isMac && event.ctrlKey) && event.shiftKey && event.keyCode === keycodeJs.KEY_K) {
|
1051
|
+
copyray.toggle();
|
1052
|
+
}
|
1053
|
+
});
|
981
1054
|
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
1055
|
+
if (console) {
|
1056
|
+
// eslint-disable-next-line no-console
|
1057
|
+
console.log('Ready to Copyray. Press ' + (isMac ? 'cmd+shift+k' : 'ctrl+shift+k') + ' to scan your UI.');
|
1058
|
+
}
|
986
1059
|
|
987
|
-
|
988
|
-
};
|
1060
|
+
window.copyray = copyray;
|
1061
|
+
};
|
989
1062
|
|
990
|
-
if (document.readyState === 'complete' || document.readyState !== 'loading') {
|
991
|
-
|
992
|
-
} else {
|
993
|
-
|
994
|
-
}
|
1063
|
+
if (document.readyState === 'complete' || document.readyState !== 'loading') {
|
1064
|
+
start();
|
1065
|
+
} else {
|
1066
|
+
document.addEventListener('DOMContentLoaded', start);
|
1067
|
+
}
|
995
1068
|
|
996
1069
|
}());
|