您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replace smaller version Imgur image to large one.
// ==UserScript== // @name [Deprecated] Ptt Imgur Cleaner // @namespace https://blog.gslin.org/ptt-imgur-gm // @description Replace smaller version Imgur image to large one. // @include https://www.ptt.cc/bbs/* // @include https://www.ptt.cc/man/* // @run-at document-idle // @version 0.20191006.1 // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function(){ let head = document.getElementsByTagName('head')[0]; let meta = document.createElement('meta'); meta.setAttribute('content', 'same-origin'); meta.setAttribute('name', 'Referrer'); head.appendChild(meta); let css = document.createElement('style'); css.type = 'text/css'; css.innerHTML = ".richcontent { max-width: 100%; }\nimg { max-height: 100%; }"; head.appendChild(css); setInterval(() => { let targets = document.querySelectorAll('.richcontent iframe.imgur-embed-iframe-pub'); targets.forEach(el => { var id = el.getAttribute('id').substring(23); // Use .webp var img = document.createElement('img'); img.setAttribute('src', '//i.imgur.com/' + id + '.webp'); el.parentNode.replaceChild(img, el); }); }, 200); })();