cloak changeable in settings
This commit is contained in:
+17
@@ -359,9 +359,13 @@ if (localStorage.getItem("preferences") == null) {
|
||||
localStorage.setItem("preferences", JSON.stringify(preferencesDefaults));
|
||||
}
|
||||
const preferences = JSON.parse(localStorage.getItem("preferences"));
|
||||
const cloakCheckbox = document.getElementById('cloakCheckboxInput');
|
||||
const cloakUrl = document.getElementById('cloakUrlInput');
|
||||
const maskCheckbox = document.getElementById('maskCheckboxInput');
|
||||
const maskTitle = document.getElementById('maskTitleInput');
|
||||
const maskIcon = document.getElementById('maskIconInput');
|
||||
cloakCheckbox.checked = preferences.cloak;
|
||||
cloakUrl.value = preferences.cloakUrl;
|
||||
maskCheckbox.checked = preferences.mask;
|
||||
maskTitle.value = preferences.maskTitle;
|
||||
maskIcon.value = preferences.maskIconUrl;
|
||||
@@ -384,6 +388,11 @@ maskCheckbox.addEventListener('change', function () {
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
});
|
||||
|
||||
cloakCheckbox.addEventListener('change', function () {
|
||||
preferences.cloak = cloakCheckbox.checked;
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
});
|
||||
|
||||
|
||||
/* if it is wanted to save on input change wather than submission
|
||||
document.querySelector('.text-field').addEventListener('change', function () {
|
||||
@@ -392,14 +401,22 @@ document.querySelector('.text-field').addEventListener('change', function () {
|
||||
});
|
||||
*/
|
||||
|
||||
document.getElementById('cloakUrlSubmit').addEventListener('click', function () {
|
||||
preferences.cloakUrl = cloakUrl.value;
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
alert("Submitted! Change will take place upon refresh");
|
||||
});
|
||||
|
||||
document.getElementById('maskTitleSubmit').addEventListener('click', function () {
|
||||
preferences.maskTitle = maskTitle.value;
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
alert("Submitted! Change will take place upon refresh");
|
||||
});
|
||||
|
||||
document.getElementById('maskIconSubmit').addEventListener('click', function () {
|
||||
preferences.maskIconUrl = maskIcon.value;
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
alert("Submitted! Change will take place upon refresh");
|
||||
});
|
||||
/* if (preferences.cloak && !localStorage.getItem("cloakTabOpened")){
|
||||
if (window.top.location.href !== "about:blank"){
|
||||
|
||||
Reference in New Issue
Block a user