showing favourite themes at the top of the command line

This commit is contained in:
Jack 2020-10-30 19:38:57 +00:00
parent b769c0cd51
commit bbd99f51c0
3 changed files with 37 additions and 0 deletions

View file

@ -265,6 +265,9 @@ firebase.auth().onAuthStateChanged(function (user) {
// showNotification('Signed in', 1000);
$(".pageLogin .preloader").addClass("hidden");
$("#menu .icon-button.account .text").text(displayName);
showFavouriteThemesAtTheTop();
if (verifyUserWhenLoggedIn !== null) {
showNotification("Verifying", 1000);
verifyUserWhenLoggedIn.uid = user.uid;

View file

@ -1456,6 +1456,39 @@ getThemesList().then((themes) => {
});
});
function showFavouriteThemesAtTheTop() {
if (config.favThemes.length > 0) {
commandsThemes.list = [];
config.favThemes.forEach((theme) => {
commandsThemes.list.push({
id: "changeTheme" + capitalizeFirstLetter(theme),
display: theme.replace(/_/g, " "),
hover: () => {
previewTheme(theme);
},
exec: () => {
setTheme(theme);
},
});
});
getThemesList().then((themes) => {
themes.forEach((theme) => {
if (config.favThemes.includes(theme.name)) return;
commandsThemes.list.push({
id: "changeTheme" + capitalizeFirstLetter(theme.name),
display: theme.name.replace(/_/g, " "),
hover: () => {
previewTheme(theme.name);
},
exec: () => {
setTheme(theme.name);
},
});
});
});
}
}
let commandsFonts = {
title: "Change font...",
list: [],

View file

@ -534,6 +534,7 @@ function toggleFavouriteTheme(themename) {
}
saveConfigToCookie();
refreshThemeButtons();
showFavouriteThemesAtTheTop();
}
function showAccountSettingsSection() {