master: initialize
57
README.md
@ -1,18 +1,9 @@
|
|||||||
[](https://github.com/Ozencb/tilde-enhanced/issues)
|
# Shiloh startpage
|
||||||
[](https://github.com/Ozencb/tilde-enhanced)
|
|
||||||
[](https://github.com/Ozencb/tilde-enhanced)
|
|
||||||
[](../master/LICENSE)
|
|
||||||
|
|
||||||
# Tilde Enhanced
|
|
||||||
|
|
||||||
Based on [Cade Scroggins](https://github.com/cadejscroggins)'s [Tilde](https://github.com/cadejscroggins/tilde).
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
Based on [Cade Scroggins](https://github.com/cadejscroggins)'s [startpage](https://github.com/cadejscroggins/startpage).
|
||||||
|
|
||||||
## Added Features
|
## Added Features
|
||||||
|
|
||||||
Most of the features are carried over from the original source.
|
Most of the features are carried over from the original source.
|
||||||
Few of the added features are:
|
Few of the added features are:
|
||||||
|
|
||||||
@ -24,18 +15,14 @@ Few of the added features are:
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To use Tilde as your homepage, simply set your browser's home URL to
|
To use startpage as your homepage, simply set your browser's home URL to
|
||||||
Tilde's index file.
|
startpage's index file.
|
||||||
To go to a site, enter the first letter of the site then hit enter.
|
To go to a site, enter the first letter of the site then hit enter.
|
||||||
To view the available sites, press `?` or click on the clock.
|
To view the available sites, press `?` or click on today's date.
|
||||||
If your input doesn't match any of the commands,
|
If your input doesn't match any of the commands,
|
||||||
a generic DuckDuckGo search will be triggered. For example:
|
a mullvad leta search will be triggered.
|
||||||
|
|
||||||
- Entering `r` would redirect you to [www.reddit.com](https://www.reddit.com).
|
Note that by default, queries are searched on Mullvad Leta but this can be
|
||||||
- Entering `t` would redirect you to [twitch.tv](https://www.twitch.tv).
|
|
||||||
- Entering `cats` would search [Cats](https://duckduckgo.com/?q=cats).
|
|
||||||
|
|
||||||
Note that by default, queries are searched on DuckDuckGo but this can be
|
|
||||||
configured easily by updating two lines on. Check [Configuration](#configuration) for details.
|
configured easily by updating two lines on. Check [Configuration](#configuration) for details.
|
||||||
|
|
||||||
You might have to allow pop-ups for your homepage to use quick launch feature.
|
You might have to allow pop-ups for your homepage to use quick launch feature.
|
||||||
@ -48,10 +35,10 @@ only bring up pre-defined sites.
|
|||||||
You can search any of the sites by typing a colon after the site's key, followed
|
You can search any of the sites by typing a colon after the site's key, followed
|
||||||
by your search query. For example:
|
by your search query. For example:
|
||||||
|
|
||||||
- Entering `g:tilde-enhanced` would search
|
- Entering `g:remnantchat` would search
|
||||||
[GitHub for tilde-enhanced](https://github.com/search?q=tilde-enhanced).
|
[GitHaven for startpage-enhanced](https://githaven.org/search?q=remnantchat).
|
||||||
- Entering `y:cats` would search
|
- Entering `stack:cats` would search
|
||||||
[Cats on YouTube](https://www.youtube.com/results?search_query=cats).
|
[Cats on stackoverflow](https://www.stackoverflow.com/results?search_query=cats).
|
||||||
|
|
||||||
### Specific Locations
|
### Specific Locations
|
||||||
|
|
||||||
@ -59,20 +46,10 @@ You can go to a specific location on a site by typing a forward slash after the
|
|||||||
site's key, followed by the location on the site you'd like to be redirected to.
|
site's key, followed by the location on the site you'd like to be redirected to.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
- Entering `r/r/startpages` would redirect you to
|
|
||||||
[www.reddit.com/r/startpages](https://www.reddit.com/r/startpages)
|
|
||||||
- Entering `h/popular` would redirect you to
|
|
||||||
[hypem.com/popular](http://hypem.com/popular).
|
|
||||||
|
|
||||||
### URL Redirects
|
### URL Redirects
|
||||||
|
|
||||||
If you enter in a full domain or URL, you will be redirected to said domain or
|
If you enter in a full domain or URL, you will be redirected to said domain or
|
||||||
URL. For example:
|
URL.
|
||||||
|
|
||||||
- Entering `stallman.org` would redirect you to
|
|
||||||
[stallman.org](https://stallman.org/).
|
|
||||||
- Entering `keep.google.com` would redirect you to
|
|
||||||
[keep.google.com](https://keep.google.com/).
|
|
||||||
|
|
||||||
You can also use `Ctrl + Enter` key combination to launch the query with a `.com` TLD.
|
You can also use `Ctrl + Enter` key combination to launch the query with a `.com` TLD.
|
||||||
|
|
||||||
@ -80,10 +57,10 @@ You can also use `Ctrl + Enter` key combination to launch the query with a `.com
|
|||||||
|
|
||||||
Additionally, you can pass any query via the `q` query param. For example:
|
Additionally, you can pass any query via the `q` query param. For example:
|
||||||
|
|
||||||
- Going to `file:///path/to/tilde/index.html?q=cats` would search
|
- Going to `file:///path/to/startpage/index.html?q=cats` would search
|
||||||
[Cats](https://duckduckgo.com/?q=cats).
|
[Cats](https://duckduckgo.com/?q=cats).
|
||||||
|
|
||||||
This allows you to invoke Tilde with your native browser search bar.
|
This allows you to invoke startpage with your native browser search bar.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@ -94,7 +71,3 @@ Open up the [config.js](js/config.js) file and read through the `CONFIG`!
|
|||||||
By default Firefox won't let you set a custom URL for new tabs but there is a work-around to circumvent the problem.
|
By default Firefox won't let you set a custom URL for new tabs but there is a work-around to circumvent the problem.
|
||||||
|
|
||||||
You can follow [Urimu's Guide](https://github.com/Urimu/Startpage#setting-it-up-on-firefox) to set your new tab to launch custom URLs.
|
You can follow [Urimu's Guide](https://github.com/Urimu/Startpage#setting-it-up-on-firefox) to set your new tab to launch custom URLs.
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Feel free to [use this and modify it however you like](https://github.com/Ozencb/tilde-enhanced/blob/master/LICENSE).
|
|
||||||
|
|||||||
BIN
assets/icons/cloud.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
BIN
assets/icons/githaven.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
assets/icons/huggingchat.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
BIN
assets/icons/lasthour.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
BIN
assets/icons/meet.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
BIN
assets/icons/projects.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
BIN
assets/icons/share.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
assets/icons/status.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
assets/icons/vault.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 137 KiB |
@ -72,11 +72,13 @@ textarea {
|
|||||||
margin: 0; /* 2 */
|
margin: 0; /* 2 */
|
||||||
}
|
}
|
||||||
button,
|
button,
|
||||||
input { /* 1 */
|
input {
|
||||||
|
/* 1 */
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
button,
|
button,
|
||||||
select { /* 1 */
|
select {
|
||||||
|
/* 1 */
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
button,
|
button,
|
||||||
@ -150,11 +152,10 @@ template {
|
|||||||
|
|
||||||
/* == End of Normalize.css == */
|
/* == End of Normalize.css == */
|
||||||
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
/* colors */
|
/* colors */
|
||||||
--background: #0E0E0E;
|
--background: #0e0e0e;
|
||||||
--foreground: #F1F1F1;
|
--foreground: #00bcf3;
|
||||||
|
|
||||||
/* fonts */
|
/* fonts */
|
||||||
--base-font-size: 18px;
|
--base-font-size: 18px;
|
||||||
@ -163,15 +164,16 @@ template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Metropolis';
|
font-family: "Metropolis";
|
||||||
src: local('Metropolis-Medium'), url('../assets/fonts/Metropolis-Medium.woff2');
|
src: local("Metropolis-Medium"),
|
||||||
|
url("../assets/fonts/Metropolis-Medium.woff2");
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Metropolis';
|
font-family: "Metropolis";
|
||||||
src: local('Metropolis-Bold'), url('../assets/fonts/Metropolis-Black.woff2');
|
src: local("Metropolis-Bold"), url("../assets/fonts/Metropolis-Black.woff2");
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@ -236,6 +238,7 @@ a:focus {
|
|||||||
|
|
||||||
.center {
|
.center {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -251,15 +254,24 @@ a:focus {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
.time-container {
|
||||||
|
display: flex;
|
||||||
|
place-content: center;
|
||||||
|
width: 90rem; /* adjust based on maximum length of the time unit */
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
.clock {
|
.clock {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: -0.06rem;
|
margin: 10px;
|
||||||
font-size: 4rem;
|
font-size: 4rem;
|
||||||
font-weight: var(--font-weight-normal);
|
font-weight: var(--font-weight-normal);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
letter-spacing: 0.05rem;
|
letter-spacing: 0.05rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: color 0.5s;
|
||||||
|
}
|
||||||
|
.clock:hover {
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.am-pm {
|
.am-pm {
|
||||||
@ -317,7 +329,7 @@ body.suggestions .search-suggestions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-suggestion b::after {
|
.search-suggestion b::after {
|
||||||
content: ' ';
|
content: " ";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: -0.3rem;
|
bottom: -0.3rem;
|
||||||
@ -380,7 +392,7 @@ body.suggestions .search-suggestions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.command-name::after {
|
.command-name::after {
|
||||||
content: ' ';
|
content: " ";
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
@ -416,7 +428,6 @@ body.form .search-form {
|
|||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (min-width: 500px) {
|
@media (min-width: 500px) {
|
||||||
.help {
|
.help {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
30
index.html
@ -1,25 +1,38 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<link rel="stylesheet" href="css/style.css" class="style">
|
<link rel="stylesheet" href="css/style.css" class="style" />
|
||||||
<title>~+</title>
|
<title>shiloh</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="center disable-select"><time class="clock" id="clock"></time></div>
|
<div class="center disable-select">
|
||||||
<form autocomplete="off" class="center overlay search-form" id="search-form" spellcheck="false">
|
<img src="https://shilohcode.com/shiloh-logo-white-1.png" width="200" />
|
||||||
|
<div class="time-container"><time class="clock" id="clock"></time></div>
|
||||||
|
|
||||||
|
<p>no announcements</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form
|
||||||
|
autocomplete="off"
|
||||||
|
class="center overlay search-form"
|
||||||
|
id="search-form"
|
||||||
|
spellcheck="false"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<input class="search-input" id="search-input" title="search" type="text" />
|
<input
|
||||||
|
class="search-input"
|
||||||
|
id="search-input"
|
||||||
|
title="search"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
<ul class="search-suggestions" id="search-suggestions"></ul>
|
<ul class="search-suggestions" id="search-suggestions"></ul>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<aside class="center help overlay disable-select" id="help"></aside>
|
<aside class="center help overlay disable-select" id="help"></aside>
|
||||||
|
|
||||||
|
|
||||||
<script src="js/svg-inject.min.js"></script>
|
<script src="js/svg-inject.min.js"></script>
|
||||||
<script src="js/config.js"></script>
|
<script src="js/config.js"></script>
|
||||||
<script src="js/body.js"></script>
|
<script src="js/body.js"></script>
|
||||||
@ -31,5 +44,4 @@
|
|||||||
<script src="js/suggester.js"></script>
|
<script src="js/suggester.js"></script>
|
||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
48
js/clock.js
@ -1,35 +1,41 @@
|
|||||||
class Clock {
|
class Clock {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this._el = $.el('#clock');
|
this._el = $.el("#clock");
|
||||||
this._delimiter = options.delimiter;
|
this._delimiter = options.delimiter;
|
||||||
this._twentyFourHourClock = options.twentyFourHourClock;
|
this._twentyFourHourClock = options.twentyFourHourClock;
|
||||||
this._setTime = this._setTime.bind(this);
|
this._setDate = this._setDate.bind(this);
|
||||||
this._el.addEventListener('click', options.toggleHelp);
|
this._el.addEventListener("click", options.toggleHelp);
|
||||||
this._start();
|
this._start();
|
||||||
}
|
}
|
||||||
|
|
||||||
_setTime() {
|
_setDate() {
|
||||||
const date = new Date();
|
const now = new Date();
|
||||||
let hours = $.pad(date.getHours());
|
let hour = now.getHours();
|
||||||
let amPm = '';
|
if (!this._twentyFourHourClock && hour > 12) {
|
||||||
|
hour -= 12;
|
||||||
if (!this._twentyFourHourClock) {
|
|
||||||
hours = date.getHours();
|
|
||||||
if (hours > 12) hours -= 12;
|
|
||||||
else if (hours === 0) hours = 12;
|
|
||||||
|
|
||||||
amPm =
|
|
||||||
` <span class="am-pm">` +
|
|
||||||
`${date.getHours() >= 12 ? 'PM' : 'AM'}</span>`;
|
|
||||||
}
|
}
|
||||||
|
let minute = now.getMinutes();
|
||||||
|
let second = now.getSeconds();
|
||||||
|
|
||||||
const minutes = $.pad(date.getMinutes());
|
let month = now.getMonth() + 1; // getMonth returns a value between 0 and 11, so add 1 to get the actual month number
|
||||||
this._el.innerHTML = `${hours}${this._delimiter}${minutes}${amPm}`;
|
let day = now.getDate();
|
||||||
this._el.setAttribute('datetime', date.toTimeString());
|
let year = now.getFullYear().toString().slice(-2); // Get last two digits of the full year
|
||||||
|
|
||||||
|
const formattedHour = $.pad(hour);
|
||||||
|
const formattedMinute = $.pad(minute);
|
||||||
|
const formattedSecond = $.pad(second);
|
||||||
|
const formattedMonth = $.pad(month);
|
||||||
|
const formattedDay = $.pad(day);
|
||||||
|
|
||||||
|
this._el.innerHTML = `${formattedMonth}${this._delimiter}${formattedDay}${this._delimiter}${year} ${formattedHour}:${formattedMinute}:${formattedSecond}`;
|
||||||
|
this._el.setAttribute(
|
||||||
|
"datetime",
|
||||||
|
`${year}-${formattedMonth}-${formattedDay}T${formattedHour}:${formattedMinute}:${formattedSecond}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_start() {
|
_start() {
|
||||||
this._setTime();
|
this._setDate();
|
||||||
setInterval(this._setTime, 1000);
|
setInterval(this._setDate, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
298
js/config.js
@ -6,209 +6,120 @@ const CONFIG = {
|
|||||||
* Commands without a category don't show up in the help menu.
|
* Commands without a category don't show up in the help menu.
|
||||||
* Update line 11 and 13 if you prefer using Google.
|
* Update line 11 and 13 if you prefer using Google.
|
||||||
*/
|
*/
|
||||||
commands: [{
|
commands: [
|
||||||
name: 'Duckduckgo',
|
{
|
||||||
key: '*',
|
name: "leta",
|
||||||
url: 'https://duckduckgo.com',
|
key: "*",
|
||||||
search: '/?q={}'
|
url: "https://leta.mullvad.net/",
|
||||||
|
search: "/?q={}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'General',
|
category: "my accounts",
|
||||||
name: 'Mail',
|
name: "mail",
|
||||||
key: 'm',
|
key: "m",
|
||||||
url: 'https://gmail.com',
|
url: "https://mail.shilohcode.com",
|
||||||
search: '/#search/text={}',
|
search: "/#search/text={}",
|
||||||
color: 'linear-gradient(135deg, #dd5145, #dd5145)',
|
color: "linear-gradient(135deg, #dd5145, #dd5145)",
|
||||||
icon: 'mail',
|
icon: "mail",
|
||||||
quickLaunch: true,
|
quickLaunch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'General',
|
category: "my accounts",
|
||||||
name: 'Drive',
|
name: "cloud",
|
||||||
key: 'd',
|
key: "c",
|
||||||
url: 'https://drive.google.com',
|
url: "https://cloud.shilohcode.com",
|
||||||
search: '/drive/search?q={}',
|
search: "/drive/search?q={}",
|
||||||
color: 'linear-gradient(135deg, #FFD04B, #1EA362, #4688F3)',
|
color: "linear-gradient(135deg, #FFD04B, #1EA362, #4688F3)",
|
||||||
icon: 'drive',
|
icon: "cloud",
|
||||||
|
quickLaunch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
category: "my accounts",
|
||||||
|
name: "meet",
|
||||||
|
key: "mtg",
|
||||||
|
url: "https://remnant.chat",
|
||||||
|
color: "#5682a3",
|
||||||
|
icon: "meet",
|
||||||
quickLaunch: false,
|
quickLaunch: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'General',
|
category: "my accounts",
|
||||||
name: 'Telegram',
|
name: "projects",
|
||||||
key: 'tg',
|
key: "p",
|
||||||
url: 'https://web.telegram.org',
|
url: "https://taiga.shilohcode.com",
|
||||||
color: '#5682a3',
|
color: "linear-gradient(135deg, #25D366, #128C7E, #075E54)",
|
||||||
icon: 'telegram',
|
icon: "projects",
|
||||||
|
quickLaunch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
category: "my accounts",
|
||||||
|
name: "passwords",
|
||||||
|
key: "ps",
|
||||||
|
url: "https://vault.shilohcode.com",
|
||||||
|
color: "#7289da",
|
||||||
|
icon: "vault",
|
||||||
quickLaunch: false,
|
quickLaunch: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'General',
|
category: "my accounts",
|
||||||
name: 'WhatsApp',
|
name: "secure share",
|
||||||
key: 'w',
|
key: "sh",
|
||||||
url: 'https://web.whatsapp.com',
|
url: "https://send.lasthourhosting.org",
|
||||||
color: 'linear-gradient(135deg, #25D366, #128C7E, #075E54)',
|
color: "#7289da",
|
||||||
icon: 'whatsapp',
|
icon: "share",
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'General',
|
|
||||||
name: 'Discord',
|
|
||||||
key: 'dc',
|
|
||||||
url: 'https://discord.com/app',
|
|
||||||
color: '#7289da',
|
|
||||||
icon: 'discord',
|
|
||||||
quickLaunch: false,
|
quickLaunch: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
category: 'Programming',
|
category: "dev",
|
||||||
name: 'GitHub',
|
name: "githaven",
|
||||||
key: 'g',
|
key: "g",
|
||||||
url: 'https://github.com',
|
url: "https://githaven.org",
|
||||||
search: '/search?q={}',
|
search: "/search?q={}",
|
||||||
color: 'linear-gradient(135deg, #2b2b2b, #3b3b3b)',
|
color: "linear-gradient(135deg, #2b2b2b, #3b3b3b)",
|
||||||
icon: 'github',
|
icon: "githaven",
|
||||||
quickLaunch: true,
|
quickLaunch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'Programming',
|
category: "dev",
|
||||||
name: 'StackOverflow',
|
name: "lasthour",
|
||||||
key: 'st',
|
key: "hc",
|
||||||
url: 'https://stackoverflow.com',
|
url: "https://console.lasthourhosting.org",
|
||||||
search: '/search?q={}',
|
search: "/search?q={}",
|
||||||
color: 'linear-gradient(135deg, #53341C, #F48024)',
|
color: "linear-gradient(135deg, #53341C, #F48024)",
|
||||||
icon: 'stackoverflow',
|
icon: "lasthour",
|
||||||
quickLaunch: true,
|
quickLaunch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: 'Programming',
|
category: "dev",
|
||||||
name: 'HackerNews',
|
name: "stackoverflow",
|
||||||
key: 'h',
|
key: "stack",
|
||||||
url: 'https://news.ycombinator.com/',
|
url: "https://stackoverflow.com",
|
||||||
search: '/search?stories[query]={}',
|
search: "/search?q={}",
|
||||||
color: 'linear-gradient(135deg, #FF6600, #DC5901)',
|
color: "linear-gradient(135deg, #53341C, #F48024)",
|
||||||
icon: 'hackernews',
|
icon: "stackoverflow",
|
||||||
quickLaunch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Programming',
|
|
||||||
name: 'MDN',
|
|
||||||
key: 'md',
|
|
||||||
url: 'https://developer.mozilla.org/en-US',
|
|
||||||
search: '/search?q={}',
|
|
||||||
color: '#212121',
|
|
||||||
icon: 'mdn',
|
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Programming',
|
|
||||||
name: 'DevDocs',
|
|
||||||
key: 'dd',
|
|
||||||
url: 'https://devdocs.io',
|
|
||||||
color: 'linear-gradient(135deg, #33373A, #484949)',
|
|
||||||
icon: 'devdocs',
|
|
||||||
quickLaunch: false,
|
quickLaunch: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
category: "dev",
|
||||||
|
name: "huggingchat",
|
||||||
|
key: "hc",
|
||||||
|
url: "https://huggingface.co/chat/",
|
||||||
|
search: "/search?q={}",
|
||||||
|
color: "linear-gradient(135deg, #53341C, #F48024)",
|
||||||
|
icon: "huggingchat",
|
||||||
|
quickLaunch: true,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
category: 'Fun',
|
category: "Uptime",
|
||||||
name: 'YouTube',
|
name: "check status",
|
||||||
key: 'y',
|
key: "st",
|
||||||
url: 'https://youtube.com',
|
url: "https://status.shilohcode.com",
|
||||||
search: '/results?search_query={}',
|
search: "/search?q={}",
|
||||||
color: 'linear-gradient(135deg, #cd201f, #cd4c1f)',
|
color: "linear-gradient(135deg, #53341C, #F48024)",
|
||||||
icon: 'youtube',
|
icon: "status",
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Fun',
|
|
||||||
name: 'Reddit',
|
|
||||||
key: 'r',
|
|
||||||
url: 'https://reddit.com',
|
|
||||||
search: '/search?q={}',
|
|
||||||
color: 'linear-gradient(135deg, #FF8456, #FF4500)',
|
|
||||||
icon: 'reddit',
|
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Fun',
|
|
||||||
name: 'Netflix',
|
|
||||||
key: 'n',
|
|
||||||
url: 'https://www.netflix.com',
|
|
||||||
color: 'linear-gradient(135deg, #E50914, #CB020C)',
|
|
||||||
icon: 'netflix',
|
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Fun',
|
|
||||||
name: 'Spotify',
|
|
||||||
key: 's',
|
|
||||||
url: 'https://open.spotify.com/',
|
|
||||||
search: '/search/{}',
|
|
||||||
color: '#1dd35e',
|
|
||||||
icon: 'spotify',
|
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Fun',
|
|
||||||
name: 'Twitch',
|
|
||||||
key: 'tw',
|
|
||||||
url: 'https://www.twitch.tv',
|
|
||||||
search: '/directory/game/{}',
|
|
||||||
color: 'linear-gradient(135deg, #6441a5, #4b367c)',
|
|
||||||
icon: 'twitch',
|
|
||||||
quickLaunch: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
category: 'Other',
|
|
||||||
name: 'Twitter',
|
|
||||||
key: 't',
|
|
||||||
url: 'https://www.twitter.com',
|
|
||||||
search: '/search?q={}&src=typed_query',
|
|
||||||
color: 'linear-gradient(135deg, #1DA1F2, #19608F)',
|
|
||||||
icon: 'twitter',
|
|
||||||
quickLaunch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Other',
|
|
||||||
name: 'Instagram',
|
|
||||||
key: 'i',
|
|
||||||
url: 'https://www.instagram.com',
|
|
||||||
color: 'linear-gradient(45deg, #405de6, #5851db, #833ab4, #c13584, #e1306c, #fd1d1d)',
|
|
||||||
icon: 'instagram',
|
|
||||||
quickLaunch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Other',
|
|
||||||
name: 'LinkedIn',
|
|
||||||
key: 'l',
|
|
||||||
url: 'https://linkedin.com',
|
|
||||||
search: '/search/results/all/?keywords={}',
|
|
||||||
color: 'linear-gradient(135deg, #006CA4, #0077B5)',
|
|
||||||
icon: 'linkedin',
|
|
||||||
quickLaunch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Other',
|
|
||||||
name: 'Notion',
|
|
||||||
key: 'ns',
|
|
||||||
url: 'https://www.notion.so',
|
|
||||||
color: 'linear-gradient(135deg, #FFF, #3F3F3F)',
|
|
||||||
icon: 'notion',
|
|
||||||
quickLaunch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
category: 'Other',
|
|
||||||
name: 'Translate',
|
|
||||||
key: 'tr',
|
|
||||||
url: 'https://translate.google.com/',
|
|
||||||
search: '/#view=home&op=translate&sl=auto&tl=en&text={}',
|
|
||||||
color: '#1a73e8',
|
|
||||||
icon: 'translate',
|
|
||||||
quickLaunch: false,
|
quickLaunch: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -228,21 +139,22 @@ const CONFIG = {
|
|||||||
* - "DuckDuckGo" suggestions come from the duck duck go search api
|
* - "DuckDuckGo" suggestions come from the duck duck go search api
|
||||||
* - "History" suggestions come from your previously entered queries
|
* - "History" suggestions come from your previously entered queries
|
||||||
*/
|
*/
|
||||||
influencers: [{
|
influencers: [
|
||||||
name: 'Commands',
|
{
|
||||||
limit: 2
|
name: "Commands",
|
||||||
|
limit: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Default',
|
name: "Default",
|
||||||
limit: 4
|
limit: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'History',
|
name: "History",
|
||||||
limit: 1
|
limit: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'DuckDuckGo',
|
name: "DuckDuckGo",
|
||||||
limit: 4
|
limit: 4,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -250,8 +162,8 @@ const CONFIG = {
|
|||||||
* Default search suggestions for the specified queries.
|
* Default search suggestions for the specified queries.
|
||||||
*/
|
*/
|
||||||
defaultSuggestions: {
|
defaultSuggestions: {
|
||||||
g: ['g/issues', 'g/pulls', 'gist.github.com'],
|
g: ["githaven.org"],
|
||||||
r: ['r/r/unixporn', 'r/r/startpages', 'r/r/webdev', 'r/r/technology'],
|
m: ["mail.shilohcode.com"],
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,7 +175,7 @@ const CONFIG = {
|
|||||||
/**
|
/**
|
||||||
* Open triggered queries in a new tab.
|
* Open triggered queries in a new tab.
|
||||||
*/
|
*/
|
||||||
newTab: false,
|
newTab: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamic overlay background colors when command domains are matched.
|
* Dynamic overlay background colors when command domains are matched.
|
||||||
@ -284,18 +196,18 @@ const CONFIG = {
|
|||||||
* The delimiter between a command key and your search query. For example,
|
* The delimiter between a command key and your search query. For example,
|
||||||
* to search GitHub for potatoes, you'd type "g:potatoes".
|
* to search GitHub for potatoes, you'd type "g:potatoes".
|
||||||
*/
|
*/
|
||||||
searchDelimiter: ':',
|
searchDelimiter: ":",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The delimiter between a command key and a path. For example, you'd type
|
* The delimiter between a command key and a path. For example, you'd type
|
||||||
* "r/r/unixporn" to go to "https://reddit.com/r/unixporn".
|
* "r/r/unixporn" to go to "https://reddit.com/r/unixporn".
|
||||||
*/
|
*/
|
||||||
pathDelimiter: '/',
|
pathDelimiter: "/",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The delimiter between the hours and minutes on the clock.
|
* The delimiter between the hours and minutes on the clock.
|
||||||
*/
|
*/
|
||||||
clockDelimiter: ' ',
|
clockDelimiter: " ",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a twenty-four-hour clock instead of a twelve-hour clock with AM/PM.
|
* Show a twenty-four-hour clock instead of a twelve-hour clock with AM/PM.
|
||||||
@ -305,5 +217,5 @@ const CONFIG = {
|
|||||||
/**
|
/**
|
||||||
* File extension for icon images
|
* File extension for icon images
|
||||||
*/
|
*/
|
||||||
iconExtension: 'png'
|
iconExtension: "png",
|
||||||
};
|
};
|
||||||
|
|||||||
80
js/help.js
@ -1,6 +1,6 @@
|
|||||||
class Help {
|
class Help {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this._el = $.el('#help');
|
this._el = $.el("#help");
|
||||||
this._commands = options.commands;
|
this._commands = options.commands;
|
||||||
this._newTab = options.newTab;
|
this._newTab = options.newTab;
|
||||||
this._toggled = false;
|
this._toggled = false;
|
||||||
@ -8,8 +8,8 @@ class Help {
|
|||||||
this.toggle = this.toggle.bind(this);
|
this.toggle = this.toggle.bind(this);
|
||||||
this.launch = this.launch.bind(this);
|
this.launch = this.launch.bind(this);
|
||||||
this.launchCategory = this.launchCategory.bind(this);
|
this.launchCategory = this.launchCategory.bind(this);
|
||||||
this._inputEl = $.el('#search-input');
|
this._inputEl = $.el("#search-input");
|
||||||
this._inputElVal = '';
|
this._inputElVal = "";
|
||||||
this._suggester = options.suggester;
|
this._suggester = options.suggester;
|
||||||
this._invertColors = options.invertedColors;
|
this._invertColors = options.invertedColors;
|
||||||
this._buildAndAppendLists();
|
this._buildAndAppendLists();
|
||||||
@ -18,50 +18,50 @@ class Help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggle(show) {
|
toggle(show) {
|
||||||
this._toggled = typeof show !== 'undefined' ? show : !this._toggled;
|
this._toggled = typeof show !== "undefined" ? show : !this._toggled;
|
||||||
this._toggled ? $.bodyClassAdd('help') : $.bodyClassRemove('help');
|
this._toggled ? $.bodyClassAdd("help") : $.bodyClassRemove("help");
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
$.bodyClassRemove('form');
|
$.bodyClassRemove("form");
|
||||||
this._inputEl.value = '';
|
this._inputEl.value = "";
|
||||||
this._inputElVal = '';
|
this._inputElVal = "";
|
||||||
this._suggester.suggest('');
|
this._suggester.suggest("");
|
||||||
}
|
}
|
||||||
|
|
||||||
launch() {
|
launch() {
|
||||||
this.hide();
|
this.hide();
|
||||||
this.toggle(true);
|
this.toggle(true);
|
||||||
$.bodyClassAdd('help');
|
$.bodyClassAdd("help");
|
||||||
|
|
||||||
CONFIG.commands.forEach(command => {
|
CONFIG.commands.forEach((command) => {
|
||||||
if (command.quickLaunch) window.open(command.url);
|
if (command.quickLaunch) window.open(command.url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
launchCategory() {
|
launchCategory() {
|
||||||
|
|
||||||
const categorySet = new Set();
|
const categorySet = new Set();
|
||||||
|
|
||||||
CONFIG.commands.forEach(command => {
|
CONFIG.commands.forEach((command) => {
|
||||||
if (command.category) categorySet.add(command.category);
|
if (command.category) categorySet.add(command.category);
|
||||||
});
|
});
|
||||||
|
|
||||||
const targetCategoryIndex = $.el('#search-input').value.replace('!', '');
|
const targetCategoryIndex = $.el("#search-input").value.replace("!", "");
|
||||||
const targetCategory = Array.from(categorySet)[targetCategoryIndex - 1];
|
const targetCategory = Array.from(categorySet)[targetCategoryIndex - 1];
|
||||||
|
|
||||||
CONFIG.commands.forEach(command => {
|
CONFIG.commands.forEach((command) => {
|
||||||
if(targetCategory && command.category === targetCategory) window.open(command.url);
|
if (targetCategory && command.category === targetCategory)
|
||||||
|
window.open(command.url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildAndAppendLists() {
|
_buildAndAppendLists() {
|
||||||
const lists = document.createElement('ul');
|
const lists = document.createElement("ul");
|
||||||
lists.classList.add('categories');
|
lists.classList.add("categories");
|
||||||
|
|
||||||
this._getCategories().forEach(category => {
|
this._getCategories().forEach((category) => {
|
||||||
lists.insertAdjacentHTML(
|
lists.insertAdjacentHTML(
|
||||||
'beforeend',
|
"beforeend",
|
||||||
`<li class="category">
|
`<li class="category">
|
||||||
<h2 class="category-name">${category}</h2>
|
<h2 class="category-name">${category}</h2>
|
||||||
<ul>${this._buildListCommands(category)}</ul>
|
<ul>${this._buildListCommands(category)}</ul>
|
||||||
@ -75,18 +75,28 @@ class Help {
|
|||||||
_buildListCommands(currentCategory) {
|
_buildListCommands(currentCategory) {
|
||||||
let invertValue = this._invertColors ? 1 : 0;
|
let invertValue = this._invertColors ? 1 : 0;
|
||||||
|
|
||||||
const bgcolor = invertValue ? getComputedStyle(document.documentElement).getPropertyValue('--foreground')
|
const bgcolor = invertValue
|
||||||
: getComputedStyle(document.documentElement).getPropertyValue('--background');
|
? getComputedStyle(document.documentElement).getPropertyValue(
|
||||||
|
"--foreground"
|
||||||
const fgcolor = invertValue ? getComputedStyle(document.documentElement).getPropertyValue('--background')
|
)
|
||||||
: getComputedStyle(document.documentElement).getPropertyValue('--foreground');
|
: getComputedStyle(document.documentElement).getPropertyValue(
|
||||||
|
"--background"
|
||||||
|
);
|
||||||
|
|
||||||
|
const fgcolor = invertValue
|
||||||
|
? getComputedStyle(document.documentElement).getPropertyValue(
|
||||||
|
"--background"
|
||||||
|
)
|
||||||
|
: getComputedStyle(document.documentElement).getPropertyValue(
|
||||||
|
"--foreground"
|
||||||
|
);
|
||||||
|
|
||||||
const commandListWithIcons = this._commands
|
const commandListWithIcons = this._commands
|
||||||
.map(({ category, name, key, url, icon }, i) => {
|
.map(({ category, name, key, url, icon }, i) => {
|
||||||
const iconEl = CONFIG.iconExtension !== 'svg'
|
const iconEl =
|
||||||
|
CONFIG.iconExtension !== "svg"
|
||||||
? `<img src='assets/icons/${icon}.png' height = 28px center style="filter: invert(${invertValue});">`
|
? `<img src='assets/icons/${icon}.png' height = 28px center style="filter: invert(${invertValue});">`
|
||||||
: `<img src='assets/icons/${icon}.svg' onload="SVGInject(this)" height = 28px center style="fill: ${fgcolor};">`
|
: `<img src='assets/icons/${icon}.svg' onload="SVGInject(this)" height = 28px center style="fill: ${fgcolor};">`;
|
||||||
|
|
||||||
if (category === currentCategory) {
|
if (category === currentCategory) {
|
||||||
return `
|
return `
|
||||||
@ -98,7 +108,7 @@ class Help {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<li class="command">
|
<li class="command">
|
||||||
<a href="${url}" target="${this._newTab ? '_blank' : '_self'}">
|
<a href="${url}" target="${this._newTab ? "_blank" : "_self"}">
|
||||||
<span class="command-key command-key-${i}">${iconEl}</span>
|
<span class="command-key command-key-${i}">${iconEl}</span>
|
||||||
<span class="command-name">${name}</span>
|
<span class="command-name">${name}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -106,14 +116,14 @@ class Help {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.join('');
|
.join("");
|
||||||
|
|
||||||
const commandListWithKeys = this._commands
|
const commandListWithKeys = this._commands
|
||||||
.map(({ category, name, key, url }, i) => {
|
.map(({ category, name, key, url }, i) => {
|
||||||
if (category === currentCategory) {
|
if (category === currentCategory) {
|
||||||
return `
|
return `
|
||||||
<li class="command">
|
<li class="command">
|
||||||
<a href="${url}" target="${this._newTab ? '_blank' : '_self'}">
|
<a href="${url}" target="${this._newTab ? "_blank" : "_self"}">
|
||||||
<style>
|
<style>
|
||||||
.command-key-${i} {
|
.command-key-${i} {
|
||||||
color: ${fgcolor};
|
color: ${fgcolor};
|
||||||
@ -128,24 +138,24 @@ class Help {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.join('');
|
.join("");
|
||||||
|
|
||||||
return CONFIG.showKeys ? commandListWithKeys : commandListWithIcons;
|
return CONFIG.showKeys ? commandListWithKeys : commandListWithIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getCategories() {
|
_getCategories() {
|
||||||
const categories = this._commands
|
const categories = this._commands
|
||||||
.map(v => v.category)
|
.map((v) => v.category)
|
||||||
.filter(category => category);
|
.filter((category) => category);
|
||||||
|
|
||||||
return [...new Set(categories)];
|
return [...new Set(categories)];
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleKeydown(e) {
|
_handleKeydown(e) {
|
||||||
if ($.key(e) === 'escape') this.toggle(false);
|
if ($.key(e) === "escape") this.toggle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_registerEvents() {
|
_registerEvents() {
|
||||||
document.addEventListener('keydown', this._handleKeydown);
|
document.addEventListener("keydown", this._handleKeydown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||