自定义屏幕分辨率

适合移动端、pc端

À partir de 2024-12-25. Voir la dernière version.

// ==UserScript==
// @name         自定义屏幕分辨率
// @namespace    http://tampermonkey.net/
// @description  适合移动端、pc端
// @version      0.1 
// @include      *
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function setResolution() {
        let box = document.createElement('div')
        box.style.position = 'fixed'
        box.style.top = '10rem'
        box.style.right = '10rem'
        let input = document.createElement('input')
        input.style.width = '10rem'
        input.style.height = '7rem'
        input.style.fontSize = '4rem'
        input.value = '30'
        box.appendChild(input)
        document.body.appendChild(box)

        document.body.style.zoom = `${input.value}%`;
        input.addEventListener('change', () => {
            document.body.style.zoom = `${input.value}%`;

        })
    }

    setResolution()
})();