Advertisement
erinx

chan crunch

May 20th, 2015
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        8chan Crunch
  3. // @namespace   erin
  4. // @description Tools for 8chan
  5. // @include     /^https?://.*8ch(an|)\.(co|net)/.*$/
  6. // @version     0.1
  7. // @grant       none
  8. // ==/UserScript==
  9.  
  10. function chanCrunch(){
  11.  
  12. /* <!-- Start Script -->  */
  13.  
  14.  
  15. // Build objects. The crunch object is made globally accessable to the window.
  16.  
  17.   window.crunch = {};  
  18.   crunch.info = {};
  19.   crunch.setting = {};
  20.   crunch.item = {};
  21.   crunch.func = {};
  22.   crunch.trash = {};  
  23.   crunch.info.namespace = 'chancrunch';
  24.   crunch.info.version = 0.1;
  25.   crunch.info.domain = window.location.host;
  26.   crunch.info.board = null;
  27.   crunch.info.thread =  null;
  28.   crunch.info.boardMod = false;
  29.   crunch.trash.urlParts = window.location.href.split(crunch.info.domain)[1].split(/[.,\/ /]/);
  30.   if(crunch.trash.urlParts[1] != null) crunch.info.board = crunch.trash.urlParts[1];
  31.   if(window.location.href.indexOf('/res/') > 0) crunch.info.thread = crunch.trash.urlParts[3];
  32.   if(crunch.info.board == 'mod' && crunch.trash.urlParts[2] == 'php?'){
  33.     crunch.info.thread = crunch.trash.urlParts[5];
  34.     crunch.info.board = crunch.trash.urlParts[3];
  35.     crunch.info.boardMod = true;
  36.   }
  37.   console.log(crunch.info);
  38.  
  39.  
  40. /* <!-- End Script -->  */
  41.  
  42. }
  43. chanCrunch();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement