From 9c9c71ba4d4cb8e097eedf7e032ed877c1503bae Mon Sep 17 00:00:00 2001 From: Ben Alman Date: Tue, 29 Sep 2009 03:28:45 +0000 Subject: [PATCH] some minor tweaks, curry optimization courtesy of jdalton --- docs/files/jquery-ba-bbq-js.html | 2 +- docs/index/Files.html | 2 +- docs/index/General.html | 2 +- docs/nd/Data/ConfigFileInfo.nd | Bin 26 -> 26 bytes docs/nd/Data/FileInfo.nd | 4 ++-- docs/nd/Data/SymbolTable.nd | Bin 5469 -> 5469 bytes jquery.ba-bbq.js | 15 ++++++++------- jquery.ba-bbq.min.js | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/files/jquery-ba-bbq-js.html b/docs/files/jquery-ba-bbq-js.html index 8ed0f39..a00ed1f 100644 --- a/docs/files/jquery-ba-bbq-js.html +++ b/docs/files/jquery-ba-bbq-js.html @@ -11,7 +11,7 @@ -

jQuery BBQ: Back Button & Query Library

Version: 0.1pre, Last updated: 9/27/2009

Homehttp://benalman.com/projects/jquery-bbq-plugin/
GitHubhttp://github.com/cowboy/jquery-bbq/
Sourcehttp://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js
(Minified)http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js (3.1kb)
Summary
jQuery BBQ: Back Button & Query LibraryVersion: 0.1pre, Last updated: 9/27/2009
LicenseCopyright © 2009 “Cowboy” Ben Alman, Licensed under the MIT license.
Support and TestingInformation about what version or versions of jQuery this plugin has been tested with, what browsers it has been tested in, and where the unit tests reside (so you can test it yourself).
Revision History
Param (to string)
Functions
jQuery.param.querystringRetrieve the query string from a URL or if no arguments are passed, the current document.location.
jQuery.param.querystring (build url)Merge a URL, with or without pre-existing query string params, plus any object, params string or URL containing query string params into a new URL.
jQuery.param.fragmentRetrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.
jQuery.param.fragment (build url)Merge a URL, with or without pre-existing fragment (hash) params, plus any object, params string or URL containing fragment (hash) params into a new URL.
Deparam (from string)
Functions
jQuery.deparamDeserialize a params string into an object, optionally coercing numbers, booleans, null and undefined values; this method is the counterpart to the internal jQuery.param method.
jQuery.deparam.querystringParse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.
jQuery.deparam.fragmentParse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.
Element manipulation
Functions
jQuery.elemUrlAttrGet the internal “Default URL attribute per tag” list, or augment the list with additional tag-attribute pairs, in case the defaults are insufficient.
jQuery.fn.querystringUpdate URL attribute in one or more elements, merging the current URL (with or without pre-existing query string params) plus any params object or string into a new URL, which is then set into that attribute.
jQuery.fn.fragmentUpdate URL attribute in one or more elements, merging the current URL (with or without pre-existing fragment/hash params) plus any params object or string into a new URL, which is then set into that attribute.
History, hashchange event
Functions
jQuery.history.pushStateAdds a ‘state’ into the browser history at the current position, setting location.hash and triggering any bound window.onhashchange event callbacks (provided the new state is different than the previous state).
jQuery.history.getStateRetrieves the current ‘state’ from the browser history, parsing location.hash for a specific key or returning an object containing the entire state, optionally coercing numbers, booleans, null and undefined values.
Properties
jQuery.history.pollDelayThe numeric speed (in milliseconds) at which the window.onhashchange polling loop polls.
Events
window.onhashchangeFired when document.location.hash changes.
+

jQuery BBQ: Back Button & Query Library

Version: 0.1pre, Last updated: 9/28/2009

