mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
showing favourite themes at the top of the command line
This commit is contained in:
parent
b769c0cd51
commit
bbd99f51c0
3 changed files with 37 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -534,6 +534,7 @@ function toggleFavouriteTheme(themename) {
|
|||
}
|
||||
saveConfigToCookie();
|
||||
refreshThemeButtons();
|
||||
showFavouriteThemesAtTheTop();
|
||||
}
|
||||
|
||||
function showAccountSettingsSection() {
|
||||
|
|
Loading…
Reference in a new issue