From 9d49d51268bcdf8d35596b96f47a24bed91f568c Mon Sep 17 00:00:00 2001 From: zombieFox Date: Thu, 4 Apr 2019 15:26:52 +0100 Subject: [PATCH] [feature] add search engine name to search input placeholder --- js/search.js | 9 +++++++-- js/state.js | 9 ++++++--- js/update.js | 7 +++++++ js/version.js | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/js/search.js b/js/search.js index 6ba56662..83e0bd08 100644 --- a/js/search.js +++ b/js/search.js @@ -63,11 +63,16 @@ var search = (function() { var render = function() { var search = helper.e(".search"); var searchInput = helper.e(".search-input"); + var placeholder = ""; if (state.get().bookmarks.link.show) { - searchInput.setAttribute("placeholder", "Find or Search"); + placeholder = "Find bookmarks or search"; } else { - searchInput.setAttribute("placeholder", "Search"); + placeholder = "Search"; }; + if (state.get().header.search.engine.selected != "custom") { + placeholder = placeholder + " " + state.get().header.search.engine[state.get().header.search.engine.selected].name; + }; + searchInput.setAttribute("placeholder", placeholder); search.setAttribute("action", state.get().header.search.engine[state.get().header.search.engine.selected].url); }; diff --git a/js/state.js b/js/state.js index 682a6961..90e2baa7 100644 --- a/js/state.js +++ b/js/state.js @@ -31,13 +31,16 @@ var state = (function() { engine: { selected: "google", google: { - url: "https://www.google.com/search" + url: "https://www.google.com/search", + name: "Google" }, duckduckgo: { - url: "https://duckduckgo.com/" + url: "https://duckduckgo.com/", + name: "Duck Duck Go" }, giphy: { - url: "https://giphy.com/search/" + url: "https://giphy.com/search/", + name: "Giphy" }, custom: { url: "" diff --git a/js/update.js b/js/update.js index be0027e3..fe611be5 100644 --- a/js/update.js +++ b/js/update.js @@ -254,6 +254,13 @@ var update = (function() { }; data.version = "2.16.0"; }; + if (version.compare(data.version, "2.17.0") == -1) { + console.log("\t -- running update", "2.17.0"); + data.state.header.search.engine.google.name = "Google"; + data.state.header.search.engine.duckduckgo.name = "Duck Duck Go"; + data.state.header.search.engine.giphy.name = "Giphy"; + data.version = "2.17.0"; + }; }; // if no update is needed // version bump diff --git a/js/version.js b/js/version.js index 874620c8..b373fa13 100644 --- a/js/version.js +++ b/js/version.js @@ -1,7 +1,7 @@ var version = (function() { // version is normally bumped when the state needs changing or any new functionality is added - var current = "2.16.1"; + var current = "2.17.0"; var compare = function(a, b) { var pa = a.split(".");