Changeset 5861
- Timestamp:
- 10/08/08 09:34:02 (3 months ago)
- Location:
- trunk/plugins/history_remote
- Files:
-
- 5 modified
-
index.html (modified) (1 diff)
-
jquery.history_remote.js (modified) (1 diff)
-
jquery.history_remote.min.js (modified) (1 diff)
-
jquery.history_remote.pack.js (modified) (1 diff)
-
jquery.history_remote.zip (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/history_remote/index.html
r2244 r5861 8 8 <title>jQuery history/remote - solution for hijaxing links</title> 9 9 <script src="jquery-1.1.3.1.pack.js" type="text/javascript"></script> 10 <script src="jquery.history_remote. pack.js" type="text/javascript"></script>10 <script src="jquery.history_remote.js" type="text/javascript"></script> 11 11 <script type="text/javascript"> 12 12 $(function() { -
trunk/plugins/history_remote/jquery.history_remote.js
r5860 r5861 314 314 $.fn.history = function(callback) { 315 315 return this.click(function(e) { 316 // die if already active 317 if (this.hash == location.hash) { 318 return false; 319 } 320 321 // add to history only if true click occured, not a triggered click... 316 // add to history only if true click occured, 317 // not a triggered click... 322 318 if (e.clientX) { 323 $.ajaxHistory.update(this.hash); 319 // ...and die if already active 320 if (this.hash == location.hash) { 321 return false; 322 } 323 $.ajaxHistory.update(this.hash); 324 324 } 325 325 if (typeof callback == 'function') { -
trunk/plugins/history_remote/jquery.history_remote.min.js
r5860 r5861 12 12 * Version: 0.2.3 13 13 */ 14 (function($){$.ajaxHistory=new function(){var RESET_EVENT='historyReset';var _currentHash=location.hash;var _intervalId=null;var _observeHistory;this.update=function(){};var _defaultReset=function(){$('.remote-output').empty();};$(document).bind(RESET_EVENT,_defaultReset);if($.browser.msie){var _historyIframe,initialized=false;$(function(){_historyIframe=$('<iframe style="display: none;"></iframe>').appendTo(document.body).get(0);var iframe=_historyIframe.contentWindow.document;iframe.open();iframe.close();if(_currentHash&&_currentHash!='#'){iframe.location.hash=_currentHash.replace('#','');}});this.update=function(hash){_currentHash=hash;var iframe=_historyIframe.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=hash.replace('#','');};_observeHistory=function(){var iframe=_historyIframe.contentWindow.document;var iframeHash=iframe.location.hash;if(iframeHash!=_currentHash){_currentHash=iframeHash;if(iframeHash&&iframeHash!='#'){$('a[@href$="'+iframeHash+'"]').click();location.hash=iframeHash;}else if(initialized){location.hash='';$(document).trigger(RESET_EVENT);}}initialized=true;};}else if($.browser.mozilla||$.browser.opera){this.update=function(hash){_currentHash=hash;};_observeHistory=function(){if(location.hash){if(_currentHash!=location.hash){_currentHash=location.hash;$('a[@href$="'+_currentHash+'"]').click();}}else if(_currentHash){_currentHash='';$(document).trigger(RESET_EVENT);}};}else if($.browser.safari){var _backStack,_forwardStack,_addHistory;$(function(){_backStack=[];_backStack.length=history.length;_forwardStack=[];});var isFirst=false,initialized=false;_addHistory=function(hash){_backStack.push(hash);_forwardStack.length=0;isFirst=false;};this.update=function(hash){_currentHash=hash;_addHistory(_currentHash);};_observeHistory=function(){var historyDelta=history.length-_backStack.length;if(historyDelta){isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)_forwardStack.unshift(_backStack.pop());}else{for(var i=0;i<historyDelta;i++)_backStack.push(_forwardStack.shift());}var cachedHash=_backStack[_backStack.length-1];$('a[@href$="'+cachedHash+'"]').click();_currentHash=location.hash;}else if(_backStack[_backStack.length-1]==undefined&&!isFirst){if(document.URL.indexOf('#')>=0){$('a[@href$="'+'#'+document.URL.split('#')[1]+'"]').click();}else if(initialized){$(document).trigger(RESET_EVENT);}isFirst=true;}initialized=true;};}this.initialize=function(callback){if(typeof callback=='function'){$(document).unbind(RESET_EVENT,_defaultReset).bind(RESET_EVENT,callback);}if(location.hash&&typeof _addHistory=='undefined'){$('a[@href$="'+location.hash+'"]').trigger('click');}if(_observeHistory&&_intervalId==null){_intervalId=setInterval(_observeHistory,200);}};};$.fn.remote=function(output,settings,callback){callback=callback||function(){};if(typeof settings=='function'){callback=settings;}settings=$.extend({hashPrefix:'remote-'},settings||{});var target=$(output).size()&&$(output)||$('<div></div>').appendTo('body');target.addClass('remote-output');return this.each(function(i){var href=this.href,hash='#'+(this.title&&this.title.replace(/\s/g,'_')||settings.hashPrefix+(i+1)),a=this;this.href=hash;$(this).click(function(e){if(!target['locked']){if(e.clientX){$.ajaxHistory.update(hash);}target.load(href,function(){target['locked']=null;callback.apply(a);});}});});};$.fn.history=function(callback){return this.click(function(e){if( this.hash==location.hash){return false;}if(e.clientX){$.ajaxHistory.update(this.hash);}if(typeof callback=='function'){callback.call(this);}});};})(jQuery);14 (function($){$.ajaxHistory=new function(){var RESET_EVENT='historyReset';var _currentHash=location.hash;var _intervalId=null;var _observeHistory;this.update=function(){};var _defaultReset=function(){$('.remote-output').empty();};$(document).bind(RESET_EVENT,_defaultReset);if($.browser.msie){var _historyIframe,initialized=false;$(function(){_historyIframe=$('<iframe style="display: none;"></iframe>').appendTo(document.body).get(0);var iframe=_historyIframe.contentWindow.document;iframe.open();iframe.close();if(_currentHash&&_currentHash!='#'){iframe.location.hash=_currentHash.replace('#','');}});this.update=function(hash){_currentHash=hash;var iframe=_historyIframe.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=hash.replace('#','');};_observeHistory=function(){var iframe=_historyIframe.contentWindow.document;var iframeHash=iframe.location.hash;if(iframeHash!=_currentHash){_currentHash=iframeHash;if(iframeHash&&iframeHash!='#'){$('a[@href$="'+iframeHash+'"]').click();location.hash=iframeHash;}else if(initialized){location.hash='';$(document).trigger(RESET_EVENT);}}initialized=true;};}else if($.browser.mozilla||$.browser.opera){this.update=function(hash){_currentHash=hash;};_observeHistory=function(){if(location.hash){if(_currentHash!=location.hash){_currentHash=location.hash;$('a[@href$="'+_currentHash+'"]').click();}}else if(_currentHash){_currentHash='';$(document).trigger(RESET_EVENT);}};}else if($.browser.safari){var _backStack,_forwardStack,_addHistory;$(function(){_backStack=[];_backStack.length=history.length;_forwardStack=[];});var isFirst=false,initialized=false;_addHistory=function(hash){_backStack.push(hash);_forwardStack.length=0;isFirst=false;};this.update=function(hash){_currentHash=hash;_addHistory(_currentHash);};_observeHistory=function(){var historyDelta=history.length-_backStack.length;if(historyDelta){isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)_forwardStack.unshift(_backStack.pop());}else{for(var i=0;i<historyDelta;i++)_backStack.push(_forwardStack.shift());}var cachedHash=_backStack[_backStack.length-1];$('a[@href$="'+cachedHash+'"]').click();_currentHash=location.hash;}else if(_backStack[_backStack.length-1]==undefined&&!isFirst){if(document.URL.indexOf('#')>=0){$('a[@href$="'+'#'+document.URL.split('#')[1]+'"]').click();}else if(initialized){$(document).trigger(RESET_EVENT);}isFirst=true;}initialized=true;};}this.initialize=function(callback){if(typeof callback=='function'){$(document).unbind(RESET_EVENT,_defaultReset).bind(RESET_EVENT,callback);}if(location.hash&&typeof _addHistory=='undefined'){$('a[@href$="'+location.hash+'"]').trigger('click');}if(_observeHistory&&_intervalId==null){_intervalId=setInterval(_observeHistory,200);}};};$.fn.remote=function(output,settings,callback){callback=callback||function(){};if(typeof settings=='function'){callback=settings;}settings=$.extend({hashPrefix:'remote-'},settings||{});var target=$(output).size()&&$(output)||$('<div></div>').appendTo('body');target.addClass('remote-output');return this.each(function(i){var href=this.href,hash='#'+(this.title&&this.title.replace(/\s/g,'_')||settings.hashPrefix+(i+1)),a=this;this.href=hash;$(this).click(function(e){if(!target['locked']){if(e.clientX){$.ajaxHistory.update(hash);}target.load(href,function(){target['locked']=null;callback.apply(a);});}});});};$.fn.history=function(callback){return this.click(function(e){if(e.clientX){if(this.hash==location.hash){return false;}$.ajaxHistory.update(this.hash);}if(typeof callback=='function'){callback.call(this);}});};})(jQuery); -
trunk/plugins/history_remote/jquery.history_remote.pack.js
r5860 r5861 12 12 * Version: 0.2.3 13 13 */ 14 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2($){$.E=16 2(){5 c=\'15\';5 k=7.4;5 e=A;5 g;6.o=2(){};5 h=2(){$(\'.x-R\').1k()};$(8).L(c,h);3($.v.19){5 f,q=p;$(2(){f=$(\'<I 13="12: Z;"></I>\').F(8.U).1q(0);5 a=f.D.8;a.O();a.N();3(k&&k!=\'#\'){a.7.4=k.C(\'#\',\'\')}});6.o=2(a){k=a;5 b=f.D.8;b.O();b.N();b.7.4=a.C(\'#\',\'\')};g=2(){5 a=f.D.8;5 b=a.7.4;3(b!=k){k=b;3(b&&b!=\'#\'){$(\'a[@l$="\'+b+\'"]\').n();7.4=b}9 3(q){7.4=\'\';$(8).w(c)}}q=z}}9 3($.v.18||$.v.17){6.o=2(a){k=a};g=2(){3(7.4){3(k!=7.4){k=7.4;$(\'a[@l$="\'+k+\'"]\').n()}}9 3(k){k=\'\';$(8).w(c)}}}9 3($.v.14){5 d,r,t;$(2(){d=[];d.m=y.m;r=[]});5 j=p,q=p;t=2(a){d.H(a);r.m=0;j=p};6.o=2(a){k=a;t(k)};g=2(){5 b=y.m-d.m;3(b){j=p;3(b<0){G(5 i=0;i<11.10(b);i++)r.Y(d.X())}9{G(5 i=0;i<b;i++)d.H(r.W())}5 a=d[d.m-1];$(\'a[@l$="\'+a+\'"]\').n();k=7.4}9 3(d[d.m-1]==T&&!j){3(8.S.1p(\'#\')>=0){$(\'a[@l$="\'+\'#\'+8.S.1o(\'#\')[1]+\'"]\').n()}9 3(q){$(8).w(c)}j=z}q=z}}6.1n=2(a){3(u a==\'2\'){$(8).1m(c,h).L(c,a)}3(7.4&&u t==\'T\'){$(\'a[@l$="\'+7.4+\'"]\').w(\'n\')}3(g&&e==A){e=1l(g,1j)}}};$.P.x=2(g,f,c){c=c||2(){};3(u f==\'2\'){c=f}f=$.1i({J:\'x-\'},f||{});5 d=$(g).1h()&&$(g)||$(\'<M></M>\').F(\'U\');d.1g(\'x-R\');B 6.1f(2(i){5 b=6.l,4=\'#\'+(6.V&&6.V.C(/\\s/g,\'1e\')||f.J+(i+1)),a=6;6.l=4;$(6).n(2(e){3(!d[\'K\']){3(e.Q){$.E.o(4)}d.1d(b,2(){d[\'K\']=A;c.1c(a)})}})})};$.P.y=2(a){B 6.n(2(e){3( 6.4==7.4){B p}3(e.Q){$.E.o(6.4)}3(u a==\'2\'){a.1b(6)}})}})(1a);',62,89,'||function|if|hash|var|this|location|document|else||||||||||||href|length|click|update|false|initialized|_forwardStack||_addHistory|typeof|browser|trigger|remote|history|true|null|return|replace|contentWindow|ajaxHistory|appendTo|for|push|iframe|hashPrefix|locked|bind|div|close|open|fn|clientX|output|URL|undefined|body|title|shift|pop|unshift|none|abs|Math|display|style|safari|historyReset|new|opera|mozilla|msie|jQuery|call|apply|load|_|each|addClass|size|extend|200|empty|setInterval|unbind|initialize|split|indexOf|get'.split('|'),0,{}))14 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2($){$.E=16 2(){5 c=\'15\';5 k=7.4;5 e=A;5 g;6.o=2(){};5 h=2(){$(\'.x-R\').1k()};$(8).L(c,h);3($.v.19){5 f,q=p;$(2(){f=$(\'<I 13="12: Z;"></I>\').F(8.U).1q(0);5 a=f.D.8;a.O();a.N();3(k&&k!=\'#\'){a.7.4=k.C(\'#\',\'\')}});6.o=2(a){k=a;5 b=f.D.8;b.O();b.N();b.7.4=a.C(\'#\',\'\')};g=2(){5 a=f.D.8;5 b=a.7.4;3(b!=k){k=b;3(b&&b!=\'#\'){$(\'a[@l$="\'+b+\'"]\').n();7.4=b}9 3(q){7.4=\'\';$(8).w(c)}}q=z}}9 3($.v.18||$.v.17){6.o=2(a){k=a};g=2(){3(7.4){3(k!=7.4){k=7.4;$(\'a[@l$="\'+k+\'"]\').n()}}9 3(k){k=\'\';$(8).w(c)}}}9 3($.v.14){5 d,r,t;$(2(){d=[];d.m=y.m;r=[]});5 j=p,q=p;t=2(a){d.H(a);r.m=0;j=p};6.o=2(a){k=a;t(k)};g=2(){5 b=y.m-d.m;3(b){j=p;3(b<0){G(5 i=0;i<11.10(b);i++)r.Y(d.X())}9{G(5 i=0;i<b;i++)d.H(r.W())}5 a=d[d.m-1];$(\'a[@l$="\'+a+\'"]\').n();k=7.4}9 3(d[d.m-1]==T&&!j){3(8.S.1p(\'#\')>=0){$(\'a[@l$="\'+\'#\'+8.S.1o(\'#\')[1]+\'"]\').n()}9 3(q){$(8).w(c)}j=z}q=z}}6.1n=2(a){3(u a==\'2\'){$(8).1m(c,h).L(c,a)}3(7.4&&u t==\'T\'){$(\'a[@l$="\'+7.4+\'"]\').w(\'n\')}3(g&&e==A){e=1l(g,1j)}}};$.P.x=2(g,f,c){c=c||2(){};3(u f==\'2\'){c=f}f=$.1i({J:\'x-\'},f||{});5 d=$(g).1h()&&$(g)||$(\'<M></M>\').F(\'U\');d.1g(\'x-R\');B 6.1f(2(i){5 b=6.l,4=\'#\'+(6.V&&6.V.C(/\\s/g,\'1e\')||f.J+(i+1)),a=6;6.l=4;$(6).n(2(e){3(!d[\'K\']){3(e.Q){$.E.o(4)}d.1d(b,2(){d[\'K\']=A;c.1c(a)})}})})};$.P.y=2(a){B 6.n(2(e){3(e.Q){3(6.4==7.4){B p}$.E.o(6.4)}3(u a==\'2\'){a.1b(6)}})}})(1a);',62,89,'||function|if|hash|var|this|location|document|else||||||||||||href|length|click|update|false|initialized|_forwardStack||_addHistory|typeof|browser|trigger|remote|history|true|null|return|replace|contentWindow|ajaxHistory|appendTo|for|push|iframe|hashPrefix|locked|bind|div|close|open|fn|clientX|output|URL|undefined|body|title|shift|pop|unshift|none|abs|Math|display|style|safari|historyReset|new|opera|mozilla|msie|jQuery|call|apply|load|_|each|addClass|size|extend|200|empty|setInterval|unbind|initialize|split|indexOf|get'.split('|'),0,{}))
