-
1.
// ==UserScript==
-
2.
// @name Thread extraction
-
3.
// @namespace http://tampermonkey.net/
-
4.
// @version 0.1
-
5.
// @author You
-
6.
// @description A script to scrape thread IDs from wayback captures of anonpone
- 7.
-
8.
// @grant GM_setClipboard
-
9.
// ==/UserScript==
-
10.
-
11.
(function() {
-
12.
'use strict';
-
13.
var btn = document.createElement("button");
-
14.
btn.textContent = "Export threads to clip";
-
15.
btn.className = "btn btn-default";
-
16.
btn.onclick = () => {
-
17.
var button = Array.from(document.getElementsByClassName("btn")).find(e => e.textContent.trim() === 'Threads');
-
18.
-
19.
if (button == null) {
-
20.
console.log("No thread menu found");
-
21.
return;
-
22.
}
-
23.
-
24.
var thread_menu = button.parentNode.getElementsByTagName("ul")[0];
-
25.
-
26.
var threads = Array.from(thread_menu.getElementsByTagName("li"));
-
27.
var clip = new Array();
-
28.
clip.push(document.title);
-
29.
-
30.
for(var i = 0; i < threads.length; i++) {
-
31.
var text = threads[i].textContent.match(/\d+/)[0];
-
32.
clip.push("\t" + text);
-
33.
}
-
34.
-
35.
GM.setClipboard(clip.join('\n') + '\n');
-
36.
btn.textContent = "Copied";
-
37.
}
-
38.
-
39.
var button_group = Array.from(document.getElementsByTagName("button")).find(e => e.textContent.trim() === 'Threads').parentNode.parentNode;
-
40.
button_group.appendChild(btn);
-
41.
})();
TEXT
38
0
151 1.42 KB 41
151 1.42 KB 41