mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-12-22 13:42:19 +01:00
12 allow for just width or height. If height, fix fullPage
This commit is contained in:
parent
a0e425353a
commit
ebc6c4234f
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
@ -38,7 +38,12 @@ console.log(fullPage);
|
|||
const browser = await puppeteer.launch()
|
||||
const page = await browser.newPage()
|
||||
const d = new Date()
|
||||
if (program.w && program.h) await page.setViewport({width: Number(program.w), height: Number(program.h)})
|
||||
if (program.w || program.h) {
|
||||
const newWidth = !program.w?600:program.w
|
||||
const newHeight = !program.h?'0':program.h
|
||||
if (program.h && !program.fullpage) fullPage = false;
|
||||
await page.setViewport({width: Number(newWidth), height: Number(newHeight)})
|
||||
}
|
||||
if (program.emulate) await page.emulate(devices[program.emulate]);
|
||||
await page.goto(urlvalue)
|
||||
const title = await page.title()
|
||||
|
|
Loading…
Reference in a new issue