// ==UserScript== // @name 8chan Crunch // @namespace erin // @description Tools for 8chan // @include /^https?://.*8ch(an|)\.(co|net)/.*$/ // @version 0.1 // @grant none // ==/UserScript== function chanCrunch(){ /* */ // Build objects. The crunch object is made globally accessable to the window. window.crunch = {}; crunch.info = {}; crunch.setting = {}; crunch.item = {}; crunch.func = {}; crunch.trash = {}; crunch.info.namespace = 'chancrunch'; crunch.info.version = 0.1; crunch.info.domain = window.location.host; crunch.info.board = null; crunch.info.thread = null; crunch.info.boardMod = false; crunch.trash.urlParts = window.location.href.split(crunch.info.domain)[1].split(/[.,\/ /]/); if(crunch.trash.urlParts[1] != null) crunch.info.board = crunch.trash.urlParts[1]; if(window.location.href.indexOf('/res/') > 0) crunch.info.thread = crunch.trash.urlParts[3]; if(crunch.info.board == 'mod' && crunch.trash.urlParts[2] == 'php?'){ crunch.info.thread = crunch.trash.urlParts[5]; crunch.info.board = crunch.trash.urlParts[3]; crunch.info.boardMod = true; } console.log(crunch.info); /* */ } chanCrunch();