Skip to content

Instantly share code, notes, and snippets.

@Brandhand
Last active January 27, 2023 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brandhand/7ba17bd81c679286d3d7f6032f276209 to your computer and use it in GitHub Desktop.
Save Brandhand/7ba17bd81c679286d3d7f6032f276209 to your computer and use it in GitHub Desktop.
used with ViolentMonkey on Firefox
// ==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();
@Brandhand
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment