Преглед на файлове

fixed back to home mobile #423

Bachir Soussi Chiadmi преди 3 години
родител
ревизия
11d54412cd
променени са 2 файла, в които са добавени 24 реда и са изтрити 18 реда
  1. 0 0
      web/themes/custom/edlptheme/assets/dist/scripts/main.min.js
  2. 24 18
      web/themes/custom/edlptheme/assets/scripts/main.js

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
web/themes/custom/edlptheme/assets/dist/scripts/main.min.js


+ 24 - 18
web/themes/custom/edlptheme/assets/scripts/main.js

@@ -829,7 +829,7 @@
       }
     };
     function onHistoryPopState(e){
-      console.log('onPopState',e.state);
+      console.log('onHistoryPopState',e.state);
       if(e.state.home){
         backToFrontPage(true);
       }
@@ -2247,25 +2247,31 @@
     //                             |___/
     function backToFrontPage(pop_state){
       console.log('backToFrontPage', pop_state);
-      closeAllModals();
-      // assume we are going back to front page
-      $('body').removeClass().addClass('path-frontpage');
-      $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
-      // close entrees
-      if(_corpus_ready){
-        _$corpus_canvas.trigger({'type':'close-all-entree'});
-        _$corpus_canvas.trigger({'type':'scramble-collection'});
-      }
 
-      if(typeof pop_state == "undefined" || !pop_state){
-        console.log('backToFrontPage push state');
-        state = {
-          home:true,
-          context:"home",
-          caller:null
+      if(!_is_mobile){
+        closeAllModals();
+        // assume we are going back to front page
+        $('body').removeClass().addClass('path-frontpage');
+        $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
+        // close entrees
+        if(_corpus_ready){
+          _$corpus_canvas.trigger({'type':'close-all-entree'});
+          _$corpus_canvas.trigger({'type':'scramble-collection'});
         }
-        _states_history.unshift(state);
-        history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
+
+        if(typeof pop_state == "undefined" || !pop_state){
+          console.log('backToFrontPage push state');
+          state = {
+            home:true,
+            context:"home",
+            caller:null
+          }
+          _states_history.unshift(state);
+          history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
+        }
+      }else{
+        // if mobile reload the front page
+        ajaxLoadContent({home: true, ajax_path: 'home_m/ajax', sys_path: 'frontpage'});
       }
     }
 

Някои файлове не бяха показани, защото твърде много файлове са промени