您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ctrl+Click/Shift image saving for most single-image pages
当前为
// ==UserScript== // @name Image Saving with Ctrl+Click/Shift [GLOBAL] // @namespace imageSaving // @description Ctrl+Click/Shift image saving for most single-image pages // @author NightLancerX // @match *://*/*.jpg* // @match *://*/*.png* // @version 2.2 // @homepageURL https://github.com/NightLancer/PixivPreview // @license MIT License // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; let img = document.querySelectorAll('img')[0]; let imgSrc = img.src; function main() { let anchor = document.createElement('a'); anchor.href = img.src; anchor.target = '_self'; anchor.download = (imgSrc.indexOf('?')>-1)? imgSrc.substring(imgSrc.lastIndexOf("/")+1, imgSrc.indexOf('?')): imgSrc.substring(imgSrc.lastIndexOf("/")+1); document.body.appendChild(anchor); anchor.click(); }; //save with Ctrl+Click img.onclick = function(e){ if (e.ctrlKey){ e.preventDefault(); main(); } }; //save with Shift document.onkeyup = function(e){ if (e.keyCode == 16){ main(); } }; //save with MMB-click img.onmouseup = function(e){ if (e.button == 1){ main(); } }; })();