-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickreply.html
More file actions
462 lines (373 loc) · 23 KB
/
Copy pathquickreply.html
File metadata and controls
462 lines (373 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>the post reiteration station</title>
<meta charset="utf-8">
<meta name="author" content="Voxalice">
<meta name="description" content="This webpage contains some of my most common responses to Scratch forum topics.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/dark.css" rel="stylesheet" type="text/css" media="all">
<style> div { margin: 1em 0 1em; } </style>
</head>
<body>
<h1>Personal Scratch forums QuickReply</h1>
<h2 id="displayName">This webpage requires JavaScript to be enabled.</h2>
<div id="dataView"></div>
<div style="display: none;" id="textDisplay" title="Copy this text">
<textarea style='width: 50em; height: 10em; max-width: 95%;' id="copier" onclick='this.select()' readonly></textarea>
<div id="mark" class="margin">The text above is marked with <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal</a>.
Feel free to use it however you want to!</div>
</div>
<div style="display: none;" id="textEditable">
<label for="editBox">Replace "__EDITABLE__" with:</label>
<input type="text" name="editBox" id="editBox" placeholder="(Replacement text)" onchange="replaceEditable(this.value)">
</div>
<div style="display: none;" id="rejectedLoading">Fetching rejected suggestions...</div>
<div style="display: none;" id="rejectedChooser">
<label for="rejectedNumber"><a href="https://scratch.mit.edu/discuss/topic/343602/" target="blank">Open The Official List of Rejected Suggestions in a new tab</a>, find the relevant suggestion, then type its number here:</label>
<div><input type="text" name="rejectedNumber" id="rejectedNumber" placeholder="1.2">
<button onclick='quoteRejected(document.querySelector("#rejectedNumber").value.toString())'>Quote</button>
<small> - Clicking "Quote" will make a request to scratch.mit.edu.</small></div>
</div>
<div id="toRoot" style="display: none;"><a href="">(Refresh to see other pages)</a></div>
<small>This webpage contains some of my most common responses to <a href="https://scratch.mit.edu/discuss/">Scratch forum topics</a>.<br>
The aforementioned responses are <a href="https://creativecommons.org/publicdomain/zero/1.0/">free to use</a>. Feel free to leave feedback on <a href="https://scratch.mit.edu/users/Voxalice/">my Scratch profile</a>.
<br><a href='https://github.com/voxalice2/voxalice2.github.io/blob/main/quickreply.html'>Click here to view this webpage's source code!</a>
<br><br><details><summary>Updates</summary><hr>
Update 1 (2024-12-20) - Original version<hr>
Update 2 (2024-12-21) - Fixed textboxes<hr>
Update 3 (2024-12-22) - Added invisible items, <a href="#test">test items</a>, and a JavaScript-disabled warning<hr>
Update 4 (2024-12-23) - Added editable items<hr>
Update 5 (2025-01-01) - Added function items, including a built-in quoter for The Official List of Rejected Suggestions<hr>
Update 6 (2025-01-05) - Fixed issues with scraping rejected suggestions, and cleaned up some code<hr>
Update 7 (2025-01-08) - Fixed title (this page originally shared a title with <a href="/imagif">/imagif</a>)<hr>
Update 8 (2025-01-11) - Add page metadata<hr>
Update 9 (2025-01-15) - Marking responses with CC0 (but not this page)<hr>
Update 10 (2025-03-04) - Improved HTML semantics, <a href="#10">added item hash links</a>
</details></small>
<script>
'use strict';
// View data starts here
var viewData = {
// Root
0: {"name": "Choose a forum:",
"text": false,
"hidden": false,
"data": [6, 1, 2, 19, 20, 25]},
6: {"name": "General (any forum)",
"text": false,
"hidden": false,
"data": ["test", 7, 8, 23]},
1: {"name": "Bugs and Glitches",
"text": false,
"hidden": false,
"data": [3, 4, 9, 12, 11, 24, 28]},
2: {"name": "Suggestions",
"text": false,
"hidden": false,
"data": [5, 10, 27]},
19: {"name": "Things I'm Making and Creating",
"text": false,
"hidden": false,
"data": [21]},
20: {"name": "Things I'm Reading and Playing",
"text": false,
"hidden": false,
"data": [22]},
25: {"name": "Questions about Scratch",
"text": false,
"hidden": false,
"data": [26, 29]},
// Bugs and Glitches
3: {"name": "Search Engine Down",
"text": true,
"hidden": false,
"editable": false,
"data": "[url=https://scratch.mit.edu/discuss/topic/790866/]Scratch's search engine is currently broken[/url]. All we can do is wait for it to be fixed.\n" +
"Unfortunately, no one knows when it will be fixed, how to fix it, or why it's broken.\n" +
"This bug affects everyone on Scratch, [url=https://scratch.mit.edu/discuss/post/8347682/]so the Scratch Team is aware of it[/url]. They are [url=https://scratch.mit.edu/discuss/post/8364515/]working on a fix[/url].\n\n" +
// 'To work around this bug, you can type "site:scratch.mit.edu [i](search query)[/i]" into a search engine like Google.\n\n' +
"If you have any important information [i]that hasn't already been shared[/i] about this bug, you can use the Contact Us link near the bottom of the page to share it with the Scratch Team directly.\n\n" +
"This bug also affects [url=https://scratch.mit.edu/explore/projects/all]the Explore page[/url], since that's internally based on Scratch's search engine."
},
4: {"name": "Search Engine Down (+ User Searching Instructions)",
"text": true,
"hidden": false,
"editable": false,
"data": "If you want to [url=https://en.scratch-wiki.info/wiki/How_do_I_search_for_a_user%3F]search for a user[/url], use a link like this: " +
"[quote]https://scratch.mit.edu/users/USERNAME/[/quote]"},
9: {"name": "Cloud Variables Resetting",
"text": true,
"hidden": false,
"editable": false,
"data": "If you own the project with the broken cloud variables, try renaming those variables.\n\n" +
"If you don't own the project with the broken cloud variables, please ask the owner of that project to rename their cloud variables."},
12: {"name": "Cloud Variables Down",
"text": true,
"hidden": false,
"editable": false,
"data": "Cloud variables are currently broken. All we can do is wait for them to be fixed.\n" +
"Unfortunately, no one knows when they will be fixed, how to fix them, or why they're broken.\n" +
"This affects every Scratcher, [url=https://scratch.mit.edu/discuss/post/8359379/]so the Scratch Team is aware of the situation[/url]. They are working on a fix."},
11: {"name": "Browser Information Instructions",
"text": true,
"hidden": false,
"editable": false,
"data": "When replying, could you click the globe icon (to the right of the emoji) to show what device and browser you're using?"},
24: {"name": "Can't Become a Scratcher (No Next Button)",
"text": true,
"hidden": false,
"editable": false,
"data": 'When you get to the Community Guidelines page, try selecting everything with the key combo Ctrl+A.\n' +
"(If you don't have a keyboard, look up how to select everything on the page and try that instead.)\n\n" +
'That should make a blue box appear near the bottom-right corner of the page, which you can use to progress.\n\n' +
'[img]https://u.cubeupload.com/rosics/Screenshot2025010420.png[/img][small]Screenshot taken by [url=https://scratch.mit.edu/users/Rosics]@Rosics[/url][/small]\n\n' +
"If that doesn't work, just keep clicking near the bottom-right corner of the page.\n\n" +
'Once you press the "I Agree" button, you [i]will[/i] be a Scratcher, even if nothing seems to happen.'},
28: {"name": "Search Engine Down (Japanese)",
"text": true,
"hidden": false,
"editable": false,
"data": "この投稿は Google 翻訳を使用して翻訳されました。間違いがあればお知らせください。\n\n---\n\n" +
"Scratch の検索エンジンは現在壊れています。私たちにできるのは、それが修正されるのを待つことだけです。\n残念ながら、いつ修正されるのか、どのように修正するのか、なぜ壊れているのかは誰にもわかりません。\nこのバグは Scratch の全員に影響するため、Scratch チームはそれを認識しています。彼らは 修正に取り組んでいます。\n\nこのバグについて まだ共有されていない重要な情報がある場合は、https://scratch.mit.edu/contact-us/ を使用して Scratch チームに直接共有できます。\n\nこのバグは、Explore ページにも影響します。これは、このページが内部的に Scratch の検索エンジンに基づいているためです。" +
"\n\n[small][url=https://scratch.mit.edu/discuss/post/8365086/](English version)[/url][/small]\n\n---\n\n[url=https://scratch.mit.edu/discuss/18/]日本語話者向けの Scratch フォーラムをチェックしてください[/url] :)"},
// Suggestions
5: {"name": "Duplicate Suggestion",
"text": true,
"hidden": false,
"editable": true,
"data": "This appears to be a duplicate of [url=__EDITABLE__]an earlier suggestion[/url].\n" +
"Please use the linked topic to keep the discussion all in one place :)\n\n" +
"For future reference, you can use the [url=https://scratch.mit.edu/discuss/topic/657522/]Suggestions Directory[/url] or [url=https://ocular.jeffalo.net/]Ocular[/url] to check for duplicates."},
10: {"name": "Rejected Suggestion",
"text": false,
"hidden": false,
"editable": false,
"function": "rejected()"},
"rejectedOriginal": {"name": "Rejected Suggestion (Original)",
"text": true,
"hidden": false,
"editable": false,
"data": "Unfortunately, this suggestion is rejected.\n\n" +
"From [url=https://scratch.mit.edu/discuss/topic/343602/]The Official List of Rejected Suggestions[/url]:\n" +
"[quote=Za-Chary]View_source_then_find_the_rejected_suggestion_then_paste_it_here[/quote]"},
27: {"name": "Dark Mode (Duplicate Suggestion)",
"text": true,
"hidden": false,
"data": "This appears to be a duplicate of two earlier suggestions.\n\n" +
"Website dark mode: https://scratch.mit.edu/discuss/topic/296027/\n" +
"Editor dark mode: https://scratch.mit.edu/discuss/topic/217797/\n\n" +
"Please use the linked topics to keep the discussion all in one place :)\n\n" +
"For future reference, you can use the [url=https://scratch.mit.edu/discuss/topic/657522/]Suggestions Directory[/url] or [url=https://ocular.jeffalo.net/]Ocular[/url] to check for duplicates."},
// General
7: {"name": "Duplicate Topic",
"text": true,
"hidden": false,
"editable": true,
"data": "This appears to be a duplicate of [url=__EDITABLE__]an earlier topic[/url].\n" +
"Please use the linked topic to keep the discussion all in one place :)\n\n" +
"For future reference, you can use the third-party search engine [url=https://ocular.jeffalo.net/]Ocular[/url] to check for duplicates."},
8: {"name": "Topic Closing Instructions",
"text": true,
"hidden": false,
"editable": false,
"data": "If you don't see a Close Topic button anywhere, you can just report the original post and ask the Scratch Team to close it in the textbox.\n\n" +
"I'll do that for you right now. :)"},
23: {"name": "Welcome to the Forums",
"text": true,
"hidden": false,
"editable": false,
"data": "Welcome to the forums! Check out the Sticky topics in [url=https://scratch.mit.edu/discuss/6/]the New Scratchers forum[/url] for guidance.\n" +
"(See more information at the Scratch Wiki: [wiki]Discussion Forums[/wiki])"},
// Things I'm [...]
21: {"name": "Duplicate Topic (Things I'm Making and Creating)",
"text": true,
"hidden": false,
"editable": true,
"data": "This appears to be a duplicate of [url=__EDITABLE__]an earlier topic[/url].\n" +
"Please use the linked topic to keep the discussion all in one place :)\n\n" +
"For future reference, you can use the [url=https://scratch.mit.edu/discuss/topic/776027/]Things I'm Making and Creating Directory[/url] or [url=https://ocular.jeffalo.net/]Ocular[/url] to check for duplicates."},
22: {"name": "Duplicate Topic (Things I'm Reading and Playing)",
"text": true,
"hidden": false,
"editable": true,
"data": "This appears to be a duplicate of [url=__EDITABLE__]an earlier topic[/url].\n" +
"Please use the linked topic to keep the discussion all in one place :)\n\n" +
"For future reference, you can use the [url=https://scratch.mit.edu/discuss/topic/735680/]Things I'm Reading and Playing Topic Directory[/url] or [url=https://ocular.jeffalo.net/]Ocular[/url] to check for duplicates."},
// Questions about Scratch
26: {"name": "4.0 Release Date",
"text": true,
"hidden": false,
"data": "No one knows when Scratch 4.0 will be released, not even the Scratch Team.\n\n" +
"Scratch 4.0 is supposed to start development in 2025, but its release date is still a mystery.\n\n" +
"Let's wait for more information on Scratch 4.0 before trying to find out when it will release."},
29: {"name": "Blood Guideline",
"text": true,
"hidden": false,
"data": "[url=https://scratch.mit.edu/discuss/post/6934705]The use of blood should be avoided on Scratch.[/url][quote=Paddle2See]No blood is the best. Anything else and it's up to the moderator's judgement as to what is “too much”. Context is also important. Is the blood the result of violence? Or is it just a nosebleed or a scraped knee from a fall? That can influence the moderator as well.[/quote]"},
// Testing
"test": {"name": "> TESTING <",
"text": false,
"hidden": true,
"data": ["this page doesn't exist", "test", 14, 15, Math.imul(3, 5) + 1, 17, 18, 0, "goTo"]},
14: {"name": "Hidden item 1",
"text": true,
"hidden": true,
"data": "HELLO WORLD"},
15: {"name": "Hidden item 2!",
"text": false,
"hidden": true,
"data": [1, 2, 3]},
16: {"name": "Invalid content 1",
"text": false,
"hidden": false,
"data": "Wow"},
17: {"name": "Invalid content 2",
"text": true,
"hidden": false,
"editable": true,
"data": [1, 2, "__EDITABLE__", 4, 5]},
18: {"name": "Invalid content 3!",
"text": false,
"hidden": false,
"data": true},
"goTo": {"name": "Go to any item",
"text": false,
"hidden": false,
"function": 'dataView.insertAdjacentHTML("beforeend",`<p><input type="text" placeholder="Item name" id="itemname"> <button onclick="displayView(document.querySelector(\'#itemname\').value)">Go</button></p>`)'},
}
viewData[4].data = viewData[3].data + "\n\n" + viewData[4].data; // Add "Search Engine Down" to "Search Engine Down (+ User Searching Instructions)"
// View data ends here
var dataView = document.querySelector("#dataView");
var textDisplay = document.querySelector("#textDisplay");
var textEditable = document.querySelector("#textEditable");
var copier = document.querySelector("#copier");
var toRoot = document.querySelector("#toRoot");
var rejectedLoading = document.querySelector("#rejectedLoading");
var rejectedChooser = document.querySelector("#rejectedChooser");
var rejectedData = "";
var viewHistory = [];
var viewing;
var hashChanging = false;
function show(element) { element.style.display = "block"; }
function hide(element) { element.style.display = "none"; }
function setCopier(copierText) { copier.value = copierText; }
function appendLink(id, name, back) {
if (!viewData[id].hidden) {
var linkContainer = document.createElement("p");
var linkElement = document.createElement("button");
linkElement.innerText = name ?? viewData[id].name;
if (back) {
linkElement.onclick = function() { displayLastItem(); };
} else {
linkElement.onclick = function() { displayView(id); };
}
linkContainer.append(linkElement);
dataView.append(linkContainer);
}
}
function displayLastItem() {
viewHistory.pop(); displayView(viewHistory.pop());
}
function displayView(id, changeHash = true, changeHistory = true) {
if (changeHash) { hashChanging = true; location.hash = id; }
if (id == undefined) { id = 0; }
viewing = id;
var data = viewData[id];
console.log("Displaying data at ID " + id, data);
if (data != undefined) {
document.querySelector("#displayName").innerText = data.name;
dataView.replaceChildren();
// Append "Back" link and hide everything (except for the name)
if (changeHistory) { viewHistory.push(id); }
if (viewHistory.length > 1) { appendLink(0, "<= Back to previous page <=", true); }
hide(textEditable);
hide(textDisplay);
hide(rejectedLoading);
hide(rejectedChooser);
document.querySelector("#editBox").value = "";
// Start handling data
if (data.text) {
show(document.querySelector("#mark"));
show(textDisplay);
setCopier(data.data.toString());
if (data.editable) {
show(textEditable);
}
} else {
if (data.function) {
eval?.(`"use strict";${data.function}`);
} else {
if (typeof data.data == "object") {
data.data.forEach((element) => {
try { appendLink(element, null, false); }
catch (exception) { console.error(exception); }
});
}
}
}
} else { displayView(0); }
}
function replaceEditable(edit) {
if (edit == "") { edit = "__EDITABLE__"; }
setCopier(viewData[viewing].data.replace("__EDITABLE__", edit));
}
window.addEventListener("hashchange", function(ev) {
var newID = location.hash.slice(1);
if (!hashChanging && viewing != newID) {
displayView(newID || 0, false);
}
hashChanging = false;
});
if (location.hash.slice(1) != "") {
toRoot.style.display = "block";
}
displayView(location.hash.slice(1) || 0, false);
// Rejected Suggestions code starts here
async function getRejected() {
if (rejectedData == "") { // If rejected suggestions data has not already been fetched
if (!window.navigator.onLine) { alert("Please connect to the Internet."); return false; }
try {
const response = await fetch("https://scratch.mit.edu/discuss/post/3466932/source/");
if (!response.ok) { throw new Error(`Response status: ${response.status}`); }
rejectedData = await response.text();
return true;
} catch (e) {
console.error(e);
alert("Something went wrong fetching rejected suggestions. Check this browser's console for more information.");
return false;
}
} else {return true}
}
function rejected() {
hide(rejectedLoading);
show(rejectedChooser);
document.querySelector("#rejectedNumber").value = "";
}
function quoteRejected(rejectedNumber) {
show(rejectedLoading);
hide(rejectedChooser);
getRejected().then((good) => {
if (good) {
hide(rejectedLoading);
var rejectedQuote = "";
// Attempt to find rejected suggestion text, and alert if not found
var quoteDelimiter = (+rejectedNumber > 0) ? ("[b]" + rejectedNumber + " ") : null;
try { rejectedQuote = (quoteDelimiter + rejectedData.split(quoteDelimiter)[1].split("[b")[0]).trim(); } // Find text between "[b]X.Y " and "[b"
catch (e) { console.error(e.message); show(rejectedChooser); alert("That doesn't seem to be a valid suggestion number. Check for typos."); }
if (rejectedQuote != "") {
hide(textEditable);
hide(rejectedChooser);
hide(document.querySelector("#mark"));
show(textDisplay);
setCopier("Unfortunately, this suggestion appears to be rejected.\n\n" +
"From [url=https://scratch.mit.edu/discuss/topic/343602/]The Official List of Rejected Suggestions[/url]:\n" +
"[quote=Za-Chary]" + rejectedQuote + "[/quote]");
}
} else { rejected(); }
})
}
</script>
<script src="/stable.js"></script>
</body>
</html>