Jelajahi Sumber

fixed infinite scroll with advenced search

Bachir Soussi Chiadmi 7 tahun lalu
induk
melakukan
9d45086951

File diff ditekan karena terlalu besar
+ 0 - 0
sites/all/modules/gui/materiobasemod/js/dist/materio_search_api_ajax.min.js


+ 15 - 5
sites/all/modules/gui/materiobasemod/js/materio_search_api_ajax.js

@@ -220,12 +220,18 @@ MaterioSearchApiAjax = function(){
   };
 
   function loadNextResultsPage(href){
-    trace('loadNextResultsPage');
-    var keys = href.match(/explore\/([^\/|\?]+)/);
+    trace('loadNextResultsPage', href);
+    var searchmode = href.match(/explore\/filters\//) ? 'advanced' : 'fulltext';
+    trace("searchmode", searchmode);
+    if(searchmode == 'advanced'){
+      var keys = href.match(/explore\/filters\/([^\/|\?]+)/);
+    }else{
+      var keys = href.match(/explore\/([^\/|\?]+)/);
+    }
     var page = href.match(/\?page=([0-9]+)/);
     var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/search/'+page[1];
 
-    loadNextPage(url, keys[1], $('.materiobase-results', _$content), '.search-results');
+    loadNextPage(url, keys[1], $('.materiobase-results', _$content), '.search-results', searchmode);
   };
 
   function loadNextActualityPage(href){
@@ -236,11 +242,15 @@ MaterioSearchApiAjax = function(){
     loadNextPage(url, '', $('.materiobase-actuality', _$content), '.actuality-items');
   };
 
-  function loadNextPage(url, keys, $container, target){
+  function loadNextPage(url, keys, $container, target, searchmode){
     // trace('MaterioSearchApiAjax :: loadNextPage()');
+
+    // define mode (between full text or only term selected on autocompletion)
+    searchmode = searchmode || "fulltext";
+
     _isloadingresults = true;
     $container.addClass('loading');
-    $.getJSON(url, {'keys':keys}, function(json){
+    $.getJSON(url, {'keys':keys,'searchmode':searchmode}, function(json){
       //trace('json', json);
       $container.removeClass('loading');
       addNextpage(json, target);

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini