This commit is contained in:
Jack 2021-05-18 20:24:03 +01:00
commit bd114c38da
2 changed files with 50 additions and 39 deletions

View file

@ -562,6 +562,46 @@ export function update() {
}
}
function toggleSettingsGroup(groupName) {
$(`.pageSettings .settingsGroup.${groupName}`)
.stop(true, true)
.slideToggle(250)
.toggleClass("slideup");
if ($(`.pageSettings .settingsGroup.${groupName}`).hasClass("slideup")) {
$(`.pageSettings .sectionGroupTitle[group=${groupName}] .fas`)
.stop(true, true)
.animate(
{
deg: -90,
},
{
duration: 250,
step: function (now) {
$(this).css({
transform: "rotate(" + now + "deg)",
});
},
}
);
} else {
$(`.pageSettings .sectionGroupTitle[group=${groupName}] .fas`)
.stop(true, true)
.animate(
{
deg: 0,
},
{
duration: 250,
step: function (now) {
$(this).css({
transform: "rotate(" + now + "deg)",
});
},
}
);
}
}
$(document).on(
"focusout",
".pageSettings .section.paceCaret input.customPaceCaretSpeed",
@ -763,44 +803,7 @@ $("#exportSettingsButton").click((e) => {
});
$(".pageSettings .sectionGroupTitle").click((e) => {
let group = $(e.currentTarget).attr("group");
$(`.pageSettings .settingsGroup.${group}`)
.stop(true, true)
.slideToggle(250)
.toggleClass("slideup");
if ($(`.pageSettings .settingsGroup.${group}`).hasClass("slideup")) {
$(`.pageSettings .sectionGroupTitle[group=${group}] .fas`)
.stop(true, true)
.animate(
{
deg: -90,
},
{
duration: 250,
step: function (now) {
$(this).css({
transform: "rotate(" + now + "deg)",
});
},
}
);
} else {
$(`.pageSettings .sectionGroupTitle[group=${group}] .fas`)
.stop(true, true)
.animate(
{
deg: 0,
},
{
duration: 250,
step: function (now) {
$(this).css({
transform: "rotate(" + now + "deg)",
});
},
}
);
}
toggleSettingsGroup($(e.currentTarget).attr("group"));
});
$(".pageSettings #resetPersonalBestsButton").on("click", (e) => {
@ -854,3 +857,11 @@ $(".pageSettings .section.customLayoutfluid .inputAndSave .input").keypress(
}
}
);
$(".quickNav .links a").on("click", (e) => {
const settingsGroup = e.target.innerText;
const isOpen = $(`.pageSettings .settingsGroup.${settingsGroup}`).hasClass(
"slideup"
);
isOpen && toggleSettingsGroup(settingsGroup);
});

View file

@ -233,7 +233,7 @@ export async function activate(funbox, mode) {
return true;
}
export function setFunbox(funbox, mode) {
if (TestLogic.active || TestUI.resultVisible) {
if (TestLogic.active) {
Notifications.add(
"You can only change the funbox before starting a test.",
0