Permalink
Browse files

adding a super bloody cool ability to change the URL string when the …

…user changes search options
  • Loading branch information...
markmacgillivray committed Mar 15, 2013
1 parent bc6dbc6 commit aa56cc6b8e0a56baa4412411ac5b7a7fb6a98add
Showing with 11 additions and 1 deletion.
  1. +11 −1 jquery.facetview.js
View
@@ -305,6 +305,10 @@ post_search_callback
--------------------
This can define or reference a function that will be executed any time new search results are retrieved and presented on the page.
+pushstate
+---------
+Updates the URL string with the current query when the user changes the
+
*/
@@ -407,7 +411,8 @@ This can define or reference a function that will be executed any time new searc
"resultwrap_end":"</td></tr>",
"result_box_colours":[],
"fadein":800,
- "post_search_callback": false
+ "post_search_callback": false,
+ "pushstate": true
};
@@ -1038,6 +1043,11 @@ This can define or reference a function that will be executed any time new searc
}
// make the search query
var qrystr = elasticsearchquery();
+ // augment the URL bar if possible
+ if ( options.pushstate ) {
+ var currurl = '?source=' + options.querystring;
+ window.history.pushState("","search",currurl);
+ };
$.ajax({
type: "get",
url: options.search_url,

0 comments on commit aa56cc6

Please sign in to comment.