From 22acb1b6daae2a4114f14cf6fb324de63e8b2383 Mon Sep 17 00:00:00 2001 From: Will Scullin Date: Tue, 22 Oct 2013 19:35:47 -0700 Subject: [PATCH] Clean up disk storage Try and consolidate all disk loading/saving into one UI. --- apple2js.html | 74 +++++++++++----------------------------------- css/scanlines.png | Bin 0 -> 1413 bytes 2 files changed, 17 insertions(+), 57 deletions(-) create mode 100644 css/scanlines.png diff --git a/apple2js.html b/apple2js.html index b071775..51eca1f 100644 --- a/apple2js.html +++ b/apple2js.html @@ -81,7 +81,6 @@ function DriveLights() "url(css/red-off-16.png)"); }, dirty: function(drive, dirty) { - $("#disksave" + drive).button("option", "disabled", !dirty); }, label: function(drive, label) { $("#disklabel" + drive).text(label); @@ -95,27 +94,17 @@ var _loadDrive = 1; function openLoad(drive, event) { _loadDrive = drive; - if (event.metaKey) { - openLoadJSON(drive); - } else if (event.altKey) { - openLoadLocal(drive); - } else { - if (disk_cur_cat[drive]) { - $("#category_select").val(disk_cur_cat[drive]).change(); - } - $("#load").dialog("open"); + if (disk_cur_cat[drive]) { + $("#category_select").val(disk_cur_cat[drive]).change(); } + $("#load").dialog("open"); } function openSave(drive, event) { _saveDrive = drive; - if (event.metaKey) { - dumpDisk(drive); - } else { - $("#save_name").val($("#disklabel" + drive).text()); - $("#save").dialog("open"); - } + $("#save_name").val($("#disklabel" + drive).text()); + $("#save").dialog("open"); } var loading = false; @@ -134,25 +123,24 @@ function loadAjax(url) { function doLoad() { var urls = $("#disk_select").val(), url; - if (urls.length) { + if (urls && urls.length) { if (typeof(urls) == "string") { url = urls; } else { url = urls[0]; } } - - if (url) { + + var files = $("#local_file").prop("files"); + if (files.length == 1) { + doLoadLocal(); + } else if (url) { var filename; $("#load").dialog("close"); if (url.substr(0,6) == "local:") { filename = url.substr(6); if (filename == "__manage") { openManage(); - } else if (name == "__setjson") { - openLoadJSON(_loadDrive); - } else if (name == "__getjson") { - dumpDisk(_loadDrive); } else { loadLocalStorage(_loadDrive, filename); } @@ -179,18 +167,6 @@ function doDelete(name) { } } -function openLoadJSON(drive) { - _saveDrive = drive; - $("#json_input").val(""); - $("#json").dialog("open"); -} - -function doLoadJSON() { - if (disk2.setJSON(_saveDrive, $("#json_input").val())) { - $("#json").dialog("close"); - } -} - function doLoadLocal() { var files = $("#local_file").prop("files") if (files.length == 1) { @@ -200,7 +176,7 @@ function doLoadLocal() { var parts = file.name.split("."); var name = parts[0], ext = parts[parts.length - 1].toLowerCase(); if (disk2.setBinary(_saveDrive, name, ext, this.result)) { - $("#local").dialog("close"); + $("#load").dialog("close"); } } fileReader.readAsArrayBuffer(file); @@ -830,14 +806,6 @@ $(function() { modal: true, width: 320, buttons: {"Close": cancel }}); - $("#json").dialog({ autoOpen: false, - modal: true, - width: 530, - buttons: {"Cancel": cancel, "OK": doLoadJSON }}); - $("#local").dialog({ autoOpen: false, - modal: true, - width: 530, - buttons: {"Cancel": cancel, "OK": doLoadLocal }}); if (window.localStorage !== undefined) { $("button.disksave").show(); @@ -914,7 +882,7 @@ $(function() { Load @@ -926,7 +894,7 @@ $(function() { Load @@ -1022,17 +990,6 @@ $(function() {
-
-
- -
-
-
-
- -
-
@@ -1051,6 +1008,9 @@ $(function() {
+
+ +
diff --git a/css/scanlines.png b/css/scanlines.png new file mode 100644 index 0000000000000000000000000000000000000000..e860b6a0cc2ab404d19a82dafa3ccfde026c8b77 GIT binary patch literal 1413 zcmeAS@N?(olHy`uVBq!ia0y~yU@~A}U~J%E1Bz_E9MKM>BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztu&R5yIEGZ*dUInVFM}h`;SG15?XRrk5@kFg7$aF_ z{FxVM4#Qk?E*>D|;N8dwq*iDGZDL?BWd&KaVA%m6$#6wP0!TK@VqykT0l^7Ck|7JC z$#+!KXh4jnh|#P;-!kICy~dld+6)Za`Oav7%PU=y%c}!>nK$naV_@+6$tuB6pOUuM THh1nLP|4=$>gTe~DWM4fZ(Hu* literal 0 HcmV?d00001