Merge pull request #5 from Serraniel/feature/#1-requests-page-own-requests-colored-border
Feature/#1 requests page own requests colored border Closes #1 .
This commit is contained in:
commit
f6fc279ac0
|
@ -1,6 +1,23 @@
|
||||||
const starIcon = "star";
|
const starIcon = "star";
|
||||||
|
const scripts = [
|
||||||
|
changeFollowedStarColor,
|
||||||
|
changeOwnBorderColor,
|
||||||
|
]
|
||||||
|
|
||||||
executeAfterPreload(changeFollowedStarColor);
|
executeAfterPreload(initScripts);
|
||||||
|
|
||||||
|
function initScripts() {
|
||||||
|
// run the scripts
|
||||||
|
runScripts();
|
||||||
|
|
||||||
|
// because of late loading in the request list we have to run the codes each time the list changes
|
||||||
|
document.querySelector("md-list").addEventListener("DOMNodeInserted", event => runScripts(event), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runScripts() {
|
||||||
|
scripts.forEach(script => script());
|
||||||
|
console.log("DDS")
|
||||||
|
}
|
||||||
|
|
||||||
function changeFollowedStarColor() {
|
function changeFollowedStarColor() {
|
||||||
// find stars
|
// find stars
|
||||||
|
@ -8,4 +25,18 @@ function changeFollowedStarColor() {
|
||||||
|
|
||||||
// change color
|
// change color
|
||||||
followedItems.forEach(item => item.style.color = aniBlue);
|
followedItems.forEach(item => item.style.color = aniBlue);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
Loading…
Reference in a new issue