您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
虎扑帖子图片缩小
// ==UserScript== // @name 虎扑图片缩小 // @description 虎扑帖子图片缩小 // @namespace Violentmonkey Scripts // @match *://bbs.hupu.com/* // @version 1.0 // @author Jason // @license GPL-3.0 License // @compatible Chrome // ==/UserScript== (function () { 'use strict'; process(); window.addEventListener('scroll', () => { process(); }) function process() { //页面向下滚动时,标题不要固定在页面顶端 let title = document.querySelector('.post-fix-title'); if(title != null) { title.style.position = 'absolute'; title = title.parentNode.parentNode; title.style.position = 'absolute'; } //楼中图片 let threadImgs = document.querySelectorAll(".thread-content-detail img"); for(let i = 0; i < threadImgs.length; ++i) { let threadImg = threadImgs[i]; let computedStyle = window.getComputedStyle(threadImg); let width = parseFloat(computedStyle.width.replace('px', '')); let height = parseFloat(computedStyle.height.replace('px', '')); //图片宽高比 let rate = height / width; let smallWidth = '50%'; let smallHeight = '50%'; //如果图片近似于正方形,就当它是表情包,表情包宽度缩小到50px,高度也按比例缩小;否则就当它是普通图片,宽度和高度缩小50% if(rate <= 1.2 && rate >= 0.7) { smallWidth = 50; smallHeight = smallWidth * rate; threadImg.style.width = smallWidth + 'px'; threadImg.style.height = smallHeight + 'px'; } else { threadImg.style.width = smallWidth; threadImg.style.height = smallHeight; } } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址