User:Technical 13/SandBox/Notification colorizer.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Technical 13/SandBox/Notification colorizer. |
/* Colors found so far to represent certain things.
No notifications = "#D2D2D2";// (current gray value)
Thanked = "#14B18A";// (green value from icon)
Reverted = "#575757";// (best average of gray color from icon)
Mentioned = "#3867B1";// (blue value from icon)
Talk page post = "#F9C557";// (old orange color)
Userrights = "#060606";// (Black color from the W icon)
Linked = "#3967B0";// (blue value from icon)
Page reviewed = "#26AA64";// (green value from icon)
Notifications = "#CC0000";// (current red value)
*/
/* NOTE THAT THIS SCRIPT WILL ALWAYS TURN THE ICON GRAY FOR NOW */
/* THIS IS BECAUSE $('li.mw-echo-unread') doesn't exist on the page until you click the notification icon. */
/* I think I can get the information from the API, but I have no time for something that in depth right now. */
var color = "#D2D2D2";
$('li.mw-echo-unread').each(function(){
/* Thank */// You were thanked [[Special:Log]]
if($(this).attr('data-notification-category') === "edit-thank" && $(this).attr('data-notification-type') === "edit-thank"){color = "#14B18A";}
/* Talk */// Someone left a message on your talk page
if($(this).attr('data-notification-category') === "edit-user-talk" && $(this).attr('data-notification-type') === "edit-user-talk"){color = "#F9C557";}
/* Reverted */// An edit of yours was reverted
if($(this).attr('data-notification-category') === "reverted" && $(this).attr('data-notification-type') === "reverted"){color = "#575757";}
/* Mention */// You were mentioned on a talk page in a discussion
if($(this).attr('data-notification-category') === "mention" && $(this).attr('data-notification-type') === "mention"){color = "#3867B1";}
/* Userrights */// Your userrights have changed
if($(this).attr('data-notification-category') === "system" && $(this).attr('data-notification-type') === "userrights"){color = "#060606";}
/* Reviewed */// A page you created as been "patrolled"
if($(this).attr('data-notification-category') === "page-review" && $(this).attr('data-notification-type') === "pagetriage-mark-as-reviewed"){color = "#26AA64";}
/* Linked */// An article you have created has been linked from another article
if($(this).attr('data-notification-category') === "article-linked" && $(this).attr('data-notification-type') === "page-linked"){color = "#3967B0";}
});
if($('a.mw-echo-notifications-badge').html() === "1"){
$('a.mw-echo-notifications-badge').css('background-color', color);
}