.
This commit is contained in:
+45
-38
@@ -250,7 +250,7 @@ async function loadExamList(data) {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
$("#user").append(logout);
|
$("#user").append(logout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2561,58 +2561,65 @@ $(".start-packet-button").click(function(evt) {
|
|||||||
$.modal.close();
|
$.modal.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function delete_answer_db() {
|
||||||
|
db.delete()
|
||||||
|
.then(() => {
|
||||||
|
$.notify("Database successfully deleted", "success");
|
||||||
|
$.notify("The page will now reload", "warn");
|
||||||
|
setTimeout(() => {
|
||||||
|
location.reload();
|
||||||
|
}, 2000);
|
||||||
|
console.debug("Database successfully deleted");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
$.notify("Error deleting databases", "error");
|
||||||
|
console.error("Could not delete database");
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// Do what should be done next...
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_question_db() {
|
||||||
|
question_db
|
||||||
|
.delete()
|
||||||
|
.then(() => {
|
||||||
|
$.notify("Database successfully deleted", "success");
|
||||||
|
$.notify("The page will now reload", "warn");
|
||||||
|
setTimeout(() => {
|
||||||
|
location.reload();
|
||||||
|
}, 2000);
|
||||||
|
console.debug("Database successfully deleted");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
$.notify("Error deleting databases", "error");
|
||||||
|
console.error("Could not delete database");
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// Do what should be done next...
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$("#btn-delete-answer-databases").click(function(evt) {
|
$("#btn-delete-answer-databases").click(function(evt) {
|
||||||
var r = confirm(
|
var r = confirm(
|
||||||
"This will delete ALL saved answers (including saved correct answers)!"
|
"This will delete ALL saved answers (including saved correct answers)!"
|
||||||
);
|
);
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
db.delete()
|
delete_answer_db();
|
||||||
.then(() => {
|
|
||||||
$.notify("Database successfully deleted", "success");
|
|
||||||
$.notify("The page will now reload", "warn");
|
|
||||||
setTimeout(() => {
|
|
||||||
location.reload();
|
|
||||||
}, 2000);
|
|
||||||
console.debug("Database successfully deleted");
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
$.notify("Error deleting databases", "error");
|
|
||||||
console.error("Could not delete database");
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
// Do what should be done next...
|
|
||||||
});
|
|
||||||
} else {}
|
} else {}
|
||||||
});
|
});
|
||||||
$("#btn-delete-cached-questions").click(function(evt) {
|
$("#btn-delete-cached-questions").click(function(evt) {
|
||||||
var r = confirm("Delete cached questions?");
|
var r = confirm("Delete cached questions?");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
question_db
|
delete_question_db();
|
||||||
.delete()
|
|
||||||
.then(() => {
|
|
||||||
$.notify("Database successfully deleted", "success");
|
|
||||||
$.notify("The page will now reload", "warn");
|
|
||||||
setTimeout(() => {
|
|
||||||
location.reload();
|
|
||||||
}, 2000);
|
|
||||||
console.debug("Database successfully deleted");
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
$.notify("Error deleting databases", "error");
|
|
||||||
console.error("Could not delete database");
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
// Do what should be done next...
|
|
||||||
});
|
|
||||||
} else {}
|
} else {}
|
||||||
});
|
});
|
||||||
$("#btn-reset-local").click(function(evt) {
|
$("#btn-reset-local").click(function(evt) {
|
||||||
var r = confirm("Clear all local data");
|
var r = confirm("Clear all local data");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
(async () => {
|
delete_answer_db();
|
||||||
const dbs = await window.indexedDB.databases();
|
delete_question_db();
|
||||||
dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) });
|
|
||||||
})();
|
|
||||||
} else {}
|
} else {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user