SHOW:
|
|
- or go back to the newest paste.
| 1 | // ==UserScript== | |
| 2 | ||
| 3 | // @name DeleteXoxohthSpamPosts | |
| 4 | ||
| 5 | // @namespace http://tampermonkey.net/ | |
| 6 | ||
| 7 | // @version 0.1 | |
| 8 | ||
| 9 | // @description Remove annoying spam posts. | |
| 10 | ||
| 11 | // @match *://xoxohth.com/thread.php* | |
| 12 | ||
| 13 | // @match *://autoadmit.com/thread.php* | |
| 14 | ||
| 15 | // @icon http://xoxohth.com/favicon.ico | |
| 16 | ||
| 17 | // @grant none | |
| 18 | ||
| 19 | // ==/UserScript== | |
| 20 | (function() {
| |
| 21 | ||
| 22 | 'use strict'; | |
| 23 | ||
| 24 | - | const postContent = "It's not a dysphoria. I see it in the positive way of working toward something, rather than away from something. Many of the guys instead of putting a negative feel on it see it as a positive." |
| 24 | + | |
| 25 | "legal efforts to overturn the 2020 election; and three offenses relating to Trump’s unlawful possession of government records at Mar-a-Lago", | |
| 26 | "America is in the midst of the Cold War. The masculine fire and fury of World War II has given way to a period of cooling", | |
| 27 | "Go to the link, and look at that woman. Look at that face. She never expressed any remorse over", | |
| 28 | "destroyed the Ancien Regime in Europe, was an economic and scientific golden era, but politically it was a mess" | |
| 29 | ] | |
| 30 | ||
| 31 | const posts = document.getElementsByTagName('table');
| |
| 32 | ||
| 33 | function removeSpamPosts() {
| |
| 34 | ||
| 35 | var postsToRemove = []; | |
| 36 | ||
| 37 | var previewPosts = new Map(); | |
| 38 | ||
| 39 | for (let i = 1; i < posts.length; i++) {
| |
| 40 | ||
| 41 | if (spamPostsContent.some(spamPostsContent => posts[i].textContent.includes(spamPostsContent)) && posts[i].outerHTML.includes("post.php?parent_message_id=") && !posts[i].baseURI.includes("5324124")) {
| |
| 42 | ||
| 43 | //console.log("Identified spam post");
| |
| 44 | ||
| 45 | //posts[i].remove(); | |
| 46 | ||
| 47 | postsToRemove.push(posts[i]) | |
| 48 | ||
| 49 | } else if ((posts[i].innerHTML.includes("imgs/ReplyArrow.gif") || posts[i].outerHTML.includes("imgs/MessageOld.gif")) && !posts[i].outerHTML.includes('imgs/Back.gif') && posts[i].parentElement.localName != "font") {
| |
| 50 | ||
| 51 | //console.log("Identified preview post");
| |
| 52 | ||
| 53 | //console.log(posts[i].getElementsByTagName('a')[0].getAttribute("href"));
| |
| 54 | ||
| 55 | var previewPostId = posts[i].getElementsByTagName('a')[0].getAttribute("href");
| |
| 56 | ||
| 57 | previewPosts.set(previewPostId, posts[i]); | |
| 58 | ||
| 59 | } | |
| 60 | ||
| 61 | } | |
| 62 | ||
| 63 | postsToRemove.forEach(function(e) {
| |
| 64 | ||
| 65 | var postId = e.parentElement.name; | |
| 66 | ||
| 67 | e.parentElement.parentElement.remove(); | |
| 68 | ||
| 69 | previewPosts.get('#' + postId).parentElement.parentElement.remove();
| |
| 70 | ||
| 71 | }); | |
| 72 | ||
| 73 | } | |
| 74 | ||
| 75 | removeSpamPosts(); | |
| 76 | ||
| 77 | })(); |