Browse files

added deparam example along with minor tweaks

  • Loading branch information...
1 parent 96a3567 commit aa8aef6c1964e3f51f78050d7e853701421c39e3 @cowboy committed Oct 1, 2009
View
10 README.markdown
@@ -1,10 +1,12 @@
# jQuery BBQ: Back Button & Query Library #
[http://benalman.com/projects/jquery-bbq-plugin/](http://benalman.com/projects/jquery-bbq-plugin/)
-Version: 0.1pre, Last updated: 9/30/2009
+Version: 0.1pre, Last updated: 10/1/2009
jQuery BBQ enables simple, yet powerful bookmarkable #hash history via a cross-browser window.onhashchange event. In addition, jQuery BBQ provides a full jQuery.deparam() method, along with both fragment and query string parse and merge utility methods.
+Visit the [project page](http://benalman.com/projects/jquery-bbq-plugin/) for more information and usage examples!
+
## License ##
Copyright (c) 2009 "Cowboy" Ben Alman
@@ -22,8 +24,8 @@ ways in which this plugin can be used.
[http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/](http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/)
[http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/](http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/)
-[http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/](http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/)
-
+[http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/](http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/)
+[http://benalman.com/code/projects/jquery-bbq/examples/deparam/](http://benalman.com/code/projects/jquery-bbq/examples/deparam/)
## Support and Testing ##
Information about what version or versions of jQuery this plugin has been
@@ -42,4 +44,4 @@ Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.
## Release History ##
-0.1pre - (9/30/2009) Pre-initial release
+0.1pre - (10/1/2009) Pre-initial release
View
16 docs/files/jquery-ba-bbq-js.html
@@ -11,37 +11,37 @@
-<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="jQuery_BBQ:Back_ButtonQuery_Library"></a>jQuery BBQ: Back Button &amp; Query Library</h1><div class=CBody><p><b>Version: 0.1pre, Last updated: 9/30/2009</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Project Home</td><td class=CDLDescription><a href="http://benalman.com/projects/jquery-bbq-plugin/" class=LURL target=_top>http://benalman.com/projects/jquery-bbq-plugin/</a></td></tr><tr><td class=CDLEntry>GitHub</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/" class=LURL target=_top>http://github.com/cowboy/jquery-bbq/</a></td></tr><tr><td class=CDLEntry>Source</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-bbq<wbr>/raw<wbr>/master<wbr>/jquery.ba-bbq.js</a></td></tr><tr><td class=CDLEntry>(Minified)</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-bbq<wbr>/raw<wbr>/master<wbr>/jquery.ba-bbq.min.js</a> (3.1kb)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#jQuery_BBQ:Back_ButtonQuery_Library" >jQuery BBQ: Back Button &amp; Query Library</a></td><td class=SDescription><b>Version: 0.1pre, Last updated: 9/30/2009</b></td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>Copyright &copy; 2009 &ldquo;Cowboy&rdquo; Ben Alman, Licensed under the MIT license. </td></tr><tr class="SGeneric"><td class=SEntry><a href="#Examples" >Examples</a></td><td class=SDescription>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Support_and_Testing" >Support and Testing</a></td><td class=SDescription>Information 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).</td></tr><tr class="SGeneric"><td class=SEntry><a href="#Release_History" >Release History</a></td><td class=SDescription></td></tr><tr class="SSection"><td class=SEntry><a href="#Param(to_string)" >Param (to string)</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.param.querystring" >jQuery.<wbr>param.<wbr>querystring</a></td><td class=SDescription>Retrieve the query string from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.param.querystring(build_url)" >jQuery.<wbr>param.<wbr>querystring (build url)</a></td><td class=SDescription>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.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.param.fragment" >jQuery.<wbr>param.<wbr>fragment</a></td><td class=SDescription>Retrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.param.fragment(build_url)" >jQuery.<wbr>param.<wbr>fragment (build url)</a></td><td class=SDescription>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.</td></tr><tr class="SSection"><td class=SEntry><a href="#Deparam(from_string)" >Deparam (from string)</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.deparam" >jQuery.<wbr>deparam</a></td><td class=SDescription>Deserialize 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.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.deparam.querystring" >jQuery.<wbr>deparam.<wbr>querystring</a></td><td class=SDescription>Parse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.deparam.fragment" >jQuery.<wbr>deparam.<wbr>fragment</a></td><td class=SDescription>Parse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr><tr class="SSection"><td class=SEntry><a href="#Element_manipulation" >Element manipulation</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.elemUrlAttr" >jQuery.<wbr>elemUrlAttr</a></td><td class=SDescription>Get the internal &ldquo;Default URL attribute per tag&rdquo; list, or augment the list with additional tag-attribute pairs, in case the defaults are insufficient.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.fn.querystring" >jQuery.<wbr>fn.<wbr>querystring</a></td><td class=SDescription>Update 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. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.fn.fragment" >jQuery.<wbr>fn.<wbr>fragment</a></td><td class=SDescription>Update 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. </td></tr><tr class="SSection"><td class=SEntry><a href="#History,hashchange_event" >History, hashchange event</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.bbq.pushState" >jQuery.<wbr>bbq.<wbr>pushState</a></td><td class=SDescription>Adds a &lsquo;state&rsquo; into the browser history at the current position, setting location.hash and triggering any bound <a href="#window.onhashchange" class=LEvent id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">window.onhashchange</a> event callbacks (provided the new state is different than the previous state).</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.bbq.getState" >jQuery.<wbr>bbq.<wbr>getState</a></td><td class=SDescription>Retrieves the current &lsquo;state&rsquo; 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.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Properties" >Properties</a></td><td class=SDescription></td></tr><tr class="SProperty SIndent2 SMarked"><td class=SEntry><a href="#jQuery.bbq.pollDelay" >jQuery.<wbr>bbq.<wbr>pollDelay</a></td><td class=SDescription>The numeric interval (in milliseconds) at which the <a href="#window.onhashchange" class=LEvent id=link2 onMouseOver="ShowTip(event, 'tt1', 'link2')" onMouseOut="HideTip('tt1')">window.onhashchange</a> polling loop executes. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Events" >Events</a></td><td class=SDescription></td></tr><tr class="SEvent SIndent2 SMarked"><td class=SEntry><a href="#window.onhashchange" >window.<wbr>onhashchange</a></td><td class=SDescription>Fired when document.location.hash changes. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
+<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="jQuery_BBQ:Back_ButtonQuery_Library"></a>jQuery BBQ: Back Button &amp; Query Library</h1><div class=CBody><p><b>Version: 0.1pre, Last updated: 10/1/2009</b></p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Project Home</td><td class=CDLDescription><a href="http://benalman.com/projects/jquery-bbq-plugin/" class=LURL target=_top>http://benalman.com/projects/jquery-bbq-plugin/</a></td></tr><tr><td class=CDLEntry>GitHub</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/" class=LURL target=_top>http://github.com/cowboy/jquery-bbq/</a></td></tr><tr><td class=CDLEntry>Source</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-bbq<wbr>/raw<wbr>/master<wbr>/jquery.ba-bbq.js</a></td></tr><tr><td class=CDLEntry>(Minified)</td><td class=CDLDescription><a href="http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js" class=LURL target=_top>http://github.com<wbr>/cowboy<wbr>/jquery-bbq<wbr>/raw<wbr>/master<wbr>/jquery.ba-bbq.min.js</a> (3.1kb)</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#jQuery_BBQ:Back_ButtonQuery_Library" >jQuery BBQ: Back Button &amp; Query Library</a></td><td class=SDescription><b>Version: 0.1pre, Last updated: 10/1/2009</b></td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#License" >License</a></td><td class=SDescription>Copyright &copy; 2009 &ldquo;Cowboy&rdquo; Ben Alman, Licensed under the MIT license. </td></tr><tr class="SGeneric"><td class=SEntry><a href="#Examples" >Examples</a></td><td class=SDescription>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</td></tr><tr class="SGeneric SMarked"><td class=SEntry><a href="#Support_and_Testing" >Support and Testing</a></td><td class=SDescription>Information 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).</td></tr><tr class="SGeneric"><td class=SEntry><a href="#Release_History" >Release History</a></td><td class=SDescription></td></tr><tr class="SSection"><td class=SEntry><a href="#Param(to_string)" >Param (to string)</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.param.querystring" >jQuery.<wbr>param.<wbr>querystring</a></td><td class=SDescription>Retrieve the query string from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.param.querystring(build_url)" >jQuery.<wbr>param.<wbr>querystring (build url)</a></td><td class=SDescription>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.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.param.fragment" >jQuery.<wbr>param.<wbr>fragment</a></td><td class=SDescription>Retrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.param.fragment(build_url)" >jQuery.<wbr>param.<wbr>fragment (build url)</a></td><td class=SDescription>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.</td></tr><tr class="SSection"><td class=SEntry><a href="#Deparam(from_string)" >Deparam (from string)</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.deparam" >jQuery.<wbr>deparam</a></td><td class=SDescription>Deserialize 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.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.deparam.querystring" >jQuery.<wbr>deparam.<wbr>querystring</a></td><td class=SDescription>Parse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.deparam.fragment" >jQuery.<wbr>deparam.<wbr>fragment</a></td><td class=SDescription>Parse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr><tr class="SSection"><td class=SEntry><a href="#Element_manipulation" >Element manipulation</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.elemUrlAttr" >jQuery.<wbr>elemUrlAttr</a></td><td class=SDescription>Get the internal &ldquo;Default URL attribute per tag&rdquo; list, or augment the list with additional tag-attribute pairs, in case the defaults are insufficient.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.fn.querystring" >jQuery.<wbr>fn.<wbr>querystring</a></td><td class=SDescription>Update 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. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.fn.fragment" >jQuery.<wbr>fn.<wbr>fragment</a></td><td class=SDescription>Update 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. </td></tr><tr class="SSection"><td class=SEntry><a href="#History,hashchange_event" >History, hashchange event</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#jQuery.bbq.pushState" >jQuery.<wbr>bbq.<wbr>pushState</a></td><td class=SDescription>Adds a &lsquo;state&rsquo; into the browser history at the current position, setting location.hash and triggering any bound <a href="#window.onhashchange" class=LEvent id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">window.onhashchange</a> event callbacks (provided the new state is different than the previous state).</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#jQuery.bbq.getState" >jQuery.<wbr>bbq.<wbr>getState</a></td><td class=SDescription>Retrieves the current &lsquo;state&rsquo; 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.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Properties" >Properties</a></td><td class=SDescription></td></tr><tr class="SProperty SIndent2 SMarked"><td class=SEntry><a href="#jQuery.bbq.pollDelay" >jQuery.<wbr>bbq.<wbr>pollDelay</a></td><td class=SDescription>The numeric interval (in milliseconds) at which the <a href="#window.onhashchange" class=LEvent id=link2 onMouseOver="ShowTip(event, 'tt1', 'link2')" onMouseOut="HideTip('tt1')">window.onhashchange</a> polling loop executes. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Events" >Events</a></td><td class=SDescription></td></tr><tr class="SEvent SIndent2 SMarked"><td class=SEntry><a href="#window.onhashchange" >window.<wbr>onhashchange</a></td><td class=SDescription>Fired when document.location.hash changes. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="License"></a>License</h3><div class=CBody><p>Copyright &copy; 2009 &ldquo;Cowboy&rdquo; Ben Alman, Licensed under the MIT license.&nbsp; <a href="http://benalman.com/about/license/" class=LURL target=_top>http://benalman.com/about/license/</a></p></div></div></div>
-<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Examples"></a>Examples</h3><div class=CBody><p>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Basic AJAX</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-basic<wbr>/</a></td></tr><tr><td class=CDLEntry>Advanced AJAX</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-advanced<wbr>/</a></td></tr><tr><td class=CDLEntry>jQuery UI Tabs</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-jquery-ui-tabs<wbr>/</a></td></tr><tr><td class=CDLEntry>Deparam</td><td class=CDLDescription>COMING SOON</td></tr></table></div></div></div>
+<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Examples"></a>Examples</h3><div class=CBody><p>These working examples, complete with fully commented code, illustrate a few ways in which this plugin can be used.</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>Basic AJAX</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-basic<wbr>/</a></td></tr><tr><td class=CDLEntry>Advanced AJAX</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-advanced<wbr>/</a></td></tr><tr><td class=CDLEntry>jQuery UI Tabs</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/fragment-jquery-ui-tabs<wbr>/</a></td></tr><tr><td class=CDLEntry>Deparam</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/examples/deparam/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/examples<wbr>/deparam<wbr>/</a></td></tr></table></div></div></div>
<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Support_and_Testing"></a>Support and Testing</h3><div class=CBody><p>Information 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).</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>jQuery Versions</td><td class=CDLDescription>1.3.2, 1.4pre</td></tr><tr><td class=CDLEntry>Browsers Tested</td><td class=CDLDescription>Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.</td></tr><tr><td class=CDLEntry>Unit Tests</td><td class=CDLDescription><a href="http://benalman.com/code/projects/jquery-bbq/unit/" class=LURL target=_top>http://benalman.com<wbr>/code<wbr>/projects<wbr>/jquery-bbq<wbr>/unit<wbr>/</a></td></tr></table></div></div></div>
-<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Release_History"></a>Release History</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>0.1pre</td><td class=CDLDescription>(9/30/2009) Pre-initial release</td></tr></table></div></div></div>
+<div class="CGeneric"><div class=CTopic><h3 class=CTitle><a name="Release_History"></a>Release History</h3><div class=CBody><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>0.1pre</td><td class=CDLDescription>(10/1/2009) Pre-initial release</td></tr></table></div></div></div>
<div class="CSection"><div class=CTopic><h2 class=CTitle><a name="Param(to_string)"></a>Param (to string)</h2><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.param.querystring" >jQuery.<wbr>param.<wbr>querystring</a></td><td class=SDescription>Retrieve the query string from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#jQuery.param.querystring(build_url)" >jQuery.<wbr>param.<wbr>querystring (build url)</a></td><td class=SDescription>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.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.param.fragment" >jQuery.<wbr>param.<wbr>fragment</a></td><td class=SDescription>Retrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#jQuery.param.fragment(build_url)" >jQuery.<wbr>param.<wbr>fragment (build url)</a></td><td class=SDescription>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.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>
-<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.querystring"></a>jQuery.<wbr>param.<wbr>querystring</h3><div class=CBody><p>Retrieve the query string from a URL or if no arguments are passed, the current document.location.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.querystring( [ url ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A URL containing query string params to be parsed.</td></tr></table><h4 class=CHeading>Returns</h4><p>(String) The parsed query string, with any leading &ldquo;?&rdquo; removed.</p></div></div></div>
+<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.querystring"></a>jQuery.<wbr>param.<wbr>querystring</h3><div class=CBody><p>Retrieve the query string from a URL or if no arguments are passed, the current document.location.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.querystring( [ url ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A URL containing query string params to be parsed.&nbsp; If url is not passed, the current document.location is used.</td></tr></table><h4 class=CHeading>Returns</h4><p>(String) The parsed query string, with any leading &ldquo;?&rdquo; removed.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.querystring(build_url)"></a>jQuery.<wbr>param.<wbr>querystring (build url)</h3><div class=CBody><p>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.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.querystring( url, params [, merge_mode ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A valid URL for params to be merged into.&nbsp; This URL may contain a query string and/or fragment (hash).</td></tr><tr><td class=CDLEntry>params</td><td class=CDLDescription>(String) A params string or URL containing query string params to be merged into url.</td></tr><tr><td class=CDLEntry>params</td><td class=CDLDescription>(Object) A params object to be merged into url.</td></tr><tr><td class=CDLEntry>merge_mode</td><td class=CDLDescription>(Number) Merge behavior defaults to 0 if merge_mode is not specified, and is as-follows:</td></tr></table><ul><li>0: params in the params argument will override any query string params in url.</li><li>1: any query string params in url will override params in the params argument.</li><li>2: params argument will completely replace any query string in url.</li></ul><h4 class=CHeading>Returns</h4><p>(String) Either a params string with urlencoded data or a URL with a urlencoded query string in the format &lsquo;a=b&amp;c=d&amp;e=f&rsquo;.</p></div></div></div>
-<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.fragment"></a>jQuery.<wbr>param.<wbr>fragment</h3><div class=CBody><p>Retrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.fragment( [ url ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A URL containing fragment (hash) params to be parsed.</td></tr></table><h4 class=CHeading>Returns</h4><p>(String) The parsed fragment (hash) string, with any leading &ldquo;#&rdquo; removed.</p></div></div></div>
+<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.fragment"></a>jQuery.<wbr>param.<wbr>fragment</h3><div class=CBody><p>Retrieve the fragment (hash) from a URL or if no arguments are passed, the current document.location.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.fragment( [ url ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A URL containing fragment (hash) params to be parsed.&nbsp; If url is not passed, the current document.location is used.</td></tr></table><h4 class=CHeading>Returns</h4><p>(String) The parsed fragment (hash) string, with any leading &ldquo;#&rdquo; removed.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.param.fragment(build_url)"></a>jQuery.<wbr>param.<wbr>fragment (build url)</h3><div class=CBody><p>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.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.param.fragment( url, params [, merge_mode ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A valid URL for params to be merged into.&nbsp; This URL may contain a query string and/or fragment (hash).</td></tr><tr><td class=CDLEntry>params</td><td class=CDLDescription>(String) A params string or URL containing fragment (hash) params to be merged into url.</td></tr><tr><td class=CDLEntry>params</td><td class=CDLDescription>(Object) A params object to be merged into url.</td></tr><tr><td class=CDLEntry>merge_mode</td><td class=CDLDescription>(Number) Merge behavior defaults to 0 if merge_mode is not specified, and is as-follows:</td></tr></table><ul><li>0: params in the params argument will override any fragment (hash) params in url.</li><li>1: any fragment (hash) params in url will override params in the params argument.</li><li>2: params argument will completely replace any query string in url.</li></ul><h4 class=CHeading>Returns</h4><p>(String) Either a params string with urlencoded data or a URL with a urlencoded fragment (hash) in the format &lsquo;a=b&amp;c=d&amp;e=f&rsquo;.</p></div></div></div>
<div class="CSection"><div class=CTopic><h2 class=CTitle><a name="Deparam(from_string)"></a>Deparam (from string)</h2><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.deparam" >jQuery.<wbr>deparam</a></td><td class=SDescription>Deserialize 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.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#jQuery.deparam.querystring" >jQuery.<wbr>deparam.<wbr>querystring</a></td><td class=SDescription>Parse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.deparam.fragment" >jQuery.<wbr>deparam.<wbr>fragment</a></td><td class=SDescription>Parse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>
-<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam"></a>jQuery.<wbr>deparam</h3><div class=CBody><p>Deserialize 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.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam( params [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>params</td><td class=CDLDescription>(String) A params string to be parsed.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
+<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam"></a>jQuery.<wbr>deparam</h3><div class=CBody><p>Deserialize 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.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam( params [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>params</td><td class=CDLDescription>(String) A params string to be parsed.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false if omitted.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
-<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam.querystring"></a>jQuery.<wbr>deparam.<wbr>querystring</h3><div class=CBody><p>Parse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam.querystring( [ url ] [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A params string or URL containing query string params to be parsed.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
+<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam.querystring"></a>jQuery.<wbr>deparam.<wbr>querystring</h3><div class=CBody><p>Parse the query string from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam.querystring( [ url ] [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) An optional params string or URL containing query string params to be parsed.&nbsp; If url is omitted, the current document.location is used.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false if omitted.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
-<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam.fragment"></a>jQuery.<wbr>deparam.<wbr>fragment</h3><div class=CBody><p>Parse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam.fragment( [ url ] [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) A params string or URL containing fragment (hash) params to be parsed.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
+<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="jQuery.deparam.fragment"></a>jQuery.<wbr>deparam.<wbr>fragment</h3><div class=CBody><p>Parse the fragment (hash) from a URL or the current document.location, deserializing it into an object, optionally coercing numbers, booleans, null and undefined values.</p><h4 class=CHeading>Usage</h4><blockquote><pre>jQuery.deparam.fragment( [ url ] [, coerce ] );</pre></blockquote><h4 class=CHeading>Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>url</td><td class=CDLDescription>(String) An optional params string or URL containing fragment (hash) params to be parsed.&nbsp; If url is omitted, the current document.location is used.</td></tr><tr><td class=CDLEntry>coerce</td><td class=CDLDescription>(Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value.&nbsp; Defaults to false if omitted.</td></tr></table><h4 class=CHeading>Returns</h4><p>(Object) An object representing the deserialized params string.</p></div></div></div>
<div class="CSection"><div class=CTopic><h2 class=CTitle><a name="Element_manipulation"></a>Element manipulation</h2><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.elemUrlAttr" >jQuery.<wbr>elemUrlAttr</a></td><td class=SDescription>Get the internal &ldquo;Default URL attribute per tag&rdquo; list, or augment the list with additional tag-attribute pairs, in case the defaults are insufficient.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#jQuery.fn.querystring" >jQuery.<wbr>fn.<wbr>querystring</a></td><td class=SDescription>Update 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. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#jQuery.fn.fragment" >jQuery.<wbr>fn.<wbr>fragment</a></td><td class=SDescription>Update 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. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
View
2 docs/index/Files.html
@@ -13,7 +13,7 @@
<div id=Index><div class=IPageTitle>File Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; <a href="#J">J</a> &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-bbq-js.html#jQuery_BBQ:Back_ButtonQuery_Library" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>jQuery BBQ:<wbr>Back Button&amp;Query Library</a></td></tr></table>
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt1"><div class=CFile><b>Version: 0.1pre, Last updated: 9/30/2009</b></div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt1"><div class=CFile><b>Version: 0.1pre, Last updated: 10/1/2009</b></div></div><!--END_ND_TOOLTIPS-->
</div><!--Index-->
View
2 docs/index/General.html
@@ -33,7 +33,7 @@
<!--START_ND_TOOLTIPS-->
-<div class=CToolTip id="tt9"><div class=CFile><b>Version: 0.1pre, Last updated: 9/30/2009</b></div></div><!--END_ND_TOOLTIPS-->
+<div class=CToolTip id="tt9"><div class=CFile><b>Version: 0.1pre, Last updated: 10/1/2009</b></div></div><!--END_ND_TOOLTIPS-->
<!--START_ND_TOOLTIPS-->
View
4 docs/nd/Data/FileInfo.nd
@@ -1,4 +1,4 @@
1.4
JavaScript
-/srv/projects/jquery-bbq/jquery.ba-bbq.min.js 1254363283 0 /srv/projects/jquery-bbq/jquery.ba-bbq.min.js
-/srv/projects/jquery-bbq/jquery.ba-bbq.js 1254363227 1 jQuery BBQ: Back Button & Query Library
+/srv/projects/jquery-bbq/jquery.ba-bbq.min.js 1254430693 0 /srv/projects/jquery-bbq/jquery.ba-bbq.min.js
+/srv/projects/jquery-bbq/jquery.ba-bbq.js 1254429406 1 jQuery BBQ: Back Button & Query Library
View
BIN docs/nd/Data/SymbolTable.nd
Binary file not shown.
View
173 examples/deparam/index.php
@@ -0,0 +1,173 @@
+<?PHP
+
+include "../index.php";
+
+$shell['title2'] = "jQuery.deparam";
+
+$shell['h2'] = 'The opposite of jQuery.param, pretty much.';
+
+array_push( $shell['shBrush'], 'Php' );
+
+// ========================================================================== //
+// SCRIPT
+// ========================================================================== //
+
+ob_start();
+?>
+$(function(){
+
+ // Values are not coerced.
+ var params = $.deparam.querystring();
+
+ debug.log( 'not coerced', params );
+ $('#deparam_string').html( JSON.stringify( params, null, 2 ) );
+
+ // Values are coerced.
+ params = $.deparam.querystring( true );
+
+ debug.log( 'coerced', params );
+ $('#deparam_coerced').html( JSON.stringify( params, null, 2 ) );
+
+ // Highlight the current sample query string link
+ var qs = $.param.querystring();
+
+ $('ul a').each(function(){
+ if ( $(this).attr( 'href' ) === '?' + qs ) {
+ $(this).addClass( 'current' );
+ }
+ });
+
+});
+<?
+$shell['script'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// HTML HEAD ADDITIONAL
+// ========================================================================== //
+
+ob_start();
+?>
+<script type="text/javascript" language="javascript">
+
+// I want to use json2.js because it allows me to format stringified JSON with
+// pretty indents, so let's nuke any existing browser-specific JSON parser.
+window.JSON = null;
+
+</script>
+<script type="text/javascript" src="../../shared/json2.js"></script>
+<script type="text/javascript" src="../../jquery.ba-bbq.js"></script>
+<script type="text/javascript" language="javascript">
+
+<?= $shell['script']; ?>
+
+$(function(){
+
+ // Syntax highlighter.
+ SyntaxHighlighter.highlight();
+
+});
+
+</script>
+<style type="text/css" title="text/css">
+
+/*
+bg: #FDEBDC
+bg1: #FFD6AF
+bg2: #FFAB59
+orange: #FF7F00
+brown: #913D00
+lt. brown: #C4884F
+*/
+
+#page {
+ width: 700px;
+}
+
+.deparam {
+ width: 343px;
+}
+
+.deparam-1 {
+ float: left;
+}
+
+.deparam-2 {
+ float: right;
+}
+
+.current {
+ color: #FF7F00;
+ text-decoration: none;
+}
+
+</style>
+<?
+$shell['html_head'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// HTML BODY
+// ========================================================================== //
+
+ob_start();
+?>
+
+<p>
+ <a href="http://benalman.com/projects/jquery-bbq-plugin/">jQuery BBQ</a> includes a powerful jQuery.deparam method that is capable of fully deserializing not only any params string that jQuery.param can create, but that PHP and Rails (and hopefully everything else) can create. And even though only the query string is being parsed this example, methods for parsing a params string out of the fragment (hash) as well parsing any stand-alone params string are included. jQuery BBQ can also be used to merge params from multiple URLs or objects into a new URL, even within element attributes. See <a href="../../docs/">the documentation</a> for a full list of methods!
+</p>
+
+<h3>Sample query strings for you to click:</h3>
+
+<ul>
+ <li><a href="?a=1&a=2&a=3&b=4&c=true&d=0">?a=1&a=2&a=3&b=4&c=true&d=0</a> - this won't work in PHP (jQuery 1.3.2 or older $.param)</li>
+ <li><a href="?a[]=1&a[]=2&a[]=3&b=4&c=true&d=0">?a[]=1&a[]=2&a[]=3&b=4&c=true&d=0</a> - this will work in PHP (jQuery 1.4 or newer $.param)</li>
+ <li><a href="?a=true&b=false&c=undefined&d=&f=1&g=2&h=hello+world">?a=true&b=false&c=undefined&d=&f=1&g=2&h=hello+world</a></li>
+ <li><a href="?a[]=4&a[]=5&a[]=6&b[x][]=7&b[y]=8&b[z][]=9&b[z][]=0&b[z][]=true&b[z][]=false&b[z][]=undefined&b[z][]=&c=1">?a[]=4&a[]=5&a[]=6&b[x][]=7&b[y]=8&b[z][]=9&b[z][]=0&b[z][]=true&b[z][]=false&b[z][]=undefined&b[z][]=&c=1</a></li>
+</ul>
+
+<h3>Urldecoded query string</h3>
+
+<?= urldecode( $_SERVER['QUERY_STRING'] ) ?>
+
+
+<h3>Query string params, as parsed by jQuery BBQ (and converted to JSON)</h3>
+
+<div class="deparam deparam-1">
+ <p><code>$.deparam.querystring();</code></p>
+ <pre class="brush:js" id="deparam_string"></pre>
+</div>
+
+<div class="deparam deparam-2">
+ <p><code>$.deparam.querystring( true );</code></p>
+ <pre class="brush:js" id="deparam_coerced"></pre>
+</div>
+
+<div style="clear:both;"></div>
+
+
+<h3>GET params, as parsed by PHP</h3>
+<p><code>print_r( $_GET );</code></p>
+
+<pre class="brush:php">
+<? print_r( $_GET ) ?>
+</pre>
+
+
+<h3>The code</h3>
+
+<pre class="brush:js">
+<?= htmlspecialchars( $shell['script'] ); ?>
+</pre>
+
+<?
+$shell['html_body'] = ob_get_contents();
+ob_end_clean();
+
+// ========================================================================== //
+// DRAW SHELL
+// ========================================================================== //
+
+draw_shell();
+
+?>
View
30 jquery.ba-bbq.js
@@ -1,5 +1,5 @@
/*!
- * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/30/2009
+ * jQuery BBQ: Back Button & Query Library - v0.1pre - 10/1/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/30/2009*
+// *Version: 0.1pre, Last updated: 10/1/2009*
//
// Project Home - http://benalman.com/projects/jquery-bbq-plugin/
// GitHub - http://github.com/cowboy/jquery-bbq/
@@ -30,7 +30,7 @@
// Basic AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/
// Advanced AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/
// jQuery UI Tabs - http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/
-// Deparam - COMING SOON
+// Deparam - http://benalman.com/code/projects/jquery-bbq/examples/deparam/
//
// About: Support and Testing
//
@@ -44,7 +44,7 @@
//
// About: Release History
//
-// 0.1pre - (9/30/2009) Pre-initial release
+// 0.1pre - (10/1/2009) Pre-initial release
(function($,window){
'$:nomunge'; // Used by YUI compressor.
@@ -113,7 +113,8 @@
//
// Arguments:
//
- // url - (String) A URL containing query string params to be parsed.
+ // url - (String) A URL containing query string params to be parsed. If url
+ // is not passed, the current document.location is used.
//
// Returns:
//
@@ -161,7 +162,8 @@
//
// Arguments:
//
- // url - (String) A URL containing fragment (hash) params to be parsed.
+ // url - (String) A URL containing fragment (hash) params to be parsed. If
+ // url is not passed, the current document.location is used.
//
// Returns:
//
@@ -283,7 +285,7 @@
//
// params - (String) A params string to be parsed.
// coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false.
+ // undefined to their actual value. Defaults to false if omitted.
//
// Returns:
//
@@ -393,10 +395,11 @@
//
// Arguments:
//
- // url - (String) A params string or URL containing query string params to be
- // parsed.
+ // url - (String) An optional params string or URL containing query string
+ // params to be parsed. If url is omitted, the current document.location
+ // is used.
// coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false.
+ // undefined to their actual value. Defaults to false if omitted.
//
// Returns:
//
@@ -414,10 +417,11 @@
//
// Arguments:
//
- // url - (String) A params string or URL containing fragment (hash) params to
- // be parsed.
+ // url - (String) An optional params string or URL containing fragment (hash)
+ // params to be parsed. If url is omitted, the current document.location
+ // is used.
// coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false.
+ // undefined to their actual value. Defaults to false if omitted.
//
// Returns:
//
View
2 jquery.ba-bbq.min.js
@@ -1,5 +1,5 @@
/*
- * jQuery BBQ: Back Button & Query Library - v0.1pre - 9/30/2009
+ * jQuery BBQ: Back Button & Query Library - v0.1pre - 10/1/2009
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
View
479 shared/json2.js
@@ -0,0 +1,479 @@
+/*
+ http://www.JSON.org/json2.js
+ 2009-09-29
+
+ Public Domain.
+
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+ See http://www.JSON.org/js.html
+
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
+
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
+
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
+
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or '&nbsp;'),
+ it contains the characters used to indent at each level.
+
+ This method produces a JSON text from a JavaScript value.
+
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the value
+
+ For example, this would serialize Dates as ISO strings.
+
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
+
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
+
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
+
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
+
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
+
+ Example:
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
+
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
+
+
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
+
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
+
+ Example:
+
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
+
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
+
+
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+*/
+
+/*jslint evil: true, strict: false */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
+*/
+
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+if (!this.JSON) {
+ this.JSON = {};
+}
+
+(function () {
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ if (typeof Date.prototype.toJSON !== 'function') {
+
+ Date.prototype.toJSON = function (key) {
+
+ return isFinite(this.valueOf()) ?
+ this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z' : null;
+ };
+
+ String.prototype.toJSON =
+ Number.prototype.toJSON =
+ Boolean.prototype.toJSON = function (key) {
+ return this.valueOf();
+ };
+ }
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ?
+ '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' :
+ '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+// Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value && typeof value === 'object' &&
+ typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+// What happens next depends on the value's type.
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+ return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+ case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+// Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+ v = partial.length === 0 ? '[]' :
+ gap ? '[\n' + gap +
+ partial.join(',\n' + gap) + '\n' +
+ mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ k = rep[i];
+ if (typeof k === 'string') {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' :
+ gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+ mind + '}' : '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+ if (typeof JSON.stringify !== 'function') {
+ JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+ }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+ if (typeof JSON.parse !== 'function') {
+ JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/.
+test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
+replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+ }
+}());
View
1 unit/index.html
@@ -861,6 +861,7 @@
function(result){
if ( is_chrome ) {
+ // Read about this issue here: http://benalman.com/news/2009/09/chrome-browser-history-buggine/
ok( true, 'history is sporadically broken in chrome, this seems to be a chrome bug' );
} else {
same( x, ['almost_done', 'omg_ponies', '', '/path/to/file.php'], 'back button and window.bbq.go(-1) should work' );
View
1 unit/jquery-1.3.2.html
@@ -861,6 +861,7 @@
function(result){
if ( is_chrome ) {
+ // Read about this issue here: http://benalman.com/news/2009/09/chrome-browser-history-buggine/
ok( true, 'history is sporadically broken in chrome, this seems to be a chrome bug' );
} else {
same( x, ['almost_done', 'omg_ponies', '', '/path/to/file.php'], 'back button and window.bbq.go(-1) should work' );

0 comments on commit aa8aef6

Please sign in to comment.