Skip to content

Commit

Permalink
fix: old button placement not being removed
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireChicken12 committed Jun 18, 2024
1 parent 10fb3c9 commit b995911
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/embedded/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,21 +725,23 @@ window.addEventListener("DOMContentLoaded", function () {
case "playbackSpeedButtons": {
for (const [buttonName, { new: newPlacement, old: oldPlacement }] of Object.entries(changes)) {
if (oldPlacement === newPlacement) continue;
await removeDecreasePlaybackSpeedButton();
await removeIncreasePlaybackSpeedButton();
const increasePlaybackSpeedButtonFuncs = getFeatureFunctions("increasePlaybackSpeedButton", oldPlacement);
const decreasePlaybackSpeedButtonFuncs = getFeatureFunctions("decreasePlaybackSpeedButton", oldPlacement);
await decreasePlaybackSpeedButtonFuncs.remove();
await increasePlaybackSpeedButtonFuncs.remove();
switch (buttonName) {
case "increasePlaybackSpeedButton":
case "decreasePlaybackSpeedButton": {
switch (newPlacement) {
case "below_player":
case "player_controls_left":
case "feature_menu": {
await addDecreasePlaybackSpeedButton().then(addIncreasePlaybackSpeedButton);
await decreasePlaybackSpeedButtonFuncs.add().then(increasePlaybackSpeedButtonFuncs.add);
break;
}
// Because of how the right controls are placed in the DOM, we need to add the buttons in reverse order
case "player_controls_right": {
await addIncreasePlaybackSpeedButton().then(addDecreasePlaybackSpeedButton);
await increasePlaybackSpeedButtonFuncs.add().then(decreasePlaybackSpeedButtonFuncs.add);
break;
}
}
Expand Down

0 comments on commit b995911

Please sign in to comment.