Skip to content

Commit df8ecfc

Browse files
authored
Merge pull request #971 from rgantzos/main
Add option to not hide advertisements in studio comments
2 parents 722cc9c + 0ad6f43 commit df8ecfc

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

features/hide-advertisements/data.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
{ "file": "three.js", "runOn": "/studios/*" },
1818
{ "file": "two.js", "runOn": "/users/*" }
1919
],
20-
"options": [{ "id": "colorComment", "name": "Highlight Comments", "type": 1 }],
20+
"options": [
21+
{ "id": "colorComment", "name": "Highlight Comments", "type": 1 },
22+
{
23+
"id": "dontHideStudioComments",
24+
"name": "Don't Hide Studio Comments",
25+
"type": 1
26+
}
27+
],
2128
"similar": ["important-messages", "block-messages"]
2229
}

features/hide-advertisements/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
body.colorComment .scratchtoolsAd .comment-bubble, .scratchtoolsAd .comment-bubble::before {
1+
body.colorComment .scratchtoolsAd .comment-bubble, body.colorComment .scratchtoolsAd .comment-bubble::before {
22
background-color: #eccedf !important;
33
border: 1px solid #ff6680;
44
}
@@ -9,6 +9,6 @@ body.colorComment .scratchtoolsAd .comment-bubble:before {
99
background-color: #eccedf !important;
1010
}
1111

12-
body.hideComment .scratchtoolsAd {
12+
body.hideComment:not(.dontHideStudioComments) .scratchtoolsAd {
1313
display: none;
1414
}

features/hide-advertisements/three.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ if (ScratchTools.Storage.colorComment) {
66
document.body.classList.add("hideComment");
77
}
88

9+
if (ScratchTools.Storage.dontHideStudioComments) {
10+
document.body.classList.add("dontHideStudioComments")
11+
}
12+
913
var hideAds = new Feature({ id: "hide-advertisements" });
1014
hideAds.settings.addEventListener("changed", function ({key: name, value}) {
1115
if (name === "colorComment") {
@@ -16,6 +20,12 @@ hideAds.settings.addEventListener("changed", function ({key: name, value}) {
1620
document.body.classList.remove("colorComment");
1721
document.body.classList.add("hideComment");
1822
}
23+
} else if (name === "dontHideStudioComments") {
24+
if (value) {
25+
document.body.classList.add("dontHideStudioComments")
26+
} else {
27+
document.body.classList.remove("dontHideStudioComments")
28+
}
1929
}
2030
});
2131

0 commit comments

Comments
 (0)