Skip to content

Commit 7f7417a

Browse files
committed
Format
1 parent 9aa726f commit 7f7417a

File tree

11 files changed

+412
-384
lines changed

11 files changed

+412
-384
lines changed

api/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ScratchTools.disable = function (feature) {
156156
};
157157

158158
function GM_addStyle(styleData) {
159-
var style = document.createElement('style')
160-
style.textContent = styleData
161-
return document.querySelector('html').appendChild(style)
162-
}
159+
var style = document.createElement("style");
160+
style.textContent = styleData;
161+
return document.querySelector("html").appendChild(style);
162+
}

extras/background.js

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ chrome.runtime.onInstalled.addListener(async function (object) {
4242
}
4343
});
4444
}
45-
var obj = await chrome.storage.sync.get("features")
45+
var obj = await chrome.storage.sync.get("features");
4646
if (obj.features && obj.features.includes("display-message-count-in-icon")) {
47-
try {
48-
var response = await fetch(
49-
"https://scratch.mit.edu/messages/ajax/get-message-count/"
50-
);
51-
var data = await response.json();
52-
chrome.action.setBadgeText({ text: data.msg_count.toString() });
53-
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
54-
} catch (err) {
55-
chrome.action.setBadgeText({ text: "?" });
56-
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
47+
try {
48+
var response = await fetch(
49+
"https://scratch.mit.edu/messages/ajax/get-message-count/"
50+
);
51+
var data = await response.json();
52+
chrome.action.setBadgeText({ text: data.msg_count.toString() });
53+
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
54+
} catch (err) {
55+
chrome.action.setBadgeText({ text: "?" });
56+
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
57+
}
58+
} else {
59+
chrome.action.setBadgeText({ text: "" });
5760
}
58-
} else {
59-
chrome.action.setBadgeText({ text:'' })
60-
}
6161
});
6262

