|
@@ -8,7 +8,8 @@ const copyToClipboard = (s) => {
|
8
|
8
|
if (!navigator.clipboard) {
|
9
|
9
|
document.execCommand('copy');
|
10
|
10
|
} else {
|
11
|
|
- navigator.clipboard.writeText(s).catch(() => {
|
|
11
|
+ navigator.clipboard.writeText(s).catch((e) => {
|
|
12
|
+ console.log(e);
|
12
|
13
|
console.log('failed to copy');
|
13
|
14
|
});
|
14
|
15
|
}
|
|
@@ -47,9 +48,11 @@ const buildGuesses = () => {
|
47
|
48
|
};
|
48
|
49
|
|
49
|
50
|
const buildShareCopy = () => {
|
50
|
|
- const app = new window.wrappedJSObject.wordle.bundle.GameApp();
|
51
|
|
- const number = app.dayOffset;
|
52
|
|
- const hardMode = app.isHardMode ? '*' : '';
|
|
51
|
+ const number = document.querySelector('[data-day-offset]').dataset.dayOffset;
|
|
52
|
+ const hardMode =
|
|
53
|
+ document.querySelector('[data-is-hard-mode]').dataset.isHardMode === 'true'
|
|
54
|
+ ? '*'
|
|
55
|
+ : '';
|
53
|
56
|
const guesses = buildGuesses();
|
54
|
57
|
const guessesCopy = guesses.join('\n');
|
55
|
58
|
|
|
@@ -100,6 +103,22 @@ const buildButton = () => {
|
100
|
103
|
};
|
101
|
104
|
|
102
|
105
|
const readyStateCheckInterval = setInterval(() => {
|
|
106
|
+ const script = document.createElement('script');
|
|
107
|
+ script.innerText = `
|
|
108
|
+ (() => {
|
|
109
|
+ const app = new window.wordle.bundle.GameApp();
|
|
110
|
+
|
|
111
|
+ const offset = document.createElement('span');
|
|
112
|
+ offset.dataset.dayOffset = app.dayOffset;
|
|
113
|
+ document.body.appendChild(offset);
|
|
114
|
+
|
|
115
|
+ const hardMode = document.createElement('span');
|
|
116
|
+ hardMode.dataset.isHardMode = app.hardMode;
|
|
117
|
+ document.body.appendChild(hardMode);
|
|
118
|
+ })();
|
|
119
|
+ `;
|
|
120
|
+ document.body.appendChild(script);
|
|
121
|
+
|
103
|
122
|
const el = document
|
104
|
123
|
.querySelector('game-app')
|
105
|
124
|
.shadowRoot.querySelector('game-theme-manager')
|