Skip to content

Commit

Permalink
Add alert dialog for (lockdown) options retrieval error
Browse files Browse the repository at this point in the history
  • Loading branch information
proginosko committed Dec 10, 2017
1 parent 83bc2f9 commit 03484d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions lockdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
</div>

<div id="alerts" style="display: none;">
<div id="alertRetrieveError" title="LeechBlock Lockdown">
<p><strong>Error:</strong> Unable to retrieve options from browser storage.</p>
</div>
<div id="alertNoDuration" title="LeechBlock Lockdown">
<p>Please enter a non-zero duration for the lockdown.</p>
</div>
Expand Down
20 changes: 10 additions & 10 deletions lockdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function initializeForm() {

function onError(error) {
warn("Cannot get options: " + error);
$("#alertRetrieveError").dialog("open");
}
}

Expand Down Expand Up @@ -122,16 +123,15 @@ $("#activate").click(onActivate);
$("#cancel").button();
$("#cancel").click(onCancel);

let alerts = ["alertNoDuration", "alertNoSets"];
for (let alert of alerts) {
$(`#${alert}`).dialog({
autoOpen: false,
modal: true,
buttons: {
OK: function() { $(this).dialog("close"); }
}
});
}
// Initialize alert dialogs
$("div[id^='alert']").dialog({
autoOpen: false,
modal: true,
width: 500,
buttons: {
OK: function () { $(this).dialog("close"); }
}
});

$("#form").show();

Expand Down

0 comments on commit 03484d5

Please sign in to comment.