Skip to content

Commit 4e82d79

Browse files
committed
[bug] fix search breaking when searching links with empty url or name
1 parent d5dcaea commit 4e82d79

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

‎js/search.js‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ var search = (function(){
5555
};
5656
searchedBookmarks.total=bookmarks.get().length;
5757
bookmarks.get().forEach(function(arrayItem,index){
58-
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,""))){
59-
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
60-
searchedBookmarks.matching.push(bookmarkDataCopy);
58+
if(arrayItem.url!=null){
59+
if(arrayItem.url.replace(/^https?\:\/\//i,"").replace(/\/$/,"").toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,""))){
60+
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
61+
searchedBookmarks.matching.push(bookmarkDataCopy);
62+
};
63+
}elseif(arrayItem.name!=null){
64+
if(arrayItem.name.toLowerCase().includes(searchInput.value.toLowerCase().replace(/\s/g,""))){
65+
varbookmarkDataCopy=JSON.parse(JSON.stringify(arrayItem));
66+
searchedBookmarks.matching.push(bookmarkDataCopy);
67+
};
6168
};
6269
});
6370
returnsearchedBookmarks;

‎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.16.2";
3+
varcurrent="3.16.3";
44

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

‎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.16.2",
5+
"version": "3.16.3",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)