Commits

Kenneth Love committed 80f0f21

updates up to 1.4.0.2

  • Participants
  • Parent commits 648dea1

Comments (0)

Files changed (5)

File forrst fire.safariextension/fire.css

 #sidebar.fire {
   margin-left:0 !important;
 }
-

File forrst-fire.chromeextension/background.html

+<!doctype html>
 <html>
 <head></head>
 <script type="text/javascript" charset="utf-8">

File forrst-fire.chromeextension/fire.js

 *   and is owned by its creator.
 */
 
-var raptor_shown = false,
-    show_raptor;
+var raptor_shown=false,
+    show_raptor,
+    minimal;
+
+function get_settings() {
+    chrome.extension.sendRequest({variable: "show_raptor"}, function(response) {
+        show_raptor=response.value;
+    });
+    chrome.extension.sendRequest({variable: "minimal"}, function(response) {
+        minimal=response.value;
+    });
+}
+
+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();
+    //}
+}
+function maximalize($item) {
+    $item.removeClass('minimal').addClass('maximal');
+    $('.post', $item).children(':not(.title)').show();
+    $('.right', $item).show();
+}
+
+function raptor(item) {
+    var $item = $(item);
+
+    if (show_raptor) {
+        var random = Math.floor(Math.random()*2);
+        if (random == 1 && raptor_shown===false) {
+            $("#raptor").trigger('click');
+            raptor_shown=true;
+        }
+    }
+
+    if (minimal) {
+        maximalize($item);
+    }
+}
+
+function add_new_content() {
+    get_settings();
+    if (typeof minimal != 'undefined' && minimal != '') {
+        minimalize();
+    }
+    $('div.activity:not(.jknav)').jknav(raptor).addClass('jknav');
+    window.setTimeout(add_new_content, 500);
+}
 
 $(function() {
-    var $code_wrapper = $(".code-wrapper"),
-        $sidebar = $(".right");
+    var $code_wrapper=$(".code-wrapper"),
+        $sidebar=$(".right"),
+        $raptor=$('<div id="raptor"></div>');
 
-    if ($code_wrapper.length && $sidebar.length) {
-        $('#post-panel, #sidebar').addClass('fire');
-        $("#sidebar").clone().end().remove().appendTo("#post-panel .right");
-    }
+    $raptor.appendTo('body');
 
-    $("#footer").raptorize();
+    $raptor.raptorize();
+    get_settings();
 
     $.jknav.init({
         speed: 'fast',
         circular: false
     });
 
-    $.jknav.init({
-        name: 'comments',
-        speed: 'fast',
-        reevalue: true,
-        circular: false
-    });
-
     add_new_content();
 
-    $('.comment').not('.bubble .comment').jknav(highlight_comment, 'comments');
-    navigate_comments();
-
     $('textarea, input').focus(function() {
         $(this).addClass('jknav');
     }).blur(function() {
         $(this).removeClass('jknav');
     });
+
+    $('div.activity.minimal').live('click', function() {
+        maximalize($(this));
+    });
 });
-
-function highlight_comment(item) {
-    var $item = $(item);
-    $('.comment').css({
-        background: 'transparent',
-        padding: 0,
-        marginTop: 0
-    }).find('.body').css('width', 601);
-    $item.css({
-        background: 'url(http://forrst.com/assets/images/layout/posts/post_stripe.png?1288622614) repeat-y 0% 0%',
-        padding: '10px 5px 0',
-        marginTop:10
-    }).find('.body').css('width', 581);
-}
-
-function navigate_comments() {
-    $('body').bind('keydown', function(e) {
-        var code = (e.keyCode ? e.keyCode : e.which);
-        if ($('textarea.jknav').length || $('input.jknav').length) {
-            return;
-        } else {
-            if (code == 74) { // j
-                $.jknav.down('comments');
-            } else if (code == 75) { // k
-                $.jknav.up('comments');
-            }
-        }
-    });
-}
-
-function get_settings() {
-    chrome.extension.sendRequest({variable: "show_raptor"}, function(response) {
-        show_raptor = response.value;
-    });
-}
-get_settings();
-
-function raptor() {
-    if (show_raptor) {
-        var random = Math.floor(Math.random()*2);
-        if (random == 1 && !raptor_shown) {
-            $("#footer").trigger('click');
-            console.log('rawr');
-            raptor_shown = true;
-        }
-    }
-}
-
-function add_new_content() {
-    get_settings();
-    $('div.activity:not(.jknav)').jknav(raptor).addClass('jknav');
-    window.setTimeout(add_new_content, 500);
-}

File forrst-fire.chromeextension/manifest.json

 {
     "name": "Forrst Fire",
-    "version": "1.3",
+    "version": "1.4.0.2",
     "description": "Enable j/k navigation on forrst.com.",
     "icons": {
         "48": "Icon-48.png",

File 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");
-			var raptor = clever_girl.value;
+			var clever_girl = document.getElementById("id_clever_girl"),
+				raptor = clever_girl.value,
+				minimal = document.getElementById("id_minimal").value;
 			localStorage["show_raptor"] = raptor;
+			localStorage["minimal"] = minimal;
 
 			// Update status to let user know options were saved.
 			var status = document.getElementById("status");
 
 		// Restores select box state to saved value from localStorage.
 		function restore_options() {
-			var raptor = localStorage["show_raptor"];
-			var clever_girl = document.getElementById("id_clever_girl");
+			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) {
 				clever_girl.checked = true;
-			} else {
-				clever_girl.checked = false;
+			}
+			minimal_check.checked = false;
+			if (minimal) {
+				minimal_check.checked = true;
 			}
 		}
 </script>
 
 <body onload="restore_options()">
-	<label for="id_clever_girl">Clever girl&hellip;</label>
-	<input type="checkbox" id="id_clever_girl" checked>
-
-	<br>
-	<button onclick="save_options()">Save</button>
+	<form action="" method="POST">
+		<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>
+	</form>
 </body>
 </html>