#6 Remember user for own requests

This commit is contained in:
Serraniel 2020-07-29 11:42:11 +02:00
parent 199c9db5c5
commit 2b08f5a559
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3

View file

@ -46,12 +46,28 @@ function removeUnknownUsers(node) {
const targetTagName = 'MD-LIST-ITEM'; // tagName is upper case
let updateFunc = item => {
// find user profile link -> own request
let profileLink = item.querySelectorAll('a[href*="/profile/"]:not([href="/profile/false"])');
// find divs
let upperDiv = node.querySelector('[layout-align="start center"][flex]')
let lowerDiv = upperDiv.parentElement.nextElementSibling;
// remember Data
let anime = lowerDiv.innerText;
let profileData = upperDiv.innerHTML;
// exchange data
upperDiv.innerHTML = `<b>${anime}</b>`;
lowerDiv.innerHTML = '&nbsp;';
// add user note if own request
if (profileLink.length > 0) {
lowerDiv.innerHTML = profileData;
}
// remove if foreign request.
else {
lowerDiv.innerHTML = '&nbsp;';
}
}
if (node.tagName === targetTagName) {