您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
One click to download current hovered in threads
当前为
- // ==UserScript==
- // @name Chin Fast Image Downloader
- // @namespace http://tampermonkey.net/
- // @version 1
- // @description One click to download current hovered in threads
- // @author Benjababe
- // @match https://boards.4channel.org/*/thread/*
- // @icon https://www.google.com/s2/favicons?domain=4channel.org
- // @grant GM_download
- // ==/UserScript==
- // jshint esversion: 6
- (function() {
- 'use strict';
- document.onkeydown = (e) => {
- // key can be whatever you want, I choose pause as it's what I bound my mouse side keys to
- if (e.code === "Pause") {
- // get all elements hovered
- let els = document.querySelectorAll( ":hover" );
- els.forEach((el) => {
- // only download for images
- if (el.tagName.toLowerCase() === "img") {
- let url = el.src,
- filename = HDFilenameFromURL(el.src);
- GM_download(url, filename);
- }
- });
- }
- }
- // eg. "1622014662736s.jpg -> 1622014662736.jpg"
- let HDFilenameFromURL = (url) => {
- let SDFilename = url.split("/").pop();
- SDFilename = SDFilename.split(".");
- SDFilename[0] = SDFilename[0].slice(0, -1);
- return SDFilename.join(".");
- }
- })();