[feature] add search input name attribute control

This commit is contained in:
zombieFox 2020-06-10 14:07:44 +01:00
parent f0bc61181e
commit 4a049008e2
10 changed files with 42 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.33.0", "version": "5.34.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.33.0", "version": "5.34.0",
"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.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -259,6 +259,13 @@ input[type="text"] {
-moz-appearance: textfield; -moz-appearance: textfield;
} }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
-webkit-appearance: none;
}
input[type="number"] { input[type="number"] {
text-align: center; text-align: center;
} }

View File

@ -102,6 +102,14 @@
<p class="control-header-search-engine-custom-helper form-helper-item">Enter a web address with the search parameters, eg: "https://vimeo.com/search?q="</p> <p class="control-header-search-engine-custom-helper form-helper-item">Enter a web address with the search parameters, eg: "https://vimeo.com/search?q="</p>
<p class="control-header-search-engine-custom-helper form-helper-item">nightTab will add the search term entered into the Search input at the end of the above URL.</p> <p class="control-header-search-engine-custom-helper form-helper-item">nightTab will add the search term entered into the Search input at the end of the above URL.</p>
</div> </div>
<div class="form-wrap">
<label for="control-header-search-engine-custom-queryname">Name attribute</label>
<input id="control-header-search-engine-custom-queryname" class="control-header-search-engine-custom-queryname" type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="q" tabindex="-1">
</div>
<div class="form-helper">
<p class="control-header-search-engine-custom-helper form-helper-item">Sets the name attribute on the Search input field.</p>
<p class="control-header-search-engine-custom-helper form-helper-item">This defines the name passed to the search engine when submitting. If not sure leave blank.</p>
</div>
</div> </div>
</div> </div>
<hr> <hr>

View File

@ -2224,6 +2224,14 @@ var control = (function() {
func: function() { func: function() {
search.render.engine(); search.render.engine();
} }
}, {
element: ".control-header-search-engine-custom-queryname",
path: "header.search.engine.custom.queryName",
type: "text",
func: function() {
console.log("hit");
search.render.engine();
}
}, { }, {
element: ".control-header-search-text-justify-left", element: ".control-header-search-text-justify-left",
path: "header.search.text.justify", path: "header.search.text.justify",
@ -11197,6 +11205,8 @@ var control = (function() {
".control-header-search-engine-custom-name", ".control-header-search-engine-custom-name",
"[for=control-header-search-engine-custom-url]", "[for=control-header-search-engine-custom-url]",
".control-header-search-engine-custom-url", ".control-header-search-engine-custom-url",
"[for=control-header-search-engine-custom-queryname]",
".control-header-search-engine-custom-queryname",
".control-header-search-engine-custom-helper" ".control-header-search-engine-custom-helper"
]; ];
} }

View File

@ -372,7 +372,12 @@ var header = (function() {
search: function() { search: function() {
var headerSearchBody = helper.node("div|class:search-wrapper"); var headerSearchBody = helper.node("div|class:search-wrapper");
var form = helper.node("form|class:search,action,method:get"); var form = helper.node("form|class:search,action,method:get");
var searchInput = helper.node("input|class:search-input,type:text,placeholder:Find or Search,name:q,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1"); var searchInput;
if (state.get.current().header.search.engine.custom.queryName != "") {
searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:" + state.get.current().header.search.engine.custom.queryName.trim() + ",autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1");
} else {
searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:q,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1");
};
var hiddenInput = helper.node("input|type:submit,value:Search,class:is-hidden"); var hiddenInput = helper.node("input|type:submit,value:Search,class:is-hidden");
var clearButton = helper.node("button|class:search-clear search-clear button button-link,tabindex:1,disabled"); var clearButton = helper.node("button|class:search-clear search-clear button button-link,tabindex:1,disabled");
var clearButtonIcon = helper.node("span|class:icon-close"); var clearButtonIcon = helper.node("span|class:icon-close");

View File

@ -113,7 +113,8 @@ var state = (function() {
}, },
custom: { custom: {
url: "", url: "",
name: "" name: "",
queryName: ""
} }
}, },
text: { text: {

View File

@ -1078,6 +1078,11 @@ var update = (function() {
l: 0 l: 0
}; };
return data; return data;
},
"5.34.0": function(data) {
console.log(data);
data.state.header.search.engine.custom.queryName = "";
return data;
} }
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "5.33.0"; var current = "5.34.0";
var name = "Zonked Tarsier"; var name = "Zonked Tarsier";

View File

@ -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": "5.33.0", "version": "5.34.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"