diff --git a/src/js/commandline.js b/src/js/commandline.js index de362fa5e..19925135d 100644 --- a/src/js/commandline.js +++ b/src/js/commandline.js @@ -1658,6 +1658,18 @@ Misc.getFontsList().then((fonts) => { }, }); }); + commandsFonts.list.push({ + id: "setFontFamilyCustom", + display: "custom...", + input: true, + hover: () => { + previewFontFamily(config.fontFamily); + }, + exec: (name) => { + setFontFamily(name.replace(/\s/g, "_")); + settingsGroups.fontFamily.updateButton(); + }, + }); }); let commandsFunbox = { diff --git a/src/js/script.js b/src/js/script.js index 912b8a81f..c034bae3a 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -5888,7 +5888,13 @@ if (window.location.hostname === "localhost") { } manualRestart = true; + +let configLoadDone; +let configLoadPromise = new Promise((v, x) => { + configLoadDone = v; +}); loadConfigFromCookie(); +configLoadDone(); Misc.getReleasesFromGitHub(); // getPatreonNames(); @@ -5986,6 +5992,7 @@ $(document).ready(() => { changePage(page); } }); + settingsFillPromise.then(updateSettingsPage); }); $(".scrollToTopButton").click((event) => { diff --git a/src/js/settings.js b/src/js/settings.js index 2a0d62004..eaad0dbe4 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -283,18 +283,22 @@ settingsGroups.alwaysShowCPM = new SettingsGroup( setAlwaysShowCPM ); -fillSettingsPage(); +let settingsFillPromise = fillSettingsPage(); async function fillSettingsPage() { + await configLoadPromise; refreshThemeButtons(); let langGroupsEl = $( ".pageSettings .section.languageGroups .buttons" ).empty(); + let currentLanguageGroup = await Misc.findCurrentGroup(config.language); Misc.getLanguageGroups().then((groups) => { groups.forEach((group) => { langGroupsEl.append( - `
` + ` ` ); }); }); @@ -351,11 +355,15 @@ async function fillSettingsPage() { }); }); + let isCustomFont = true; let fontsEl = $(".pageSettings .section.fontFamily .buttons").empty(); Misc.getFontsList().then((fonts) => { fonts.forEach((font) => { + if (config.fontFamily === font.name) isCustomFont = false; fontsEl.append( - `