-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
32 lines (28 loc) · 1.07 KB
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Save this script as `options.js`
// Saves options to localStorage.
function saveOptions(event)
{
event.preventDefault(true);
localStorage["topLevelProjectId"] = $("#topLevelProjectId").val();
localStorage["defaultSelectedProjectId"] = $("#defaultSelectedProjectId").val();
localStorage["rallyUsername"] = $("#rallyUsername").val();
localStorage["rallyPassword"] = $("#rallyPassword").val();
// Update status to let user know options were saved.
var status = $("#status");
status.html("Options Saved.");
setTimeout(function()
{
status.html("");
}, 1500);
}
// Restores select box state to saved value from localStorage.
function restoreOptions()
{
var topLevelProjectId = localStorage["topLevelProjectId"] == null ? 129886306 : localStorage["topLevelProjectId"];
$("#topLevelProjectId").val(topLevelProjectId);
$("#defaultSelectedProjectId").val(localStorage["defaultSelectedProjectId"]);
$("#rallyUsername").val(localStorage["rallyUsername"]);
$("#rallyPassword").val(localStorage["rallyPassword"]);
$("#save").click(saveOptions);
}
$(document).ready(restoreOptions);