Bugfix/#67 list separator on last element #69

Merged
Serraniel merged 8 commits from bugfix/#67-list-separator-on-last-element into develop 2020-10-12 17:52:45 +02:00
2 changed files with 0 additions and 37 deletions
Showing only changes of commit 62fa39c2bf - Show all commits

View file

@ -1,35 +0,0 @@
import * as core from '../utils/aniwatchCore';
import * as helper from '../utils/helpers';
export function init() {
core.registerScript(node => {
// run the scripts
if (helper.isHtmlElement(node)) {
addListHorizontalSeparators(node)
}
}, ".*");
}
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) {
if (typeof node.nextSibling !== "undefined") {
updateFunc(node);
}
} else {
// find items -> all
let requestItems = node.querySelectorAll('md-list-item:not(:last-child)');
// update borders
requestItems.forEach(item => {
updateFunc(item);
});
}
}

View file

@ -5,7 +5,6 @@ import { initHelpers } from './utils/helpers';
// enhancements
import { init as animeRequests } from './enhancements/animeRequests';
import { init as languageDisplay } from './enhancements/languageDisplay';
import { init as lists } from './enhancements/lists';
import { init as quickSearch } from './enhancements/quickSearch';
// core
@ -17,5 +16,4 @@ initHelpers();
// enhancements
animeRequests();
languageDisplay();
lists();
quickSearch();