From 526098fc0e90cbfe39074d53d6d848f6d7abb9f1 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 4 Aug 2020 12:35:14 +0200 Subject: [PATCH 1/3] #20 prepared dummy js File --- enhancements/lists.js | 4 ++++ manifest.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 enhancements/lists.js diff --git a/enhancements/lists.js b/enhancements/lists.js new file mode 100644 index 0000000..19cf246 --- /dev/null +++ b/enhancements/lists.js @@ -0,0 +1,4 @@ +registerScript(node => { + // run the scripts + +}, ".*"); \ No newline at end of file diff --git a/manifest.json b/manifest.json index a7777d7..f0f0ef7 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ ], "js": [ "enhancements/quickSearch.js", - "enhancements/animeRequests.js" + "enhancements/animeRequests.js", + "enhancements/lists.js" ], "run_at": "document_end" } From 502fa4d2dc4a08535a0fd525481cea13479737e9 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 4 Aug 2020 14:39:58 +0200 Subject: [PATCH 2/3] #20 added function to add list seperators globally --- enhancements/lists.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/enhancements/lists.js b/enhancements/lists.js index 19cf246..7939a00 100644 --- a/enhancements/lists.js +++ b/enhancements/lists.js @@ -1,4 +1,28 @@ registerScript(node => { // run the scripts + if (isHtmlElement(node)) { + addListHorizontalSeparators(node) + } +}, ".*"); -}, ".*"); \ No newline at end of file +function addListHorizontalSeparators(node) { + const targetTagName = 'MD-LIST-ITEM'; // tagName is upper case + + let updateFunc = item => { + // add border as horizontal seperator + item.style.borderBottom = "1px solid rgba(155,155,155, 0.2)"; + } + + // are we target tag? + if (node.tagName === targetTagName) { + updateFunc(node); + } else { + // find items -> all + let requestItems = node.querySelectorAll('md-list-item'); + + // update borders + requestItems.forEach(item => { + updateFunc(item); + }); + } +} \ No newline at end of file From cbeb46e666674d432f00cf776df73ab0e2009c2f Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 4 Aug 2020 14:40:37 +0200 Subject: [PATCH 3/3] #20 Removed obsolete functionallity Horizontal seperators are now handled globally --- enhancements/animeRequests.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/enhancements/animeRequests.js b/enhancements/animeRequests.js index f4f6fbd..066be38 100644 --- a/enhancements/animeRequests.js +++ b/enhancements/animeRequests.js @@ -2,7 +2,7 @@ registerScript(node => { // run the scripts if (isHtmlElement(node)) { changeFollowedStarColor(node); - changeBorderColor(node); + changeBorderColorOwnRequests(node); removeUnknownUsers(node); } }, "/requests"); @@ -17,7 +17,7 @@ function changeFollowedStarColor(node) { followedItems.forEach(item => item.style.color = aniBlue); } -function changeBorderColor(node) { +function changeBorderColorOwnRequests(node) { const targetTagName = 'MD-LIST-ITEM'; // tagName is upper case let updateFunc = item => { @@ -27,9 +27,6 @@ function changeBorderColor(node) { if (profileLink.length > 0) { item.style.borderColor = aniBlue } - - // add border as horizontal seperator - item.style.borderBottom = "1px solid rgba(155,155,155, 0.2)"; } // are we target tag?