Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name NeoGAF - Total Ignore
- // @namespace neogaf
- // @description Hides ignored users' posts totally, as well as text from posts that quote them (leaves option to display those posts)
- // @version 1.0
- // @icon http://s3.amazonaws.com/uso_ss/icon/125952/large.png
- // @include http://*neogaf.tld/forum/showthread.php*
- // ==/UserScript==
- var SCORCHED_EARTH = true; // if true, totally remove posts that quote someone on ignore. Otherwise, they're just hidden, with an option to "show post"
- var p = document.querySelectorAll('a[onclick*="display_post"]'), i = p.length;
- while (i--) {
- p[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
- }
- GM_xmlhttpRequest({
- method: "GET",
- url: "profile.php?do=ignorelist",
- onload: function(response){
- var range = document.createRange();
- range.selectNode(document.body);
- var parsedhtml = document.createElement("div");
- parsedhtml.style.display = "none";
- parsedhtml.innerHTML = response.responseText;
- document.body.appendChild(parsedhtml);
- if(document.getElementById("ignorelist") != null)
- {
- var ignoreduserslinks = document.getElementById("ignorelist").getElementsByTagName("a");
- var ignoredusers = [];
- for(var i = 0; i < ignoreduserslinks.length; i++)
- ignoredusers.push(ignoreduserslinks[i].innerHTML);
- // var quotes = document.getElementsByClassName("alt2");
- var quotes = document.querySelectorAll('div[style*="margin:20px; margin-top:5px;"]');
- console.log(ignoredusers);
- for(var i = 0; i < quotes.length; i++)
- {
- if(ignoredusers.indexOf(quotes[i].getElementsByTagName("strong")[0].innerHTML) != -1)
- {
- if(SCORCHED_EARTH)
- {
- quotes[i].parentNode.parentNode.parentNode.style.display = "none";
- }
- else
- {
- var post = quotes[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
- var extradiv = document.createElement("div");
- extradiv.innerHTML = post.innerHTML;
- extradiv.style.visibility = "hidden";
- post.innerHTML = "";
- var show = document.createElement("div");
- show.innerHTML = "---This post quotes ignored user, click to show---";
- show.style.textDecoration = "underline";
- show.style.cursor = "pointer";
- show.onclick = function(){
- this.nextSibling.style.visibility = "visible";
- this.style.display = "none";
- };
- post.appendChild(show);
- post.appendChild(extradiv);
- }
- }
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement