Fixed line endings

This commit is contained in:
Uwe Oestermeier 2019-06-06 16:17:58 +02:00
parent 502bdf47a3
commit 6f7a18d6b8
1 changed files with 13 additions and 13 deletions

View File

@ -1,9 +1,9 @@
/**
*
* make screenshots and log errors to
*
* make screenshots and log errors to
* console
* (c) 2019 - Leibniz-Insitut für Wissensmedien
*
*
*/
const puppeteer = require('puppeteer');
@ -24,13 +24,13 @@ function logPageEvent(event){
}
async function makeScreenshot(href){
const browser = await puppeteer.launch({args: [
'allow-file-access-from-files',
],});
const page = await browser.newPage();
await page.setViewport({width: 1024,height : 624})
// register events
@ -53,9 +53,9 @@ async function makeScreenshot(href){
}
// image_url = image_url.replace("file:///","")
// fpath = fpath.replace("file:///","")
page.removeAllListeners()
fs.ensureDir(fpath)
await page.screenshot({path: image_url});
@ -63,10 +63,10 @@ async function makeScreenshot(href){
}
/**
*
*
* collect all navigational links in all documents
*
* */
*
* */
async function collectLinks(href,reflist)
{
@ -76,12 +76,12 @@ async function collectLinks(href,reflist)
await page.goto(href)
let hrefs = await page.$$('a.wrapper')
for (var i=0; i < hrefs.length; i++) {
let hrefValue = await hrefs[i].getProperty('href')
let linkText = await hrefValue.jsonValue();
if (!linkText.startsWith("file:"))
{
{
continue;
}
if(linkText.endsWith("#")) continue;
@ -113,4 +113,4 @@ async function collectLinks(href,reflist)
await makeScreenshot(reflist[i])
console.log(i,reflist[i])
}
})()
})()