Homehttp://benalman.com/projects/jquery-bbq-plugin/
GitHubhttp://github.com/cowboy/jquery-bbq/
Sourcehttp://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js
(Minified)http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js (3.1kb)
Summary
jQuery BBQ: Back Button & Query LibraryVersion: 0.1pre, Last updated: 9/28/2009
LicenseCopyright © 2009 “Cowboy” Ben Alman, Licensed under the MIT license.
Support and TestingInformation about what version or versions of jQuery this plugin has been tested with, what browsers it has been tested in, and where the unit tests reside (so you can test it yourself).
Revision History
Param (to string)
Functions
jQuery.param.querystringRetrieve the query string from a URL or if no arguments are passed, the current document.location.
jQuery.param.querystring (build url)Merge a URL, with or without pre-existing query string params, plus any object, params string or URL containing query string params into a new URL.
jQuery.param.fragmentRetrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.
jQuery.param.fragment (build url)Merge a URL, with or without pre-existing fragment (hash) params, plus any object, params string or URL containing fragment (hash) params into a new URL.
Deparam (from string)
Functions
jQuery.deparamDeserialize a params string into an object, optionally coercing numbers, booleans, null and undefined values; this method is the counterpart to the internal jQuery.param method.
jQuery.deparam.querystringParse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.
jQuery.deparam.fragmentParse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.
Element manipulation
Functions
jQuery.elemUrlAttrGet the internal “Default URL attribute per tag” list, or augment the list with additional tag-attribute pairs, in case the defaults are insufficient.
jQuery.fn.querystringUpdate URL attribute in one or more elements, merging the current URL (with or without pre-existing query string params) plus any params object or string into a new URL, which is then set into that attribute.
jQuery.fn.fragmentUpdate URL attribute in one or more elements, merging the current URL (with or without pre-existing fragment/hash params) plus any params object or string into a new URL, which is then set into that attribute.
History, hashchange event
Functions
jQuery.history.pushStateAdds a ‘state’ into the browser history at the current position, setting location.hash and triggering any bound window.onhashchange event callbacks (provided the new state is different than the previous state).
jQuery.history.getStateRetrieves the current ‘state’ from the browser history, parsing location.hash for a specific key or returning an object containing the entire state, optionally coercing numbers, booleans, null and undefined values.
Properties
jQuery.history.pollDelayThe numeric speed (in milliseconds) at which the window.onhashchange polling loop polls.
Events
window.onhashchangeFired when document.location.hash changes.

License

Copyright © 2009 “Cowboy” Ben Alman, Licensed under the MIT license.  http://benalman.com/about/license/

diff --git a/docs/index/Files.html b/docs/index/Files.html index 9080345..21baa81 100644 --- a/docs/index/Files.html +++ b/docs/index/Files.html @@ -13,7 +13,7 @@
File Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
J
 jQuery BBQ:Back Button&Query Library
