pixiv图片自动下载&快捷键换页

按右键下载cat上打开的图片,通过左右箭头、pageUp和pageDown、数字键来控制翻页

  1. // ==UserScript==
  2. // @name pixiv图片自动下载&快捷键换页
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 按右键下载cat上打开的图片,通过左右箭头、pageUp和pageDown、数字键来控制翻页
  6. // @author Pikaqian
  7. // @match https://pixiv.cat/*
  8. // @icon https://pixiv.cat/favicon.ico
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Your code here...
  16. window.addEventListener('keydown',function(event){
  17. var url=window.location.href
  18. if(url.match("-")!=null){
  19. var first=url.split("-")[0]
  20. var num=url.split("-")[1].match(/\d{1,3}/)[0]
  21. if(event.keyCode=="39"){
  22. window.open(first+"-"+((parseInt(num)+1)+".png"),"_self")
  23. }
  24. else if(event.keyCode=="37"){
  25. window.open(first+"-"+((parseInt(num)-1)+".png"),"_self")
  26. }
  27. else if(event.keyCode=="34"){
  28. window.open(first+"-"+((parseInt(num)+10)+".png"),"_self")
  29. }
  30. else if(event.keyCode=="33"){
  31. window.open(first+"-"+((parseInt(num)-10)+".png"),"_self")
  32. }
  33. else if(event.keyCode>="49"&&event.keyCode<="57"){
  34. var press=event.keyCode-48
  35. if(event.altKey!=true){
  36. window.open(first+"-"+((parseInt(num)+press)+".png"),"_self")
  37. }
  38. else{
  39. window.open(first+"-"+((parseInt(num)-press)+".png"),"_self")}
  40. }
  41. }
  42. })
  43. window.addEventListener('contextmenu',function (event){
  44. if(event.ctrlKey!=true){
  45. var a = document.createElement('a');
  46. var url=window.location.href
  47. a.href = url;
  48. a.download = url;
  49. a.click();
  50. window.URL.revokeObjectURL(url);
  51. event.preventDefault()
  52. }
  53. })
  54. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址