Created
December 29, 2020 03:33
-
-
Save biuuu/bc611b1e05beac2210fd80e8c30e7a06 to your computer and use it in GitHub Desktop.
把闪耀色彩的窗口缩放到合适的尺寸
This file contains hidden or 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
function start (tw, th) { | |
const resizeCount = 10 | |
const resize = () => { | |
let ih = window.outerHeight | |
let iw = window.outerWidth | |
const h = document.body.clientHeight | |
const w = document.body.clientWidth | |
const oh = th - h | |
const ow = tw - w | |
if (oh || ow) { | |
ih += oh | |
iw += ow | |
window.resizeTo(iw, ih) | |
} | |
} | |
const autoResize = (count) => { | |
count-- | |
console.info(`${resizeCount - count} / ${resizeCount}`) | |
resize() | |
if (count > 0) { | |
setTimeout(() => autoResize(count), 1000) | |
} | |
} | |
autoResize(resizeCount) | |
} | |
start(1136, 640) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment