tampermonkey: dfde-necroviz
von TRex- SNIPPET_DESC:
- hebt alte threads hervor
- SNIPPET_CREATION_TIME:
- 01.05.2018 02:14:15
- SNIPPET_PRUNE_TIME:
- Unendlich
- SNIPPET_TEXT:
-
- // ==UserScript==
- // @name dfde-necroviz
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://debianforum.de/forum/search.php*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- function parseDate(datestring) {
- const components = datestring.split(', ');
- const dmY = components[0].split('.');
- const hm = components[1];
- return new Date(dmY.reverse().join('-') + "T" + hm + ":00.000Z");
- }
- function daysBetween(d0, d1) {
- return Math.floor((d1 - d0) / 1000 / 60 / 60 / 24);
- }
- const pattern = /(?:([0-9]{2})\.([0-9]{2})\.([0-9]{4,4}), ([0-9]{2}):([0-9]{2}))/g;
- let threads = document.querySelectorAll('dl.row-item');
- threads.forEach(function (row) {
- if (! row.innerText) { console.log(row); return; }
- let dates = row.innerText.match(pattern);
- if (! dates) { return; }
- let days = daysBetween(parseDate(dates[0]), parseDate(dates[1]));
- if (days > 100) {
- row.style.color = 'red';
- }
- });
- })();
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN