Skip to content

Commit

Permalink
fix: assume confirmation if window modal fails
Browse files Browse the repository at this point in the history
guard against embed alert issues
  • Loading branch information
seleb committed Jan 2, 2022
1 parent af972fd commit 19a2124
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/scripts/borksy.js
Expand Up @@ -365,14 +365,19 @@ function loadDefaults(checkSaveData = true) {
}

function restoreDefaults() {
if (window.confirm('Are you sure you want to erase all data and restore defaults?')) {
Array.from(document.querySelectorAll('[data-save]')).forEach(i => {
localStorage.removeItem($(i).attr('name'));
});
console.log('Cookies removed');
loadDefaults(false);
$('#mascot').removeClass('borksyHD');
let confirm;
try {
confirm = window.confirm('Are you sure you want to erase all data and restore defaults?');
} catch {
confirm = true;
}
if (!confirm) return;
Array.from(document.querySelectorAll('[data-save]')).forEach(i => {
localStorage.removeItem($(i).attr('name'));
});
console.log('Cookies removed');
loadDefaults(false);
$('#mascot').removeClass('borksyHD');
}

function onFontImageLoaded() {
Expand Down

0 comments on commit 19a2124

Please sign in to comment.