diff --git a/sites/all/modules/contrib/search_api_ajax/search_api_ajax.js b/sites/all/modules/contrib/search_api_ajax/search_api_ajax.js index bac3313..3d1e13d 100644 --- a/sites/all/modules/contrib/search_api_ajax/search_api_ajax.js +++ b/sites/all/modules/contrib/search_api_ajax/search_api_ajax.js @@ -43,7 +43,10 @@ // Read URL and remove Drupal base with RegExp Drupal.search_api_ajax.readUrl = function(url) { - return url.replace(new RegExp('^.*' + Drupal.settings.basePath + ajaxPath + '/' + '?'), ''); + url = url.replace(new RegExp('^.*' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '/' + '?'), ''); + // Try replacing again, if ajaxPath has changed to include search_api_ajax/ prefix but settings not being reloaded + url = url.replace(new RegExp('^.*' + Drupal.settings.basePath + Drupal.settings.pathPrefix + 'search_api_ajax/' + ajaxPath + '/' + '?'), ''); + return url; }; // Translate clicked URL to BBQ state @@ -132,7 +135,7 @@ } // Get AJAX, callback for returned JSON data - $.get(Drupal.settings.basePath + 'search_api_ajax/' + ajaxPath + path, { + $.get(Drupal.settings.basePath + Drupal.settings.pathPrefix + 'search_api_ajax/' + ajaxPath + path, { query: data['query'], sort: data['sort'], order: data['order'], @@ -265,7 +268,7 @@ // Observe facet and sorts links ^ starts with * contains // Check two paths: ^basePath/ajaxPath OR ^search_api_ajax/basePath/ajaxPath - $(selector + ' a[href="' + Drupal.settings.basePath + ajaxPath + '"], ' + selector + ' a[href^="' + Drupal.settings.basePath + ajaxPath + '?"], ' + selector + ' a[href^="' + Drupal.settings.basePath + ajaxPath + '#"], ' + selector + ' a[href^="' + Drupal.settings.basePath + ajaxPath + '/"], ' + selector + ' a[href^="' + Drupal.settings.basePath + 'search_api_ajax/' + ajaxPath + '"]').live('click', function() { + $(selector + ' a[href^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '"], ' + selector + ' a[href^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '?"], ' + selector + ' a[href^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '#"], ' + selector + ' a[href^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '/"], ' + selector + ' a[href^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + 'search_api_ajax/' + ajaxPath + '"]').live('click', function() { return Drupal.search_api_ajax.navigateUrl($(this).attr('href')); }); @@ -287,7 +290,7 @@ }); // Observe facet range sliders - $(selector + ' .search-api-ranges-widget form[action^="' + Drupal.settings.basePath + ajaxPath + '"], ' + selector + ' .search-api-ranges-widget form[action^="' + Drupal.settings.basePath + 'search_api_ajax/' + ajaxPath + '"]').live('submit', function() { + $(selector + ' .search-api-ranges-widget form[action^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + ajaxPath + '"], ' + selector + ' .search-api-ranges-widget form[action^="' + Drupal.settings.basePath + Drupal.settings.pathPrefix + 'search_api_ajax/' + ajaxPath + '"]').live('submit', function() { rangeTarget = Drupal.search_api_ajax.readUrl('/' + $(this).find('input[name="path"]').val()); rangeField = $(this).find('input[name="range-field"]').val(); rangeFrom = $(this).find('input[name="range-from"]').val();