您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to download the background image from a specific element
// ==UserScript== // @name Download Background Image // @namespace http://tampermonkey.net/ // @version 0.3 // @description Adds a button to download the background image from a specific element // @match *://*/* // @grant GM_download // @run-at document-end // ==/UserScript== (function() { 'use strict'; // Функция для создания кнопки скачивания function createDownloadButton(url) { const button = document.createElement('button'); button.innerText = 'Скачать фон'; button.style.position = 'fixed'; button.style.top = '60px'; // Положение кнопки ниже button.style.left = '20px'; button.style.padding = '10px 20px'; button.style.backgroundColor = '#28a745'; // Зеленый цвет button.style.color = '#fff'; // Белый текст button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.zIndex = '1000'; button.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)'; // Тень для улучшения видимости button.addEventListener('click', () => { GM_download(url, 'background_image.webp'); }); document.body.appendChild(button); } // Функция для поиска и извлечения URL фона function findBackgroundImage() { const element = document.querySelector('#memberBackground'); if (element) { const style = window.getComputedStyle(element); const backgroundImage = style.getPropertyValue('--img'); const urlMatch = backgroundImage.match(/url\((.*?)\)/); if (urlMatch && urlMatch[1]) { const imageUrl = urlMatch[1].replace(/['"]/g, ''); createDownloadButton(imageUrl); } } } // Проверяем фоновое изображение через 1 секунду после загрузки страницы setTimeout(findBackgroundImage, 1000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址