diff --git a/addons/scratch-notifier/addon.json b/addons/scratch-notifier/addon.json index 7dbbe680a0..46ced31f79 100644 --- a/addons/scratch-notifier/addon.json +++ b/addons/scratch-notifier/addon.json @@ -4,6 +4,9 @@ "credits": [ { "name": "World_Languages" + }, + { + "name": "NitroCipher/ZenithRogue" } ], "permissions": ["notifications"], @@ -16,55 +19,55 @@ "default": true }, { - "name": "๐ฌ Notify profile comments & replies", + "name": "@comment.svg Notify profile comments & replies", "id": "commentsforme_notifications", "type": "boolean", "default": true }, { - "name": "๐ฌ Notify comments on my projects", + "name": "@comment.svg Notify comments on my projects", "id": "commentsonmyprojects_notifications", "type": "boolean", "default": true }, { - "name": "๐ Notify forum activity", + "name": "@forum.svg Notify forum activity", "id": "forumpost_notifications", "type": "boolean", "default": true }, { - "name": "โค๏ธ Notify loves", + "name": "@heart.svg Notify loves", "id": "loveproject_notifications", "type": "boolean", "default": true }, { - "name": "โญ Notify favorites", + "name": "@star.svg Notify favorites", "id": "favoriteproject_notifications", "type": "boolean", "default": true }, { - "name": "๐ง Notify new followers", + "name": "@follow.svg Notify new followers", "id": "followuser_notifications", "type": "boolean", "default": true }, { - "name": "โ๏ธ Notify studio invites", + "name": "@studio-add.svg Notify studio invites", "id": "curatorinvite_notifications", "type": "boolean", "default": true }, { - "name": "๐ Notify studio activity", + "name": "@studio.svg Notify studio activity", "id": "studioactivity_notifications", "type": "boolean", "default": true }, { - "name": "๐ Notify remixes", + "name": "@remix.svg Notify remixes", "id": "remixproject_notifications", "type": "boolean", "default": true diff --git a/addons/scratch-notifier/background.js b/addons/scratch-notifier/background.js index 7695b2ec58..7f9041e5bf 100644 --- a/addons/scratch-notifier/background.js +++ b/addons/scratch-notifier/background.js @@ -5,14 +5,14 @@ export default async function ({ addon, global, console, setTimeout, setInterval let lastDateTime = null; let lastAuthChange; // Used to check if auth changed while waiting for promises to resolve const emojis = { - addcomment: "๐ฌ", - forumpost: "๐", - loveproject: "โค๏ธ", - favoriteproject: "โญ", - followuser: "๐ง", - curatorinvite: "โ๏ธ", - remixproject: "๐", - studioactivity: "๐", + addcomment: "comment", + forumpost: "forum", + loveproject: "heart", + favoriteproject: "star", + followuser: "follow", + curatorinvite: "studio-add", + remixproject: "remix", + studioactivity: "studio", }; checkCount(); @@ -44,52 +44,85 @@ export default async function ({ addon, global, console, setTimeout, setInterval }) { let text = ""; let url; - if (emoji) text += `${emoji} `; if (messageType.startsWith("addcomment/")) { url = commentUrl; if (title.length > 20) title = `${title.substring(0, 17).trimEnd()}...`; - if (messageType === "addcomment/ownProjectNewComment") { - text += `${actor} commented in your project "${title}":\n${fragment}`; - } else if (messageType === "addcomment/projectReplyToSelf") { - text += `${actor} replied to you in project "${title}":\n${fragment}`; - } else if (messageType === "addcomment/ownProjectReplyToOther") { - text += `${actor} replied to ${commentee} in project "${title}":\n${fragment}`; - } else if (messageType === "addcomment/ownProfileNewComment") { - text += `${actor} commented in your profile:\n${fragment}`; - } else if (messageType === "addcomment/ownProfileReplyToSelf") { - text += `${actor} replied to you in your profile:\n${fragment}`; - } else if (messageType === "addcomment/ownProfileReplyToOther") { - text += `${actor} replied to ${commentee} in your profile:\n${fragment}`; - } else if (messageType === "addcomment/otherProfileReplyToSelf") { - text += `${actor} replied in ${title}'s profile:\n${fragment}`; - } else if (messageType === "addcomment/studio") { - text += `${actor} replied in studio "${title}":\n${fragment}`; + var notificationTitle; + switch (messageType.split("/")[1]) { + case "ownProjectNewComment": + notificationTitle = `${actor} commented on your project "${title}"`; + text = fragment; + break; + case "projectReplyToSelf": + notificationTitle = `${actor} replied to you on project "${title}"`; + text = fragment; + break; + case "ownProjectReplyToOther": + notificationTitle = `${actor} replied to ${commentee} on project "${title}"`; + text = fragment; + break; + case "ownProfileNewComment": + notificationTitle = `${actor} commented on your profile`; + text = fragment; + break; + case "ownProfileReplyToSelf": + notificationTitle = `${actor} replied to you on your profile`; + text = fragment; + break; + case "ownProfileReplyToOther": + notificationTitle = `${actor} replied to ${commentee} on your profile`; + text = fragment; + break; + case "otherProfileReplyToSelf": + notificationTitle = `${actor} replied on ${title}'s profile`; + text = fragment; + break; + case "studio": + notificationTitle = `${actor} replied in studio "${title}"`; + text = fragment; + break; + default: + notificationTitle = "New Scratch comment"; + break; + } + } else { + switch (messageType) { + case "forumpost": + notificationTitle = `There are new posts in the forum thread "${title}"`; + url = `https://scratch.mit.edu/discuss/topic/${element_id}/unread/`; + break; + case "loveproject": + notificationTitle = `${actor} loved your project "${title}"`; + url = `https://scratch.mit.edu/users/${actor}/`; + break; + case "favoriteproject": + notificationTitle = `${actor} favorited your project "${title}"`; + url = `https://scratch.mit.edu/users/${actor}/`; + break; + case "followuser": + notificationTitle = `${actor} is now following you`; + url = `https://scratch.mit.edu/users/${actor}/`; + break; + case "curatorinvite": + notificationTitle = `${actor} invited you to curate the studio "${title}"`; + url = `https://scratch.mit.edu/studios/${element_id}/curators/`; + break; + case "remixproject": + notificationTitle = `${actor} remixed your project "${parent_title}" as "${title}"`; + url = `https://scratch.mit.edu/projects/${element_id}/`; + break; + case "studioactivity": + notificationTitle = `There was new activity in studio "${title}" today`; + break; + default: + notificationTitle = "New Scratch message"; + break; } - } else if (messageType === "forumpost") { - text += `There are new posts in the forum thread "${title}"`; - url = `https://scratch.mit.edu/discuss/topic/${element_id}/unread/`; - } else if (messageType === "loveproject") { - text += `${actor} loved your project "${title}"`; - url = `https://scratch.mit.edu/users/${actor}/`; - } else if (messageType === "favoriteproject") { - text += `${actor} favorited your project "${title}"`; - url = `https://scratch.mit.edu/users/${actor}/`; - } else if (messageType === "followuser") { - text += `${actor} is now following you`; - url = `https://scratch.mit.edu/users/${actor}/`; - } else if (messageType === "curatorinvite") { - text += `${actor} invited you to curate the studio "${title}"`; - url = `https://scratch.mit.edu/studios/${element_id}/curators/`; - } else if (messageType === "remixproject") { - text += `${actor} remixed your project "${parent_title}" as "${title}"`; - url = `https://scratch.mit.edu/projects/${element_id}/`; - } else if (messageType === "studioactivity") { - text += `There was new activity in studio "${title}" today`; } const notifId = await addon.notifications.create({ type: "basic", - title: "New Scratch message", - iconUrl: "/images/icon.png", + title: notificationTitle, + iconUrl: emoji ? `../../images/icons/${emoji}.svg` : "/images/icon.png", message: text, buttons: [ { diff --git a/webpages/settings/brush.svg b/images/icons/brush.svg similarity index 100% rename from webpages/settings/brush.svg rename to images/icons/brush.svg diff --git a/images/icons/cloud.svg b/images/icons/cloud.svg new file mode 100644 index 0000000000..05e2782431 --- /dev/null +++ b/images/icons/cloud.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/comment.svg b/images/icons/comment.svg new file mode 100644 index 0000000000..61032ae3f0 --- /dev/null +++ b/images/icons/comment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/envelope.svg b/images/icons/envelope.svg new file mode 100644 index 0000000000..20e606e4b6 --- /dev/null +++ b/images/icons/envelope.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/settings/expand.svg b/images/icons/expand.svg similarity index 100% rename from webpages/settings/expand.svg rename to images/icons/expand.svg diff --git a/images/icons/follow.svg b/images/icons/follow.svg new file mode 100644 index 0000000000..3619065b2d --- /dev/null +++ b/images/icons/follow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/forum.svg b/images/icons/forum.svg new file mode 100644 index 0000000000..49180ed03d --- /dev/null +++ b/images/icons/forum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/heart.svg b/images/icons/heart.svg new file mode 100644 index 0000000000..dd0e88b58c --- /dev/null +++ b/images/icons/heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/settings/list.svg b/images/icons/list.svg similarity index 100% rename from webpages/settings/list.svg rename to images/icons/list.svg diff --git a/images/icons/plus.svg b/images/icons/plus.svg new file mode 100644 index 0000000000..bb7d92e90c --- /dev/null +++ b/images/icons/plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/popout.svg b/images/icons/popout.svg new file mode 100644 index 0000000000..533a7129fe --- /dev/null +++ b/images/icons/popout.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/settings/puzzle.svg b/images/icons/puzzle.svg similarity index 100% rename from webpages/settings/puzzle.svg rename to images/icons/puzzle.svg diff --git a/images/icons/read.svg b/images/icons/read.svg new file mode 100644 index 0000000000..8e288f922c --- /dev/null +++ b/images/icons/read.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/reload.svg b/images/icons/reload.svg new file mode 100644 index 0000000000..66026a149a --- /dev/null +++ b/images/icons/reload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/remix.svg b/images/icons/remix.svg new file mode 100644 index 0000000000..eacc197126 --- /dev/null +++ b/images/icons/remix.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/popup/settings.svg b/images/icons/settings.svg similarity index 100% rename from webpages/popup/settings.svg rename to images/icons/settings.svg diff --git a/images/icons/star.svg b/images/icons/star.svg new file mode 100644 index 0000000000..d2c2d89ac3 --- /dev/null +++ b/images/icons/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/studio-add.svg b/images/icons/studio-add.svg new file mode 100644 index 0000000000..e1acc6c980 --- /dev/null +++ b/images/icons/studio-add.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/studio.svg b/images/icons/studio.svg new file mode 100644 index 0000000000..76b8a821a5 --- /dev/null +++ b/images/icons/studio.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/settings/theme.svg b/images/icons/theme.svg similarity index 100% rename from webpages/settings/theme.svg rename to images/icons/theme.svg diff --git a/webpages/settings/undo.svg b/images/icons/undo.svg similarity index 100% rename from webpages/settings/undo.svg rename to images/icons/undo.svg diff --git a/images/icons/users.svg b/images/icons/users.svg new file mode 100644 index 0000000000..d6a5c1a64e --- /dev/null +++ b/images/icons/users.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpages/settings/web.svg b/images/icons/web.svg similarity index 100% rename from webpages/settings/web.svg rename to images/icons/web.svg diff --git a/webpages/settings/wrench.svg b/images/icons/wrench.svg similarity index 100% rename from webpages/settings/wrench.svg rename to images/icons/wrench.svg diff --git a/popups/cloud-games/light.css b/popups/cloud-games/light.css index e429a1d481..481e1a5030 100644 --- a/popups/cloud-games/light.css +++ b/popups/cloud-games/light.css @@ -20,3 +20,7 @@ body::-webkit-scrollbar-thumb { .title a { color: #222; } + +.small-icon:not(.colored) { + filter: brightness(0); +} diff --git a/popups/cloud-games/popup.css b/popups/cloud-games/popup.css index 8833e2e899..39883f02d1 100644 --- a/popups/cloud-games/popup.css +++ b/popups/cloud-games/popup.css @@ -59,7 +59,7 @@ a:hover { .float-right { margin-left: 4px; white-space: nowrap; - font-size: 0.9rem; + font-size: 12px; } .float-right > span { display: inline-block; @@ -86,3 +86,8 @@ a:hover { .title a { color: white; } + +.small-icon { + height: 14px; + vertical-align: text-bottom; +} diff --git a/popups/cloud-games/popup.html b/popups/cloud-games/popup.html index a0adb8e7a5..5cf40a2c8c 100644 --- a/popups/cloud-games/popup.html +++ b/popups/cloud-games/popup.html @@ -15,7 +15,7 @@ {{ project.title }} - ๐ค {{ project.amt }} + {{ project.amt }}