From cd7f62fd7d55ca98671aed8a5b60537ca6b070c8 Mon Sep 17 00:00:00 2001 From: Eric Fredricksen Date: Fri, 9 Jul 2010 15:07:05 -0700 Subject: [PATCH] Warn when ipad save fails --- config.js | 14 ++++++++++++-- main.js | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 44ebba7..0549cc6 100644 --- a/config.js +++ b/config.js @@ -193,8 +193,18 @@ function loadSheet(name) { } function storeRoster(roster) { - if (storage) - storage.setItem("roster", JSON.stringify(roster)); + if (storage) { + try { + storage.setItem("roster", JSON.stringify(roster)); + return true; + } catch (err) { + if (err.toString().indexOf("QUOTA_EXCEEDED_ERR") != -1) { + alert("The limited storage available on this device has been filled. This game can lo longer be saved.") + storage = null;; + return false; + } + } + } } function addToRoster(newguy) { diff --git a/main.js b/main.js index 5b99585..4aa92b9 100644 --- a/main.js +++ b/main.js @@ -5,6 +5,7 @@ // TODO: Hide cheaters // After launch +// TODO: Stop using HTML to save the game // TODO: Get fully operational in Opera // TODO: Online leader board // TODO: Server side saves