mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-12-22 13:42:19 +01:00
Merge pull request #21 from vid-pas/12-width-only-full-height
12 allow for just width or height. If height, fix fullPage
This commit is contained in:
commit
95bc888f20
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
@ -40,7 +40,12 @@ console.log(program.fullPage);
|
|||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
const timestamp = new Date().getTime();
|
||||
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) program.fullPage = false;
|
||||
await page.setViewport({width: Number(newWidth), height: Number(newHeight)})
|
||||
}
|
||||
if (program.emulate)
|
||||
await page.emulate(devices[program.emulate]);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue