mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-24 17:14:28 +01:00
[refactor] improve searching bookmarks
This commit is contained in:
parent
bd46361aea
commit
1cc6e9b313
@ -42,17 +42,12 @@ var search = (function() {
|
||||
};
|
||||
searchedBookmarks.total = bookmarks.get().length;
|
||||
bookmarks.get().forEach(function(arrayItem, index) {
|
||||
if (arrayItem.url != null) {
|
||||
if (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, ""))) {
|
||||
var matchUrl = (arrayItem.url != null) && (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, "")));
|
||||
var matchName = (arrayItem.name != null) && (arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g, "")));
|
||||
if (matchUrl || matchName) {
|
||||
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;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "3.60.0";
|
||||
var current = "3.61.0";
|
||||
|
||||
var compare = function(a, b) {
|
||||
var pa = a.split(".");
|
||||
|
@ -2,7 +2,7 @@
|
||||
"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.",
|
||||
"version": "3.60.0",
|
||||
"version": "3.61.0",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user