diff --git a/features/features.json b/features/features.json index f3b5ed09..9a434187 100644 --- a/features/features.json +++ b/features/features.json @@ -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", diff --git a/features/follows-you/data.json b/features/follows-you/data.json new file mode 100644 index 00000000..34a81bb8 --- /dev/null +++ b/features/follows-you/data.json @@ -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/*" }] +} \ No newline at end of file diff --git a/features/follows-you.js b/features/follows-you/script.js similarity index 85% rename from features/follows-you.js rename to features/follows-you/script.js index 76cca14b..c7a71233 100644 --- a/features/follows-you.js +++ b/features/follows-you/script.js @@ -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"; - } + } }); } }); @@ -45,9 +48,8 @@ if ( .split("/")[0] ); } - ScratchTools.setDisable("follows-you", function () { if (document.querySelector(".scratchtoolsFollowsYou")) { document.querySelector(".scratchtoolsFollowsYou").remove(); } -}); +}); \ No newline at end of file diff --git a/features/follows-you/style.css b/features/follows-you/style.css new file mode 100644 index 00000000..a7b95e43 --- /dev/null +++ b/features/follows-you/style.css @@ -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; +} \ No newline at end of file