add tooltip, efficient-ify class toggling

This commit is contained in:
RossAscends 2024-08-10 17:53:02 +09:00
parent e77dd96bb7
commit d7d99fa94c
2 changed files with 7 additions and 21 deletions

View File

@ -5302,7 +5302,7 @@
<span class="drag-handle">&#9776;</span>
<div class="gap5px world_entry_thin_controls wide100p alignitemscenter">
<div class="inline-drawer-toggle fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
<div class="fa-solid fa-toggle-on killSwitch" name="entryKillSwitch"></div>
<div class="fa-solid fa-toggle-on killSwitch" name="entryKillSwitch" title="Toggle entry's active state."></div>
<div class="flex-container alignitemscenter wide100p">
<div class="WIEntryTitleAndStatus flex-container flex1 alignitemscenter">

View File

@ -2920,15 +2920,9 @@ async function getWorldEntry(name, data, entry) {
data.entries[uid].disable = !data.entries[uid].disable;
let isActive = !data.entries[uid].disable;
setWIOriginalDataValue(data, uid, 'enabled', isActive);
if (isActive) {
template.removeClass('disabledWIEntry');
entryKillSwitch.removeClass('fa-toggle-off');
entryKillSwitch.addClass('fa-toggle-on');
} else {
template.addClass('disabledWIEntry');
entryKillSwitch.addClass('fa-toggle-off');
entryKillSwitch.removeClass('fa-toggle-on');
}
template.toggleClass('disabledWIEntry', !isActive);
entryKillSwitch.toggleClass('fa-toggle-off', !isActive);
entryKillSwitch.toggleClass('fa-toggle-on', isActive);
await saveWorldInfo(name, data);
});
@ -2947,17 +2941,9 @@ async function getWorldEntry(name, data, entry) {
};
const isActive = !entry.disable;
if (isActive) {
console.warn(`${entry.uid} is active`);
template.removeClass('disabledWIEntry');
entryKillSwitch.removeClass('fa-toggle-off');
entryKillSwitch.addClass('fa-toggle-on');
} else {
console.warn(`${entry.uid} is not active`);
template.addClass('disabledWIEntry');
entryKillSwitch.addClass('fa-toggle-off');
entryKillSwitch.removeClass('fa-toggle-on');
}
template.toggleClass('disabledWIEntry', !isActive);
entryKillSwitch.toggleClass('fa-toggle-off', !isActive);
entryKillSwitch.toggleClass('fa-toggle-on', isActive);
template
.find(`select[name="entryStateSelector"] option[value=${entryState()}]`)