Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function cat(port) {
console.error('The environment variable $BROWSER is not set. Falling back to default opening mechanism.')
opn('http://localhost:' + server.address().port, { wait: false })
} else {
console.error('The environment variable $BROWSER is set to "' + $BROWSER + '"')
console.error('The environment variable $BROWSER is set to "' + process.env.BROWSER + '"')
child.spawn(process.env.BROWSER, [url], { detached: true })
}
})
Expand Down Expand Up @@ -133,13 +133,21 @@ function handler(request, response) {

var style = 'body { background-color: ' + bg + '; color: ' + fg + '; font-family:Monaco, Menlo, monospace; padding:2em;} ' +
'div#headline { position: fixed; top: 2em; right: 2em ; text-align: right;} ' +
'div#autoscroll { position: fixed; bottom: 2em; right: 2em ; }'


response.write('<!DOCTYPE html><html><head><style>' + style + '</style></head>' +
'div#autoscroll { position: fixed; bottom: 2em; right: 2em ; } ' +
'.noselect { ' +
'-webkit-touch-callout: none; /* iOS Safari */ ' +
'-webkit-user-select: none; /* Safari */ ' +
'-khtml-user-select: none; /* Konqueror HTML */ ' +
'-moz-user-select: none; /* Old versions of Firefox */ ' +
'-ms-user-select: none; /* Internet Explorer/Edge */ ' +
'user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ }'

response.write('<!DOCTYPE html><html><head>' +
'<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">' +
'<style>' + style + '</style></head>' +
'<body>' +
'<div id="headline">Pipe from terminal to browser<br> <br><code style="color:gray">started at:' + new Date() + '</code></div>' +
'<div id="autoscroll">Auto scroll <input type="checkbox" id="autoscrollToggle" checked /></div>' +
'<div id="headline" class="noselect">Pipe from terminal to browser<br> <br><code style="color:gray">started at:' + new Date() + '</code></div>' +
'<div id="autoscroll" class="noselect">Auto scroll <input type="checkbox" id="autoscrollToggle" checked /></div>' +
'<script>' + script + '</script><div id="container">')
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bcat",
"version": "2.0.0",
"version": "2.0.1",
"description": "A pipe to browser utility",
"main": "index.js",
"bin": {
Expand Down