diff --git a/features/features.json b/features/features.json index f3b5ed09..c2990930 100644 --- a/features/features.json +++ b/features/features.json @@ -1013,15 +1013,8 @@ "type": ["Editor"] }, { - "title": "Round Profile Pictures", - "description": "All profile pictures on the Scratch website will be rounded.", - "credits": ["Scratchfangs", "rgantzos"], - "urls": [ - "https://scratch.mit.edu/users/scratchfangs/", - "https://scratch.mit.edu/users/rgantzos/" - ], - "file": "round-profile-pictures", - "type": ["Website", "Theme"] + "id": "round-profile-pictures", + "version": 2 }, { "title": "Sidebar", diff --git a/features/round-profile-pictures/data.json b/features/round-profile-pictures/data.json new file mode 100644 index 00000000..cb8d77d6 --- /dev/null +++ b/features/round-profile-pictures/data.json @@ -0,0 +1,14 @@ +{ + "title": "Round Profile Pictures", + "description": "All profile pictures on the Scratch website will be rounded.", + "credits": [ + { "username": "Scratchfangs", "url": "https://scratch.mit.edu/users/scratchfangs/" }, + { "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" } + ], + "type": ["Website", "Theme"], + "tags": [], + "scripts": [{ "file": "script.js", "runOn": "/*" }], + "options": [ + { "id": "Rounding Percentage", "name": "Rounding Percentage", "default": "50%" } + ] +} \ No newline at end of file diff --git a/features/round-profile-pictures/script.js b/features/round-profile-pictures/script.js new file mode 100644 index 00000000..ef5b09bb --- /dev/null +++ b/features/round-profile-pictures/script.js @@ -0,0 +1,17 @@ +var roundness = ScratchTools.Storage["Rounding Percentage"]; +if (!roundness.includes("%")){roundness = roundness.concat("%");} +function roundProfile() { + document.querySelectorAll("img").forEach(function (el) { + if (el.src !== undefined) { + if (el.src.includes("scratch.mit.edu/get_image/user/")) { + el.style.borderRadius = roundness; + } + } + document.querySelectorAll(".mod-social-message").forEach(function (mod) { + mod.style.paddingLeft = ".825rem"; + el.style.paddingRight = "0rem"; + }); +}); +window.setTimeout(roundProfile, 80); +} +roundProfile(); \ No newline at end of file