🏠 Home 

逛丢

逛丢加入方向键访问上一页和下一页


Install this script?
  1. // ==UserScript==
  2. // @name 逛丢
  3. // @namespace https://greasyfork.org/zh-CN/users/821
  4. // @author gfork
  5. // @description 逛丢加入方向键访问上一页和下一页
  6. // @include https://guangdiu.com/*
  7. // @exclude https://guangdiu.com/rank.php*
  8. // @version 1.0
  9. // @grant none
  10. // ==/UserScript==
  11. var bfurl,aturl;
  12. var url = window.location.href;
  13. var num = url.match(/\?p=(\d+)/);
  14. if (num !== null) {
  15. var before = parseInt(num[1])-1;
  16. var after = parseInt(num[1])+1;
  17. if(before===0)
  18. {
  19. bfurl = null;
  20. aturl = url.replace(/\?p=(\d+)/, "?p="+after);}
  21. else
  22. {
  23. bfurl = url.replace(/\?p=(\d+)/, "?p="+before);
  24. aturl = url.replace(/\?p=(\d+)/, "?p="+after);
  25. }
  26. }
  27. else
  28. {
  29. bfurl = null;
  30. aturl = url.replace(/\?/, "?p=2&");
  31. }
  32. if (url == "https://guangdiu.com/")
  33. {
  34. bfurl = null;
  35. aturl = "https://guangdiu.com/index.php?p=2";
  36. }
  37. if (url == "https://guangdiu.com/cheaps.php")
  38. {
  39. bfurl = null;
  40. aturl = "https://guangdiu.com/cheaps.php?p=2";
  41. }
  42. if (url == "https://guangdiu.com/hots.php")
  43. {
  44. bfurl = null;
  45. aturl = "https://guangdiu.com/hots.php?p=2";
  46. }
  47. var handle = {
  48. hotKey: function (e) {
  49. //默认退出键为ESC。需要修改为其他快捷键的请搜索"keycode",修改为按键对应的数字。
  50. if (e.keyCode == 37 && bfurl !== null) {
  51. window.location.href = bfurl;
  52. }
  53. if (e.keyCode == 39 ) {
  54. window.location.href = aturl;
  55. }
  56. }
  57. };
  58. document.addEventListener('keydown', handle.hotKey, false);