Skip to content

Commit 1cc6e9b

Browse files
committed
[refactor] improve searching bookmarks
1 parent bd46361 commit 1cc6e9b

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

‎src/js/search.js‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,11 @@ var search = (function(){
4242
};
4343
searchedBookmarks.total=bookmarks.get().length;
4444
bookmarks.get().forEach(function(arrayItem,index){
45-
if(arrayItem.url!=null){
46-
if(arrayItem.url.replace(/^https?\:\/\//i,"").replace(/\/$/,"").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,""))){
47-
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
48-
searchedBookmarks.matching.push(bookmarkDataCopy);
49-
};
50-
}elseif(arrayItem.name!=null){
51-
if(arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,""))){
52-
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
53-
searchedBookmarks.matching.push(bookmarkDataCopy);
54-
};
45+
varmatchUrl=(arrayItem.url!=null)&&(arrayItem.url.replace(/^https?\:\/\//i,"").replace(/\/$/,"").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,"")));
46+
varmatchName=(arrayItem.name!=null)&&(arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,"")));
47+
if(matchUrl||matchName){
48+
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
49+
searchedBookmarks.matching.push(bookmarkDataCopy);
5550
};
5651
});
5752
returnsearchedBookmarks;

‎src/js/version.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
varversion=(function(){
22

3-
varcurrent="3.60.0";
3+
varcurrent="3.61.0";
44

55
varcompare=function(a,b){
66
varpa=a.split(".");

‎src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nightTab",
33
"short_name": "nightTab",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
5-
"version": "3.60.0",
5+
"version": "3.61.0",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)