Skip to content

Commit

Permalink
Simplify, and also avoid relying on class hashes (they're different i…
Browse files Browse the repository at this point in the history
…n the desktop app)
  • Loading branch information
GarboMuffin committed Aug 22, 2023
1 parent b6463e0 commit 9c7b63f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions extensions/NexusKitten/controlcontrols.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
pauseButton = undefined;
stopButton = undefined;

const rightButtons = document.getElementsByClassName('button_outlined-button_1bS__ stage-header_stage-button_hkl9B');
const rightButtons = document.querySelectorAll('[class*="stage-header_stage-button_"]');
fullScreen = rightButtons[rightButtons.length - 1];
if (!fullScreen) {
fullScreen = document.getElementsByClassName('control-button fullscreen-button')[0] || document.getElementsByClassName('standalone-fullscreen-button')[0];
fullScreen = document.querySelector('.fullscreen-button') || document.querySelector('.standalone-fullscreen-button');
}

greenFlag = document.getElementsByClassName('green-flag_green-flag_1kiAo')[0] || document.getElementsByClassName('control-button green-flag-button active')[0];
pauseButton = document.getElementsByClassName('pause-btn addons-display-none-pause')[0] || document.getElementsByClassName('control-button pause-button')[0];
stopButton = document.getElementsByClassName('stop-all_stop-all_1Y8P9')[0] || document.getElementsByClassName('control-button stop-all-button')[0];
greenFlag = document.querySelector('[class*="green-flag_green-flag_"]') || document.querySelector('.green-flag-button');
pauseButton = document.querySelector('.pause-btn') || document.querySelector('.pause-button');
stopButton = document.querySelector('[class*="stop-all_stop-all_"]') || document.querySelector('.stop-all-button');
};

class controlcontrols {
Expand Down Expand Up @@ -126,13 +126,13 @@
optionShown(args) {
getButtons();
if (args.OPTION === "green flag" && greenFlag) {
return !(greenFlag.style.display === 'none');
return greenFlag.style.display !== 'none';
} else if (args.OPTION === "pause" && pauseButton) {
return !(pauseButton.style.display === 'none');
return pauseButton.style.display !== 'none';
} else if (args.OPTION === "stop" && stopButton) {
return !(stopButton.style.display === 'none');
return stopButton.style.display !== 'none';
} else if (args.OPTION === "fullscreen" && fullScreen) {
return !(fullScreen.style.display === 'none');
return fullScreen.style.display !== 'none';
}
return false;
}
Expand Down

0 comments on commit 9c7b63f

Please sign in to comment.