Kenneth Love avatar Kenneth Love committed b11f8cf

updates to both safari and chrome

Comments (0)

Files changed (12)

forrst fire.safariextension/Info.plist

 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.4</string>
+	<string>1.4.1</string>
 	<key>CFBundleVersion</key>
-	<string>1.4</string>
+	<string>1.4.1</string>
 	<key>Chrome</key>
 	<dict>
 		<key>Global Page</key>

forrst fire.safariextension/fire.js

 function getMessage(msgEvent) {
     if (msgEvent.name == "settingValueIs") {
         show_raptor = msgEvent.message;
-        console.log('show raptor is: ' + show_raptor);
     }
 }
 safari.self.tab.dispatchMessage("getSettingValue", "raptor");

forrst-fire.chromeextension/background.html

+<html>
+<head></head>
+<script type="text/javascript" charset="utf-8">
+	chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
+		sendResponse({value: localStorage[request.variable]});
+	});
+</script>
+</html>

forrst-fire.chromeextension/fire.js

 *   and is owned by its creator.
 */
 
+var raptor_shown = false,
+    show_raptor;
 
 $(function() {
     var $code_wrapper = $(".code-wrapper"),
         $("#sidebar").clone().end().remove().appendTo("#post-panel .right");
     }
 
+    $("#footer").raptorize();
+
     $.jknav.init({
         speed: 'fast',
         reevaluate: true,
     });
 }
 
+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() {
-    $('div.activity:not(.jknav)').jknav().addClass('jknav');
+    get_settings();
+    $('div.activity:not(.jknav)').jknav(raptor).addClass('jknav');
     window.setTimeout(add_new_content, 500);
 }
Add a comment to this file

forrst-fire.chromeextension/forrst-fire.zip

Binary file modified.

Add a comment to this file

forrst-fire.chromeextension/images/raptor.png

Added
New image

forrst-fire.chromeextension/jquery.raptorize.1.0.js

 			}
 
 			//Raptor Vars
-			var raptorImageMarkup = '<img id="elRaptor" style="display: none" src="' + safari.extension.baseURI + 'images/raptor.png" />'
-			var raptorAudioMarkup = '<audio id="elRaptorShriek" preload="auto"><source src="' + safari.extension.baseURI + 'sounds/raptor-sound.mp3" /><source src="' + safari.extension.baseURI + 'sounds/raptor-sound.ogg" /></audio>';
+			var raptorImageMarkup = '<img id="elRaptor" style="display: none" src="' + chrome.extension.getURL('images/raptor.png') + '" />';
+			var raptorAudioMarkup = '<audio id="elRaptorShriek" preload="auto"><source src="' + chrome.extension.getURL('sounds/raptor-sound.mp3') + '" /><source src="' + chrome.extension.getURL('sounds/raptor-sound.ogg') + '" /></audio>';
 			var locked = false;
 
 			//Append Raptor and Style

forrst-fire.chromeextension/manifest.json

 {
     "name": "Forrst Fire",
-    "version": "1.1",
+    "version": "1.2",
     "description": "Enable j/k navigation on forrst.com.",
     "icons": {
         "48": "Icon-48.png",
         "128": "Icon-128.png"
     },
+    "options_page": "options.html",
+    "background_page": "background.html",
     "content_scripts": [
         {
             "matches": ["http://www.forrst.com/*", "http://forrst.com/*"],
-            "js": ["jquery-1.4.2.min.js", "jquery.jknav.min.js", "fire.js"],
+            "js": [
+                "jquery-1.4.4.min.js",
+                "jquery.jknav.min.js",
+                "jquery.raptorize.1.0.js",
+                "fire.js"
+            ],
             "css": ["fire.css"]
         }
     ],

forrst-fire.chromeextension/options.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;
+			localStorage["show_raptor"] = raptor;
+
+			// 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 raptor = localStorage["show_raptor"];
+			var clever_girl = document.getElementById("id_clever_girl");
+			if (raptor) {
+				clever_girl.checked = true;
+			} else {
+				clever_girl.checked = false;
+			}
+		}
+</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>
+</body>
+</html>
+
Add a comment to this file

forrst-fire.chromeextension/sounds/raptor-sound.mp3

Binary file added.

Add a comment to this file

forrst-fire.chromeextension/sounds/raptor-sound.ogg

Binary file added.

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.