mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-11-17 01:18:32 +01:00
New big update
This commit is contained in:
parent
a33214dfe1
commit
478a84cc0b
3 changed files with 17 additions and 3 deletions
|
@ -43,6 +43,8 @@ Parameters:
|
||||||
--no - exclude "image", "stylesheet", "script", "font"
|
--no - exclude "image", "stylesheet", "script", "font"
|
||||||
--click - example: ".selector>a" excellent way to close popups or to click some buttons on the page.
|
--click - example: ".selector>a" excellent way to close popups or to click some buttons on the page.
|
||||||
--file - output file name (optional, otherwise based on page title and timestamp)
|
--file - output file name (optional, otherwise based on page title and timestamp)
|
||||||
|
--theme - switch to dark or light color theme
|
||||||
|
--vd - Emulate vision deficiency 'achromatopsia', 'deuteranopia', 'protanopia', 'tritanopia', 'blurredVision', and 'none'
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
<h4>Example: </h4>
|
<h4>Example: </h4>
|
||||||
|
@ -75,6 +77,10 @@ screenshoteer --url https://www.economist.com/ --click ".ribbon__close-button"
|
||||||
screenshoteer --url file:///Users/../index.html
|
screenshoteer --url file:///Users/../index.html
|
||||||
|
|
||||||
screenshoteer --url https://www.slashdot.org --file /tmp/slashdot.png
|
screenshoteer --url https://www.slashdot.org --file /tmp/slashdot.png
|
||||||
|
|
||||||
|
screenshoteer --url https://mxb.dev/blog/color-theme-switcher/ --theme dark
|
||||||
|
|
||||||
|
screenshoteer --url https://news.ycombinator.com --vd blurredVision
|
||||||
```
|
```
|
||||||
<p> List of of supported mobile devices: https://github.com/GoogleChrome/puppeteer/blob/master/DeviceDescriptors.js
|
<p> List of of supported mobile devices: https://github.com/GoogleChrome/puppeteer/blob/master/DeviceDescriptors.js
|
||||||
</p>
|
</p>
|
||||||
|
|
8
index.js
Executable file → Normal file
8
index.js
Executable file → Normal file
|
@ -18,6 +18,8 @@ program
|
||||||
.option('--no, [no]', 'Exclude')
|
.option('--no, [no]', 'Exclude')
|
||||||
.option('--click, [click]', 'Click')
|
.option('--click, [click]', 'Click')
|
||||||
.option('--file, [file]', 'Output file')
|
.option('--file, [file]', 'Output file')
|
||||||
|
.option('--theme, [theme]', 'Color Theme light or dark')
|
||||||
|
.option('--vd, [vd]', 'Emulate vision deficiency')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
if (!program.url) {
|
if (!program.url) {
|
||||||
|
@ -58,6 +60,12 @@ console.log(program.fullPage);
|
||||||
if (program.h && !program.fullpage) program.fullPage = false;
|
if (program.h && !program.fullpage) program.fullPage = false;
|
||||||
await page.setViewport({width: Number(newWidth), height: Number(newHeight)})
|
await page.setViewport({width: Number(newWidth), height: Number(newHeight)})
|
||||||
}
|
}
|
||||||
|
if (program.theme) {
|
||||||
|
await page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: program.theme }]);
|
||||||
|
}
|
||||||
|
if (program.vd) {
|
||||||
|
await page.emulateVisionDeficiency(program.vd);
|
||||||
|
}
|
||||||
if (program.emulate)
|
if (program.emulate)
|
||||||
await page.emulate(devices[program.emulate]);
|
await page.emulate(devices[program.emulate]);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "screenshoteer",
|
"name": "screenshoteer",
|
||||||
"version": "1.0.9",
|
"version": "1.1.0",
|
||||||
"description": "Make screenshots and device emulations form your terminal",
|
"description": "Make screenshots and device emulations form your terminal",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"screenshoteer": "./index.js"
|
"screenshoteer": "index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^2.19.0",
|
"commander": "^2.19.0",
|
||||||
"puppeteer": "^1.10.0"
|
"puppeteer": "^4.00.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"screenshots",
|
"screenshots",
|
||||||
|
|
Loading…
Reference in a new issue