Greasy Fork

Greasy Fork is available in English.

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

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

当前为 2021-08-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         pixiv图片自动下载&快捷键换页
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  按右键下载cat上打开的图片,通过左右箭头、pageUp和pageDown、数字键来控制翻页
// @author       Pikaqian
// @match        https://pixiv.cat/*
// @icon         https://pixiv.cat/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    window.addEventListener('keydown',function(event){
        var url=window.location.href
        if(url.match("-")!=null){
            var first=url.split("-")[0]
            var num=url.split("-")[1].match(/\d{1,3}/)[0]
            if(event.keyCode=="39"){
                window.open(first+"-"+((parseInt(num)+1)+".png"),"_self")
            }
            else if(event.keyCode=="37"){
                window.open(first+"-"+((parseInt(num)-1)+".png"),"_self")
            }
            else if(event.keyCode=="34"){
                window.open(first+"-"+((parseInt(num)+10)+".png"),"_self")
            }
            else if(event.keyCode=="33"){
                window.open(first+"-"+((parseInt(num)-10)+".png"),"_self")
            }
            else if(event.keyCode>="49"&&event.keyCode<="57"){
                var press=event.keyCode-48
                if(event.altKey!=true){
                    window.open(first+"-"+((parseInt(num)+press)+".png"),"_self")
                }
                else{
                    window.open(first+"-"+((parseInt(num)-press)+".png"),"_self")}
            }
        }
    })
    window.addEventListener('contextmenu',function (event){
        if(event.ctrlKey!=true){
            var a = document.createElement('a');
            var url=window.location.href
            a.href = url;
            a.download = url;
            a.click();
            window.URL.revokeObjectURL(url);
            event.preventDefault()
        }
    })
})();