gine 7 лет назад
Родитель
Сommit
34e9ee2fa5
1 измененных файлов с 11 добавлено и 20 удалено
  1. 11 20
      www/js/main.js

+ 11 - 20
www/js/main.js

@@ -72,12 +72,6 @@ function alterContent(url) {
     // store the data-foo attribute information with the url
     $.mobile.navigate(url);
 
-    //Se si lancia il loader prima che sia cambiata pagina il loader scompare,
-    // ritardando invece che appaia, quando appare è già sulla pagina in cambiata
-//    setTimeout(function () {
-//        $.mobile.loading('show');
-//    }, 300);
-
     switch (oldUrl) {
     case '#index':
         $("#navheader").addClass("hide");
@@ -95,17 +89,25 @@ function alterContent(url) {
     case '#ilove':
         $("#navheader").removeClass("hide");
         $("#navfooter").addClass("hide");
-        postsUpdate(FONTE.categories.ilove);
+        if(checkConnection()) {
+            postsUpdate(FONTE.categories.ilove);
+        } else {
+            renderLastNews(FONTE.contentListClass, FONTE.categories.ilove);
+        }
         break;
     case '#info':
         $("#navheader").removeClass("hide");
         $("#navfooter").addClass("hide");
-        postsUpdate(FONTE.categories.info);
+        if(checkConnection()) {
+            postsUpdate(FONTE.categories.info);
+        } else {
+            renderLastNews(FONTE.contentListClass, FONTE.categories.info);
+        }
         break;
     case '#events':
         $("#navheader").removeClass("hide");
         $("#navfooter").addClass("hide");
-        EVENTS.render();
+        EVENTS.render(); //il checkconenction è fatto dentro
         break;
     case '#laboratori':
         $("#navheader").removeClass("hide");
@@ -128,10 +130,6 @@ function alterContent(url) {
         myJsonRandomPost('#titolosingleR', '#mostracontentsingleR');
         break;
     }
-//    $( "#outside" ).panel( "close" );
-//    // Alter the url according to the anchor's href attribute, and
-//    // store the data-foo attribute information with the url
-//    $.mobile.navigate(url);
 }
 /*///////////////utilities//////////////http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript*/
 function getParameterByName(name, url) {
@@ -242,13 +240,6 @@ Site.prototype.init = function () {
     });
 };
 
-// On document ready
-$(function () {
-    // intercettaUrl();
-    // new Site();
-    // $(".minibox").click(function () {});
-});
-
 function onDeviceReady() {
     // console.log('deviceready');
     createDB();