Strip down templates and JS

This commit is contained in:
2021-12-24 12:51:28 +00:00
parent 04617350d8
commit 2daacd3bde
3 changed files with 7 additions and 54 deletions

View File

@@ -20,7 +20,7 @@ function handleKeyPress(e) {
if (key == 13) { // Search functions
search(text);
}
if(key == 32){ //Space to go to search
if (key == 32) { //Space to go to search
document.getElementById("keywords").focus();
}
sindex = 0;
@@ -28,42 +28,7 @@ function handleKeyPress(e) {
}
function search(text) {
var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);
var subtext = text.substr(2 + option.length);
if (text[0] === '/') {
if (text.indexOf(' ') > -1) {
switch (option) {
case "d":
window.location = "https://duckduckgo.com/?q=" + subtext;
break;
case "i":
window.location = "https://www.imdb.com/find?q=" + subtext;
break;
case "r":
window.location = "https://www.reddit.com/search?q=" + subtext;
break;
case "y":
window.location = "https://www.youtube.com/results?search_query=" + subtext;
break;
}
} else {
var option = text.substr(1);
switch (option) {
case "d":
window.location = "https://www.duckduckgo.com";
break;
case "y":
window.location = "https://www.youtube.com";
break;
case "r":
window.location = "https://reddit.com";
break;
case "s":
window.location = "https://open.spotify.com";
break;
}
}
} else if (validURL(text)) {
if (validURL(text)) {
if (containsProtocol(text))
window.location = text;
else
@@ -89,7 +54,7 @@ function containsProtocol(str) {
return !!pattern.test(str);
}
String.prototype.replaceAll = function(search, replacement) {
String.prototype.replaceAll = function (search, replacement) {
var target = this;
return target.split(search).join(replacement);
};

View File

@@ -101,7 +101,7 @@ for (let i = 0; i < dataThemeButtons.length; i++) {
'color-text-acc': '#6EE2FF'
});
return;
case 'blues':
setTheme({
'color-background': '#2B2C56',
@@ -109,7 +109,7 @@ for (let i = 0; i < dataThemeButtons.length; i++) {
'color-text-acc': '#6677EB'
});
return;
case 'passion':
setTheme({
'color-background': '#f5f5f5',
@@ -117,7 +117,7 @@ for (let i = 0; i < dataThemeButtons.length; i++) {
'color-text-acc': '#8e24aa'
});
return;
case 'chalk':
setTheme({
'color-background': '#263238',
@@ -125,7 +125,7 @@ for (let i = 0; i < dataThemeButtons.length; i++) {
'color-text-acc': '#FF869A'
});
return;
case 'paper':
setTheme({
'color-background': '#F8F6F1',