|
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.9"; |
| 4 | + Unbxd.jsSdkVersion = "1.0.10"; |
5 | 5 |
|
6 | 6 | // Production steps of ECMA-262, Edition 5, 15.4.4.14
|
7 | 7 | // Reference: http://es5.github.io/#x15.4.4.14
|
@@ -1981,12 +1981,31 @@ var unbxdSearchInit = function(jQuery, Handlebars){
|
1981 | 1981 | });
|
1982 | 1982 | };
|
1983 | 1983 |
|
1984 |
| -if(!window.jQuery || !window.Handlebars) |
1985 |
| - throw "Please include jQuery & Handlebars libraries before loading unbxdSearch.js"; |
1986 | 1984 |
|
1987 |
| -var arr = jQuery.fn.jquery.split('.'); |
1988 |
| -if( arr[0] < 1 || (arr[0] == 1 && arr[1] < 7) ) |
1989 |
| - throw "jQuery version needs to be greater than 1.7 to use unbxdSearch.js. You can pass custom jQuery & Handlebars by calling unbxdSeachInit(jQuery, Handlebars)"; |
| 1985 | +Unbxd = window.Unbxd || {}; |
1990 | 1986 |
|
| 1987 | +Unbxd.isJqueryRequiredVersion = Unbxd.isJqueryRequiredVersion || |
| 1988 | + function isJqueryRequiredVersion(current) { |
| 1989 | + var jQueryVersion = current.split('.'); |
| 1990 | + jQueryVersion = jQueryVersion.map(function convertToNumber(version) { |
| 1991 | + return Number(version); |
| 1992 | + }); |
| 1993 | + if ( |
| 1994 | + jQueryVersion[0] > 1 || (jQueryVersion[0] === 1 && jQueryVersion[1] >= 7) |
| 1995 | + ) { |
| 1996 | + return true; |
| 1997 | + } |
| 1998 | + return false; |
| 1999 | + }; |
1991 | 2000 |
|
1992 |
| -unbxdSearchInit(jQuery, Handlebars); |
| 2001 | +if (!window.jQuery || !window.Handlebars) { |
| 2002 | + console.error( |
| 2003 | + 'Please include jQuery & Handlebars libraries before loading unbxdSearch.js or You can pass custom jQuery & Handlebars by calling unbxdSeachInit(jQuery, Handlebars) ' |
| 2004 | + ); |
| 2005 | +} else if (!Unbxd.isJqueryRequiredVersion(jQuery.fn.jquery)) { |
| 2006 | + console.error( |
| 2007 | + 'jQuery version needs to be greater than 1.7 to use unbxdSearch.js. You can pass custom jQuery & Handlebars by calling unbxdSeachInit(jQuery, Handlebars)' |
| 2008 | + ); |
| 2009 | +} else { |
| 2010 | + unbxdSearchInit(jQuery, Handlebars); |
| 2011 | +} |
0 commit comments