From 2daacd3bde639ba79ccf4aa82b86aefb16cd5b40 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 24 Dec 2021 12:51:28 +0000 Subject: [PATCH] Strip down templates and JS --- ohayodash/static/js/search.js | 41 +++-------------------------------- ohayodash/static/js/themer.js | 8 +++---- ohayodash/templates/index.j2 | 12 ---------- 3 files changed, 7 insertions(+), 54 deletions(-) diff --git a/ohayodash/static/js/search.js b/ohayodash/static/js/search.js index 76f6cda..1bdee3b 100755 --- a/ohayodash/static/js/search.js +++ b/ohayodash/static/js/search.js @@ -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); }; diff --git a/ohayodash/static/js/themer.js b/ohayodash/static/js/themer.js index 9c19380..fb941cf 100755 --- a/ohayodash/static/js/themer.js +++ b/ohayodash/static/js/themer.js @@ -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', diff --git a/ohayodash/templates/index.j2 b/ohayodash/templates/index.j2 index 7247c90..4e86f71 100644 --- a/ohayodash/templates/index.j2 +++ b/ohayodash/templates/index.j2 @@ -9,10 +9,6 @@ - - - - @@ -102,14 +98,6 @@ - - - - - - - - \ No newline at end of file