您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Download images with original filenames on desuarchive.org (all boards)
当前为
- // ==UserScript==
- // @name Desu Image Downloader
- // @version 1.15
- // @description Download images with original filenames on desuarchive.org (all boards)
- // @author Anonimas
- // @match https://desuarchive.org/*
- // @grant GM_download
- // @namespace https://greasyfork.org/users/1342214
- // ==/UserScript==
- (function() {
- 'use strict';
- function getFullFilename(element) {
- return element.getAttribute('title') || element.textContent.trim();
- }
- function downloadImage(imageUrl, originalFilename) {
- if (imageUrl && originalFilename) {
- GM_download({
- url: imageUrl,
- name: originalFilename,
- onload: () => {},
- onerror: (error) => console.error('Download error:', error)
- });
- }
- }
- function handleDownload(event) {
- event.preventDefault();
- const imageLink = event.target.closest('a[href*="//desu-usergeneratedcontent.xyz/"]');
- if (!imageLink) return;
- const imageUrl = imageLink.href;
- let filenameElement = imageLink.closest('div.post_file, article.thread, article.post')?.querySelector('a.post_file_filename');
- if (!filenameElement) return;
- const originalFilename = getFullFilename(filenameElement);
- downloadImage(imageUrl, originalFilename);
- }
- document.querySelectorAll('a[href*="//desu-usergeneratedcontent.xyz/"] i.icon-download-alt').forEach(button => {
- button.closest('a').addEventListener('click', handleDownload);
- });
- document.querySelectorAll('a.post_file_filename').forEach(link => {
- link.addEventListener('click', handleDownload);
- });
- })();