Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion features/hide-advertisements/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
{ "file": "three.js", "runOn": "/studios/*" },
{ "file": "two.js", "runOn": "/users/*" }
],
"options": [{ "id": "colorComment", "name": "Highlight Comments", "type": 1 }],
"options": [
{ "id": "colorComment", "name": "Highlight Comments", "type": 1 },
{
"id": "dontHideStudioComments",
"name": "Don't Hide Studio Comments",
"type": 1
}
],
"similar": ["important-messages", "block-messages"]
}
4 changes: 2 additions & 2 deletions features/hide-advertisements/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
body.colorComment .scratchtoolsAd .comment-bubble, .scratchtoolsAd .comment-bubble::before {
body.colorComment .scratchtoolsAd .comment-bubble, body.colorComment .scratchtoolsAd .comment-bubble::before {
background-color: #eccedf !important;
border: 1px solid #ff6680;
}
Expand All @@ -9,6 +9,6 @@ body.colorComment .scratchtoolsAd .comment-bubble:before {
background-color: #eccedf !important;
}

body.hideComment .scratchtoolsAd {
body.hideComment:not(.dontHideStudioComments) .scratchtoolsAd {
display: none;
}
10 changes: 10 additions & 0 deletions features/hide-advertisements/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ if (ScratchTools.Storage.colorComment) {
document.body.classList.add("hideComment");
}

if (ScratchTools.Storage.dontHideStudioComments) {
document.body.classList.add("dontHideStudioComments")
}

var hideAds = new Feature({ id: "hide-advertisements" });
hideAds.settings.addEventListener("changed", function ({key: name, value}) {
if (name === "colorComment") {
Expand All @@ -16,6 +20,12 @@ hideAds.settings.addEventListener("changed", function ({key: name, value}) {
document.body.classList.remove("colorComment");
document.body.classList.add("hideComment");
}
} else if (name === "dontHideStudioComments") {
if (value) {
document.body.classList.add("dontHideStudioComments")
} else {
document.body.classList.remove("dontHideStudioComments")
}
}
});

Expand Down
Loading