mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-24 17:14:28 +01:00
[bug] fix search breaking when searching links with empty url or name
This commit is contained in:
parent
d5dcaea23d
commit
4e82d797aa
13
js/search.js
13
js/search.js
@ -55,9 +55,16 @@ var search = (function() {
|
|||||||
};
|
};
|
||||||
searchedBookmarks.total = bookmarks.get().length;
|
searchedBookmarks.total = bookmarks.get().length;
|
||||||
bookmarks.get().forEach(function(arrayItem, index) {
|
bookmarks.get().forEach(function(arrayItem, index) {
|
||||||
if (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, "")) || arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, ""))) {
|
if (arrayItem.url != null) {
|
||||||
var bookmarkDataCopy = JSON.parse(JSON.stringify(arrayItem));
|
if (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, ""))) {
|
||||||
searchedBookmarks.matching.push(bookmarkDataCopy);
|
var bookmarkDataCopy = JSON.parse(JSON.stringify(arrayItem));
|
||||||
|
searchedBookmarks.matching.push(bookmarkDataCopy);
|
||||||
|
};
|
||||||
|
} else if (arrayItem.name != null) {
|
||||||
|
if (arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, ""))) {
|
||||||
|
var bookmarkDataCopy = JSON.parse(JSON.stringify(arrayItem));
|
||||||
|
searchedBookmarks.matching.push(bookmarkDataCopy);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return searchedBookmarks;
|
return searchedBookmarks;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "3.16.2";
|
var current = "3.16.3";
|
||||||
|
|
||||||
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.16.2",
|
"version": "3.16.3",
|
||||||
"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