6363
chrome.tabs.onUpdated.addListener(function (tabId, info) {
@@ -180,29 +180,30 @@ chrome.tabs.onUpdated.addListener(function (tabId, info) {
180180
}
181181
ScratchTools.console.log("Injected storage API.");
182182
Object.keys(data).forEach(async function (el) {
183-
var disabled = (await chrome.storage.sync.get("autoDisabled")).autoDisabled
183+
var disabled = (await chrome.storage.sync.get("autoDisabled"))
184+
.autoDisabled;
184185
if (!disabled || !disabled.includes(data[el].file)) {
185-
if (data[el]["world"] === undefined) {
186-
var world = "MAIN";
187-
} else {
188-
if (data[el]["world"].toLowerCase() === "isolated") {
189-
var world = "ISOLATED";
190-
}
191-
if (data[el]["world"].toLowerCase() === "main") {
186+
if (data[el]["world"] === undefined) {
192187
var world = "MAIN";
188+
} else {
189+
if (data[el]["world"].toLowerCase() === "isolated") {
190+
var world = "ISOLATED";
191+
}
192+
if (data[el]["world"].toLowerCase() === "main") {
193+
var world = "MAIN";
194+
}
193195
}
196+
chrome.storage.sync.get("features", function (obj) {
197+
if (obj["features"].includes(data[el]["file"])) {
198+
chrome.scripting.executeScript({
199+
target: { tabId: tabId },
200+
files: [`/features/${data[el]["file"]}.js`],
201+
world: world,
202+
});
203+
ScratchTools.console.log("Injected feature: " + data[el].file);
204+
}
205+
});
194206
}
195-
chrome.storage.sync.get("features", function (obj) {
196-
if (obj["features"].includes(data[el]["file"])) {
197-
chrome.scripting.executeScript({
198-
target: { tabId: tabId },
199-
files: [`/features/${data[el]["file"]}.js`],
200-
world: world,
201-
});
202-
ScratchTools.console.log("Injected feature: " + data[el].file);
203-
}
204-
});
205-
}
206207
});
207208
await chrome.storage.sync.get("version", async function (obj) {
208209
if (obj["version"] !== version) {
@@ -228,23 +229,23 @@ chrome.alarms.onAlarm.addListener(async function () {
228229
delayInMinutes: 0.1,
229230
periodInMinutes: 0.1,
230231
});
231-
var response = await fetch('https://scratchtools.app/disabled/')
232-
var data = await response.json()
233-
await chrome.storage.sync.set({"autoDisabled":data})
234-
var obj = await chrome.storage.sync.get("features")
232+
var response = await fetch("https://scratchtools.app/disabled/");
233+
var data = await response.json();
234+
await chrome.storage.sync.set({ autoDisabled: data });
235+
var obj = await chrome.storage.sync.get("features");
235236
if (obj.features && obj.features.includes("display-message-count-in-icon")) {
236-
try {
237-
var response = await fetch(
238-
"https://scratch.mit.edu/messages/ajax/get-message-count/"
239-
);
240-
var data = await response.json();
241-
chrome.action.setBadgeText({ text: data.msg_count.toString() });
242-
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
243-
} catch (err) {
244-
chrome.action.setBadgeText({ text: "?" });
245-
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
237+
try {
238+
var response = await fetch(
239+
"https://scratch.mit.edu/messages/ajax/get-message-count/"
240+
);
241+
var data = await response.json();
242+
chrome.action.setBadgeText({ text: data.msg_count.toString() });
243+
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
244+
} catch (err) {
245+
chrome.action.setBadgeText({ text: "?" });
246+
chrome.action.setBadgeBackgroundColor({ color: "#ff9f00" });
247+
}
248+
} else {
249+
chrome.action.setBadgeText({ text: "" });
246250
}
247-
} else {
248-
chrome.action.setBadgeText({ text:'' })
249-
}
250251
});

extras/index.html

Lines changed: 107 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ <h3>Blocked Users</h3>
197197
color: rgba(0, 0, 0, 0.8);
198198
padding: 2em;
199199
border-radius: 15px;
200-
margin-top:1rem;
200+
margin-top: 1rem;
201201
}
202202
.section1 .note.yellow {
203203
background: rgba(252, 224, 79, 0.79);
@@ -215,7 +215,7 @@ <h3>Blocked Users</h3>
215215
}
216216

217217
.section1 .note.blue {
218-
background:#4fb1fc;
218+
background: #4fb1fc;
219219
}
220220
.section1 .note h3 {
221221
line-height: 10px;
@@ -251,7 +251,7 @@ <h3>Blocked Users</h3>
251251
display: inline-block;
252252
width: 55px;
253253
height: 28px;
254-
margin-bottom:1rem;
254+
margin-bottom: 1rem;
255255
}
256256

257257
.switch input {
@@ -373,127 +373,127 @@ <h3>Blocked Users</h3>
373373
<style disabled="true" class="easterEgg"></style>
374374
<style>
375375
.beta {
376-
background-color: #f2420c;
377-
border-radius: 0.4rem;
378-
display: inline-block;
379-
padding: 0.35rem;
380-
font-family: "Space Grotesk", sans-serif;
381-
font-size: 0.8rem;
382-
transition: box-shadow 0.3s;
383-
cursor: default;
384-
}
376+
background-color: #f2420c;
377+
border-radius: 0.4rem;
378+
display: inline-block;
379+
padding: 0.35rem;
380+
font-family: "Space Grotesk", sans-serif;
381+
font-size: 0.8rem;
382+
transition: box-shadow 0.3s;
383+
cursor: default;
384+
}
385385

386-
.beta:hover {
387-
box-shadow: 3px 3px #f2420c80;
388-
}
386+
.beta:hover {
387+
box-shadow: 3px 3px #f2420c80;
388+
}
389389

390-
.betatab {
391-
color: #f2420c;
392-
}
390+
.betatab {
391+
color: #f2420c;
392+
}
393393

394-
.easter {
395-
background-color: #f20cd3;
396-
border-radius: 0.4rem;
397-
display: inline-block;
398-
padding: 0.35rem;
399-
font-family: "Space Grotesk", sans-serif;
400-
font-size: 0.8rem;
401-
transition: box-shadow 0.3s;
402-
cursor: default;
403-
}
394+
.easter {
395+
background-color: #f20cd3;
396+
border-radius: 0.4rem;
397+
display: inline-block;
398+
padding: 0.35rem;
399+
font-family: "Space Grotesk", sans-serif;
400+
font-size: 0.8rem;
401+
transition: box-shadow 0.3s;
402+
cursor: default;
403+
}
404404

405-
.easter:hover {
406-
box-shadow: 3px 3px #f20cd380;
407-
}
405+
.easter:hover {
406+
box-shadow: 3px 3px #f20cd380;
407+
}
408408

409-
.eastertab {
410-
color: #f20cd3;
411-
}
409+
.eastertab {
410+
color: #f20cd3;
411+
}
412412

413-
.recommended {
414-
background-color: #f2ad0c;
415-
border-radius: 0.4rem;
416-
display: inline-block;
417-
padding: 0.35rem;
418-
font-family: "Space Grotesk", sans-serif;
419-
font-size: 0.8rem;
420-
transition: box-shadow 0.3s;
421-
cursor: default;
422-
}
413+
.recommended {
414+
background-color: #f2ad0c;
415+
border-radius: 0.4rem;
416+
display: inline-block;
417+
padding: 0.35rem;
418+
font-family: "Space Grotesk", sans-serif;
419+
font-size: 0.8rem;
420+
transition: box-shadow 0.3s;
421+
cursor: default;
422+
}
423423

424-
.recommended:hover {
425-
box-shadow: 3px 3px #f2ad0c80;
426-
}
424+
.recommended:hover {
425+
box-shadow: 3px 3px #f2ad0c80;
426+
}
427427

428-
.recommendedtab {
429-
color: #f2ad0c;
430-
}
428+
.recommendedtab {
429+
color: #f2ad0c;
430+
}
431431

432-
.tabtype {
433-
display: block;
434-
background-color: #1b2126;
435-
outline: none;
436-
border: 0px;
437-
font-size: 200%;
438-
font-family: "Space Grotesk", sans-serif;
439-
float: left;
440-
}
432+
.tabtype {
433+
display: block;
434+
background-color: #1b2126;
435+
outline: none;
436+
border: 0px;
437+
font-size: 200%;
438+
font-family: "Space Grotesk", sans-serif;
439+
float: left;
440+
}
441441

442-
.settingstab {
443-
cursor: pointer;
444-
border-radius: 0.4rem;
445-
display: inline-block;
446-
padding: 0.35rem;
447-
font-family: "Space Grotesk", sans-serif;
448-
font-size: 0.8rem;
449-
}
442+
.settingstab {
443+
cursor: pointer;
444+
border-radius: 0.4rem;
445+
display: inline-block;
446+
padding: 0.35rem;
447+
font-family: "Space Grotesk", sans-serif;
448+
font-size: 0.8rem;
449+
}
450450

451-
.new {
452-
background-color: #0c5df2;
453-
border-radius: 0.4rem;
454-
display: inline-block;
455-
padding: 0.35rem;
456-
font-family: "Space Grotesk", sans-serif;
457-
font-size: 0.8rem;
458-
transition: box-shadow 0.3s;
459-
cursor: default;
460-
}
451+
.new {
452+
background-color: #0c5df2;
453+
border-radius: 0.4rem;
454+
display: inline-block;
455+
padding: 0.35rem;
456+
font-family: "Space Grotesk", sans-serif;
457+
font-size: 0.8rem;
458+
transition: box-shadow 0.3s;
459+
cursor: default;
460+
}
461461

462-
.new:hover {
463-
box-shadow: 3px 3px #0c5df280;
464-
}
462+
.new:hover {
463+
box-shadow: 3px 3px #0c5df280;
464+
}
465465

466-
.newtab {
467-
color: #0c5df2;
468-
}
466+
.newtab {
467+
color: #0c5df2;
468+
}
469469

470-
.featured {
471-
background-color: #700cf2;
472-
border-radius: 0.4rem;
473-
display: inline-block;
474-
padding: 0.35rem;
475-
font-family: "Space Grotesk", sans-serif;
476-
font-size: 0.8rem;
477-
transition: box-shadow 0.3s;
478-
cursor: default;
479-
}
470+
.featured {
471+
background-color: #700cf2;
472+
border-radius: 0.4rem;
473+
display: inline-block;
474+
padding: 0.35rem;
475+
font-family: "Space Grotesk", sans-serif;
476+
font-size: 0.8rem;
477+
transition: box-shadow 0.3s;
478+
cursor: default;
479+
}
480480

481-
.featured:hover {
482-
box-shadow: 3px 3px #700cf280;
483-
}
481+
.featured:hover {
482+
box-shadow: 3px 3px #700cf280;
483+
}
484484

485-
.featuredtab {
486-
color: #700cf2;
487-
}
485+
.featuredtab {
486+
color: #700cf2;
487+
}
488488

489-
.tag {
490-
margin-left: 0.4rem;
491-
}
489+
.tag {
490+
margin-left: 0.4rem;
491+
}
492492

493-
.tags {
494-
position: relative;
495-
float:right;
496-
top:-3rem;
497-
}
493+
.tags {
494+
position: relative;
495+
float: right;
496+
top: -3rem;
497+
}
498498
</style>
499499
</html>

0 commit comments

Comments
 (0)