Fix out-of-sync pinned drawer icons (#2944)

* Fix out-of-sync pinned drawer icons

* Ugly but consistent

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
Goshe-nite 2024-10-04 14:36:48 +01:00 committed by GitHub
parent 9820478296
commit c016319477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View File

@ -10671,7 +10671,7 @@ jQuery(async function () {
$('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggle(200, 'swing', async function () { $('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggle(200, 'swing', async function () {
await delay(50); $(this).closest('.drawer-content').removeClass('resizing'); await delay(50); $(this).closest('.drawer-content').removeClass('resizing');
}); });
$('.openIcon').toggleClass('closedIcon openIcon'); $('.openIcon').not('.drawerPinnedOpen').toggleClass('closedIcon openIcon');
$('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer'); $('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer');
icon.toggleClass('openIcon closedIcon'); icon.toggleClass('openIcon closedIcon');
drawer.toggleClass('openDrawer closedDrawer'); drawer.toggleClass('openDrawer closedDrawer');
@ -10757,7 +10757,7 @@ jQuery(async function () {
$('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggle(200, 'swing', function () { $('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggle(200, 'swing', function () {
$(this).closest('.drawer-content').removeClass('resizing'); $(this).closest('.drawer-content').removeClass('resizing');
}); });
$('.openIcon').toggleClass('closedIcon openIcon'); $('.openIcon').not('.drawerPinnedOpen').toggleClass('closedIcon openIcon');
$('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer'); $('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer');
} }

View File

@ -45,8 +45,11 @@ var LPanelPin = document.getElementById('lm_button_panel_pin');
var WIPanelPin = document.getElementById('WI_panel_pin'); var WIPanelPin = document.getElementById('WI_panel_pin');
var RightNavPanel = document.getElementById('right-nav-panel'); var RightNavPanel = document.getElementById('right-nav-panel');
var RightNavDrawerIcon = document.getElementById('rightNavDrawerIcon');
var LeftNavPanel = document.getElementById('left-nav-panel'); var LeftNavPanel = document.getElementById('left-nav-panel');
var LeftNavDrawerIcon = document.getElementById('leftNavDrawerIcon');
var WorldInfo = document.getElementById('WorldInfo'); var WorldInfo = document.getElementById('WorldInfo');
var WIDrawerIcon = document.getElementById('WIDrawerIcon');
var SelectedCharacterTab = document.getElementById('rm_button_selected_ch'); var SelectedCharacterTab = document.getElementById('rm_button_selected_ch');
@ -761,13 +764,15 @@ export function initRossMods() {
if ($(RPanelPin).prop('checked') == true) { if ($(RPanelPin).prop('checked') == true) {
//console.log('adding pin class to right nav'); //console.log('adding pin class to right nav');
$(RightNavPanel).addClass('pinnedOpen'); $(RightNavPanel).addClass('pinnedOpen');
$(RightNavDrawerIcon).addClass('drawerPinnedOpen');
} else { } else {
//console.log('removing pin class from right nav'); //console.log('removing pin class from right nav');
$(RightNavPanel).removeClass('pinnedOpen'); $(RightNavPanel).removeClass('pinnedOpen');
$(RightNavDrawerIcon).removeClass('drawerPinnedOpen');
if ($(RightNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) { if ($(RightNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) {
$(RightNavPanel).slideToggle(200, 'swing'); $(RightNavPanel).slideToggle(200, 'swing');
//$(rightNavDrawerIcon).toggleClass('openIcon closedIcon'); $(RightNavDrawerIcon).toggleClass('openIcon closedIcon');
$(RightNavPanel).toggleClass('openDrawer closedDrawer'); $(RightNavPanel).toggleClass('openDrawer closedDrawer');
} }
} }
@ -777,13 +782,15 @@ export function initRossMods() {
if ($(LPanelPin).prop('checked') == true) { if ($(LPanelPin).prop('checked') == true) {
//console.log('adding pin class to Left nav'); //console.log('adding pin class to Left nav');
$(LeftNavPanel).addClass('pinnedOpen'); $(LeftNavPanel).addClass('pinnedOpen');
$(LeftNavDrawerIcon).addClass('drawerPinnedOpen');
} else { } else {
//console.log('removing pin class from Left nav'); //console.log('removing pin class from Left nav');
$(LeftNavPanel).removeClass('pinnedOpen'); $(LeftNavPanel).removeClass('pinnedOpen');
$(LeftNavDrawerIcon).removeClass('drawerPinnedOpen');
if ($(LeftNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) { if ($(LeftNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) {
$(LeftNavPanel).slideToggle(200, 'swing'); $(LeftNavPanel).slideToggle(200, 'swing');
//$(leftNavDrawerIcon).toggleClass('openIcon closedIcon'); $(LeftNavDrawerIcon).toggleClass('openIcon closedIcon');
$(LeftNavPanel).toggleClass('openDrawer closedDrawer'); $(LeftNavPanel).toggleClass('openDrawer closedDrawer');
} }
} }
@ -794,14 +801,16 @@ export function initRossMods() {
if ($(WIPanelPin).prop('checked') == true) { if ($(WIPanelPin).prop('checked') == true) {
console.debug('adding pin class to WI'); console.debug('adding pin class to WI');
$(WorldInfo).addClass('pinnedOpen'); $(WorldInfo).addClass('pinnedOpen');
$(WIDrawerIcon).addClass('drawerPinnedOpen');
} else { } else {
console.debug('removing pin class from WI'); console.debug('removing pin class from WI');
$(WorldInfo).removeClass('pinnedOpen'); $(WorldInfo).removeClass('pinnedOpen');
$(WIDrawerIcon).removeClass('drawerPinnedOpen');
if ($(WorldInfo).hasClass('openDrawer') && $('.openDrawer').length > 1) { if ($(WorldInfo).hasClass('openDrawer') && $('.openDrawer').length > 1) {
console.debug('closing WI after lock removal'); console.debug('closing WI after lock removal');
$(WorldInfo).slideToggle(200, 'swing'); $(WorldInfo).slideToggle(200, 'swing');
//$(WorldInfoDrawerIcon).toggleClass('openIcon closedIcon'); $(WIDrawerIcon).toggleClass('openIcon closedIcon');
$(WorldInfo).toggleClass('openDrawer closedDrawer'); $(WorldInfo).toggleClass('openDrawer closedDrawer');
} }
} }
@ -812,20 +821,24 @@ export function initRossMods() {
if (LoadLocalBool('NavLockOn') == true) { if (LoadLocalBool('NavLockOn') == true) {
//console.log('setting pin class via local var'); //console.log('setting pin class via local var');
$(RightNavPanel).addClass('pinnedOpen'); $(RightNavPanel).addClass('pinnedOpen');
$(RightNavDrawerIcon).addClass('drawerPinnedOpen');
} }
if ($(RPanelPin).prop('checked')) { if ($(RPanelPin).prop('checked')) {
console.debug('setting pin class via checkbox state'); console.debug('setting pin class via checkbox state');
$(RightNavPanel).addClass('pinnedOpen'); $(RightNavPanel).addClass('pinnedOpen');
$(RightNavDrawerIcon).addClass('drawerPinnedOpen');
} }
// read the state of left Nav Lock and apply to leftnav classlist // read the state of left Nav Lock and apply to leftnav classlist
$(LPanelPin).prop('checked', LoadLocalBool('LNavLockOn')); $(LPanelPin).prop('checked', LoadLocalBool('LNavLockOn'));
if (LoadLocalBool('LNavLockOn') == true) { if (LoadLocalBool('LNavLockOn') == true) {
//console.log('setting pin class via local var'); //console.log('setting pin class via local var');
$(LeftNavPanel).addClass('pinnedOpen'); $(LeftNavPanel).addClass('pinnedOpen');
$(LeftNavDrawerIcon).addClass('drawerPinnedOpen');
} }
if ($(LPanelPin).prop('checked')) { if ($(LPanelPin).prop('checked')) {
console.debug('setting pin class via checkbox state'); console.debug('setting pin class via checkbox state');
$(LeftNavPanel).addClass('pinnedOpen'); $(LeftNavPanel).addClass('pinnedOpen');
$(LeftNavDrawerIcon).addClass('drawerPinnedOpen');
} }
// read the state of left Nav Lock and apply to leftnav classlist // read the state of left Nav Lock and apply to leftnav classlist
@ -833,11 +846,13 @@ export function initRossMods() {
if (LoadLocalBool('WINavLockOn') == true) { if (LoadLocalBool('WINavLockOn') == true) {
//console.log('setting pin class via local var'); //console.log('setting pin class via local var');
$(WorldInfo).addClass('pinnedOpen'); $(WorldInfo).addClass('pinnedOpen');
$(WIDrawerIcon).addClass('drawerPinnedOpen');
} }
if ($(WIPanelPin).prop('checked')) { if ($(WIPanelPin).prop('checked')) {
console.debug('setting pin class via checkbox state'); console.debug('setting pin class via checkbox state');
$(WorldInfo).addClass('pinnedOpen'); $(WorldInfo).addClass('pinnedOpen');
$(WIDrawerIcon).addClass('drawerPinnedOpen');
} }
//save state of Right nav being open or closed //save state of Right nav being open or closed