mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-06-27 04:51:25 +02:00
[bug] fix link edit when searching not working as expected
This commit is contained in:
parent
c26956812e
commit
bf617c2393
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nighttab",
|
"name": "nighttab",
|
||||||
"version": "4.19.1",
|
"version": "4.19.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nighttab",
|
"name": "nighttab",
|
||||||
"version": "4.19.1",
|
"version": "4.19.2",
|
||||||
"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": {
|
||||||
|
@ -55,6 +55,14 @@ input[type="submit"]:active {
|
|||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.disabled,
|
||||||
|
button.disabled:hover,
|
||||||
|
button.disabled:focus,
|
||||||
|
button.disabled:active,
|
||||||
|
.button.disabled,
|
||||||
|
.button.disabled:hover,
|
||||||
|
.button.disabled:focus,
|
||||||
|
.button.disabled:active,
|
||||||
button:disabled,
|
button:disabled,
|
||||||
button:disabled:hover,
|
button:disabled:hover,
|
||||||
button:disabled:focus,
|
button:disabled:focus,
|
||||||
@ -109,6 +117,14 @@ input[type="submit"]:active:after {
|
|||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.disabled:after,
|
||||||
|
.button.disabled:after,
|
||||||
|
button.disabled:hover:after,
|
||||||
|
.button.disabled:hover:after,
|
||||||
|
button.disabled:focus:after,
|
||||||
|
.button.disabled:focus:after,
|
||||||
|
button.disabled:active:after,
|
||||||
|
.button.disabled:active:after,
|
||||||
button:disabled:after,
|
button:disabled:after,
|
||||||
.button:disabled:after,
|
.button:disabled:after,
|
||||||
button:disabled:hover:after,
|
button:disabled:hover:after,
|
||||||
@ -196,12 +212,15 @@ button [class*=" button-"]:last-child,
|
|||||||
color: rgb(var(--button-link-text-active));
|
color: rgb(var(--button-link-text-active));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-link.disabled,
|
||||||
.button-link:disabled {
|
.button-link:disabled {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: transparent;
|
color: transparent;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-link.disabled:hover,
|
||||||
|
.button-link.disabled:focus,
|
||||||
.button-link:hover:disabled,
|
.button-link:hover:disabled,
|
||||||
.button-link:focus:disabled {
|
.button-link:focus:disabled {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@ -763,7 +763,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: rgb(var(--theme-color-02));
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,6 +770,11 @@
|
|||||||
content: none;
|
content: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-control-item.disabled,
|
||||||
|
.link-control-item:disabled {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.is-link-style-list .link-control-item {
|
.is-link-style-list .link-control-item {
|
||||||
flex-basis: inherit;
|
flex-basis: inherit;
|
||||||
}
|
}
|
||||||
@ -787,6 +791,16 @@
|
|||||||
color: rgb(var(--theme-white));
|
color: rgb(var(--theme-white));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-text-dark .link-control-item.disabled,
|
||||||
|
.link-text-dark .link-control-item:disabled {
|
||||||
|
color: rgba(var(--theme-black), 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-text-light .link-control-item.disabled,
|
||||||
|
.link-text-light .link-control-item:disabled {
|
||||||
|
color: rgba(var(--theme-white), 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
.is-link-orientation-top.is-link-style-list .link-control-item:nth-child(1) {
|
.is-link-orientation-top.is-link-style-list .link-control-item:nth-child(1) {
|
||||||
border-top-left-radius: var(--theme-radius);
|
border-top-left-radius: var(--theme-radius);
|
||||||
}
|
}
|
||||||
@ -831,6 +845,22 @@
|
|||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-text-dark .link-control-item.disabled:focus,
|
||||||
|
.link-text-dark .link-control-item.disabled:hover,
|
||||||
|
.link-text-dark .link-control-item:disabled:focus,
|
||||||
|
.link-text-dark .link-control-item:disabled:hover {
|
||||||
|
color: rgba(var(--theme-black), 0.25);
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-text-light .link-control-item.disabled:focus,
|
||||||
|
.link-text-light .link-control-item.disabled:hover,
|
||||||
|
.link-text-light .link-control-item:disabled:focus,
|
||||||
|
.link-text-light .link-control-item:disabled:hover {
|
||||||
|
color: rgba(var(--theme-white), 0.25);
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.link-text-dark .link-control-item:active {
|
.link-text-dark .link-control-item:active {
|
||||||
color: rgb(var(--theme-black));
|
color: rgb(var(--theme-black));
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
@ -22,6 +22,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453104010
|
timeStamp: 1546453104010
|
||||||
}, {
|
}, {
|
||||||
display: "letter",
|
display: "letter",
|
||||||
@ -41,6 +42,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453107633
|
timeStamp: 1546453107633
|
||||||
}, {
|
}, {
|
||||||
display: "letter",
|
display: "letter",
|
||||||
@ -60,6 +62,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453110265
|
timeStamp: 1546453110265
|
||||||
}, {
|
}, {
|
||||||
display: "icon",
|
display: "icon",
|
||||||
@ -79,6 +82,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453111491
|
timeStamp: 1546453111491
|
||||||
}, {
|
}, {
|
||||||
display: "icon",
|
display: "icon",
|
||||||
@ -98,6 +102,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453104460
|
timeStamp: 1546453104460
|
||||||
}, {
|
}, {
|
||||||
display: "letter",
|
display: "letter",
|
||||||
@ -117,6 +122,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453111953
|
timeStamp: 1546453111953
|
||||||
}]
|
}]
|
||||||
}, {
|
}, {
|
||||||
@ -139,6 +145,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453101749
|
timeStamp: 1546453101749
|
||||||
}, {
|
}, {
|
||||||
display: "icon",
|
display: "icon",
|
||||||
@ -158,6 +165,7 @@ var bookmarks = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchMatch: false,
|
||||||
timeStamp: 1546453108926
|
timeStamp: 1546453108926
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
|
107
src/js/link.js
107
src/js/link.js
@ -56,7 +56,8 @@ var link = (function() {
|
|||||||
b: null
|
b: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
searchMatch: null
|
||||||
};
|
};
|
||||||
|
|
||||||
stagedLink.init = function() {
|
stagedLink.init = function() {
|
||||||
@ -67,6 +68,7 @@ var link = (function() {
|
|||||||
stagedLink.position.group.new = false;
|
stagedLink.position.group.new = false;
|
||||||
stagedLink.link.display = "letter";
|
stagedLink.link.display = "letter";
|
||||||
stagedLink.link.accent.override = false;
|
stagedLink.link.accent.override = false;
|
||||||
|
stagedLink.link.searchMatch = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
stagedLink.reset = function() {
|
stagedLink.reset = function() {
|
||||||
@ -88,6 +90,7 @@ var link = (function() {
|
|||||||
stagedLink.link.accent.color.r = null;
|
stagedLink.link.accent.color.r = null;
|
||||||
stagedLink.link.accent.color.g = null;
|
stagedLink.link.accent.color.g = null;
|
||||||
stagedLink.link.accent.color.b = null;
|
stagedLink.link.accent.color.b = null;
|
||||||
|
stagedLink.link.searchMatch = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var mod = {};
|
var mod = {};
|
||||||
@ -292,7 +295,9 @@ var link = (function() {
|
|||||||
bookmarks.mod.move.group(stagedGroup);
|
bookmarks.mod.move.group(stagedGroup);
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.group.previous.up(copyStagedGroup);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.group.previous.up(copyStagedGroup);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
down: function(copyStagedGroup) {
|
down: function(copyStagedGroup) {
|
||||||
stagedGroup.group = JSON.parse(JSON.stringify(copyStagedGroup.group));
|
stagedGroup.group = JSON.parse(JSON.stringify(copyStagedGroup.group));
|
||||||
@ -301,7 +306,9 @@ var link = (function() {
|
|||||||
bookmarks.mod.move.group(stagedGroup);
|
bookmarks.mod.move.group(stagedGroup);
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.group.next.down(copyStagedGroup);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.group.next.down(copyStagedGroup);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
@ -315,7 +322,9 @@ var link = (function() {
|
|||||||
bookmarks.mod.move.link(JSON.parse(JSON.stringify(stagedLink)));
|
bookmarks.mod.move.link(JSON.parse(JSON.stringify(stagedLink)));
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.item.previous.left(copyStagedLink);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.item.previous.left(copyStagedLink);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
right: function(copyStagedLink) {
|
right: function(copyStagedLink) {
|
||||||
stagedLink.link = JSON.parse(JSON.stringify(copyStagedLink.link));
|
stagedLink.link = JSON.parse(JSON.stringify(copyStagedLink.link));
|
||||||
@ -324,7 +333,9 @@ var link = (function() {
|
|||||||
bookmarks.mod.move.link(JSON.parse(JSON.stringify(stagedLink)));
|
bookmarks.mod.move.link(JSON.parse(JSON.stringify(stagedLink)));
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.item.next.right(copyStagedLink);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.item.next.right(copyStagedLink);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -402,6 +413,12 @@ var link = (function() {
|
|||||||
itemGroupControlItemRemove.appendChild(itemGroupControlItemRemoveIcon);
|
itemGroupControlItemRemove.appendChild(itemGroupControlItemRemoveIcon);
|
||||||
groupControl.appendChild(itemGroupControlItemRemove);
|
groupControl.appendChild(itemGroupControlItemRemove);
|
||||||
|
|
||||||
|
if (state.get.current().search) {
|
||||||
|
itemGroupControlItemUp.disabled = true;
|
||||||
|
helper.addClass(itemGroupControlItemHandle, "disabled");
|
||||||
|
itemGroupControlItemDown.disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
var copyStagedGroup = JSON.parse(JSON.stringify(stagedGroup));
|
var copyStagedGroup = JSON.parse(JSON.stringify(stagedGroup));
|
||||||
|
|
||||||
itemGroupControlItemUp.addEventListener("click", function(event) {
|
itemGroupControlItemUp.addEventListener("click", function(event) {
|
||||||
@ -654,6 +671,12 @@ var link = (function() {
|
|||||||
linkItem.appendChild(linkPanelFront);
|
linkItem.appendChild(linkPanelFront);
|
||||||
linkItem.appendChild(linkPanelBack);
|
linkItem.appendChild(linkPanelBack);
|
||||||
|
|
||||||
|
if (state.get.current().search) {
|
||||||
|
linkLeft.disabled = true;
|
||||||
|
helper.addClass(linkHandle, "disabled");
|
||||||
|
linkRight.disabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
||||||
|
|
||||||
linkLeft.addEventListener("click", function() {
|
linkLeft.addEventListener("click", function() {
|
||||||
@ -1135,15 +1158,9 @@ var link = (function() {
|
|||||||
|
|
||||||
render.all = function() {
|
render.all = function() {
|
||||||
var linkSection = helper.e(".link");
|
var linkSection = helper.e(".link");
|
||||||
var bookmarksToRender = false;
|
|
||||||
if (state.get.current().search) {
|
|
||||||
bookmarksToRender = search.get();
|
|
||||||
} else {
|
|
||||||
bookmarksToRender = bookmarks.get();
|
|
||||||
};
|
|
||||||
var make = {
|
var make = {
|
||||||
bookmarks: function(data) {
|
bookmarks: function() {
|
||||||
data.forEach(function(arrayItem, index) {
|
bookmarks.get().forEach(function(arrayItem, index) {
|
||||||
stagedGroup.position.origin = index;
|
stagedGroup.position.origin = index;
|
||||||
stagedGroup.position.destination = index;
|
stagedGroup.position.destination = index;
|
||||||
stagedGroup.position.origin = index;
|
stagedGroup.position.origin = index;
|
||||||
@ -1158,12 +1175,24 @@ var link = (function() {
|
|||||||
stagedLink.position.destination.item = index;
|
stagedLink.position.destination.item = index;
|
||||||
stagedLink.position.group.new = null;
|
stagedLink.position.group.new = null;
|
||||||
stagedLink.position.group.name = null;
|
stagedLink.position.group.name = null;
|
||||||
group.querySelector(".group-body").appendChild(render.item.link());
|
if (state.get.current().search) {
|
||||||
|
if (stagedLink.link.searchMatch) {
|
||||||
|
group.querySelector(".group-body").appendChild(render.item.link());
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
group.querySelector(".group-body").appendChild(render.item.link());
|
||||||
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
group.querySelector(".group-body").appendChild(render.empty.item(stagedGroup.position.destination));
|
group.querySelector(".group-body").appendChild(render.empty.item(stagedGroup.position.destination));
|
||||||
};
|
};
|
||||||
linkSection.appendChild(group);
|
if (state.get.current().search) {
|
||||||
|
if (search.mod.searching.count.group(index) > 0) {
|
||||||
|
linkSection.appendChild(group);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
linkSection.appendChild(group);
|
||||||
|
};
|
||||||
stagedGroup.reset();
|
stagedGroup.reset();
|
||||||
stagedLink.reset();
|
stagedLink.reset();
|
||||||
});
|
});
|
||||||
@ -1177,21 +1206,23 @@ var link = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// if searching
|
// if bookmarks exist
|
||||||
if (state.get.current().search) {
|
if (bookmarks.get().length > 0) {
|
||||||
// if bookmarks exist to be searched
|
// if searching
|
||||||
if (bookmarksToRender.total > 0) {
|
if (state.get.current().search) {
|
||||||
make.bookmarks(bookmarksToRender.matching);
|
search.mod.searching.get();
|
||||||
|
// if matching results found
|
||||||
|
if (search.mod.searching.count.all() > 0) {
|
||||||
|
make.bookmarks();
|
||||||
|
} else {
|
||||||
|
make.empty.search();
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
make.empty.search();
|
search.mod.searching.clear();
|
||||||
|
make.bookmarks();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// if bookmarks exist
|
make.empty.bookmarks();
|
||||||
if (bookmarksToRender.length > 0) {
|
|
||||||
make.bookmarks(bookmarksToRender);
|
|
||||||
} else {
|
|
||||||
make.empty.bookmarks();
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1504,7 +1535,9 @@ var link = (function() {
|
|||||||
edit.item.close();
|
edit.item.close();
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.item.current.edit(copyStagedLink);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.item.current.edit(copyStagedLink);
|
||||||
|
};
|
||||||
autoSuggest.close();
|
autoSuggest.close();
|
||||||
shade.close();
|
shade.close();
|
||||||
pagelock.unlock();
|
pagelock.unlock();
|
||||||
@ -1549,7 +1582,9 @@ var link = (function() {
|
|||||||
edit.group.close();
|
edit.group.close();
|
||||||
data.save();
|
data.save();
|
||||||
groupAndItems();
|
groupAndItems();
|
||||||
render.focus.group.current.edit(copyStagedGroup);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.group.current.edit(copyStagedGroup);
|
||||||
|
};
|
||||||
autoSuggest.close();
|
autoSuggest.close();
|
||||||
shade.close();
|
shade.close();
|
||||||
pagelock.unlock();
|
pagelock.unlock();
|
||||||
@ -1600,7 +1635,9 @@ var link = (function() {
|
|||||||
groupAndItems();
|
groupAndItems();
|
||||||
control.render.dependents();
|
control.render.dependents();
|
||||||
control.render.class();
|
control.render.class();
|
||||||
render.focus.item.previous.remove(copyStagedLink);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.item.previous.remove(copyStagedLink);
|
||||||
|
};
|
||||||
shade.close();
|
shade.close();
|
||||||
pagelock.unlock();
|
pagelock.unlock();
|
||||||
};
|
};
|
||||||
@ -1644,7 +1681,9 @@ var link = (function() {
|
|||||||
groupAndItems();
|
groupAndItems();
|
||||||
control.render.dependents();
|
control.render.dependents();
|
||||||
control.render.class();
|
control.render.class();
|
||||||
render.focus.group.previous.remove(copyStagedGroup);
|
if (!state.get.current().search) {
|
||||||
|
render.focus.group.previous.remove(copyStagedGroup);
|
||||||
|
};
|
||||||
shade.close();
|
shade.close();
|
||||||
pagelock.unlock();
|
pagelock.unlock();
|
||||||
};
|
};
|
||||||
@ -1767,8 +1806,10 @@ var link = (function() {
|
|||||||
render.all();
|
render.all();
|
||||||
render.group.tabindex();
|
render.group.tabindex();
|
||||||
render.item.tabindex();
|
render.item.tabindex();
|
||||||
bind.sort.group();
|
if (!state.get.current().search) {
|
||||||
bind.sort.item();
|
bind.sort.group();
|
||||||
|
bind.sort.item();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var init = function() {
|
var init = function() {
|
||||||
|
@ -36,40 +36,54 @@ var search = (function() {
|
|||||||
path: "search",
|
path: "search",
|
||||||
newValue: false
|
newValue: false
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
get: function() {
|
||||||
|
var searchInput = helper.e(".search-input");
|
||||||
var get = function() {
|
var string = searchInput.value.toLowerCase().replace(/\s/g, "");
|
||||||
var searchInput = helper.e(".search-input");
|
if (state.get.current().search) {
|
||||||
var string = searchInput.value.toLowerCase().replace(/\s/g, "");
|
bookmarks.get().forEach(function(arrayItem, index) {
|
||||||
if (state.get.current().search) {
|
arrayItem.items.forEach(function(arrayItem, index) {
|
||||||
var searchedBookmarks = {
|
var matchUrl = (arrayItem.url != null) && (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(string));
|
||||||
total: 0,
|
var matchName = (arrayItem.name != null) && (arrayItem.name.toLowerCase().replace(/\s/g, "").includes(string));
|
||||||
matching: []
|
arrayItem.searchMatch = false;
|
||||||
|
if (matchUrl || matchName) {
|
||||||
|
arrayItem.searchMatch = true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
searchedBookmarks.total = bookmarks.get().length;
|
},
|
||||||
|
clear: function() {
|
||||||
bookmarks.get().forEach(function(arrayItem, index) {
|
bookmarks.get().forEach(function(arrayItem, index) {
|
||||||
var currentGroup = JSON.parse(JSON.stringify(arrayItem));
|
arrayItem.items.forEach(function(arrayItem, index) {
|
||||||
var matchingItems = [];
|
arrayItem.searchMatch = false;
|
||||||
currentGroup.items.forEach(function(arrayItem, index) {
|
|
||||||
var matchUrl = (arrayItem.url != null) && (arrayItem.url.replace(/^https?\:\/\//i, "").replace(/\/$/, "").toLowerCase().includes(string));
|
|
||||||
var matchName = (arrayItem.name != null) && (arrayItem.name.toLowerCase().replace(/\s/g, "").includes(string));
|
|
||||||
if (matchUrl || matchName) {
|
|
||||||
matchingItems.push(JSON.parse(JSON.stringify(arrayItem)));
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
if (matchingItems.length > 0) {
|
|
||||||
currentGroup.items = matchingItems;
|
|
||||||
searchedBookmarks.matching.push(currentGroup);
|
|
||||||
};
|
|
||||||
var count = 0;
|
|
||||||
searchedBookmarks.matching.forEach(function(arrayItem, index) {
|
|
||||||
count = count + arrayItem.items.length
|
|
||||||
});
|
|
||||||
searchedBookmarks.total = count;
|
|
||||||
});
|
});
|
||||||
return searchedBookmarks;
|
},
|
||||||
};
|
count: {
|
||||||
|
all: function() {
|
||||||
|
var searchResultCount = 0;
|
||||||
|
bookmarks.get().forEach(function(arrayItem, index) {
|
||||||
|
arrayItem.items.forEach(function(arrayItem, index) {
|
||||||
|
if (arrayItem.searchMatch) {
|
||||||
|
searchResultCount = searchResultCount + 1;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return searchResultCount;
|
||||||
|
},
|
||||||
|
group: function(index) {
|
||||||
|
var searchResultCount = 0;
|
||||||
|
if (bookmarks.get()[index]) {
|
||||||
|
bookmarks.get()[index].items.forEach(function(arrayItem, index) {
|
||||||
|
if (arrayItem.searchMatch) {
|
||||||
|
searchResultCount = searchResultCount + 1;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return searchResultCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var render = {};
|
var render = {};
|
||||||
@ -142,6 +156,7 @@ var search = (function() {
|
|||||||
bind.input();
|
bind.input();
|
||||||
bind.clear();
|
bind.clear();
|
||||||
mod.searching.close();
|
mod.searching.close();
|
||||||
|
mod.searching.clear();
|
||||||
render.engine();
|
render.engine();
|
||||||
render.focus();
|
render.focus();
|
||||||
render.searching();
|
render.searching();
|
||||||
@ -150,7 +165,7 @@ var search = (function() {
|
|||||||
// exposed methods
|
// exposed methods
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
get: get,
|
mod: mod,
|
||||||
render: render,
|
render: render,
|
||||||
check: check
|
check: check
|
||||||
};
|
};
|
||||||
|
@ -365,8 +365,8 @@ var update = (function() {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
"2.22.0": function(data) {
|
"2.22.0": function(data) {
|
||||||
data.bookmarks.forEach(function(item, index) {
|
data.bookmarks.forEach(function(arrayItem, index) {
|
||||||
item.accent = {
|
arrayItem.accent = {
|
||||||
override: false,
|
override: false,
|
||||||
color: {
|
color: {
|
||||||
r: null,
|
r: null,
|
||||||
@ -378,9 +378,9 @@ var update = (function() {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
"3.0.0": function(data) {
|
"3.0.0": function(data) {
|
||||||
data.bookmarks.forEach(function(item, index) {
|
data.bookmarks.forEach(function(arrayItem, index) {
|
||||||
item.display = "letter";
|
arrayItem.display = "letter";
|
||||||
item.icon = {
|
arrayItem.icon = {
|
||||||
name: null,
|
name: null,
|
||||||
prefix: null,
|
prefix: null,
|
||||||
label: null
|
label: null
|
||||||
@ -775,6 +775,14 @@ var update = (function() {
|
|||||||
data.state.theme.accent.rgb = data.state.theme.accent.current;
|
data.state.theme.accent.rgb = data.state.theme.accent.current;
|
||||||
delete data.state.theme.accent.current;
|
delete data.state.theme.accent.current;
|
||||||
return data;
|
return data;
|
||||||
|
},
|
||||||
|
"4.19.2": function(data) {
|
||||||
|
data.bookmarks.forEach(function(arrayItem, index) {
|
||||||
|
arrayItem.items.forEach(function(arrayItem, index) {
|
||||||
|
arrayItem.searchMatch = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "4.19.1";
|
var current = "4.19.2";
|
||||||
|
|
||||||
var name = "Naughty Goose";
|
var name = "Naughty Goose";
|
||||||
|
|
||||||
|
@ -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": "4.19.1",
|
"version": "4.19.2",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"chrome_url_overrides": {
|
"chrome_url_overrides": {
|
||||||
"newtab": "index.html"
|
"newtab": "index.html"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user