您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enlarge all p tags on a page with Alt+p (reset with Alt-o)
当前为
// ==UserScript== // @name Enhance! // @namespace meyerk.com // @match *://*/* // @grant none // @version 1.0 // @author MeyerK // @description Enlarge all p tags on a page with Alt+p (reset with Alt-o) // ==/UserScript== class enhance { constructor() { this.zoomInc = 3; this.currentZoomStep = 0; this.maxZoomSteps = 6; } zoom(ev) { var pElems = null; var i = 0; if ((ev.which == 80) && (ev.altKey === true)) { pElems = document.querySelectorAll('p'); this.currentZoomStep = (this.currentZoomStep < this.maxZoomSteps) ? this.currentZoomStep + 1 : 0; for (i=0; i<pElems.length; i++) { var originalSize = parseInt(window.getComputedStyle(pElems[i]).fontSize, 10); if (this.currentZoomStep === 0) { newSize = ''; } else { var newSize = originalSize + this.zoomInc + 'px'; } pElems[i].style.fontSize = newSize; } } if ((ev.which == 79) && (ev.altKey === true)) { pElems = document.querySelectorAll('p'); this.currentZoomStep = 0; for (i=0; i<pElems.length; i++) { pElems[i].style.fontSize = ''; } } } } var e = new enhance(); document.addEventListener('keyup', e.zoom.bind(e));