Last active
January 27, 2023 12:32
-
-
Save Brandhand/7ba17bd81c679286d3d7f6032f276209 to your computer and use it in GitHub Desktop.
used with ViolentMonkey on Firefox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name aaaas listing cleaner | |
// @description remove doubles from aas listing | |
// @version 230127.2 | |
// | |
// @grant GM_addStyle | |
// | |
// @match https://www.allesausseraas.de/* | |
// @exclude https://www.allesausseraas.de/impressum/* | |
// @exclude https://www.allesausseraas.de/listing/* | |
// @exclude https://www.allesausseraas.de/maschinenraum/* | |
// @exclude https://www.allesausseraas.de/meta-wtf/* | |
// @exclude https://www.allesausseraas.de/spiele/* | |
// @exclude https://www.allesausseraas.de/spiele/rl/* | |
// @exclude https://www.allesausseraas.de/streams/* | |
// inject-into content | |
// ==/UserScript== | |
/*global console */ | |
const $ = el => document.querySelector(el); | |
const $$ = el => document.querySelectorAll(el); | |
function main() { | |
rmDoubleEntries(); | |
} | |
function rmDoubleEntries() { | |
let lastEntry; | |
let withoutInfo = true; | |
function checkText(el) { | |
const cleanText = el.innerText.replace(/\+$/, '').trim(); | |
if (lastEntry == cleanText) { | |
if (withoutInfo && el.innerText.endsWith('+')) { | |
withoutInfo = false; | |
el.previousSibling.hidden = true; | |
} else { | |
el.hidden = true; | |
} | |
} else { | |
withoutInfo = !el.innerText.endsWith('+'); | |
lastEntry = cleanText; | |
} | |
} | |
$$('div.aas_listing > div').forEach((el) => { | |
checkText(el); | |
}); | |
$$('div.aas_listing > div > div').forEach((el) => { | |
checkText(el); | |
}); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kleines Update: Script hat doppelte Einträge ohne Rücksicht auf Infos gelöscht und evtl Einträge ohne Info stehen lassen, nur weil sie zuerst gelistet waren.