您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
download image.
// ==UserScript== // @name download image // @namespace http://tampermonkey.net/ // @version 0.1 // @description download image. // @author You // @match https://www.starsing.cn/product/detail/* // @icon https://www.google.com/s2/favicons?sz=64&domain=starsing.cn // @grant none // @require https://code.jquery.com/jquery-3.6.0.min.js // ==/UserScript== (function() { 'use strict'; let ele = $('<a href="javascript:void(0)">click</a>'); let i = 1; ele.click(function(){ document.querySelectorAll('.product-detail-content_eGy_d p img').forEach(e=>adjust(e.src,i++)); }); $('.product-share-btn_3t5Ne').after(ele); // Your code here... })(); function adjust(src,index) { var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); let img = new Image; img.onload = _ => { canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; ctx.fillStyle = "#fff"; ctx.fillRect(0,0,canvas.width,canvas.height); ctx.drawImage(img,0,0); download(canvas,index); } img.src = src; img.setAttribute("crossOrigin", "Anonymous"); } function download(canvas,index) { let dom = document.createElement("a"); dom.href = canvas.toDataURL("image/jpeg"); let id = location.pathname.split('/')[3]; dom.download = id + "-" + index + ".jpg"; dom.click(); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址