您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides a GIF until it's fully loaded
// ==UserScript== // @name Load GIFs before playing // @namespace https://greasyfork.org/en/users/321-joesimmons // @description Hides a GIF until it's fully loaded // @include http://* // @include https://* // @exclude http://*.gif // @exclude https://*.gif // @exclude http://*.gif?* // @exclude https://*.gif?* // @copyright JoeSimmons // @author JoeSimmons // @version 1.0.0 // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @grant GM_addStyle // ==/UserScript== (function () { 'use strict'; var gifs = document.querySelectorAll('img[src$=".gif"]'), gif, i; function unhide(elem) { elem.target.style.visibility = 'visible'; } for (i = 0; i < gifs.length; i += 1) { gif = gifs[i]; // skip ones that are hidden already if (gif.style.visiblity === 'hidden' || gif.style.display === 'none') { continue; } // temporarily hide the GIF gif.style.visibility = 'hidden'; // set it to un-hide when it's fully loaded gif.addEventListener('load', unhide, false); } }());