-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c3e96cf
Showing
33 changed files
with
4,475 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
How to debug | ||
=== | ||
- Run `node bin/debug` | ||
- Visit `localhost:1234` | ||
|
||
|
||
How to build | ||
=== | ||
- Run `node bin/debug` | ||
- To view, open the static standalone HTML file generated at `./docs/index.html` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
exports.default = false | ||
|
||
|
||
|
||
|
||
/**********/ exports.__esModule = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
const fs = require('fs') | ||
const utils = require('./utils') | ||
|
||
utils.build(true).then(page => | ||
fs.writeFile('docs/index.html', page, () => console.log('done'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
const http = require('http') | ||
const utils = require('./utils') | ||
|
||
http.createServer(async (req, res) => { | ||
try { | ||
res.end(await utils.build()) | ||
} catch (e) { | ||
console.log(new Date()) | ||
console.log(e) | ||
res.end('error') | ||
} | ||
}).listen(1234) | ||
|
||
console.log('running') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
<h1>Outdated Browser</h1> | ||
<div id="warning"> | ||
notice | ||
<br> | ||
<a id="upgrade" href="https://google.com/chrome" target="_blank"> | ||
<i class="fa fa-chrome"></i> | ||
<span>cta</span> | ||
</a> | ||
</div> | ||
<p>prompt</p> | ||
<div id="browser-list"> | ||
<a class="browser chrome" href="https://google.com/chrome" target="_blank"> | ||
<i class="fa fa-chrome"></i> | ||
<br>Chrome | ||
</a> | ||
<a class="browser firefox" href="https://mozilla.com/firefox" target="_blank"> | ||
<i class="fa fa-firefox"></i> | ||
<br>FireFox | ||
</a> | ||
<a class="browser edge" href="https://microsoft.com/edge" target="_blank"> | ||
<i class="fa fa-edge"></i> | ||
<br>Edge | ||
</a> | ||
<a class="browser safari" href="https://apple.com/safari" target="_blank"> | ||
<i class="fa fa-safari"></i> | ||
<br>Safari | ||
</a> | ||
<a class="browser opera" href="https://opera.com" target="_blank"> | ||
<i class="fa fa-opera"></i> | ||
<br>Opera | ||
</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Ali Dorosty | Front-End Engineer</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | ||
<style> | ||
canvas { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
#content { | ||
position: fixed; | ||
direction: ltr; | ||
top: 0; | ||
left: 0; | ||
width: calc(100% + 100px); | ||
height: calc(100% + 100px); | ||
overflow: scroll; | ||
} | ||
#content a { | ||
position: fixed; | ||
display: block; | ||
opacity: 0; | ||
cursor: pointer; | ||
} | ||
#content a[href=''], #content a:not([href]) { | ||
display: none; | ||
} | ||
|
||
#outdated { | ||
font-family: sans-serif; | ||
color: #fff; | ||
text-align: center; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
#outdated a { color: #fff; } | ||
#outdated h1, #outdated p { | ||
color: #444; | ||
margin: 2rem; | ||
padding: 0; | ||
} | ||
#outdated h1 { | ||
font-size: 2rem; | ||
font-weight: bold; | ||
} | ||
#warning { | ||
background-color: #5b4346; | ||
padding: 2rem; | ||
} | ||
#upgrade { | ||
display: inline-block; | ||
background-color: #1d7335; | ||
margin-top: 2rem; | ||
padding: 1rem 2rem; | ||
text-decoration: none; | ||
} | ||
#upgrade i { | ||
vertical-align: middle; | ||
font-size: 4rem; | ||
margin: 1rem 1rem 1rem 0; | ||
} | ||
#upgrade span { | ||
display: inline-block; | ||
vertical-align: middle; | ||
font-size: 2rem; | ||
} | ||
#browser-list { | ||
display: inline-block; | ||
padding: 0 1rem 1rem; | ||
} | ||
.browser { | ||
float: left; | ||
width: 7rem; | ||
padding: 2rem; | ||
text-decoration: none; | ||
} | ||
.browser i { | ||
font-size: 3rem; | ||
padding-bottom: 1.5rem; | ||
} | ||
.chrome { background-color: #ffb31a; } | ||
.firefox { background-color: #f78009; } | ||
.edge { background-color: #33ccff; } | ||
.safari { background-color: #0099ff; } | ||
.opera { background-color: #ff4d4d; } | ||
</style> | ||
</head> | ||
<body> | ||
<script> | ||
jsCode | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
const fs = require('fs') | ||
const esbuild = require('esbuild') | ||
const isWorkerEnabled = require('../_isWorkerEnabled').default | ||
|
||
exports.build = async isProduction => { | ||
const read = file => fs.promises.readFile(file).then(file => file.toString()) | ||
|
||
const build = async file => { | ||
let { outputFiles: [{ text }] } = await esbuild.build({ | ||
entryPoints: [file], | ||
target: 'es2015', | ||
bundle: true, | ||
write: false, | ||
format: 'cjs', | ||
minify: isProduction, | ||
}) | ||
if (isProduction) | ||
text = text.trim().replace(/\n/g, '\\n') | ||
return text | ||
} | ||
|
||
const [ | ||
template, | ||
outdatedTemplate, | ||
mainCode, | ||
workerCode, | ||
] = await Promise.all([ | ||
read('bin/template.html'), | ||
read('bin/outdated.html'), | ||
build('src/index.js'), | ||
build('src/worker.js'), | ||
]) | ||
|
||
let workerCodeString = workerCode.replace(/\\/g, '\\\\') | ||
workerCodeString = isProduction | ||
? "'" + workerCodeString.replace(/\'/g, '\\\'') + "'" | ||
: '`' + workerCodeString.replace(/\`/g, '\\\`').replace(/\$/g, '\\\$') + '`' | ||
|
||
const outTemplateString = "'" + outdatedTemplate.replace(/\n */g, '') + "'" | ||
|
||
let html = isProduction ? template.trim().replace(/\n */g, '') : template | ||
html = html.replace( | ||
'jsCode', isWorkerEnabled | ||
? 'var workerCode = workerCodeString;mainCode' | ||
: '(function(){workerCode})();(function(){mainCode})()' | ||
) | ||
.replace('mainCode', () => mainCode) | ||
.replace('outdatedTemplate', () => outTemplateString) | ||
return isWorkerEnabled | ||
? html.replace('workerCodeString', () => workerCodeString) | ||
: html.replace('workerCode', () => workerCode) | ||
} |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.