1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Implemented: Restore default colors (#109)

This commit is contained in:
nobody
2020-09-25 16:18:08 +02:00
parent e9fd82a416
commit 95f4e0bd1b
3 changed files with 62 additions and 0 deletions

View File

@ -139,6 +139,9 @@ options._renderOptionsPanel = function () {
document.getElementById('export-data').addEventListener('click', storageManager.export);
document.getElementById('import-data').addEventListener('click', storageManager.startImportFilePicker);
document.getElementById('import-file-picker').addEventListener('change', storageManager.handleImportFilePicker);
document.getElementById('restore-background-color').addEventListener('click', options._setDefaultColor);
document.getElementById('restore-text-color').addEventListener('click', options._setDefaultColor);
};
options._renderBlockMissingNotice = function () {
@ -382,6 +385,22 @@ options._colorPicker = function () {
});
};
options._setDefaultColor = function ({ target }) {
if (target.id === 'restore-text-color') {
options._textColor = '#FFFFFF';
wrappers.setBadgeTextColor({color: options._textColor});
document.getElementById('counter-preview-badge').style.color = options._textColor;
document.getElementById('pre-badged-text-color').style.backgroundColor = options._textColor;
document.getElementById('badged-text-color').value = options._textColor;
} else if (target.id === 'restore-background-color') {
options._backgroundColor = '#4A826C';
wrappers.setBadgeBackgroundColor({color: options._backgroundColor});
document.getElementById('counter-preview-badge').style.backgroundColor = options._backgroundColor;
document.getElementById('pre-badged-background-color').style.backgroundColor = options._backgroundColor;
document.getElementById('badged-background-color').value = options._backgroundColor;
}
};
/**
* Event Handlers