data transfer fixes
- transfer data only if it wasn't transferred before, preventing unexpected changes. - show popup every time a user is redirected. - don't show an error if user's settings are equal to defaults.
This commit is contained in:
parent
04484f634f
commit
5fb23dae65
1 changed files with 13 additions and 7 deletions
|
@ -302,10 +302,10 @@ function loadSettings() {
|
||||||
eid("downloadPopup").checked = true;
|
eid("downloadPopup").checked = true;
|
||||||
}
|
}
|
||||||
if (sGet("reduceTransparency") === "true" || isOldFirefox) {
|
if (sGet("reduceTransparency") === "true" || isOldFirefox) {
|
||||||
eid("cobalt-body").classList.toggle('no-transparency');
|
eid("cobalt-body").classList.add('no-transparency');
|
||||||
}
|
}
|
||||||
if (sGet("disableAnimations") === "true") {
|
if (sGet("disableAnimations") === "true") {
|
||||||
eid("cobalt-body").classList.toggle('no-animation');
|
eid("cobalt-body").classList.add('no-animation');
|
||||||
}
|
}
|
||||||
for (let i = 0; i < checkboxes.length; i++) {
|
for (let i = 0; i < checkboxes.length; i++) {
|
||||||
if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true;
|
if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true;
|
||||||
|
@ -493,7 +493,7 @@ function restoreUpdateHistory() {
|
||||||
eid("changelog-history").innerHTML = store.historyButton;
|
eid("changelog-history").innerHTML = store.historyButton;
|
||||||
}
|
}
|
||||||
function unpackSettings(b64) {
|
function unpackSettings(b64) {
|
||||||
let changed = false;
|
let changed = null;
|
||||||
try {
|
try {
|
||||||
let settingsToImport = JSON.parse(atob(b64));
|
let settingsToImport = JSON.parse(atob(b64));
|
||||||
let currentSettings = JSON.parse(JSON.stringify(localStorage));
|
let currentSettings = JSON.parse(JSON.stringify(localStorage));
|
||||||
|
@ -535,15 +535,21 @@ window.onload = () => {
|
||||||
eid("url-input-area").value = pageQuery.get("u");
|
eid("url-input-area").value = pageQuery.get("u");
|
||||||
button()
|
button()
|
||||||
}
|
}
|
||||||
if (pageQuery.has("migration") && !sGet("migrated")) {
|
if (pageQuery.has("migration")) {
|
||||||
if (pageQuery.has("settingsData")) {
|
if (pageQuery.has("settingsData") && !sGet("migrated")) {
|
||||||
let setUn = unpackSettings(pageQuery.get("settingsData"));
|
let setUn = unpackSettings(pageQuery.get("settingsData"));
|
||||||
eid("desc-migration").innerHTML += setUn ? `<br/><br/>${loc.DataTransferSuccess}` : `<br/><br/>${loc.DataTransferError}`
|
if (setUn !== null) {
|
||||||
|
if (setUn) {
|
||||||
|
sSet("migrated", "true")
|
||||||
|
eid("desc-migration").innerHTML += `<br/><br/>${loc.DataTransferSuccess}`
|
||||||
|
} else {
|
||||||
|
eid("desc-migration").innerHTML += `<br/><br/>${loc.DataTransferError}`
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loadSettings();
|
loadSettings();
|
||||||
detectColorScheme();
|
detectColorScheme();
|
||||||
popup("migration", 1);
|
popup("migration", 1);
|
||||||
sSet("migrated", "true")
|
|
||||||
}
|
}
|
||||||
window.history.replaceState(null, '', window.location.pathname);
|
window.history.replaceState(null, '', window.location.pathname);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue