Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f7761a824b
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (62 sloc) 1.858 kb
<html>
<head><title>try-clojure-in-chrome options</title></head>
<script type="text/javascript">
function reset_storage ()
{
localStorage.clear ();
restore_options ();
}
// Saves options to localStorage.
function save_options()
{
var text = document.getElementById ("historyDepth");
var select = document.getElementById ("logLevel");
localStorage.setItem ("historyDepth", text.value);
localStorage.setItem ("logLevel", select.children[select.selectedIndex].value);
//// Update status to let user know options were saved.
//var status = document.getElementById("status");
//status.innerHTML = "Options Saved.";
//setTimeout(function() {
// status.innerHTML = "";
//}, 750);
}
// Restores select box state to saved value from localStorage.
function restore_options()
{
var historyDepth = localStorage.getItem ("historyDepth") * 1;
var logLevel = localStorage.getItem ("logLevel") * 1;
if (!historyDepth)
{
historyDepth = "500";
}
if (!logLevel)
{
logLevel = 1;
}
var text = document.getElementById ("historyDepth");
var select = document.getElementById ("logLevel");
text.value = historyDepth;
for (var i = 0; i < select.children.length; i++)
{
var child = select.children[i];
if (child.value == logLevel)
{
child.selected = "true";
break;
}
}
}
</script>
<body onload="restore_options()">
History depth: <input type="text" name="historyDepth" id="historyDepth" /><br />
Log:
<select id="logLevel">
<option value="1">DEBUG</option>
<option value="2">TRACE</option>
<option value="3">INFO</option>
</select>
<br />
<button onclick="save_options()">Save</button>
<button onclick="reset_storage ()">Reset history storage</button>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.