Greasy Fork

来自缓存

Greasy Fork is available in English.

站酷网作品原图查看

站酷网图片辅助下载工具

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         站酷网作品原图查看
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  站酷网图片辅助下载工具
// @author       You
// @match        *://www.zcool.com.cn/*
// @grant        GM_openInTab
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 方式1:为所有图片添加右键保存功能
    document.addEventListener('contextmenu', function(e) {
        if (e.target.tagName === 'IMG') {
            e.stopPropagation();
        }
    }, true);

    // 方式2:创建图片查看器按钮
    function addDownloadButtons() {
        const images = document.querySelectorAll('img.photoImage');
        images.forEach(img => {
            if(!img.parentNode.querySelector('.zcool-helper-btn')) {
                const btn = document.createElement('button');
                btn.className = 'zcool-helper-btn';
                btn.textContent = '查看原图';
                btn.style.position = 'absolute';
                btn.style.zIndex = '9999';
                btn.style.background = '#ff4e00';
                btn.style.color = 'white';
                btn.style.padding = '2px 5px';
                btn.style.borderRadius = '3px';
                btn.style.border = 'none';
                btn.style.cursor = 'pointer';

                btn.onclick = function() {
                    const src = img.src.replace(/\/\/(.*?)\.zcool/, '//$1.zcool');
                    GM_openInTab(src, {active: true});
                };

                img.parentNode.style.position = 'relative';
                img.parentNode.appendChild(btn);
            }
        });
    }

    // 监听动态加载内容
    const observer = new MutationObserver(addDownloadButtons);
    observer.observe(document.body, {childList: true, subtree: true});

    // 初始执行
    addDownloadButtons();
})();