您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
打工都是人上人
// ==UserScript== // @name 摸鱼神器-网页图片控制 // @namespace http://tampermonkey.net/ // @version 0.14 // @description 打工都是人上人 // @author csj // @match * // @include * // @grant none // @require https://code.jquery.com/jquery-1.12.4.min.js // ==/UserScript== (function() { 'use strict'; start() var defaultType = true var defaultWidth = '50px' //图片缩小或放大 function strongImg(type){ let imgs = $('img') for(let i=0;i<imgs.length;i++){ const item = imgs[i] if((item.offsetHeight < 100 || item.offsetWidth < 100) && type){ continue; } item.style.width = type ? defaultWidth : "" item.style.height = type ? defaultWidth : "" } type ? defaultWidth = '50px' : defaultWidth = '' console.log(type ? "缩小成功" : "放大成功") } //控制单个图片 function controlOne(){ let imgs = $('img') for(let i=0;i<imgs.length;i++){ const item = imgs[i] if(item.offsetHeight < 100 || item.offsetWidth < 100){ continue; } $(item).mouseout(function(){ const img = this img.style.width = defaultWidth img.style.height = defaultWidth }) $(item).mouseover(function(){ const img = this img.style.width = '' img.style.height = '' }) } } //添加控制按钮 function start(){ const button = "<button id='injectStrongImg' style='position: fixed;left: 10px;top: 10px;border: none;z-index: 99999;'>注入</button>" $('body').prepend(button) $('button#injectStrongImg').click(function(){ //单个图片绑定单击事件控制 controlOne() strongImg(defaultType); defaultType = !defaultType }) } //测试更新 })();