[feature] add search engine name to search input placeholder

This commit is contained in:
zombieFox 2019-04-04 15:26:52 +01:00
parent 14fbe03c6e
commit 9d49d51268
4 changed files with 21 additions and 6 deletions

View File

@ -63,11 +63,16 @@ var search = (function() {
var render = function() { var render = function() {
var search = helper.e(".search"); var search = helper.e(".search");
var searchInput = helper.e(".search-input"); var searchInput = helper.e(".search-input");
var placeholder = "";
if (state.get().bookmarks.link.show) { if (state.get().bookmarks.link.show) {
searchInput.setAttribute("placeholder", "Find or Search"); placeholder = "Find bookmarks or search";
} else { } 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); search.setAttribute("action", state.get().header.search.engine[state.get().header.search.engine.selected].url);
}; };

View File

@ -31,13 +31,16 @@ var state = (function() {
engine: { engine: {
selected: "google", selected: "google",
google: { google: {
url: "https://www.google.com/search" url: "https://www.google.com/search",
name: "Google"
}, },
duckduckgo: { duckduckgo: {
url: "https://duckduckgo.com/" url: "https://duckduckgo.com/",
name: "Duck Duck Go"
}, },
giphy: { giphy: {
url: "https://giphy.com/search/" url: "https://giphy.com/search/",
name: "Giphy"
}, },
custom: { custom: {
url: "" url: ""

View File

@ -254,6 +254,13 @@ var update = (function() {
}; };
data.version = "2.16.0"; 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 // if no update is needed
// version bump // version bump

View File

@ -1,7 +1,7 @@
var version = (function() { var version = (function() {
// version is normally bumped when the state needs changing or any new functionality is added // 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 compare = function(a, b) {
var pa = a.split("."); var pa = a.split(".");