mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-28 11:03:16 +01:00
[feature] [refactor] add Bing to the list of search engines
This commit is contained in:
parent
0a31c441a4
commit
bb8d15a470
@ -615,6 +615,10 @@
|
|||||||
<input id="control-header-search-engine-giphy" class="control-header-search-engine-giphy" type="radio" name="control-header-search-engine" value="giphy" tabindex="1">
|
<input id="control-header-search-engine-giphy" class="control-header-search-engine-giphy" type="radio" name="control-header-search-engine" value="giphy" tabindex="1">
|
||||||
<label for="control-header-search-engine-giphy">Giphy</label>
|
<label for="control-header-search-engine-giphy">Giphy</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-wrap">
|
||||||
|
<input id="control-header-search-engine-bing" class="control-header-search-engine-bing" type="radio" name="control-header-search-engine" value="bing" tabindex="1">
|
||||||
|
<label for="control-header-search-engine-bing">Bing</label>
|
||||||
|
</div>
|
||||||
<div class="input-wrap">
|
<div class="input-wrap">
|
||||||
<input id="control-header-search-engine-custom" class="control-header-search-engine-custom" type="radio" name="control-header-search-engine" value="custom" tabindex="1">
|
<input id="control-header-search-engine-custom" class="control-header-search-engine-custom" type="radio" name="control-header-search-engine" value="custom" tabindex="1">
|
||||||
<label for="control-header-search-engine-custom">Custom</label>
|
<label for="control-header-search-engine-custom">Custom</label>
|
||||||
|
@ -1294,6 +1294,14 @@ var control = (function() {
|
|||||||
dependents();
|
dependents();
|
||||||
search.render.engine();
|
search.render.engine();
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
element: helper.e(".control-header-search-engine-bing"),
|
||||||
|
path: "header.search.engine.selected",
|
||||||
|
type: "radio",
|
||||||
|
func: function() {
|
||||||
|
dependents();
|
||||||
|
search.render.engine();
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
element: helper.e(".control-header-search-engine-custom"),
|
element: helper.e(".control-header-search-engine-custom"),
|
||||||
path: "header.search.engine.selected",
|
path: "header.search.engine.selected",
|
||||||
@ -2610,6 +2618,7 @@ var control = (function() {
|
|||||||
helper.e(".control-header-search-engine-duckduckgo").disabled = false;
|
helper.e(".control-header-search-engine-duckduckgo").disabled = false;
|
||||||
helper.e(".control-header-search-engine-youtube").disabled = false;
|
helper.e(".control-header-search-engine-youtube").disabled = false;
|
||||||
helper.e(".control-header-search-engine-giphy").disabled = false;
|
helper.e(".control-header-search-engine-giphy").disabled = false;
|
||||||
|
helper.e(".control-header-search-engine-bing").disabled = false;
|
||||||
helper.e(".control-header-search-engine-custom").disabled = false;
|
helper.e(".control-header-search-engine-custom").disabled = false;
|
||||||
helper.e(".control-header-search-text-alignment-label").removeAttribute("disabled");
|
helper.e(".control-header-search-text-alignment-label").removeAttribute("disabled");
|
||||||
helper.e(".control-header-search-text-alignment-left").disabled = false;
|
helper.e(".control-header-search-text-alignment-left").disabled = false;
|
||||||
@ -2630,6 +2639,7 @@ var control = (function() {
|
|||||||
helper.e(".control-header-search-engine-duckduckgo").disabled = true;
|
helper.e(".control-header-search-engine-duckduckgo").disabled = true;
|
||||||
helper.e(".control-header-search-engine-youtube").disabled = true;
|
helper.e(".control-header-search-engine-youtube").disabled = true;
|
||||||
helper.e(".control-header-search-engine-giphy").disabled = true;
|
helper.e(".control-header-search-engine-giphy").disabled = true;
|
||||||
|
helper.e(".control-header-search-engine-bing").disabled = true;
|
||||||
helper.e(".control-header-search-engine-custom").disabled = true;
|
helper.e(".control-header-search-engine-custom").disabled = true;
|
||||||
helper.e(".control-header-search-text-alignment-label").setAttribute("disabled", "");
|
helper.e(".control-header-search-text-alignment-label").setAttribute("disabled", "");
|
||||||
helper.e(".control-header-search-text-alignment-left").disabled = true;
|
helper.e(".control-header-search-text-alignment-left").disabled = true;
|
||||||
|
@ -84,6 +84,10 @@ var state = (function() {
|
|||||||
url: "https://giphy.com/search/",
|
url: "https://giphy.com/search/",
|
||||||
name: "Giphy"
|
name: "Giphy"
|
||||||
},
|
},
|
||||||
|
bing: {
|
||||||
|
url: "https://www.bing.com/search?q=",
|
||||||
|
name: "Bing"
|
||||||
|
},
|
||||||
custom: {
|
custom: {
|
||||||
url: "",
|
url: "",
|
||||||
name: ""
|
name: ""
|
||||||
|
@ -572,8 +572,20 @@ var update = (function() {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
var _update_3270 = function(data) {
|
// This associative array contains all the updates. Add
|
||||||
data.version = "3.27.0";
|
// a new entry if you need to modify data.
|
||||||
|
//
|
||||||
|
// Example, this assumes the previous version is less than
|
||||||
|
// 3.28.0, so 3.27.0 would be upgraded in this case.
|
||||||
|
// versionUpdates["3.28.0"] = function(data) {
|
||||||
|
// return data;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// Always add the version in increasing order so the
|
||||||
|
// most recent version is last.
|
||||||
|
var versionUpdates = {};
|
||||||
|
|
||||||
|
versionUpdates["3.27.0"] = function(data) {
|
||||||
data.state.header.area.alignment = data.state.header.area.alignment.horizontal;
|
data.state.header.area.alignment = data.state.header.area.alignment.horizontal;
|
||||||
data.state.header.item.alignment = data.state.header.item.alignment.horizontal;
|
data.state.header.item.alignment = data.state.header.item.alignment.horizontal;
|
||||||
data.state.header.search.text.alignment = data.state.header.search.text.align;
|
data.state.header.search.text.alignment = data.state.header.search.text.align;
|
||||||
@ -584,10 +596,14 @@ var update = (function() {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// var _update_300 = function(data) {
|
// Add Bing as a option for the search engines.
|
||||||
// data.version = 3.00;
|
versionUpdates["3.28.0"] = function(data) {
|
||||||
// return data;
|
data.state.header.search.engine.bing = {
|
||||||
// };
|
url: "https://www.bing.com/search?q=",
|
||||||
|
name: "Bing"
|
||||||
|
};
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
function run(data) {
|
function run(data) {
|
||||||
if (!("version" in data)) {
|
if (!("version" in data)) {
|
||||||
@ -595,35 +611,35 @@ var update = (function() {
|
|||||||
data = _update_100(data);
|
data = _update_100(data);
|
||||||
};
|
};
|
||||||
if (typeof data.version == "number") {
|
if (typeof data.version == "number") {
|
||||||
if (data.version < 2.00) {
|
if (data.version < 2.0) {
|
||||||
console.log("\t= running update 2.0.0");
|
console.log("\t= running update 2.0.0");
|
||||||
data = _update_200(data);
|
data = _update_200(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.10) {
|
if (data.version < 2.1) {
|
||||||
console.log("\t= running update 2.1.0");
|
console.log("\t= running update 2.1.0");
|
||||||
data = _update_210(data);
|
data = _update_210(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.30) {
|
if (data.version < 2.3) {
|
||||||
console.log("\t= running update 2.3.0");
|
console.log("\t= running update 2.3.0");
|
||||||
data = _update_230(data);
|
data = _update_230(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.40) {
|
if (data.version < 2.4) {
|
||||||
console.log("\t= running update 2.4.0");
|
console.log("\t= running update 2.4.0");
|
||||||
data = _update_240(data);
|
data = _update_240(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.50) {
|
if (data.version < 2.5) {
|
||||||
console.log("\t= running update 2.5.0");
|
console.log("\t= running update 2.5.0");
|
||||||
data = _update_250(data);
|
data = _update_250(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.70) {
|
if (data.version < 2.7) {
|
||||||
console.log("\t= running update 2.7.0");
|
console.log("\t= running update 2.7.0");
|
||||||
data = _update_270(data);
|
data = _update_270(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.80) {
|
if (data.version < 2.8) {
|
||||||
console.log("\t= running update 2.8.0");
|
console.log("\t= running update 2.8.0");
|
||||||
data = _update_280(data);
|
data = _update_280(data);
|
||||||
};
|
};
|
||||||
if (data.version < 2.90) {
|
if (data.version < 2.9) {
|
||||||
console.log("\t= running update 2.9.0");
|
console.log("\t= running update 2.9.0");
|
||||||
data = _update_290(data);
|
data = _update_290(data);
|
||||||
};
|
};
|
||||||
@ -730,17 +746,24 @@ var update = (function() {
|
|||||||
console.log("\t= running update 3.21.0");
|
console.log("\t= running update 3.21.0");
|
||||||
data = _update_3210(data);
|
data = _update_3210(data);
|
||||||
};
|
};
|
||||||
if (version.compare(data.version, "3.27.0") == -1) {
|
// Shift to a associate array for the configuration update as
|
||||||
console.log("\t= running update 3.27.0");
|
// there less code to maintain.
|
||||||
data = _update_3270(data);
|
for (var key in versionUpdates) {
|
||||||
|
if (version.compare(data.version, key) == -1) {
|
||||||
|
console.log("\t= running update", key);
|
||||||
|
data = versionUpdates[key](data);
|
||||||
|
data.version = key;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// if no update is needed
|
// if no update is needed
|
||||||
// version bump
|
// version bump
|
||||||
if (version.compare(data.version, version.get()) == -1) {
|
if (version.compare(data.version, version.get()) == -1) {
|
||||||
console.log("\t= nothing to update, version bump to", version.get());
|
console.log("\t= nothing to update, version bump to", version.get());
|
||||||
data.version = version.get();
|
data.version = version.get();
|
||||||
};
|
};
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "3.27.0";
|
var current = "3.28.0";
|
||||||
|
|
||||||
var compare = function(a, b) {
|
var compare = function(a, b) {
|
||||||
var pa = a.split(".");
|
var pa = a.split(".");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"short_name": "nightTab",
|
"short_name": "nightTab",
|
||||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||||
"version": "3.27.0",
|
"version": "3.28.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"chrome_url_overrides": {
|
"chrome_url_overrides": {
|
||||||
"newtab": "index.html"
|
"newtab": "index.html"
|
||||||
|
Loading…
Reference in New Issue
Block a user