Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed window['location']['href'] to location.href to fix OMG FUN bu…

…g in blackberry 4.6. Closes #9.
  • Loading branch information...
commit 400b3573ded39d4f5c10320de9ab43b08bbd2e1a 1 parent a62a601
@cowboy authored
View
4 docs/nd/Data/FileInfo.nd
@@ -1,4 +1,4 @@
1.4
JavaScript
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278343229 1 jQuery hashchange event
-/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278343232 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
+/srv/projects/jquery-hashchange/jquery.ba-hashchange.js 1278344463 1 jQuery hashchange event
+/srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js 1278344669 0 /srv/projects/jquery-hashchange/jquery.ba-hashchange.min.js
View
20 jquery.ba-hashchange.js
@@ -81,14 +81,12 @@
(function($,window,undefined){
'$:nomunge'; // Used by YUI compressor.
- // Method / object references.
- var fake_onhashchange,
- jq_event_special = $.event.special,
+ // Reused string.
+ var str_hashchange = 'hashchange',
- // Reused strings.
- str_location = 'location',
- str_hashchange = 'hashchange',
- str_href = 'href',
+ // Method / object references.
+ fake_onhashchange,
+ jq_event_special = $.event.special,
// IE6/7 specifically need some special love when it comes to back-button
// support, so let's do a little browser sniffing..
@@ -102,7 +100,7 @@
// Get location.hash (or what you'd expect location.hash to be) sans any
// leading #. Thanks for making this necessary, Firefox!
function get_fragment( url ) {
- url = url || window[ str_location ][ str_href ];
+ url = url || location.href;
return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
};
@@ -227,7 +225,7 @@
$(window).trigger( str_hashchange );
} else if ( history_hash !== last_hash ) {
- window[ str_location ][ str_href ] = window[ str_location ][ str_href ].replace( /#.*/, '' ) + history_hash;
+ location.href = location.href.replace( /#.*/, '' ) + history_hash;
}
timeout_id = setTimeout( poll, $[ str_hashchange + 'Delay' ] );
@@ -274,7 +272,7 @@
// Get history by looking at the hidden Iframe's location.hash.
history_get = function() {
- return get_fragment( iframe[ str_location ][ str_href ] );
+ return get_fragment( iframe.location.href );
};
// Set a new history item by opening and then closing the Iframe
@@ -288,7 +286,7 @@
domain && doc.write( '<script>document.domain="' + domain + '"</script>' );
doc.close();
- iframe[ str_location ].hash = hash;
+ iframe.location.hash = hash;
}
};
View
2  jquery.ba-hashchange.min.js
@@ -6,4 +6,4 @@
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
-(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&(g===b||g>7);function a(m){m=m||i[c][l];return"#"+m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=50;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},s,p=a(),n=function(t){return t},o=n,r=n;m.start=function(){s||q()};m.stop=function(){s&&clearTimeout(s);s=b};function q(){var u=a(),t=r(p);if(u!==p){o(p=u,t);$(i).trigger(d)}else{if(t!==p){i[c][l]=i[c][l].replace(/#.*/,"")+t}}s=setTimeout(q,$[d+"Delay"])}h&&(function(){var t,u;m.start=function(){if(!t){u=$[d+"IframeSrc"];u=u&&u+a();t=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){u||o(a());q()}).attr("src",u||"javascript:0").insertAfter("body")[0].contentWindow}};m.stop=n;r=function(){return a(t[c][l])};o=function(y,v){if(y!==v){var x=t.document.open(),w=$[d+"Domain"];w&&x.write('<script>document.domain="'+w+'"<\/script>');x.close();t[c].hash=y}}})();return m})()})(jQuery,this);
+(function($,h,b){var c="hashchange",i,j=$.event.special,e=$.browser,f=document.documentMode,g=e.msie&&(f===b||f<8),d="on"+c in h&&(f===b||f>7);function a(k){k=k||location.href;return"#"+k.replace(/^[^#]*#?(.*)$/,"$1")}$[c+"Delay"]=50;j[c]=$.extend(j[c],{setup:function(){if(d){return false}$(i.start)},teardown:function(){if(d){return false}$(i.stop)}});i=(function(){var k={},q,n=a(),l=function(r){return r},m=l,p=l;k.start=function(){q||o()};k.stop=function(){q&&clearTimeout(q);q=b};function o(){var s=a(),r=p(n);if(s!==n){m(n=s,r);$(h).trigger(c)}else{if(r!==n){location.href=location.href.replace(/#.*/,"")+r}}q=setTimeout(o,$[c+"Delay"])}g&&(function(){var r,s;k.start=function(){if(!r){s=$[c+"IframeSrc"];s=s&&s+a();r=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){s||m(a());o()}).attr("src",s||"javascript:0").insertAfter("body")[0].contentWindow}};k.stop=l;p=function(){return a(r.location.href)};m=function(w,t){if(w!==t){var v=r.document.open(),u=$[c+"Domain"];u&&v.write('<script>document.domain="'+u+'"<\/script>');v.close();r.location.hash=w}}})();return k})()})(jQuery,this);
Please sign in to comment.
Something went wrong with that request. Please try again.