[bug] fix link name null value

This commit is contained in:
zombieFox 2020-06-11 19:12:25 +01:00
parent 6affe552a2
commit 6d581ddde7
11 changed files with 38 additions and 33 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.36.0", "version": "5.37.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.36.0", "version": "5.37.1",
"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": {

View File

@ -1,6 +1,6 @@
::selection { ::selection {
background-color: rgb(var(--theme-accent)); background-color: rgb(var(--theme-accent));
color: rgb(var(--theme-white)); color: hsl(var(--theme-accent-accessible-color));
} }
html { html {

View File

@ -112,9 +112,10 @@ var clock = (function() {
}; };
if (state.get.current().header.clock.separator.show) { if (state.get.current().header.clock.separator.show) {
var separatorCharacter; var separatorCharacter;
if (state.get.current().header.clock.separator.text.trim().replace(/\s\s+/g, " ") != "") { if (typeof state.get.current().header.clock.separator.text == "string" && state.get.current().header.clock.separator.text != "") {
separatorCharacter = state.get.current().header.clock.separator.text.trim().replace(/\s\s+/g, " "); separatorCharacter = state.get.current().header.clock.separator.text.trim().replace(/\s\s+/g, " ");
} else { };
if (separatorCharacter == "" || separatorCharacter == " " || separatorCharacter == undefined) {
separatorCharacter = ":"; separatorCharacter = ":";
}; };
var parts = clock.querySelectorAll("span"); var parts = clock.querySelectorAll("span");

View File

@ -129,10 +129,11 @@ var date = (function() {
}; };
if (state.get.current().header.date.separator.show) { if (state.get.current().header.date.separator.show) {
var separatorCharacter; var separatorCharacter;
if (state.get.current().header.date.separator.text.trim().replace(/\s\s+/g, " ") != "") { if (typeof state.get.current().header.date.separator.text == "string" && state.get.current().header.date.separator.text != "") {
separatorCharacter = state.get.current().header.date.separator.text.trim().replace(/\s\s+/g, " "); separatorCharacter = state.get.current().header.date.separator.text.trim().replace(/\s\s+/g, " ");
} else { };
separatorCharacter = "/"; if (separatorCharacter == "" || separatorCharacter == " " || separatorCharacter == undefined) {
separatorCharacter = "/";
}; };
var parts = date.querySelectorAll("span"); var parts = date.querySelectorAll("span");
if (parts.length > 1) { if (parts.length > 1) {

View File

@ -373,7 +373,7 @@ var header = (function() {
var headerSearchBody = helper.node("div|class:search-wrapper"); var headerSearchBody = helper.node("div|class:search-wrapper");
var form = helper.node("form|class:search,action,method:get"); var form = helper.node("form|class:search,action,method:get");
var searchInput; var searchInput;
if (state.get.current().header.search.engine.custom.queryName != "") { if (typeof state.get.current().header.search.engine.custom.queryName == "string" && state.get.current().header.search.engine.custom.queryName != "") {
searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:" + state.get.current().header.search.engine.custom.queryName.trim() + ",autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1"); searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:" + state.get.current().header.search.engine.custom.queryName.trim() + ",autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1");
} else { } else {
searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:q,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1"); searchInput = helper.node("input|class:search-input,type:search,placeholder:Find or Search,name:q,autocomplete:off,autocorrect:off,autocapitalize:off,spellcheck:false,tabindex:1");

View File

@ -24,8 +24,8 @@ var layout = (function() {
render.title = function() { render.title = function() {
var title = helper.e("title"); var title = helper.e("title");
if (state.get.current().layout.title.trim().replace(/\s\s+/g, " ") != "") { if (typeof state.get.current().layout.title == "string" && state.get.current().layout.title != "") {
title.textContent = state.get.current().layout.title; title.textContent = state.get.current().layout.title.trim().replace(/\s\s+/g, " ");
} else { } else {
title.textContent = "New tab"; title.textContent = "New tab";
}; };

View File

@ -18,9 +18,12 @@ var link = (function() {
}; };
stagedGroup.init = function() { stagedGroup.init = function() {
stagedGroup.group.items = []; stagedGroup.position.origin = 0;
stagedGroup.position.destination = 0;
stagedGroup.group.name.text = "";
stagedGroup.group.name.show = true; stagedGroup.group.name.show = true;
stagedGroup.group.openAll.show = true; stagedGroup.group.openAll.show = true;
stagedGroup.group.items = [];
}; };
stagedGroup.reset = function() { stagedGroup.reset = function() {
@ -66,7 +69,6 @@ var link = (function() {
}, },
name: null, name: null,
url: null, url: null,
timeStamp: null,
accent: { accent: {
by: null, by: null,
hsl: { hsl: {
@ -94,6 +96,7 @@ var link = (function() {
} }
}, },
image: null, image: null,
timeStamp: null,
searchMatch: null searchMatch: null
} }
}; };
@ -104,10 +107,17 @@ var link = (function() {
stagedLink.position.destination.group = 0; stagedLink.position.destination.group = 0;
stagedLink.position.destination.item = 0; stagedLink.position.destination.item = 0;
stagedLink.position.group.new = false; stagedLink.position.group.new = false;
stagedLink.position.group.name.show = false; stagedLink.position.group.name.show = true;
stagedLink.position.group.openAll.show = false; stagedLink.position.group.name.text = "";
stagedLink.position.group.openAll.show = true;
stagedLink.link.visual.display = "letter"; stagedLink.link.visual.display = "letter";
stagedLink.link.visual.letter = "";
stagedLink.link.visual.image = "";
stagedLink.link.visual.icon.name = "";
stagedLink.link.visual.icon.prefix = "";
stagedLink.link.visual.icon.label = "";
stagedLink.link.name = ""; stagedLink.link.name = "";
stagedLink.link.url = "";
stagedLink.link.accent.by = "theme"; stagedLink.link.accent.by = "theme";
stagedLink.link.accent.hsl.h = 0; stagedLink.link.accent.hsl.h = 0;
stagedLink.link.accent.hsl.s = 0; stagedLink.link.accent.hsl.s = 0;
@ -132,7 +142,9 @@ var link = (function() {
stagedLink.position.destination.group = null; stagedLink.position.destination.group = null;
stagedLink.position.destination.item = null; stagedLink.position.destination.item = null;
stagedLink.position.group.new = null; stagedLink.position.group.new = null;
stagedLink.position.group.name.show = null;
stagedLink.position.group.name.text = null; stagedLink.position.group.name.text = null;
stagedLink.position.group.openAll.show = null;
stagedLink.link.visual.display = null; stagedLink.link.visual.display = null;
stagedLink.link.visual.letter = null; stagedLink.link.visual.letter = null;
stagedLink.link.visual.image = null; stagedLink.link.visual.image = null;
@ -141,7 +153,6 @@ var link = (function() {
stagedLink.link.visual.icon.label = null; stagedLink.link.visual.icon.label = null;
stagedLink.link.name = null; stagedLink.link.name = null;
stagedLink.link.url = null; stagedLink.link.url = null;
stagedLink.link.timeStamp = null;
stagedLink.link.accent.by = null; stagedLink.link.accent.by = null;
stagedLink.link.accent.hsl.h = null; stagedLink.link.accent.hsl.h = null;
stagedLink.link.accent.hsl.s = null; stagedLink.link.accent.hsl.s = null;
@ -157,6 +168,7 @@ var link = (function() {
stagedLink.link.color.rgb.g = null; stagedLink.link.color.rgb.g = null;
stagedLink.link.color.rgb.b = null; stagedLink.link.color.rgb.b = null;
stagedLink.link.image = null; stagedLink.link.image = null;
stagedLink.link.timeStamp = null;
stagedLink.link.searchMatch = null; stagedLink.link.searchMatch = null;
}; };
@ -904,7 +916,7 @@ var link = (function() {
value: "link-item" value: "link-item"
}] }]
}; };
if (stagedLink.link.accent.by == "custom" || stagedLink.link.color.by == "custom" || (stagedLink.link.image != null && stagedLink.link.image != "")) { if (stagedLink.link.accent.by == "custom" || stagedLink.link.color.by == "custom" || (stagedLink.link.image != null && typeof stagedLink.link.image == "string" && stagedLink.link.image != "")) {
linkItemOptions.attr.push({ linkItemOptions.attr.push({
key: "style", key: "style",
value: "" value: ""
@ -985,9 +997,9 @@ var link = (function() {
}] }]
}); });
}; };
var nameText = stagedLink.link.name.trim(); var nameText = "";
if (nameText == null) { if (typeof stagedLink.link.name == "string" && stagedLink.link.name != "") {
nameText = ""; nameText = stagedLink.link.name.trim().replace(/\s\s+/g, " ");
}; };
var linkDisplayName = helper.node("p:" + nameText + "|class:link-display-name"); var linkDisplayName = helper.node("p:" + nameText + "|class:link-display-name");

View File

@ -967,7 +967,7 @@ var update = (function() {
}; };
return data; return data;
}, },
"5.32.0": function(data) { "5.37.1": function(data) {
data.bookmarks.forEach(function(arrayItem, index) { data.bookmarks.forEach(function(arrayItem, index) {
arrayItem.items.forEach(function(arrayItem, index) { arrayItem.items.forEach(function(arrayItem, index) {
arrayItem.accent.color.rgb = { arrayItem.accent.color.rgb = {
@ -994,9 +994,6 @@ var update = (function() {
delete arrayItem.accent.color.b; delete arrayItem.accent.color.b;
}); });
}); });
return data;
},
"5.33.0": function(data) {
data.bookmarks.forEach(function(arrayItem, index) { data.bookmarks.forEach(function(arrayItem, index) {
arrayItem.items.forEach(function(arrayItem, index) { arrayItem.items.forEach(function(arrayItem, index) {
arrayItem.visual = { arrayItem.visual = {
@ -1077,13 +1074,7 @@ var update = (function() {
s: 0, s: 0,
l: 0 l: 0
}; };
return data;
},
"5.34.0": function(data) {
data.state.header.search.engine.custom.queryName = ""; data.state.header.search.engine.custom.queryName = "";
return data;
},
"5.35.0": function(data) {
data.state.link.item.display.visual.shadow = { data.state.link.item.display.visual.shadow = {
size: 0 size: 0
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "5.36.0"; var current = "5.37.1";
var name = "Zonked Tarsier"; var name = "Zonked Tarsier";

View File

@ -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": "5.36.0", "version": "5.37.1",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"