#t123456 {display: none;}
// ==UserScript==// @name heyuri// @namespace filterstuff// @include *.heyuri.net/*// @version 1// @grant none// @run-at document-end// ==/UserScript=={ // Get board name from the current URL! let board = document.location.pathname.substring(1, document.location.pathname.indexOf("/",1)); // Get filters from the browser's local storage! let filters = localStorage.getItem("filters"); try { filters = JSON.parse(filters); } catch (e) {} // Fix the variable if it's invalid! if (!filters || typeof filters !== "object") filters = {}; // Make sure the filters object has an array for this board! if (!filters[board]) filters[board] = []; function hide (event) { // If didn't click with the left mouse button, don't do anything! if (event.button !== 0) return; // Prevent the click from doing anything else by accident! event.stopPropagation(); // Add this post number into the filters! let num = Number(this.dataset.num); filters[board].push(num); localStorage.setItem("filters", JSON.stringify(filters)); // Hide the post! let post = this.parentNode.parentNode; if (post.classList.contains("op")) { post.parentNode.style.display = "none"; } else { post.style.display = "none"; } } // Loop through threads on the page! let posts = document.getElementsByClassName("post"); for (let post of posts) { // Get post number from the ID! let num = Number(post.id.replace(/[^0-9]/g,'')); // Hide this post if it was filtered in the past! if (filters[board].includes(num)) { // If this post is OP, hide the entire thread! if (post.classList.contains("op")) { post.parentNode.style.display = "none"; } else { post.style.display = "none"; } } // Add button for hiding the post! let button = document.createElement("a"); button.innerHTML = "[Hide]"; button.style.cursor = "pointer"; button.dataset.num = num; button.addEventListener("click", hide); post.getElementsByClassName("postinfo")[0].append(button); }}