Commits

Kenneth Love committed 195555d

continuous scrolling now works

Comments (0)

Files changed (5)

forrst fire.safariextension/Info.plist

 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.1</string>
+	<string>1.2</string>
 	<key>CFBundleVersion</key>
-	<string>1.1</string>
+	<string>1.2</string>
 	<key>Chrome</key>
 	<dict/>
 	<key>Content</key>
 			<key>End</key>
 			<array>
 				<string>jquery-1.4.2.min.js</string>
-				<string>jquery.jknav.js</string>
+				<string>jquery.jknav.min.js</string>
 				<string>fire.js</string>
 			</array>
 		</dict>

forrst fire.safariextension/fire.js

-$("div.activity").jknav();
-$.jknav.init({
-    up: 'k',
-    down: 'j',
-    name: 'default',
-    easing: 'swing',
-    speed: 'fast',
-    reevaluate: true
+$(function() {
+    $.jknav.init({
+        speed: 'fast',
+        reevaluate: true,
+        circular: false
+    });
+    add_new_content();
 });
 
+function add_new_content() {
+    $('div.activity:not(.jknav)').jknav().addClass('jknav');
+    window.setTimeout(add_new_content, 1000);
+}

forrst fire.safariextension/jquery.jknav.js

-/**
- * @preserve jknav
- * @name      jquery.jknav.js
- * @author    Yu-Jie Lin http://lmgtfy.com/?q=livibetter
- * @version   0.1.0.2
- * @date      05-26-2010
- * @copyright (c) 2010 Yu-Jie Lin <livibetter@gmail.com>
- * @license   BSD License
- * @homepage  http://lilbtn.blogspot.com/2010/05/js-jquery-jknav-jk-binding-navigation.html
- * @example   http://lilbtn.googlecode.com/hg/src/static/js/jquery/jquery.jknav.demo.html
-*/
-(function ($) {
-	/**
-	 * Add jQuery objects to navgation list
-	 *
-	 * @param {Function} callback Callback function to be invoked after plugin scroll to item
-	 * @param {String} name Navagation set name
-	 * @return {jQuery} <code>this</code> for chaining
-	 */
-	$.fn.jknav = function (callback, name) {
-		if (name == null)
-			name = 'default';
-		if ($.jknav.items[name] == null)
-			$.jknav.items[name] = [];
-		return this.each(function () {
-			$.jknav.items[name].push([this, callback]);
-			$.jknav.items[name].sort(function (a, b) {
-				var a_top = $(a[0]).offset().top;
-				var b_top = $(b[0]).offset().top;
-				if (a_top < b_top)
-					return -1;
-				if (a_top > b_top)
-					return 1;
-				if (a_top == b_top) {
-					var a_left = $(a[0]).offset().left;
-					var b_left = $(b[0]).offset().left;
-					if (a_left < b_left)
-						return -1;
-					if (a_left > b_left)
-						return 1;
-					return 0;
-					}
-				});
-			});
-		};
-
-	/**
-	 * A helper to do callback
-	 * @param {Number} index of the item navgation set
-	 * @param {Object} opts Options
-	 */
-	function do_callback(index, opts) {
-		var callback = $.jknav.items[opts.name][index][1];
-		if (callback)
-			callback($.jknav.items[opts.name][index][0]);
-		}
-
-	/**
-	 * Calculate the index of next item
-	 * @param {Number} offset Indicates move forword or backward
-	 * @param {Object} opts Options
-	 */
-	function calc_index(offset, opts) {
-		var index = $.jknav.index[opts.name];
-		if (index == null) {
-			// Initialize index
-			var top = $('body').scrollTop();
-			$.each($.jknav.items[opts.name], function (idx, item) {
-				var item_top = $(item).offset().top;
-				if (top >= item_top)
-					index = idx;
-				});
-			if (index == null) {
-				if (offset > 0)
-					index = 0
-				else
-					index = $.jknav.items[opts.name].length - 1;
-				}
-			else {
-				if (offset > 0 && ++index >= $.jknav.items[opts.name].length)
-					index = 0
-				else if (offset < 0 && top == $($.jknav.items[opts.name][index]).offset().top && --index < 0)
-					index = $.jknav.items[opts.name].length - 1;
-				}
-			}
-		else {
-			index += offset;
-			if (index >= $.jknav.items[opts.name].length)
-				index = 0;
-			if (index < 0)
-				index = $.jknav.items[opts.name].length - 1;
-			}
-		$.jknav.index[opts.name] = index;
-		return index;
-		}
-		
-	/**
-	 * Keyup handler
-	 * @param {Event} e jQuery event object
-	 * @param {Object} opts Options
-	 */
-	function keyup(e, opts) {
-		if (e.srcElement.tagName != 'BODY')
-			return
-		var ch = String.fromCharCode(e.keyCode).toLowerCase();
-		if (ch == opts.up.toLowerCase() || ch == opts.down.toLowerCase()) {
-			if (opts.reevaluate)
-				$.jknav.index[opts.name] = null;
-			var index = calc_index((ch == opts.down.toLowerCase()) ? 1 : -1, opts);
-			var $item = $($.jknav.items[opts.name][index][0]);
-			$('body').animate(
-				{
-					scrollLeft: $item.offset().left,
-					scrollTop: $item.offset().top
-					},
-				opts.speed,
-				opts.easing,
-				function () {
-					do_callback(index, opts)
-					}
-				);
-			}
-		}
-
-	$.jknav = {
-		index: {},
-		items: {},
-		default_options: {
-			up: 'k',
-			down: 'j',
-			name: 'default',
-			easing: 'swing',
-			speed: 'normal',
-			reevaluate: false
-			},
-		/**
-		 * Initialization function
-		 * @param {Object} options Options
-		 */
-		init: function (options) {
-			var opts = $.extend($.extend({}, $.jknav.default_options), options);
-			$.jknav.index[opts.name] = null;
-			$('body').keyup(function (e) {
-				keyup(e, opts);
-				});
-			}
-		};
-	})(jQuery);
-// vim: ts=2: sw=2

forrst fire.safariextension/jquery.jknav.min.js

+/*
+ jknav
+ @name      jquery.jknav.js
+ @author    Yu-Jie Lin http://j.mp/Google-livibetter
+ @version   0.5
+ @date      11-01-2010
+ @copyright (c) 2010 Yu-Jie Lin <livibetter@gmail.com>
+ @license   BSD License
+ @homepage  http://code.google.com/p/lilbtn/wiki/JsJqueryJknav
+ @example   http://lilbtn.googlecode.com/hg/src/static/js/jquery/jquery.jknav.demo.html
+*/
+(function(a){function h(d){var b=window.console;a.jknav.DEBUG&&b&&b.log&&b.log("jknav: "+d)}function j(d,b){var c=a.jknav.index[b.name];h("Calculating index for "+b.name+", current index = "+c);if(c==null){var f=a(a.jknav.TARGET).scrollTop();h(a.jknav.TARGET+" top = "+f);a.each(a.jknav.items[b.name],function(e,g){var k=Math.floor(a(g).offset().top);if(f>=k)c=e});if(c==null)c=d>0?0:a.jknav.items[b.name].length-1;else if(d>0&&++c>=a.jknav.items[b.name].length)c=0;else if(d<0&&f==Math.floor(a(a.jknav.items[b.name][c]).offset().top)&&
+--c<0)c=a.jknav.items[b.name].length-1}else{if(!b.circular&&(c==0&&d==-1||c==a.jknav.items[b.name].length-1&&d==1))return c;c+=d;if(c>=a.jknav.items[b.name].length)c=0;if(c<0)c=a.jknav.items[b.name].length-1}h("new index = "+c);return a.jknav.index[b.name]=c}function i(d,b){if(d.target.tagName.toLowerCase()=="input")h("keyup: "+d.target.tagName+", target is INPUT ignored.");else{var c=String.fromCharCode(d.keyCode).toLowerCase();h("keyup: "+d.target.tagName+", key: "+c);if(c==b.up.toLowerCase()||
+c==b.down.toLowerCase()){if(b.reevaluate)a.jknav.index[b.name]=null;var f=j(c==b.down.toLowerCase()?1:-1,b);c=a(a.jknav.items[b.name][f][0]);a(a.jknav.TARGET).animate({scrollLeft:Math.floor(c.offset().left),scrollTop:Math.floor(c.offset().top)},b.speed,b.easing,function(){var e=a.jknav.items[b.name][f][1];e&&e(a.jknav.items[b.name][f][0])})}}}a.fn.jknav=function(d,b){if(b==null)b="default";if(a.jknav.items[b]==null)a.jknav.items[b]=[];return this.each(function(){a.jknav.items[b].push([this,d]);a.jknav.items[b].sort(function(c,
+f){var e=a(c[0]).offset().top,g=a(f[0]).offset().top;if(e<g)return-1;if(e>g)return 1;if(e==g){e=a(c[0]).offset().left;g=a(f[0]).offset().left;if(e<g)return-1;if(e>g)return 1;return 0}})})};a.jknav={index:{},items:{},opts:{},default_options:{up:"k",down:"j",name:"default",easing:"swing",speed:"normal",circular:true,reevaluate:false},DEBUG:false,TARGET_KEYUP:"html",TARGET:!a.browser.webkit?"html":"body",init:function(d){var b=a.extend(a.extend({},a.jknav.default_options),d);a.jknav.index[b.name]=null;
+a.jknav.opts[b.name]=b;a(a.jknav.TARGET_KEYUP).keyup(function(c){i(c,b)});h('new set "'+b.name+'" initialzed.')},up:function(d){d=a.jknav.opts[d||"default"];i({target:{tagName:""},keyCode:d.up.charCodeAt(0)},d)},down:function(d){d=a.jknav.opts[d||"default"];i({target:{tagName:""},keyCode:d.down.charCodeAt(0)},d)}}})(jQuery);

forrst-fire.safariextz

Binary file modified.