export function showBackgroundLoader() {
$("#backgroundLoader").stop(true, true).fadeIn(125);
}
export function hideBackgroundLoader() {
$("#backgroundLoader").stop(true, true).fadeOut(125);
}
export function accountIconLoading(truefalse) {
if (truefalse) {
$("#top #menu .account .icon").html(
''
);
$("#top #menu .account").css("opacity", 1).css("pointer-events", "none");
} else {
$("#top #menu .account .icon").html('');
$("#top #menu .account").css("opacity", 1).css("pointer-events", "auto");
}
}
export function swapElements(
el1,
el2,
totalDuration,
callback = function () {
return;
}
) {
if (
(el1.hasClass("hidden") && !el2.hasClass("hidden")) ||
(!el1.hasClass("hidden") && el2.hasClass("hidden"))
) {
//one of them is hidden and the other is visible
if (el1.hasClass("hidden")) {
callback();
return false;
}
$(el1)
.removeClass("hidden")
.css("opacity", 1)
.animate(
{
opacity: 0,
},
totalDuration / 2,
() => {
$(el1).addClass("hidden");
$(el2)
.removeClass("hidden")
.css("opacity", 0)
.animate(
{
opacity: 1,
},
totalDuration / 2,
() => {
callback();
}
);
}
);
} else if (el1.hasClass("hidden") && el2.hasClass("hidden")) {
//both are hidden, only fade in the second
$(el2)
.removeClass("hidden")
.css("opacity", 0)
.animate(
{
opacity: 1,
},
totalDuration,
() => {
callback();
}
);
} else {
callback();
}
}