|
1 | 1 | //uglifyjs unbxdSearch.js -o unbxdSearch.min.js && gzip -c unbxdSearch.min.js > unbxdSearch.min.js.gz && aws s3 cp unbxdSearch.min.js.gz s3://unbxd/unbxdSearch.js --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-encoding gzip --cache-control max-age=3600
|
2 | 2 | var unbxdSearchInit = function(jQuery, Handlebars){
|
3 | 3 | window.Unbxd = window.Unbxd || {};
|
| 4 | + Unbxd.jsSdkVersion = "1.0.1"; |
4 | 5 |
|
5 | 6 | // Production steps of ECMA-262, Edition 5, 15.4.4.14
|
6 | 7 | // Reference: http://es5.github.io/#x15.4.4.14
|
@@ -477,6 +478,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
|
477 | 478 | '</li>',
|
478 | 479 | '{{/options}}'
|
479 | 480 | ].join('')
|
| 481 | + ,searchQueryParam:"q" |
480 | 482 | };
|
481 | 483 |
|
482 | 484 | jQuery.extend(Unbxd.setSearch.prototype,{
|
@@ -1045,7 +1047,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
|
1045 | 1047 | var nonhistoryPath = "";
|
1046 | 1048 |
|
1047 | 1049 | if(this.options.type == "search" && this.params['query'] != undefined){
|
1048 |
| - url += '&q=' + encodeURIComponent(this.params.query); |
| 1050 | + url += '&'+ this.options.searchQueryParam +'='+ encodeURIComponent(this.params.query); |
1049 | 1051 | }else if(this.options.type == "browse" && this.params['categoryId'] != undefined){
|
1050 | 1052 | url += '&category-id=' + encodeURIComponent(this.params.categoryId);
|
1051 | 1053 | }
|
@@ -1189,7 +1191,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
|
1189 | 1191 | }
|
1190 | 1192 |
|
1191 | 1193 | this.ajaxCall = jQuery.ajax({
|
1192 |
| - url: urlobj.url |
| 1194 | + url: urlobj.url.replace(this.options.searchQueryParam+"=", "q=") |
1193 | 1195 | ,dataType: "jsonp"
|
1194 | 1196 | ,jsonp: 'json.wrf'
|
1195 | 1197 | ,success: cb.bind(self)
|
@@ -1300,8 +1302,8 @@ var unbxdSearchInit = function(jQuery, Handlebars){
|
1300 | 1302 | params.extra.rows = this.options.pageSize;
|
1301 | 1303 |
|
1302 | 1304 | //lets get query
|
1303 |
| - if("q" in obj) |
1304 |
| - params.query = obj.q; |
| 1305 | + if(this.options.searchQueryParam in obj) |
| 1306 | + params.query = obj[this.options.searchQueryParam]; |
1305 | 1307 |
|
1306 | 1308 | //lets get category-id
|
1307 | 1309 | if("category-id" in obj)
|
|
0 commit comments