mirror of
https://github.com/pkimpel/retro-b5500.git
synced 2026-02-12 03:07:30 +00:00
75 lines
2.3 KiB
HTML
75 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<title>B5500 Emulator Storage DB Deletion</title>
|
|
<meta name="Author" content="Nigel Williams & Paul Kimpel">
|
|
<!--
|
|
2014-08-30 Original version.
|
|
2016-03-25 P.Kimpel Add getDBName() routine to take stroage name from ?db=... query string.
|
|
-->
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
|
|
<script>
|
|
|
|
window.addEventListener("load", function(ev) {
|
|
var req;
|
|
var storageName = "________";
|
|
|
|
function getDBName(defaultName) {
|
|
/* Parses the URL query string for a "db=name" parameter. If "db" is
|
|
found, returns the corresponding name; if not found, returns "defaultName" */
|
|
var args;
|
|
var i;
|
|
var name;
|
|
var search = location.search.substring(1); // drop the "?"
|
|
var value = defaultName;
|
|
var x;
|
|
|
|
args = search.split("&");
|
|
for (x=args.length-1; x>=0; --x) {
|
|
i = args[x].indexOf("=");
|
|
if (i > 0 ) {
|
|
name = decodeURIComponent(args[x].substring(0, i));
|
|
if (name.toLowerCase() == "db") {
|
|
value = decodeURIComponent(args[x].substring(i+1));
|
|
break; // out of for loop
|
|
}
|
|
}
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
storageName = getDBName(storageName);
|
|
|
|
if (confirm("This will PERMANENTLY DELETE the \n\"" +
|
|
storageName + "\" Disk Storage database." +
|
|
"\n\nAre you sure you want to do this?\n")) {
|
|
if (confirm("Deletion of the storage database CANNOT BE UNDONE.\n\n" +
|
|
"Are you really sure?\n")) {
|
|
req = window.indexedDB.deleteDatabase(storageName);
|
|
|
|
req.onerror = function(ev) {
|
|
alert("CANNOT DELETE the Disk Storage database:\n" + ev.target.error);
|
|
};
|
|
|
|
req.onblocked = function(ev) {
|
|
alert("Deletion of the Disk Storage database is BLOCKED");
|
|
};
|
|
|
|
req.onsuccess = function(ev) {
|
|
alert("Disk Storage database \"" + storageName +
|
|
"\"\n successfully deleted.");
|
|
};
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<h2>Delete a Disk Storage Database!</h2>
|
|
|
|
</body>
|
|
</html> |