您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically promotes Tumblr image links to raw HD versions
当前为
// ==UserScript== // @name Tumblr Images to HD Redirector // @namespace TumblrImgReszr // @description Automatically promotes Tumblr image links to raw HD versions // @version 1.6 // @author Kai Krause <[email protected]> // @include /^https?://.+\.media\.tumblr\.com.+(jpe?g|png|bmp|gif)/ // @grant GM_xmlhttpRequest // @connect media.tumblr.com // @run-at document-start // ==/UserScript== var imageSizes = ['raw', '1280', '540', '500', '400', '250', '100']; var loc = location.toString(); // To fix issues with URLs ending with #, especially multi-level hashes that confuse the regex, by removing this parameter var locHash = loc.indexOf('#'); if (locHash > -1) { loc = loc.slice(0,locHash) } function checkSize (i) { var i = i || 0; if (i > imageSizes.length) return; console.log(loc); var imageType = loc.match(/[^.]*$/)[0]; // Gifs are <540 pixels. Do not redirect if already HD. var gifSize = loc.match(/(?!_)(\d+)(?=\.gif)/); if (gifSize && gifSize >= 540) return; // Create the HD image url pattern if (imageSizes[i] == 'raw') { loc = loc.replace(/[^/]*media.tumblr.com/, 'media.tumblr.com'); loc = loc.replace(/[^_]*$/, imageSizes[i] + '.' + imageType); } else { loc = loc.replace(/[^_]*$/, imageSizes[i] + '.' + imageType); } // Do not redirect if already HD if (loc == window.location.href) return; // If the URL is HTTP, change it to HTTPS if (!loc.startsWith('https://')) { loc = loc.replace(/^http/, 'https'); } // Check that the HD image exists, then redirect to it GM_xmlhttpRequest({ url: loc, method: 'HEAD', onload: function(response) { if (response.status == '200') { window.location = loc; } else { checkSize(i+1); } } }); } checkSize();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址