Last active
March 23, 2024 07:38
-
-
Save w311ang/65693528245dcfaac371df5e3977ca42 to your computer and use it in GitHub Desktop.
via浏览器页面缩放
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 网页比例缩放 | |
// @namespace https://viayoo.com/ | |
// @version 0.1 | |
// @description 按比例缩放网页,而不是只改变字体大小 | |
// @author w311ang | |
// @run-at document-start | |
// @match * | |
// @grant none | |
// @downloadURL https://gist.githubusercontent.com/w311ang/65693528245dcfaac371df5e3977ca42/raw/scalepage.js | |
// ==/UserScript== | |
function scalePage(scaleValue) { | |
document.body.style.transform = 'scale(' + scaleValue + ')'; | |
document.body.style.transformOrigin = 'top left'; | |
document.body.style.width = 100 / scaleValue + '%'; | |
document.body.style.height = 100 / scaleValue + '%'; | |
} | |
(function() { | |
'use strict'; | |
scalePage(0.6); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment