您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add download button for downloading ALL Images from LDH mo details page
当前为
// ==UserScript== // @name mo (LDH) Images download // @name:zh-CN mo (LDH) 图片下载器 // @namespace https://1mether.me/ // @version 0.7 // @description Add download button for downloading ALL Images from LDH mo details page // @description:zh-CN 在mo的内容页增加下载和复制图片链接的按钮,用于批量下载页面图片 // @author 乙醚(@locoda) // @match http*://m.tribe-m.jp/diary/detail?id=* // @match http*://m.tribe-m.jp/image_diary/detail?id=* // @match http*://m.tribe-m.jp/news/detail?news_id=* // @match http*://m.ex-m.jp/diary/detail?id=* // @match http*://m.ex-m.jp/image_diary/detail?id=* // @match http*://m.ex-m.jp/news/detail?news_id=* // @match http*://m.ldh-m.jp/diary/detail?id=* // @match http*://m.ldh-m.jp/image_diary/detail?id=* // @match http*://m.ldh-m.jp/news/detail?news_id=* // @match http*://m.ldhgirls-m.jp/diary/detail?id=* // @match http*://m.ldhgirls-m.jp/image_diary/detail?id=* // @match http*://m.ldhgirls-m.jp/news/detail?news_id=* // @icon https://www.google.com/s2/favicons?sz=64&domain=tribe-m.jp // @source https://gist.github.com/locoda/460ac9d42b05e75df12ef2f80d66c3d2 // @grant none // @license MIT // ==/UserScript== (function () { "use strict"; var imgs = findEligibleImgs(); injectButtons(imgs); })(); function findEligibleImgs() { const keywords = ["uplcmn", "upload"]; // , "off_shot", "offshot", "artist_photo"]; var imgs = document.querySelectorAll(".protectimg img"); var imgSrcs = Array.from(imgs) .map((img) => img.src) .filter((img) => keywords.some((k) => img.includes(k))); return imgSrcs; } function injectButtons(imgs) { var article = document.querySelector("article"); var downloadButton = document.createElement("BUTTON"); var downloadButtonText = document.createTextNode( "下载所有图片 (" + imgs.length + ")" ); downloadButton.appendChild(downloadButtonText); downloadButton.addEventListener("click", function () { downloadOnClickHandler(imgs); }); downloadButton.className = "ldh-mo-dl"; article.insertBefore(downloadButton, article.firstChild); var generateButton = document.createElement("BUTTON"); var generateButtonText = document.createTextNode("生成图片链接"); generateButton.appendChild(generateButtonText); generateButton.addEventListener("click", function () { generateOnClickHandler(imgs); }); generateButton.className = "ldh-mo-dl"; article.insertBefore(generateButton, article.firstChild); } function downloadOnClickHandler(imgs) { console.log(imgs); downloadAll(imgs); } function generateOnClickHandler(imgs) { console.log(imgs); var article = document.querySelector("article"); var textarea = document.querySelector("textarea.ldh-mo-dl"); if (!textarea) { textarea = document.createElement("textarea"); textarea.className = "ldh-mo-dl"; textarea.style = "height: 100px; width: 80%;"; var br = document.createElement("br"); article.insertBefore(br, article.firstChild); article.insertBefore(textarea, article.firstChild); } textarea.value = imgs.join("\n"); textarea.select(); } function downloadAll(imgs) { // Thanks to https://github.com/y252328/Instagram_Download_Button imgs.map((img) => fetch(img, { headers: new Headers({ Origin: window.location.origin, }), mode: "cors", }) .then((response) => response.blob()) .then((blob) => dowloadBlob( window.URL.createObjectURL(blob), img.substring(img.lastIndexOf("/") + 1) ) ) .catch((e) => console.error(e)) ); } function dowloadBlob(blob, filename) { var a = document.createElement("a"); a.download = filename; a.href = blob; document.body.appendChild(a); a.click(); a.remove(); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址