mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-31 20:41:46 +08:00
updating the settings page no longer simulates a click onthe theme tabs to avoid escessive theme loading and config saving
This commit is contained in:
parent
8213c18599
commit
2fbe6ce186
1 changed files with 23 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import * as Notifications from "./notifications";
|
|||
import * as CommandlineLists from "./commandline-lists";
|
||||
import * as ThemeColors from "./theme-colors";
|
||||
import * as ChartController from "./chart-controller";
|
||||
import * as UI from "./ui";
|
||||
|
||||
export function updateActiveButton() {
|
||||
$(`.pageSettings .section.themes .theme`).removeClass("active");
|
||||
|
|
@ -99,9 +100,28 @@ function toggleFavourite(themename) {
|
|||
}
|
||||
|
||||
export function updateActiveTab() {
|
||||
Config.customTheme === true
|
||||
? $(".pageSettings .section.themes .tabs .button[tab='custom']").click()
|
||||
: $(".pageSettings .section.themes .tabs .button[tab='preset']").click();
|
||||
$(".pageSettings .section.themes .tabs .button").removeClass("active");
|
||||
if (!Config.customTheme) {
|
||||
$(".pageSettings .section.themes .tabs .button[tab='preset']").addClass(
|
||||
"active"
|
||||
);
|
||||
|
||||
UI.swapElements(
|
||||
$('.pageSettings .section.themes .tabContainer [tabContent="custom"]'),
|
||||
$('.pageSettings .section.themes .tabContainer [tabContent="preset"]'),
|
||||
250
|
||||
);
|
||||
} else {
|
||||
$(".pageSettings .section.themes .tabs .button[tab='custom']").addClass(
|
||||
"active"
|
||||
);
|
||||
|
||||
UI.swapElements(
|
||||
$('.pageSettings .section.themes .tabContainer [tabContent="preset"]'),
|
||||
$('.pageSettings .section.themes .tabContainer [tabContent="custom"]'),
|
||||
250
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$("#shareCustomThemeButton").click((e) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue