Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Follows You" update to feature version 2 #490

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
34 changes: 7 additions & 27 deletions features/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,8 @@
"type": ["Website"]
},
{
"title": "Show if Following on Profile",
"description": "If a user is following you, it will show next to their username when you visit their profile.",
"credits": ["Bob the Potato with Drip", "TimMcCool"],
"urls": [
"https://scratch.mit.edu/users/JefferyTheSuperKat/",
"https://scratch.mit.edu/users/TimMcCool/"
],
"file": "follows-you",
"type": ["Website"],
"tags": ["Featured"],
"dynamic": true
"version": 2,
"id": "follows-you"
},
{
"title": "Custom Studio Section",
Expand All @@ -203,15 +194,9 @@
{ "id": "Studio ID", "name": "Studio ID", "default": "27205657" }
]
},
{
"title": "Highlight Unanswered Forum Topics",
"description": "Adds a blue highlight to topics in the forums that have no replies.",
"credits": ["rgantzos"],
"urls": ["https://scratch.mit.edu/users/rgantzos/"],
"file": "highlight-unanswered",
"type": ["Website"],
"tags": ["New", "Recommended"],
"dynamic": true
{
"version": 2,
"id": "highlight-unanswered"
},
{
"title": "Hide Project Tags",
Expand Down Expand Up @@ -764,13 +749,8 @@
"type": ["Website"]
},
{
"title": "Go to Parent Button",
"description": "In the editor for any project that is a remix, you can click a button to go to the editor in the parent project.",
"credits": ["rgantzos"],
"urls": ["https://scratch.mit.edu/users/rgantzos/"],
"file": "go-to-parent",
"tags": [],
"type": ["Editor"]
"version": 2,
"id": "go-to-parent"
},
{
"title": "Most Popular Project",
Expand Down
12 changes: 12 additions & 0 deletions features/follows-you/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"title": "Show if Following on Profile",
"description": "If a user is following you, it will show next to their username when you visit their profile.",
"credits": [
{ "username": "Bob the Potato with Drip", "url": "https://scratch.mit.edu/users/JefferyTheSuperKat/" },
{ "username": "TimMcCool", "url": "https://scratch.mit.edu/users/TimMcCool/" }
],
"type": ["Website"],
"tags": ["Featured"],
"styles": [{ "file": "style.css", "runOn": "/users/*" }],
"scripts": [{ "file": "script.js", "runOn": "/users/*" }]
}
14 changes: 8 additions & 6 deletions features/follows-you.js → features/follows-you/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ async function getFollowing(user1, user2) {
document.createElement("span"),
document.querySelector(".profile-details")
);
if (typeof scratchAddons !== 'undefined') {
for(var i = 0; i < scratchAddons.eventTargets.self.length; i++) {
if(scratchAddons.eventTargets.self[i].id == "better-featured-project"){
span.style.color = "white";
}
}}
span.className = "scratchtoolsFollowsYou";
span.textContent = "Follows You";
span.style.opacity = ".5";
span.style.fontSize = ".8rem";
element.querySelector("h2").style.display = "inline-block";
}
}
});
}
});
Expand All @@ -45,9 +48,8 @@ if (
.split("/")[0]
);
}

ScratchTools.setDisable("follows-you", function () {
if (document.querySelector(".scratchtoolsFollowsYou")) {
document.querySelector(".scratchtoolsFollowsYou").remove();
}
});
});
8 changes: 8 additions & 0 deletions features/follows-you/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.scratchtoolsFollowsYou {
opacity: .6;
text-shadow: rgba(0, 0, 0, 0.5) 0 0 10px;
font-size: .9rem;
}
.header-text > h2 {
display: inline-block;
}