您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
点击脚本菜单关闭/开启页面图片
当前为
// ==UserScript== // @name 无图模式 // @namespace http://tampermonkey.net/ // @license MIT // @version 0.2 // @icon https://qwn3213.com/icon/tupian.png // @description 点击脚本菜单关闭/开启页面图片 // @author Q伟N // @match *://*/* // @require http://code.jquery.com/jquery-latest.js // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function() { 'use strict'; var host = window.location.hostname; var imgShow = GM_getValue(host); if (imgShow === false) { $('img').each(function() { $(this).hide(); if (!$(this).next().is('.hidden-image-notice')) { // 如果还没有添加过文案 $(this).after('<div class="hidden-image-notice">!!!已隐藏图片!!!</div>'); // 在图片后面添加文案 } }); } else { imgShow = true; } function menu_change() { imgShow = !imgShow; if (imgShow) { $('img').show(); $('.hidden-image-notice').remove(); // 移除所有的 "已隐藏图片" 文案 } else { $('img').each(function() { $(this).hide(); if (!$(this).next().is('.hidden-image-notice')) { $(this).after('<div class="hidden-image-notice">!!!已隐藏图片!!!</div>'); } }); } GM_setValue(host, imgShow); GM_unregisterMenuCommand(menuId); menuId = GM_registerMenuCommand((imgShow ? '✅': '❌') + '图', menu_change, 'h'); } var menuId = GM_registerMenuCommand((imgShow ? '✅': '❌') + '图', menu_change, 'h'); })();