-
Version: 0.1pre, Last updated: 9/27/2009
+
Version: 0.1pre, Last updated: 9/28/2009
diff --git a/docs/index/General.html b/docs/index/General.html index 7aaa051..cfd576c 100644 --- a/docs/index/General.html +++ b/docs/index/General.html @@ -33,7 +33,7 @@ -
Version: 0.1pre, Last updated: 9/27/2009
+
Version: 0.1pre, Last updated: 9/28/2009
diff --git a/docs/nd/Data/ConfigFileInfo.nd b/docs/nd/Data/ConfigFileInfo.nd index e52a1c40a6e593dd7e3e2a97fd81c3af8ad13042..41724f1bc8847fba48030b81a297717eaafe8aa2 100644 GIT binary patch literal 26 XcmZQ$)L>v>@H$w#!)sTzGcpYTZR846 literal 26 XcmZQ$)L>v>@Y*$Tr`N7*XJiZjX$%QQ diff --git a/docs/nd/Data/FileInfo.nd b/docs/nd/Data/FileInfo.nd index 7f65442..b73c31e 100644 --- a/docs/nd/Data/FileInfo.nd +++ b/docs/nd/Data/FileInfo.nd @@ -1,4 +1,4 @@ 1.4 JavaScript -/srv/projects/jquery-bbq/jquery.ba-bbq.min.js 1254071586 0 /srv/projects/jquery-bbq/jquery.ba-bbq.min.js -/srv/projects/jquery-bbq/jquery.ba-bbq.js 1254071582 1 jQuery BBQ: Back Button & Query Library +/srv/projects/jquery-bbq/jquery.ba-bbq.min.js 1254194615 0 /srv/projects/jquery-bbq/jquery.ba-bbq.min.js +/srv/projects/jquery-bbq/jquery.ba-bbq.js 1254194346 1 jQuery BBQ: Back Button & Query Library diff --git a/docs/nd/Data/SymbolTable.nd b/docs/nd/Data/SymbolTable.nd index f60094733b3022aea82ab4b4dc78b4d95b8462e8..0b1424d9ca738cfb9f359691cb208d69b7dde06e 100644 GIT binary patch delta 169 zcmV;a09OCqD%~mu1_3Al005H)0bG$0^^@uf3X@tA6ti^!ngX+21PB3>4FpZIS_TLK zld2ORlZ^$QMU$-ve6wx|d;yaX44;!$6A_bm2RV~I3(}KN5*4$$3~2$A za1KP1BMwam21RydZgg{#!4NK!nh+GTNe>(Wle7+j3OFw^FfchhFJeBkq!3;LlU5U3 XlL-?;lL8c5ld2O~lb{m{qg@mML8vql delta 159 zcmV;Q0AT;!D%~mr1_3CsR09E#23(U{5)-p^0h$7n83jwT4Fn1SlVS$;vt$Jb0kdKU zO97Me2z-;T2t%`M34Q^ye+wo7lj;helUfoBv$_mv0h4DAO_L)IM3Wg1feJS-GB7YX zJTGECv-1un0S5*}c4cmKbCbakE|Xgh3bUjTUILR=6H1dz6AF`w3lWnO6H1eF1{jkX N6giWi6I-KQ6ajT;F#iAm diff --git a/jquery.ba-bbq.js b/jquery.ba-bbq.js index 62929bf..5e9fbf7 100644 --- a/jquery.ba-bbq.js +++ b/jquery.ba-bbq.js @@ -1,5 +1,5 @@ /*! - * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/27/2009 + * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/28/2009 * http://benalman.com/projects/jquery-bbq-plugin/ * * Copyright (c) 2009 "Cowboy" Ben Alman @@ -9,7 +9,7 @@ // Script: jQuery BBQ: Back Button & Query Library // -// *Version: 0.1pre, Last updated: 9/27/2009* +// *Version: 0.1pre, Last updated: 9/28/2009* // // Home - http://benalman.com/projects/jquery-bbq-plugin/ // GitHub - http://github.com/cowboy/jquery-bbq/ @@ -85,9 +85,8 @@ // Why write the same function twice? Let's curry! Mmmm, curry.. - function curry() { - var args = aps.call( arguments ), - func = args.shift(); + function curry( func ) { + var args = aps.call( arguments, 1 ); return function() { return func.apply( this, args.concat( aps.call( arguments ) ) ); @@ -729,7 +728,9 @@ // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } - // Otherwise, we need to create our own. + // Otherwise, we need to create our own. And we don't want to call this + // until the user binds to the event, just in case they never do, since it + // will create a polling loop and possibly even a hidden IFRAME. fake_onhashchange.start(); }, @@ -738,7 +739,7 @@ // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } - // Otherwise, we need to stop ours, if possible. + // Otherwise, we need to stop ours (if possible). fake_onhashchange.stop(); }, diff --git a/jquery.ba-bbq.min.js b/jquery.ba-bbq.min.js index 6fd1259..8b3f088 100644 --- a/jquery.ba-bbq.min.js +++ b/jquery.ba-bbq.min.js @@ -1,9 +1,9 @@ /* - * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/27/2009 + * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/28/2009 * http://benalman.com/projects/jquery-bbq-plugin/ * * Copyright (c) 2009 "Cowboy" Ben Alman * Licensed under the MIT license * http://benalman.com/about/license/ */ -(function($){var c=this,g,k=document.location,i=Array.prototype.slice,C=decodeURIComponent,a=$.param,l,d,n,p=$.history=$.history||{},m,e,y,b="hashchange",u="querystring",x="fragment",o="hash",w="elemUrlAttr",h="href",B="src",j="on"+b in c,q=/^.*\?|#.*$/g,z=/^.*\#/,s={};function r(D){return typeof D==="string"}function v(){var D=i.call(arguments),E=D.shift();return function(){return E.apply(this,D.concat(i.call(arguments)))}}function f(E,M,D,F,I){var K,J,H,L,G;if(F!==g){H=D.match(E?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);G=H[3]||"";if(I===2&&r(F)){J=F.replace(M,"")}else{L=d(H[2]);F=r(F)?d[E?x:u](F):F;J=I===2?F:I===1?$.extend({},F,L):$.extend({},L,F);J=a(J)}K=H[1]+(E?"#":J||!H[1]?"?":"")+J+G}else{if(D){K=D.replace(M,"")}else{K=E?k[o]?k[h].replace(M,""):"":k.search.replace(/^\??/,"")}}return K}a[u]=v(f,0,q);a[x]=l=v(f,1,z);$.deparam=d=function(G,E){var F={},D={"true":!0,"false":!1,"null":null};$.each(G.replace(/\+/g," ").split("&"),function(K,M){var J=M.split("="),N=C(J[0]),I,O=F,L=0,P=N.split("]["),H=P.length-1;if(/\[/.test(P[0])&&/\]$/.test(P[H])){P[H]=P[H].replace(/\]$/,"");P=P.shift().split("[").concat(P);H=P.length-1}else{H=0}if(J.length===2){I=C(J[1]);if(E){I=I&&!isNaN(I)?+I:I==="undefined"?g:D[I]!==g?D[I]:I}if(H){for(;L<=H;L++){N=P[L]===""?O.length:P[L];O=O[N]=L").hide().appendTo("body")[0].contentWindow;H=function(){return D.document.location[o].replace(/^#/,"")};F=function(M,K){if(M!==K){var L=D.document;L.open();L.close();L.location[o]="#"+M}};F(l())}}E.start=function(){if(I){return}var K=l();F||G();(function J(){var M=l(),L=H(K);if(M!==K){F(K=M,L);$(c).trigger(b)}else{if(L!==K){m("#"+L)}}I=setTimeout(J,p.pollDelay)})()};E.stop=function(){if(!D){I&&clearTimeout(I);I=0}};return E})()})(jQuery); \ No newline at end of file +(function($){var c=this,g,k=document.location,i=Array.prototype.slice,C=decodeURIComponent,a=$.param,l,d,n,p=$.history=$.history||{},m,e,y,b="hashchange",u="querystring",x="fragment",o="hash",w="elemUrlAttr",h="href",B="src",j="on"+b in c,q=/^.*\?|#.*$/g,z=/^.*\#/,s={};function r(D){return typeof D==="string"}function v(E){var D=i.call(arguments,1);return function(){return E.apply(this,D.concat(i.call(arguments)))}}function f(E,M,D,F,I){var K,J,H,L,G;if(F!==g){H=D.match(E?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);G=H[3]||"";if(I===2&&r(F)){J=F.replace(M,"")}else{L=d(H[2]);F=r(F)?d[E?x:u](F):F;J=I===2?F:I===1?$.extend({},F,L):$.extend({},L,F);J=a(J)}K=H[1]+(E?"#":J||!H[1]?"?":"")+J+G}else{if(D){K=D.replace(M,"")}else{K=E?k[o]?k[h].replace(M,""):"":k.search.replace(/^\??/,"")}}return K}a[u]=v(f,0,q);a[x]=l=v(f,1,z);$.deparam=d=function(G,E){var F={},D={"true":!0,"false":!1,"null":null};$.each(G.replace(/\+/g," ").split("&"),function(K,M){var J=M.split("="),N=C(J[0]),I,O=F,L=0,P=N.split("]["),H=P.length-1;if(/\[/.test(P[0])&&/\]$/.test(P[H])){P[H]=P[H].replace(/\]$/,"");P=P.shift().split("[").concat(P);H=P.length-1}else{H=0}if(J.length===2){I=C(J[1]);if(E){I=I&&!isNaN(I)?+I:I==="undefined"?g:D[I]!==g?D[I]:I}if(H){for(;L<=H;L++){N=P[L]===""?O.length:P[L];O=O[N]=L").hide().appendTo("body")[0].contentWindow;H=function(){return D.document.location[o].replace(/^#/,"")};F=function(M,K){if(M!==K){var L=D.document;L.open();L.close();L.location[o]="#"+M}};F(l())}}E.start=function(){if(I){return}var K=l();F||G();(function J(){var M=l(),L=H(K);if(M!==K){F(K=M,L);$(c).trigger(b)}else{if(L!==K){m("#"+L)}}I=setTimeout(J,p.pollDelay)})()};E.stop=function(){if(!D){I&&clearTimeout(I);I=0}};return E})()})(jQuery); \ No newline at end of file