[bug] fix some custom fonts not loading

This commit is contained in:
zombieFox 2020-04-06 09:06:44 +01:00
parent 0ea6147849
commit 33990b8aeb
5 changed files with 15 additions and 6 deletions

2
package-lock.json generated
View File

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

View File

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

@ -1644,6 +1644,7 @@ var theme = (function() {
}; };
mod.font = { mod.font = {
loaded: [],
display: { display: {
light: function() { light: function() {
helper.setObject({ helper.setObject({
@ -1752,9 +1753,11 @@ var theme = (function() {
var displayFont = arrayItem.font.display.name + ":" + arrayItem.font.display.weight; var displayFont = arrayItem.font.display.name + ":" + arrayItem.font.display.weight;
var uiFont = arrayItem.font.ui.name + ":" + arrayItem.font.ui.weight; var uiFont = arrayItem.font.ui.name + ":" + arrayItem.font.ui.weight;
if (arrayItem.font.display.name != "" && !allPresetFonts.includes(displayFont)) { if (arrayItem.font.display.name != "" && !allPresetFonts.includes(displayFont)) {
mod.font.loaded.push(arrayItem.font.display.name);
allPresetFonts.push(displayFont); allPresetFonts.push(displayFont);
}; };
if (arrayItem.font.ui.name != "" && !allPresetFonts.includes(uiFont)) { if (arrayItem.font.ui.name != "" && !allPresetFonts.includes(uiFont)) {
mod.font.loaded.push(arrayItem.font.ui.name);
allPresetFonts.push(uiFont); allPresetFonts.push(uiFont);
}; };
}); });
@ -1766,7 +1769,9 @@ var theme = (function() {
}, },
custom: { custom: {
display: function() { display: function() {
if (state.get.current().theme.font.display.name.trim().replace(/\s\s+/g, " ") != "") { var displayFont = state.get.current().theme.font.display.name.trim().replace(/\s\s+/g, " ");
if (!mod.font.loaded.includes(displayFont) && displayFont != "") {
mod.font.loaded.push(displayFont);
WebFont.load({ WebFont.load({
google: { google: {
families: [state.get.current().theme.font.display.name.trim().replace(/\s\s+/g, " ") + ":100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i"] families: [state.get.current().theme.font.display.name.trim().replace(/\s\s+/g, " ") + ":100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i"]
@ -1776,7 +1781,9 @@ var theme = (function() {
render.font.display.name(); render.font.display.name();
}, },
ui: function() { ui: function() {
if (state.get.current().theme.font.ui.name.trim().replace(/\s\s+/g, " ") != "") { var uiFont = state.get.current().theme.font.ui.name.trim().replace(/\s\s+/g, " ");
if (!mod.font.loaded.includes(uiFont) && uiFont != "") {
mod.font.loaded.push(uiFont);
WebFont.load({ WebFont.load({
google: { google: {
families: [state.get.current().theme.font.ui.name.trim().replace(/\s\s+/g, " ") + ":100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i"] families: [state.get.current().theme.font.ui.name.trim().replace(/\s\s+/g, " ") + ":100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i"]
@ -2012,6 +2019,8 @@ var theme = (function() {
render.shadow(); render.shadow();
render.shade.opacity(); render.shade.opacity();
render.themeMetaTag(); render.themeMetaTag();
render.font.load.custom.display();
render.font.load.custom.ui();
style.check(); style.check();
control.render.update.control.header(); control.render.update.control.header();
control.render.update.control.menu(); control.render.update.control.menu();

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "5.5.3"; var current = "5.5.4";
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.5.3", "version": "5.5.4",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"