2020-04-25 22:23:02 +02:00
|
|
|
const starIcon = "star";
|
|
|
|
|
2020-07-29 10:03:25 +02:00
|
|
|
registerScript(() => {
|
2020-04-25 23:23:13 +02:00
|
|
|
// run the scripts
|
2020-07-29 10:03:25 +02:00
|
|
|
handleListAfterLoad();
|
2020-04-25 23:23:13 +02:00
|
|
|
|
|
|
|
// because of late loading in the request list we have to run the codes each time the list changes
|
2020-07-29 10:03:25 +02:00
|
|
|
//document.querySelector("md-list").addEventListener("DOMNodeInserted", event => handleListAfterLoad(event), false);
|
|
|
|
});
|
2020-04-25 23:23:13 +02:00
|
|
|
|
2020-07-29 10:03:25 +02:00
|
|
|
function handleListAfterLoad() {
|
|
|
|
changeFollowedStarColor();
|
|
|
|
changeOwnBorderColor();
|
2020-04-25 23:23:13 +02:00
|
|
|
}
|
2020-04-25 22:23:02 +02:00
|
|
|
|
|
|
|
function changeFollowedStarColor() {
|
|
|
|
// find stars
|
|
|
|
let followedItems = Array.from(document.querySelectorAll("i")).filter(i => i.innerText == starIcon);
|
|
|
|
|
|
|
|
// change color
|
|
|
|
followedItems.forEach(item => item.style.color = aniBlue);
|
2020-04-25 22:43:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function changeOwnBorderColor() {
|
|
|
|
// find items -> all
|
|
|
|
let requestItems = document.querySelectorAll("md-list-item");
|
|
|
|
|
|
|
|
// change border color if profile link is not "false"
|
|
|
|
requestItems.forEach(item => {
|
|
|
|
let profileLink = item.querySelectorAll("a[href*='/profile/']:not([href='/profile/false'])");
|
|
|
|
|
|
|
|
if (profileLink.length > 0) {
|
|
|
|
item.style.borderColor = aniBlue
|
|
|
|
}
|
|
|
|
});
|
2020-04-25 22:23:02 +02:00
|
|
|
}
|