Skip to content

Instantly share code, notes, and snippets.

@oxguy3
Last active December 10, 2019 02:44
Show Gist options
  • Save oxguy3/a34f2177a90e5ef6d67e1892f4a27a2d to your computer and use it in GitHub Desktop.
Save oxguy3/a34f2177a90e5ef6d67e1892f4a27a2d to your computer and use it in GitHub Desktop.
userscript to make the log for ArchiveTeam's tracker a little bit easier to read
// ==UserScript==
// @name ArchiveTeam tracker log cleaner
// @namespace https://schiff.io/
// @version 0.1
// @description make the log for the AT tracker a little bit easier to read
// @author Hayden Schiff (oxguy3)
// @match http://tracker-test.ddns.net/*
// @match http://tracker.archiveteam.org/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function monitorLog(textReplace) {
const logNode = document.getElementById('log');
const callback = function(mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
for (let addedNode of mutation.addedNodes) {
if (addedNode instanceof HTMLElement) {
const title = addedNode.querySelector('td:nth-child(2) span.text');
if (typeof title !== 'undefined') {
title.innerHTML = textReplace(title.innerHTML);
}
}
}
}
}
};
const observer = new MutationObserver(callback);
observer.observe(logNode, { childList: true, subtree: true });
}
const pages = [
{
hostname: "tracker-test.ddns.net",
pathname: "/yahoo-groups-api/",
textReplace: function(text) {
return text.replace('group_cookie:', '').replace(':a-c-d-f-i-l-m-p', '');
}
},
{
hostname: "tracker.archiveteam.org",
pathname: "/yahoogroups/",
textReplace: function(text) {
return text.replace('group:', '');
}
}
];
for (const page of pages) {
if (page.hostname == window.location.hostname && page.pathname == window.location.pathname) {
console.log(page.url);
monitorLog(page.textReplace);
break;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment