diff --git a/static/cryptopad.html b/static/cryptopad.html index af9faf4..fda8cf1 100644 --- a/static/cryptopad.html +++ b/static/cryptopad.html @@ -187,7 +187,9 @@ } for (var pad in pads) { - addPadList(pads[pad]); + if (pads[pad] != null) { + addPadList(pads[pad]); + } } $("#searchtext").attr("data-source", JSON.stringify(pads)); } @@ -219,18 +221,27 @@ getKVSItem(hashTitle(pads[pad]), function(data) { backup[pads[pad]] = sjcl.decrypt(key, data); backupWaiting--; - if (backupWaiting == 0) { - $("#backupDlg").modal(); - $("#backupText").val(JSON.stringify(backup)) - } + doShowBackupDlg(); }) } + function doShowBackupDlg() { + if (backupWaiting == 0) { + $("#backupDlg").modal(); + $("#backupText").val(JSON.stringify(backup)) + } + } + function doBackup() { backup = new Object(); backupWaiting = pads.length; - for (var pad in pads) { - backupKVS(pad); + for (var pad = 0; pad < pads.length; pad++) { + if ((pads[pad] == null) || (typeof pads[pad] === 'undefined')) { + backupWaiting--; + doShowBackupDlg(); + } else { + backupKVS(pad); + } } }