8chan mod view toggle

slurp slurp slurp

当前为 2015-06-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 8chan mod view toggle
  3. // @description slurp slurp slurp
  4. // @author slurp slurp slurp
  5. // @match *://8ch.net/*
  6. // @match *://8chan.co/*
  7. // @grant none
  8. // @version 0.0.1.20150611020908
  9. // @namespace https://greasyfork.org/users/12245
  10. // ==/UserScript==
  11.  
  12. if(location.toString().indexOf("mod.php") != -1) {
  13. $(".boardlist").after (
  14. '<a href="#" id="leaveMod" style="position: fixed; right: 1em; z-index: 999; top: 2.2em;">Leave Mod View</a>'
  15. );
  16. } else {
  17. $(".boardlist").after (
  18. '<a href="#" id="enterMod" style="position: fixed; right: 1em; z-index: 999; top: 2.2em;">Enter Mod View</a>'
  19. );
  20. }
  21.  
  22. $(document).on("click", "#leaveMod", function(){
  23. location = location.href.replace("/mod.php?", "");
  24. });
  25.  
  26. $(document).on("click", "#enterMod", function(){
  27. var tld = ".net";
  28. if(location.href.indexOf(".co") != -1) {
  29. tld = ".co";
  30. }
  31. location = location.href.replace(tld, tld + "/mod.php?");
  32. });