// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://nullnyan.net/* // @grant none // ==/UserScript== window.Hide = { board: /\/(\w+)\/?/i.exec(window.location.pathname)[1], toggleThread: (opNum, keepRecord) => { let op = _.id(`P${opNum}`); let board = window.Hide.board; if (op) { let thread = op.parentNode; !localStorage.hiddenThreads && localStorage.setItem('hiddenThreads', '{"placeholder": true}'); /* Fuck javascript */ let wholeHiddenList = JSON.parse(localStorage.hiddenThreads); let thisBoardHiddenList = wholeHiddenList[board] || {}; !!thisBoardHiddenList[opNum] ? (!keepRecord ? delete thisBoardHiddenList[opNum] : void(0)) : thisBoardHiddenList[opNum] = true; wholeHiddenList[board] = thisBoardHiddenList; localStorage.setItem('hiddenThreads', JSON.stringify(wholeHiddenList)); thread.style.display = (thread.style.display == 'none'?'':'none'); } }, init: () => { let board = window.Hide.board; if (!!localStorage.hiddenThreads) { for (let num in JSON.parse(localStorage.hiddenThreads)[board]) window.Hide.toggleThread(num, true); } } }; Hide.init(); // Everything except media is loaded //window.addEventListener('load', Hide.init); // Page is fully loaded