GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — makeHTMLFileReadable.js/makeHTMLFileReadable.js at master · Gmousse/makeHTMLFileReadable.js

This repository was archived by the owner on Aug 17, 2024. It is now read-only.

Expand file tree

/

makeHTMLFileReadable.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
55 lines (50 loc) · 1.81 KB
/

makeHTMLFileReadable.js

Copy path

File metadata and controls

55 lines (50 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
const fs = require('fs');
const jsdom = require('jsdom').jsdom;
const Readability = require('readability/index.js').Readability;
function readFile(path) {
return fs.readFileSync(path, {encoding: 'utf-8'}).trim();
}
const file = readFile(process.argv[2]);
const doc = jsdom(file, {
features: {
FetchExternalResources: ['link'],
},
});
const location = doc.location;
const uri = {
spec: location.href,
host: location.host,
prePath: location.protocol + '//' + location.host,
scheme: location.protocol.substr(0, location.protocol.indexOf(':')),
pathBase: location.protocol + '//' + location.host + location.pathname.substr(0, location.pathname.lastIndexOf('/') + 1),
};
let article = new Readability(uri, doc).parse();
article = `
<header>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width; user-scalable=0">
<link rel="stylesheet" href="chrome://global/skin/aboutReader.css" type="text/css">
<title>${article.title}</title>
</header>
<body>
</body>
<div id="container" class="container font-size5">
<div style="display: block;" id="reader-header" class="header">
<style scoped="">
@import url("chrome://global/skin/aboutReaderControls.css");
</style>
<a href=${article.dir} id="reader-domain" class="domain">${article.uri.host}</a>
<div class="domain-border"></div>
<h1 id="reader-title">${article.title}</h1>
<div id="reader-credits" class="credits">${article.byline}</div>
</div>
<div class="content">
<style scoped="">
@import url("chrome://global/skin/aboutReaderContent.css");
</style>
<div style="display: block;" id="moz-reader-content">${article.content}</div>
</div>
</body>
`;
fs.writeFile(process.argv[3], article, 'utf-8');
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.