copy_tuner_client 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +3 -1
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/copytuner.js +186 -323
- data/copy_tuner_client.gemspec +1 -1
- data/lib/copy_tuner_client/version.rb +1 -1
- data/package.json +3 -3
- data/yarn.lock +978 -689
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375dbe69369421e9f764466f5b92f63b3eacda2235ddc0a42892620ae6474342
|
4
|
+
data.tar.gz: '07638a3f438bee6a23fa8fa3109cd620585821f417c15693bfcac4589ca053d0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc8bee8ccf7f8668e3d7abb146fe568692a0e765d9fad2bc9137185d34115703a342e2bdd79a5db3a3a0a45e5fabeedd1d70cffa7fc70fc9bd5d81c28cddd3e0
|
7
|
+
data.tar.gz: 15f30baf267916980605c002524e07818e66aa7dcec62173c9c907acf54e849302862b05cf245bd3cb065668b67dcf39bb0636b62a499af709d99d2c58fdada8
|
data/.github/workflows/rspec.yml
CHANGED
@@ -22,11 +22,13 @@ jobs:
|
|
22
22
|
strategy:
|
23
23
|
fail-fast: false
|
24
24
|
matrix:
|
25
|
-
ruby: [
|
25
|
+
ruby: ["3.0", 3.1, 3.2]
|
26
26
|
gemfile: ["6.1", "7.0", "main"]
|
27
27
|
exclude:
|
28
28
|
- ruby: "3.1"
|
29
29
|
gemfile: "6.1"
|
30
|
+
- ruby: "3.2"
|
31
|
+
gemfile: "6.1"
|
30
32
|
steps:
|
31
33
|
- name: Install packages
|
32
34
|
run: |
|
data/CHANGELOG.md
CHANGED
@@ -1,389 +1,252 @@
|
|
1
|
-
var
|
2
|
-
|
3
|
-
var NAN = 0 / 0;
|
4
|
-
var symbolTag = "[object Symbol]";
|
5
|
-
var reTrim = /^\s+|\s+$/g;
|
6
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
7
|
-
var reIsBinary = /^0b[01]+$/i;
|
8
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
9
|
-
var freeParseInt = parseInt;
|
10
|
-
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
11
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
12
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
13
|
-
var objectProto = Object.prototype;
|
14
|
-
var objectToString = objectProto.toString;
|
15
|
-
var nativeMax = Math.max, nativeMin = Math.min;
|
16
|
-
var now = function() {
|
17
|
-
return root.Date.now();
|
1
|
+
var y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, A = "Expected a function", C = 0 / 0, _ = "[object Symbol]", $ = /^\s+|\s+$/g, R = /^[-+]0x[0-9a-f]+$/i, H = /^0b[01]+$/i, W = /^0o[0-7]+$/i, F = parseInt, D = typeof y == "object" && y && y.Object === Object && y, P = typeof self == "object" && self && self.Object === Object && self, q = D || P || Function("return this")(), K = Object.prototype, U = K.toString, Y = Math.max, V = Math.min, v = function() {
|
2
|
+
return q.Date.now();
|
18
3
|
};
|
19
|
-
function
|
20
|
-
var
|
21
|
-
if (typeof
|
22
|
-
throw new TypeError(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
31
|
-
function
|
32
|
-
var
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
function
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}
|
66
|
-
function cancel() {
|
67
|
-
if (timerId !== void 0) {
|
68
|
-
clearTimeout(timerId);
|
69
|
-
}
|
70
|
-
lastInvokeTime = 0;
|
71
|
-
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
72
|
-
}
|
73
|
-
function flush() {
|
74
|
-
return timerId === void 0 ? result : trailingEdge(now());
|
75
|
-
}
|
76
|
-
function debounced() {
|
77
|
-
var time = now(), isInvoking = shouldInvoke(time);
|
78
|
-
lastArgs = arguments;
|
79
|
-
lastThis = this;
|
80
|
-
lastCallTime = time;
|
81
|
-
if (isInvoking) {
|
82
|
-
if (timerId === void 0) {
|
83
|
-
return leadingEdge(lastCallTime);
|
84
|
-
}
|
85
|
-
if (maxing) {
|
86
|
-
timerId = setTimeout(timerExpired, wait);
|
87
|
-
return invokeFunc(lastCallTime);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
if (timerId === void 0) {
|
91
|
-
timerId = setTimeout(timerExpired, wait);
|
92
|
-
}
|
93
|
-
return result;
|
94
|
-
}
|
95
|
-
debounced.cancel = cancel;
|
96
|
-
debounced.flush = flush;
|
97
|
-
return debounced;
|
4
|
+
function X(t, e, n) {
|
5
|
+
var o, s, d, r, a, c, u = 0, x = !1, f = !1, b = !0;
|
6
|
+
if (typeof t != "function")
|
7
|
+
throw new TypeError(A);
|
8
|
+
e = O(e) || 0, E(n) && (x = !!n.leading, f = "maxWait" in n, d = f ? Y(O(n.maxWait) || 0, e) : d, b = "trailing" in n ? !!n.trailing : b);
|
9
|
+
function g(i) {
|
10
|
+
var l = o, p = s;
|
11
|
+
return o = s = void 0, u = i, r = t.apply(p, l), r;
|
12
|
+
}
|
13
|
+
function B(i) {
|
14
|
+
return u = i, a = setTimeout(m, e), x ? g(i) : r;
|
15
|
+
}
|
16
|
+
function M(i) {
|
17
|
+
var l = i - c, p = i - u, T = e - l;
|
18
|
+
return f ? V(T, d - p) : T;
|
19
|
+
}
|
20
|
+
function w(i) {
|
21
|
+
var l = i - c, p = i - u;
|
22
|
+
return c === void 0 || l >= e || l < 0 || f && p >= d;
|
23
|
+
}
|
24
|
+
function m() {
|
25
|
+
var i = v();
|
26
|
+
if (w(i))
|
27
|
+
return S(i);
|
28
|
+
a = setTimeout(m, M(i));
|
29
|
+
}
|
30
|
+
function S(i) {
|
31
|
+
return a = void 0, b && o ? g(i) : (o = s = void 0, r);
|
32
|
+
}
|
33
|
+
function I() {
|
34
|
+
a !== void 0 && clearTimeout(a), u = 0, o = c = s = a = void 0;
|
35
|
+
}
|
36
|
+
function N() {
|
37
|
+
return a === void 0 ? r : S(v());
|
38
|
+
}
|
39
|
+
function k() {
|
40
|
+
var i = v(), l = w(i);
|
41
|
+
if (o = arguments, s = this, c = i, l) {
|
42
|
+
if (a === void 0)
|
43
|
+
return B(c);
|
44
|
+
if (f)
|
45
|
+
return a = setTimeout(m, e), g(c);
|
46
|
+
}
|
47
|
+
return a === void 0 && (a = setTimeout(m, e)), r;
|
48
|
+
}
|
49
|
+
return k.cancel = I, k.flush = N, k;
|
98
50
|
}
|
99
|
-
function
|
100
|
-
var
|
101
|
-
return !!
|
51
|
+
function E(t) {
|
52
|
+
var e = typeof t;
|
53
|
+
return !!t && (e == "object" || e == "function");
|
102
54
|
}
|
103
|
-
function
|
104
|
-
return !!
|
55
|
+
function z(t) {
|
56
|
+
return !!t && typeof t == "object";
|
105
57
|
}
|
106
|
-
function
|
107
|
-
return typeof
|
58
|
+
function G(t) {
|
59
|
+
return typeof t == "symbol" || z(t) && U.call(t) == _;
|
108
60
|
}
|
109
|
-
function
|
110
|
-
if (typeof
|
111
|
-
return
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
value = value.replace(reTrim, "");
|
124
|
-
var isBinary = reIsBinary.test(value);
|
125
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
61
|
+
function O(t) {
|
62
|
+
if (typeof t == "number")
|
63
|
+
return t;
|
64
|
+
if (G(t))
|
65
|
+
return C;
|
66
|
+
if (E(t)) {
|
67
|
+
var e = typeof t.valueOf == "function" ? t.valueOf() : t;
|
68
|
+
t = E(e) ? e + "" : e;
|
69
|
+
}
|
70
|
+
if (typeof t != "string")
|
71
|
+
return t === 0 ? t : +t;
|
72
|
+
t = t.replace($, "");
|
73
|
+
var n = H.test(t);
|
74
|
+
return n || W.test(t) ? F(t.slice(2), n ? 2 : 8) : R.test(t) ? C : +t;
|
126
75
|
}
|
127
|
-
var
|
128
|
-
const
|
129
|
-
class
|
130
|
-
|
131
|
-
|
132
|
-
this.data =
|
133
|
-
this.callback = callback;
|
134
|
-
this.searchBoxElement = element.querySelector(".js-copy-tuner-bar-search");
|
135
|
-
this.logMenuElement = this.makeLogMenu();
|
136
|
-
this.element.append(this.logMenuElement);
|
137
|
-
this.addHandler();
|
76
|
+
var Z = X;
|
77
|
+
const h = "copy-tuner-hidden";
|
78
|
+
class J {
|
79
|
+
// @ts-expect-error TS7006
|
80
|
+
constructor(e, n, o) {
|
81
|
+
this.element = e, this.data = n, this.callback = o, this.searchBoxElement = e.querySelector(".js-copy-tuner-bar-search"), this.logMenuElement = this.makeLogMenu(), this.element.append(this.logMenuElement), this.addHandler();
|
138
82
|
}
|
139
83
|
addHandler() {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
this.toggleLogMenu();
|
144
|
-
});
|
145
|
-
this.searchBoxElement.addEventListener("input", lodash_debounce(this.onKeyup.bind(this), 250));
|
84
|
+
this.element.querySelector(".js-copy-tuner-bar-open-log").addEventListener("click", (n) => {
|
85
|
+
n.preventDefault(), this.toggleLogMenu();
|
86
|
+
}), this.searchBoxElement.addEventListener("input", Z(this.onKeyup.bind(this), 250));
|
146
87
|
}
|
147
88
|
show() {
|
148
|
-
this.element.classList.remove(
|
149
|
-
this.searchBoxElement.focus();
|
89
|
+
this.element.classList.remove(h), this.searchBoxElement.focus();
|
150
90
|
}
|
151
91
|
hide() {
|
152
|
-
this.element.classList.add(
|
92
|
+
this.element.classList.add(h);
|
153
93
|
}
|
154
94
|
showLogMenu() {
|
155
|
-
this.logMenuElement.classList.remove(
|
95
|
+
this.logMenuElement.classList.remove(h);
|
156
96
|
}
|
157
97
|
toggleLogMenu() {
|
158
|
-
this.logMenuElement.classList.toggle(
|
98
|
+
this.logMenuElement.classList.toggle(h);
|
159
99
|
}
|
160
100
|
makeLogMenu() {
|
161
|
-
const
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
const
|
166
|
-
|
167
|
-
|
168
|
-
const value = this.data[key];
|
169
|
-
if (value === "") {
|
101
|
+
const e = document.createElement("div");
|
102
|
+
e.setAttribute("id", "copy-tuner-bar-log-menu"), e.classList.add(h);
|
103
|
+
const n = document.createElement("table"), o = document.createElement("tbody");
|
104
|
+
o.classList.remove("is-not-initialized");
|
105
|
+
for (const s of Object.keys(this.data).sort()) {
|
106
|
+
const d = this.data[s];
|
107
|
+
if (d === "")
|
170
108
|
continue;
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
}
|
186
|
-
table.append(tbody);
|
187
|
-
div.append(table);
|
188
|
-
return div;
|
189
|
-
}
|
190
|
-
onKeyup({ target }) {
|
191
|
-
const keyword = target.value.trim();
|
109
|
+
const r = document.createElement("td");
|
110
|
+
r.textContent = s;
|
111
|
+
const a = document.createElement("td");
|
112
|
+
a.textContent = d;
|
113
|
+
const c = document.createElement("tr");
|
114
|
+
c.classList.add("copy-tuner-bar-log-menu__row"), c.dataset.key = s, c.addEventListener("click", ({ currentTarget: u }) => {
|
115
|
+
this.callback(u.dataset.key);
|
116
|
+
}), c.append(r), c.append(a), o.append(c);
|
117
|
+
}
|
118
|
+
return n.append(o), e.append(n), e;
|
119
|
+
}
|
120
|
+
// @ts-expect-error TS7031
|
121
|
+
onKeyup({ target: e }) {
|
122
|
+
const n = e.value.trim();
|
192
123
|
this.showLogMenu();
|
193
|
-
const
|
194
|
-
for (const
|
195
|
-
const
|
196
|
-
|
124
|
+
const o = [...this.logMenuElement.querySelectorAll("tr")];
|
125
|
+
for (const s of o) {
|
126
|
+
const d = n === "" || [...s.querySelectorAll("td")].some((r) => r.textContent.includes(n));
|
127
|
+
s.classList.toggle(h, !d);
|
197
128
|
}
|
198
129
|
}
|
199
130
|
}
|
200
|
-
const
|
201
|
-
const
|
202
|
-
const getOffset = (elment) => {
|
203
|
-
const box = elment.getBoundingClientRect();
|
131
|
+
const L = navigator.platform.toUpperCase().includes("MAC"), Q = (t) => !!(t.offsetWidth || t.offsetHeight || t.getClientRects().length > 0), ee = (t) => {
|
132
|
+
const e = t.getBoundingClientRect();
|
204
133
|
return {
|
205
|
-
top:
|
206
|
-
left:
|
134
|
+
top: e.top + (window.pageYOffset - document.documentElement.clientTop),
|
135
|
+
left: e.left + (window.pageXOffset - document.documentElement.clientLeft)
|
207
136
|
};
|
208
|
-
}
|
209
|
-
|
210
|
-
if (!isVisible(element)) {
|
137
|
+
}, te = (t) => {
|
138
|
+
if (!Q(t))
|
211
139
|
return null;
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
height: boxFrame.bottom - boxFrame.top
|
140
|
+
const e = ee(t);
|
141
|
+
return e.right = e.left + t.offsetWidth, e.bottom = e.top + t.offsetHeight, {
|
142
|
+
left: e.left,
|
143
|
+
top: e.top,
|
144
|
+
// @ts-expect-error TS2339
|
145
|
+
width: e.right - e.left,
|
146
|
+
// @ts-expect-error TS2339
|
147
|
+
height: e.bottom - e.top
|
221
148
|
};
|
222
|
-
};
|
223
|
-
|
224
|
-
|
225
|
-
constructor(
|
226
|
-
this.element =
|
227
|
-
this.key = key;
|
228
|
-
this.callback = callback;
|
149
|
+
}, ne = 2e9;
|
150
|
+
class oe {
|
151
|
+
// @ts-expect-error TS7006
|
152
|
+
constructor(e, n, o) {
|
153
|
+
this.element = e, this.key = n, this.callback = o;
|
229
154
|
}
|
230
155
|
show() {
|
231
|
-
this.box = this.makeBox()
|
232
|
-
if (this.box === null)
|
233
|
-
return;
|
234
|
-
this.box.addEventListener("click", () => {
|
156
|
+
this.box = this.makeBox(), this.box !== null && (this.box.addEventListener("click", () => {
|
235
157
|
this.callback(this.key);
|
236
|
-
});
|
237
|
-
document.body.append(this.box);
|
158
|
+
}), document.body.append(this.box));
|
238
159
|
}
|
239
160
|
remove() {
|
240
|
-
|
241
|
-
return;
|
242
|
-
}
|
243
|
-
this.box.remove();
|
244
|
-
this.box = null;
|
161
|
+
this.box && (this.box.remove(), this.box = null);
|
245
162
|
}
|
246
163
|
makeBox() {
|
247
|
-
const
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
if (bounds === null)
|
164
|
+
const e = document.createElement("div");
|
165
|
+
e.classList.add("copyray-specimen"), e.classList.add("Specimen");
|
166
|
+
const n = te(this.element);
|
167
|
+
if (n === null)
|
252
168
|
return null;
|
253
|
-
for (const
|
254
|
-
const
|
255
|
-
|
256
|
-
}
|
257
|
-
box.style.zIndex = ZINDEX;
|
258
|
-
const { position, top, left } = getComputedStyle(this.element);
|
259
|
-
if (position === "fixed") {
|
260
|
-
this.box.style.position = "fixed";
|
261
|
-
this.box.style.top = `${top}px`;
|
262
|
-
this.box.style.left = `${left}px`;
|
169
|
+
for (const r of Object.keys(n)) {
|
170
|
+
const a = n[r];
|
171
|
+
e.style[r] = `${a}px`;
|
263
172
|
}
|
264
|
-
|
265
|
-
|
173
|
+
e.style.zIndex = ne;
|
174
|
+
const { position: o, top: s, left: d } = getComputedStyle(this.element);
|
175
|
+
return o === "fixed" && (this.box.style.position = "fixed", this.box.style.top = `${s}px`, this.box.style.left = `${d}px`), e.append(this.makeLabel()), e;
|
266
176
|
}
|
267
177
|
makeLabel() {
|
268
|
-
const
|
269
|
-
|
270
|
-
div.classList.add("Specimen");
|
271
|
-
div.textContent = this.key;
|
272
|
-
return div;
|
178
|
+
const e = document.createElement("div");
|
179
|
+
return e.classList.add("copyray-specimen-handle"), e.classList.add("Specimen"), e.textContent = this.key, e;
|
273
180
|
}
|
274
181
|
}
|
275
|
-
const
|
276
|
-
const
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
return comments.filter((comment) => comment.nodeValue.startsWith("COPYRAY")).map((comment) => {
|
284
|
-
const [, key] = comment.nodeValue.match(/^COPYRAY (\S*)$/);
|
285
|
-
const element = comment.parentNode;
|
286
|
-
return { key, element };
|
182
|
+
const se = () => {
|
183
|
+
const t = () => NodeFilter.FILTER_ACCEPT, e = document.createNodeIterator(document.body, NodeFilter.SHOW_COMMENT, t, !1), n = [];
|
184
|
+
let o;
|
185
|
+
for (; o = e.nextNode(); )
|
186
|
+
n.push(o);
|
187
|
+
return n.filter((s) => s.nodeValue.startsWith("COPYRAY")).map((s) => {
|
188
|
+
const [, d] = s.nodeValue.match(/^COPYRAY (\S*)$/), r = s.parentNode;
|
189
|
+
return { key: d, element: r };
|
287
190
|
});
|
288
191
|
};
|
289
|
-
class
|
290
|
-
|
291
|
-
|
292
|
-
this.data = data;
|
293
|
-
this.isShowing = false;
|
294
|
-
this.specimens = [];
|
295
|
-
this.overlay = this.makeOverlay();
|
296
|
-
this.toggleButton = this.makeToggleButton();
|
297
|
-
this.boundOpen = this.open.bind(this);
|
298
|
-
this.copyTunerBar = new CopytunerBar(document.querySelector("#copy-tuner-bar"), this.data, this.boundOpen);
|
192
|
+
class ie {
|
193
|
+
// @ts-expect-error TS7006
|
194
|
+
constructor(e, n) {
|
195
|
+
this.baseUrl = e, this.data = n, this.isShowing = !1, this.specimens = [], this.overlay = this.makeOverlay(), this.toggleButton = this.makeToggleButton(), this.boundOpen = this.open.bind(this), this.copyTunerBar = new J(document.querySelector("#copy-tuner-bar"), this.data, this.boundOpen);
|
299
196
|
}
|
300
197
|
show() {
|
301
|
-
this.reset();
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
specimen.show();
|
306
|
-
}
|
307
|
-
this.copyTunerBar.show();
|
308
|
-
this.isShowing = true;
|
198
|
+
this.reset(), document.body.append(this.overlay), this.makeSpecimens();
|
199
|
+
for (const e of this.specimens)
|
200
|
+
e.show();
|
201
|
+
this.copyTunerBar.show(), this.isShowing = !0;
|
309
202
|
}
|
310
203
|
hide() {
|
311
|
-
this.overlay.remove();
|
312
|
-
this.reset();
|
313
|
-
this.copyTunerBar.hide();
|
314
|
-
this.isShowing = false;
|
204
|
+
this.overlay.remove(), this.reset(), this.copyTunerBar.hide(), this.isShowing = !1;
|
315
205
|
}
|
316
206
|
toggle() {
|
317
|
-
|
318
|
-
this.hide();
|
319
|
-
} else {
|
320
|
-
this.show();
|
321
|
-
}
|
207
|
+
this.isShowing ? this.hide() : this.show();
|
322
208
|
}
|
323
|
-
|
324
|
-
|
209
|
+
// @ts-expect-error TS7006
|
210
|
+
open(e) {
|
211
|
+
window.open(`${this.baseUrl}/blurbs/${e}/edit`);
|
325
212
|
}
|
326
213
|
makeSpecimens() {
|
327
|
-
for (const { element, key } of
|
328
|
-
this.specimens.push(new
|
329
|
-
}
|
214
|
+
for (const { element: e, key: n } of se())
|
215
|
+
this.specimens.push(new oe(e, n, this.boundOpen));
|
330
216
|
}
|
331
217
|
makeToggleButton() {
|
332
|
-
const
|
333
|
-
|
218
|
+
const e = document.createElement("a");
|
219
|
+
return e.addEventListener("click", () => {
|
334
220
|
this.show();
|
335
|
-
});
|
336
|
-
element.classList.add("copyray-toggle-button");
|
337
|
-
element.classList.add("hidden-on-mobile");
|
338
|
-
element.textContent = "Open CopyTuner";
|
339
|
-
document.body.append(element);
|
340
|
-
return element;
|
221
|
+
}), e.classList.add("copyray-toggle-button"), e.classList.add("hidden-on-mobile"), e.textContent = "Open CopyTuner", document.body.append(e), e;
|
341
222
|
}
|
342
223
|
makeOverlay() {
|
343
|
-
const
|
344
|
-
|
345
|
-
div.addEventListener("click", () => this.hide());
|
346
|
-
return div;
|
224
|
+
const e = document.createElement("div");
|
225
|
+
return e.setAttribute("id", "copyray-overlay"), e.addEventListener("click", () => this.hide()), e;
|
347
226
|
}
|
348
227
|
reset() {
|
349
|
-
for (const
|
350
|
-
|
351
|
-
}
|
228
|
+
for (const e of this.specimens)
|
229
|
+
e.remove();
|
352
230
|
}
|
353
231
|
}
|
354
|
-
|
355
|
-
const
|
356
|
-
|
357
|
-
|
358
|
-
bar.classList.add("copy-tuner-hidden");
|
359
|
-
bar.innerHTML = `
|
360
|
-
<a class="copy-tuner-bar-button" target="_blank" href="${url}">CopyTuner</a>
|
232
|
+
const re = (t) => {
|
233
|
+
const e = document.createElement("div");
|
234
|
+
e.id = "copy-tuner-bar", e.classList.add("copy-tuner-hidden"), e.innerHTML = `
|
235
|
+
<a class="copy-tuner-bar-button" target="_blank" href="${t}">CopyTuner</a>
|
361
236
|
<a href="/copytuner" target="_blank" class="copy-tuner-bar-button">Sync</a>
|
362
237
|
<a href="javascript:void(0)" class="copy-tuner-bar-open-log copy-tuner-bar-button js-copy-tuner-bar-open-log">Translations in this page</a>
|
363
238
|
<input type="text" class="copy-tuner-bar__search js-copy-tuner-bar-search" placeholder="search">
|
364
|
-
|
365
|
-
|
366
|
-
};
|
367
|
-
|
368
|
-
const
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
document.addEventListener("keydown", (event) => {
|
373
|
-
if (copyray2.isShowing && ["Escape", "Esc"].includes(event.key)) {
|
374
|
-
copyray2.hide();
|
239
|
+
`, document.body.append(e);
|
240
|
+
}, j = () => {
|
241
|
+
const { url: t, data: e } = window.CopyTuner;
|
242
|
+
re(t);
|
243
|
+
const n = new ie(t, e);
|
244
|
+
window.CopyTuner.toggle = () => n.toggle(), document.addEventListener("keydown", (o) => {
|
245
|
+
if (n.isShowing && ["Escape", "Esc"].includes(o.key)) {
|
246
|
+
n.hide();
|
375
247
|
return;
|
376
248
|
}
|
377
|
-
|
378
|
-
|
379
|
-
}
|
380
|
-
});
|
381
|
-
if (console) {
|
382
|
-
console.log(`Ready to Copyray. Press ${isMac ? "cmd+shift+k" : "ctrl+shift+k"} to scan your UI.`);
|
383
|
-
}
|
249
|
+
(L && o.metaKey || !L && o.ctrlKey) && o.shiftKey && o.key.toLowerCase() === "k" && n.toggle();
|
250
|
+
}), console && console.log(`Ready to Copyray. Press ${L ? "cmd+shift+k" : "ctrl+shift+k"} to scan your UI.`);
|
384
251
|
};
|
385
|
-
|
386
|
-
start();
|
387
|
-
} else {
|
388
|
-
document.addEventListener("DOMContentLoaded", () => start());
|
389
|
-
}
|
252
|
+
document.readyState === "complete" || document.readyState !== "loading" ? j() : document.addEventListener("DOMContentLoaded", () => j());
|
data/copy_tuner_client.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
require 'copy_tuner_client/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.required_ruby_version = '>=
|
6
|
+
s.required_ruby_version = '>= 3.0.0'
|
7
7
|
s.add_dependency 'i18n', '>= 0.5.0'
|
8
8
|
s.add_dependency 'json'
|
9
9
|
s.add_dependency 'nokogiri'
|