Commits

Ryan Giglio committed f308a6b

Fixed Chrome options menu, made raptor appear only 1% of the time

  • Participants
  • Parent commits 80f0f21

Comments (0)

Files changed (2)

forrst-fire.chromeextension/fire.js

 }
 
 function minimalize() {
-    //if (minimal == 'on') {
-    $('div.activity:not(.maximal)').addClass('minimal');
-    $('div.activity:not(.maximal) .post').children(':not(.title)').hide();
-    $('div.activity:not(.maximal) .right').hide();
-    //}
+    if (minimal != "false") {
+        $('div.activity:not(.maximal)').addClass('minimal');
+        $('div.activity:not(.maximal) .post').children(':not(.title)').hide();
+        $('div.activity:not(.maximal) .right').hide();
+    }
 }
 function maximalize($item) {
     $item.removeClass('minimal').addClass('maximal');
 function raptor(item) {
     var $item = $(item);
 
-    if (show_raptor) {
-        var random = Math.floor(Math.random()*2);
+    if (show_raptor != "false") {
+        var random = Math.floor(Math.random()*101);
         if (random == 1 && raptor_shown===false) {
             $("#raptor").trigger('click');
             raptor_shown=true;

forrst-fire.chromeextension/options.html

 		// Saves options to localStorage.
 		function save_options() {
 			var clever_girl = document.getElementById("id_clever_girl"),
-				raptor = clever_girl.value,
-				minimal = document.getElementById("id_minimal").value;
+				raptor = clever_girl.checked,
+				minimal = document.getElementById("id_minimal").checked;
 			localStorage["show_raptor"] = raptor;
 			localStorage["minimal"] = minimal;
 
 			setTimeout(function() {
 				status.innerHTML = "";
 			}, 750);
+            return false;
 		}
 
 		// Restores select box state to saved value from localStorage.
 				minimal = localStorage["minimal"],
 				minimal_check = document.getElementById("id_minimal");
 			clever_girl.checked = false;
-			if (raptor) {
+			if (raptor != "false") {
 				clever_girl.checked = true;
 			}
 			minimal_check.checked = false;
-			if (minimal) {
+			if (minimal != "false") {
 				minimal_check.checked = true;
 			}
 		}
 </script>
 
 <body onload="restore_options()">
-	<form action="" method="POST">
+	<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 onclick="save_options()">Save</button>
+		<button type="submit">Save</button>
 	</form>
+    <p id="status"></p>
 </body>
 </html>