-
// ==UserScript==
-
// @name Thread extraction
-
// @namespace http://tampermonkey.net/
-
// @version 0.1
-
// @author You
-
// @description A script to scrape thread IDs from wayback captures of anonpone
-
// @grant GM_setClipboard
-
// ==/UserScript==
-
-
(function() {
-
'use strict';
-
var btn = document.createElement("button");
-
btn.textContent = "Export threads to clip";
-
btn.className = "btn btn-default";
-
btn.onclick = () => {
-
var button = Array.from(document.getElementsByClassName("btn")).find(e => e.textContent.trim() === 'Threads');
-
-
if (button == null) {
-
console.log("No thread menu found");
-
return;
-
}
-
-
var thread_menu = button.parentNode.getElementsByTagName("ul")[0];
-
-
var threads = Array.from(thread_menu.getElementsByTagName("li"));
-
var clip = new Array();
-
clip.push(document.title);
-
-
for(var i = 0; i < threads.length; i++) {
-
var text = threads[i].textContent.match(/\d+/)[0];
-
clip.push("\t" + text);
-
}
-
-
GM.setClipboard(clip.join('\n') + '\n');
-
btn.textContent = "Copied";
-
}
-
-
var button_group = Array.from(document.getElementsByTagName("button")).find(e => e.textContent.trim() === 'Threads').parentNode.parentNode;
-
button_group.appendChild(btn);
-
})();
TEXT
36
0
151 1.42 KB 41
151 1.42 KB 41