Skip to content

Commit

Permalink
Merge pull request #971 from rgantzos/main
Browse files Browse the repository at this point in the history
Add option to not hide advertisements in studio comments
  • Loading branch information
rgantzos authored Nov 30, 2024
2 parents 722cc9c + 0ad6f43 commit df8ecfc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
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

0 comments on commit df8ecfc

Please sign in to comment.