Enhance settings UI with reset functionality and improved button layout
This commit is contained in:
@@ -3049,9 +3049,12 @@ const MediaBarEnhancedSettingsManager = {
|
||||
`;
|
||||
});
|
||||
|
||||
// Reload button
|
||||
// Buttons Container
|
||||
html += `
|
||||
<div style="margin-top:1em; text-align:right;">
|
||||
<div style="margin-top:1em; display:flex; justify-content:space-between; align-items:center;">
|
||||
<button is="emby-button" type="button" class="raised button-cancel emby-button" id="mb-settings-reset" title="Reset to Server Defaults">
|
||||
<span>Defaults</span>
|
||||
</button>
|
||||
<button is="emby-button" type="button" class="raised button-submit emby-button" id="mb-settings-save">
|
||||
<span>Reload</span>
|
||||
</button>
|
||||
@@ -3068,10 +3071,23 @@ const MediaBarEnhancedSettingsManager = {
|
||||
});
|
||||
});
|
||||
|
||||
// Reload Handler
|
||||
popup.querySelector('#mb-settings-save').addEventListener('click', () => {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// Reset Handler
|
||||
popup.querySelector('#mb-settings-reset').addEventListener('click', () => {
|
||||
if (confirm("Reset all local Media Bar settings to server defaults?")) {
|
||||
Object.keys(localStorage).forEach(key => {
|
||||
if (key.startsWith('mediaBarEnhanced-')) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
});
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
const closeHandler = (e) => {
|
||||
if (!popup.contains(e.target) && e.target !== anchorElement && !anchorElement.contains(e.target)) {
|
||||
popup.remove();
|
||||
|
||||
Reference in New Issue
Block a user