Skip to content

Instantly share code, notes, and snippets.

@biuuu
Created December 29, 2020 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biuuu/bc611b1e05beac2210fd80e8c30e7a06 to your computer and use it in GitHub Desktop.
Save biuuu/bc611b1e05beac2210fd80e8c30e7a06 to your computer and use it in GitHub Desktop.
把闪耀色彩的窗口缩放到合适的尺寸
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