update commands & add more colors

This commit is contained in:
Cade Scroggins
2019-12-31 12:01:31 -08:00
parent 7d33ff89b8
commit 6ddc6ee95a
+27 -20
View File
@@ -71,22 +71,22 @@
search: '/search/{}', search: '/search/{}',
color: 'linear-gradient(135deg, #83c441, #62c441)', color: 'linear-gradient(135deg, #83c441, #62c441)',
}, },
{
category: 'Listen',
name: 'Line Radio',
key: 'l',
url: 'https://linerad.io',
search: '/#{}',
color: 'linear-gradient(135deg, #a29bfe, #bb9bfe)',
},
{ {
category: 'Listen', category: 'Listen',
name: 'SoundCloud', name: 'SoundCloud',
key: 's', key: 'S',
url: 'https://soundcloud.com/discover', url: 'https://soundcloud.com/discover',
search: '/search?q={}', search: '/search?q={}',
color: 'linear-gradient(135deg, #ff8800, #ffc800)', color: 'linear-gradient(135deg, #ff8800, #ffc800)',
}, },
{
category: 'Listen',
name: 'Spotify',
key: 's',
url: 'https://open.spotify.com',
search: '/search/{}',
color: 'linear-gradient(135deg, #1DB954, #1Da974)',
},
{ {
category: 'Watch', category: 'Watch',
name: 'Netflix', name: 'Netflix',
@@ -146,7 +146,7 @@
category: 'Download', category: 'Download',
name: 'YTS', name: 'YTS',
key: 'Y', key: 'Y',
url: 'https://yts.am/browse-movies/all/1080p/all/7/latest', url: 'https://yts.am/browse-movies/0/1080p/all/8/latest',
search: '/browse-movies/{}', search: '/browse-movies/{}',
color: 'linear-gradient(135deg, #2f2f2f, #373737)', color: 'linear-gradient(135deg, #2f2f2f, #373737)',
}, },
@@ -202,9 +202,9 @@
newTab: true, newTab: true,
/** /**
* Dynamic overlay background colors when command domains are matched. * Use command colors when domains are matched and on the help page.
*/ */
colors: false, colors: true,
/** /**
* The delimiter between a command key and your search query. For example, * The delimiter between a command key and your search query. For example,
@@ -243,8 +243,8 @@
/* colors */ /* colors */
--background: #fffef8; --background: #fffef8;
--foreground: #3e4959; --foreground: #3e4959;
--searchBackground: #fffef8; --searchBackground: #3e4959;
--searchForeground: #3e4959; --searchForeground: #fffef8;
/* fonts */ /* fonts */
--font-family: Lato, sans-serif; --font-family: Lato, sans-serif;
@@ -473,7 +473,7 @@
border-radius: 50%; border-radius: 50%;
background: var(--foreground); background: var(--foreground);
color: var(--background); color: var(--background);
font-size: 0.75rem; font-size: 0.8rem;
line-height: 2rem; line-height: 2rem;
text-align: center; text-align: center;
} }
@@ -487,9 +487,9 @@
display: none; display: none;
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0.5rem; bottom: 0.4rem;
left: 0; left: 0;
height: 4px; height: 0.4rem;
transition: 0.2s; transition: 0.2s;
transform: translateX(-2rem); transform: translateX(-2rem);
background: var(--foreground); background: var(--foreground);
@@ -696,6 +696,7 @@
class Help { class Help {
constructor(options) { constructor(options) {
this._el = $.el('#help'); this._el = $.el('#help');
this._colors = options.colors;
this._commands = options.commands; this._commands = options.commands;
this._newTab = options.newTab; this._newTab = options.newTab;
this._toggled = false; this._toggled = false;
@@ -729,13 +730,18 @@
_buildListCommands(currentCategory) { _buildListCommands(currentCategory) {
return this._commands return this._commands
.map(({ category, name, key, url }) => { .map(({ category, color, 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'}">
<span class="command-key">${key}</span> ${
<span class="command-name">${name}</span> this._colors
? `<style>.command-key-${i},.command-name-${i}::after{background:${color};}</style>`
: ''
}
<span class="command-key command-key-${i}">${key}</span>
<span class="command-name command-name-${i}">${name}</span>
</a> </a>
</li> </li>
`; `;
@@ -1301,6 +1307,7 @@
}); });
const help = new Help({ const help = new Help({
colors: CONFIG.colors,
commands: CONFIG.commands, commands: CONFIG.commands,
newTab: CONFIG.newTab, newTab: CONFIG.newTab,
}); });