home

my firefox custom homepage
Log | Files | Refs | README | git clone https://git.ne02ptzero.me/git/home

commit 7e672309e2350fb224082e944e1c2cb6cee23d6f
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue,  3 Oct 2017 18:03:22 +0200

[TREE] ADD: Basic tree for homepage, with some instructions

Signed-off-by: Ne02ptzero <louis@ne02ptzero.me>

Diffstat:
AREADME.md | 30++++++++++++++++++++++++++++++
Aindex.html | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amain.css | 173+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amain.js | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amask.png | 0
Aserver.js | 6++++++
6 files changed, 384 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -0,0 +1,30 @@ +# Firefox Home Page + +## Install +Clone +``` +git clone https://github.com/Ne02ptzero/home +``` + +Install: +``` +npm install connect serve-static +``` + +## Launch +``` +sudo node server.js +``` +Note that you can run the server as a normal user if you don't use the ```80``` +port. + +Go to [the home page)(127.0.0.1) + +## Integration with firefox +Install the [New tabs Override addon](https://addons.mozilla.org/en-US/firefox/addon/new-tab-override/) +Choose the option ```custom URL``` and put the server URL below. +Do not forget to check the ```Focus``` option. + +If you're like me and do not like the default addressbar, add an entry in your +```/etc/hosts``` file like: ```127.0.0.1 home.com``` and change the url to ```home.com``` +in the New Tabs Override configuration. diff --git a/index.html b/index.html @@ -0,0 +1,74 @@ +<!DOCTYPE html> +<html> + <head> + <title>Home</title> + <meta charset="UTF-8"> + <link rel="icon" href="favicon.png" type="image/icon"> + <link rel="stylesheet" href="main.css"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <script type="text/javascript" src="main.js"></script> + </head> + <body onload="startTime()"> + <div id="main-container"> + <div id="content-container"> + <img src="mask.png" /> + <h1>/home</h1> + <form action="javascript: submit();"> + <ul class='search'> + <li class='first'>/search/</li> + <li><input id="search" type="text" placeholder="ggl" autofocus autocomplete="off"></li> + </ul> + </form> + <div id="column-container"> + <ul> + <li>/work</li> + <li><a href="https://labo-sns.stormshield.eu/reviewboard/dashboard/?view=to-group&group=NGIUTM">/w/reviews</a></li> + <li><a href="https://labo-sns.stormshield.eu/cgit/index/">/w/git</a></li> + <li><a href="https://wearestormshield.talkspirit.com/#/l/home?clip=all&type=all&view=wall&_k=srnj5s">/w/we_are</a></li> + <li><a href="https://mantis.stormshield.eu/login_page.php">/w/mantis</a></li> + </ul> + <ul> + <li>/code</li> + <li><a href="https://github.com">/c/github</a></li> + <li><a href="https://fw.senc.io/">/c/senc-io</a></li> + </ul> + <ul> + <li>/social</li> + <li><a href="https://youtube.com">/s/yt</a></li> + <li><a href="https://twitter.com">/s/twt</a></li> + <li><a href="https://facebook.com">/s/fb</a></li> + <li><a href="https://e2r13.slack.com/messages/C03B5MYF9">/s/slck</a></li> + </ul> + <ul> + <li>/reddit</li> + <li><a href="https://reddit.com/r/all">/r/*</a></li> + <li><a href="https://reddit.com/r/france">/r/fr</a></li> + <li><a href="https://reddit.com/r/wow">/r/wow</a></li> + <li><a href="https://reddit.com/r/linux">/r/nux</a></li> + </ul> + <ul> + <li>/tech</li> + <li><a href="https://news.ycombinator.com/">/t/hn</a></li> + <li><a href="https://lwn.net/">/t/lwn</a></li> + <li><a href="https://korben.info/">/t/kbn</a></li> + <li><a href="https://lobste.rs/">/t/lbst</a></li> + </ul> + <ul> + <li>/fun</li> + <li><a href="https://xkcd.com/">/f/xkcd</a></li> + <li><a href="https://danstonchat.com/latest.html">/f/dtc</a></li> + <li><a href="https://www.twitch.tv/">/f/twitch</a></li> + </ul> + <ul> + <li>/music</li> + <li><a href="https://plug.dj/tastycat#playlists">/m/pdj</a><li> + <li><a href="https://soundcloud.com/stream">/m/sc</a><li> + </ul> + </div> + </div> + </div> + <div id="time"></div> + <div class='help'><a href="#" onclick="show_help()">Help</a></div> + <div id='show_help'></div> + </body> +</html> diff --git a/main.css b/main.css @@ -0,0 +1,173 @@ +/* + * Minimal Firefox Homepage + * + * Author: clyde80 + * Website: https://github.com/clyde80 + * Created on: February 05, 2017 + * Updated on: February 06, 2017 + * + * Colors: + * Red: #A26A5B + * Yellow: #FAE8A4 + * Green: #406158 + * Black: #211716 + * + */ +html, body { + margin: 0; + padding: 0; + background-color: #080707; + color: #DBD8C3; + font-family: 'Inconsolata', monospace; +} + +/* + * Use the following code to center stuff in browser window in future. + * + * Source: (https://www.w3.org/Style/Examples/007/center-example) + */ +#main-container { + top: 0; + left: 0; + width: 100%; + height: 100%; + position: absolute; + display: table; +} + +#content-container { + text-align: center; + display: table-cell; + vertical-align: middle; +} +/* End of centering stuff in browser window. */ + +@media only screen and (min-width: 481px) { + #search { + width: 400px; + } + + #column-container ul { + display: inline-block; + } +} + +@media only screen and (max-width: 480px) { + #search { + width: 300px; + } + + #column-container ul { + display: block; + } +} + +#search { + padding: 5px 5px; + border: none; + background-color: transparent; + color: #DBD8C3; + font-family: 'Inconsolata', monospace; + font-size: 14px; +} + +#column-container ul { + padding: 10px; + list-style-type: none; + vertical-align: top; +} + +#column-container ul li:first-child { + color: #757368; + font-size: 16px; + padding-bottom: 5px; +} + +#column-container ul li a { + color: #F5F1DA; + font-size: 12px !important; + text-decoration: none; +} + +#column-container ul li a:hover { + color: #A26A5B; +} + +img { + height: auto; + width: 18%; + margin-top: -80px; + margin-bottom: 50px; +} + +#time { + position: absolute; + width: 100%; + bottom: 10px; + text-align: center; + color: #B5B2A1; +} + +.search { + list-style: none; + padding: 0; + margin: 0; +} + +.search li { + display: inline-block; +} + +.search .first { + font-size: 14px; + margin-right: -12px; +} + +.help { + position: absolute; + width: 100%; + bottom: 10px; + right: 10px; + text-align: right; + color: #B5B2A1; +} + +.help a { + text-decoration: none; + background-color: #B5B2A1; + color: #080707; + padding: 5px 10px 5px 10px; +} + +#show_help { + position: absolute; + height: auto; + left: 0; + bottom: 0; + background-color: #B5B2A1; + z-index: 999; + padding: 0 20px 0 20px; + display: none; +} + +#show_help ul { + list-style: none; + margin-left: 0; + padding: 0; +} + +#show_help ul li { + margin-bottom: 12px; + color: #080707; +} + +#show_help ul .shortcut { + background-color: #080707; + font-weight: bold; + height: 15px; + width: 30px; + padding: 5px 5px 5px 5px; + text-align: center; + display: inline-block; + color: #B5B2A1; +} diff --git a/main.js b/main.js @@ -0,0 +1,101 @@ +var bangs = { + "g": { + "url": "https://www.google.com/search?q=%s", + "help": "Google" + }, + "gi": { + "url": "https://www.google.com/search?q=%s&tbm=isch", + "help": "Google Images" + }, + "yt": { + "url": "https://www.youtube.com/results?search_query=%s", + "help": "YouTube" + }, + "r": { + "url": "https://www.reddit.com/search?q=%s", + "help": "Reddit" + }, + "i": { + "url": "https://profile.intra.42.fr/searches/search?query=%s", + "help": "42 Intra Search" + }, + "iu": { + "url": "https://profile.intra.42.fr/users/%s", + "help": "42 Intra User" + }, + "gt": { + "url": "https://github.com/search?utf8=✓&q=%s&type=", + "help": "Github" + }, + "st": { + "url": "https://stackoverflow.com/search?q=%s", + "help": "Stack Overflow" + }, + "hn": { + "url": "https://hn.algolia.com/?query=%s", + "help": "Hacker News" + }, + "lbs": { + "url": "https://lobste.rs/search?utf8=✓&q=%s&what=stories&order=relevance", + "help": "Lobste.rs" + } +}; + +function submit() { + url = document.getElementById('search').value + if (url.startsWith("http")) + window.location.href = url; + else + { + res = url.split(" ") + if (bangs[res[0]]) + { + term = url.substring(res[0].length + 1, url.len) + url = bangs[res[0]].url.replace(/%s/i, term) + window.location.href = url + } + else + { + window.location.href = "https://www.google.com/search?q=" + url; + } + } +} + +function startTime() { + var today = new Date(); + var h = today.getHours(); + var m = today.getMinutes(); + var s = today.getSeconds(); + m = checkTime(m); + s = checkTime(s); + document.getElementById('time').innerHTML = + h + ":" + m + ":" + s; + var t = setTimeout(startTime, 500); +} + +function checkTime(i) { + if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10 + return i; +} + +help_show = 0 + +function show_help() { + if (help_show == 0) + { + html = "<ul>" + for (var key in bangs) + { + b = bangs[key] + html += "<li><div class='shortcut'>"+ key + "</div> "+ b["help"] +"</li>" + } + html += "</ul>" + document.getElementById("show_help").innerHTML = html + document.getElementById("show_help").style.display = "block" + } + else + { + document.getElementById("show_help").style.display = "none" + } + help_show = help_show == 0 ? 1 : 0; +} diff --git a/mask.png b/mask.png Binary files differ. diff --git a/server.js b/server.js @@ -0,0 +1,6 @@ +var connect = require('connect'); +var serveStatic = require('serve-static'); + +connect().use(serveStatic(__dirname)).listen(80, function() { + console.log("Server running on 80 port."); +})