Source

Forrst Fire / forrst-fire.chromeextension / options.html

<!doctype html>
<html>
	<head><title>Forrst Fire Extension Options</title></head>
	<script type="text/javascript">
		// Saves options to localStorage.
		function save_options() {
			var clever_girl = document.getElementById("id_clever_girl"),
				raptor = clever_girl.checked,
				minimal = document.getElementById("id_minimal").checked;
			localStorage["show_raptor"] = raptor;
			localStorage["minimal"] = minimal;

			// Update status to let user know options were saved.
			var status = document.getElementById("status");
			status.innerHTML = "Options Saved.";
			setTimeout(function() {
				status.innerHTML = "";
			}, 750);
            return false;
		}

		// Restores select box state to saved value from localStorage.
		function restore_options() {
			var raptor = localStorage["show_raptor"],
				clever_girl = document.getElementById("id_clever_girl"),
				minimal = localStorage["minimal"],
				minimal_check = document.getElementById("id_minimal");
			clever_girl.checked = false;
			if (raptor != "false") {
				clever_girl.checked = true;
			}
			minimal_check.checked = false;
			if (minimal != "false") {
				minimal_check.checked = true;
			}
		}
</script>

<body onload="restore_options()">
	<form action="" method="POST" onsubmit="return save_options()">
		<label for="id_clever_girl" title="A random surprise">Clever girl&hellip;</label>
		<input type="checkbox" id="id_clever_girl">
		<br>
		<label for="id_minimal" title="Show less">Title-only posts</label>
		<input type="checkbox" id="id_minimal">
		<br>
		<button type="submit">Save</button>
	</form>
    <p id="status"></p>
</body>
</html>