From 1eb104b4503aea3d0af2a78bc126e0b6cdd937d9 Mon Sep 17 00:00:00 2001 From: "cek@posta.indivia.net" Date: Wed, 29 Mar 2017 22:29:15 +0200 Subject: [PATCH 1/9] sistemato bug di scambio tab in caso non ci fossero nuovi post e aggiunto reset paginazione quando si cambia tab --- www/js/query.js | 2 +- www/js/update.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/www/js/query.js b/www/js/query.js index 520819e..4b4fe81 100644 --- a/www/js/query.js +++ b/www/js/query.js @@ -103,7 +103,7 @@ var appendPostList = function(div, resultSet, categories, fallback) { var prependPostsList = function(div, resultSet, categories, fallback) { var type = getObjKey(FONTE.categories, categories); - $(div).empty(); + //$(div).empty(); if (resultSet.rows.length > 0) { FONTE.page_loaded[type]++; drawListPost(div, resultSet, 'prepend'); diff --git a/www/js/update.js b/www/js/update.js index 3fd7fc3..c980bd1 100644 --- a/www/js/update.js +++ b/www/js/update.js @@ -62,6 +62,8 @@ function update() { } function postsUpdate(categories) { + $(FONTE.contentListClass).empty(); + var storage = window.localStorage; var type = getObjKey(FONTE.categories, categories); var jsonurl = weburl + REST_PARAMS.posts + REST_PARAMS.per_page + "&categories=" + categories.join(','); @@ -177,6 +179,10 @@ function getPrevSinglePageRecur(url, pagenum, categories) { } function getLastSinglePageRecur(url, pagenum, categories) { + // resetto la paginazione di #info e #ilove + FONTE.page_loaded.info = 0; + FONTE.page_loaded.ilove = 0; + var type = getObjKey(FONTE.categories, categories); console.log('url:'+url); @@ -238,7 +244,11 @@ function getLastSinglePageRecur(url, pagenum, categories) { insertOrUpdateCatToPost(id, val); }); }); + + if (data.length == 0) { + renderLastNews(FONTE.contentListClass, categories); + } }, error: JSONErrorHandler }); -} \ No newline at end of file +} From 9af340d0a5974e7caf75a11834b4e7f78549f44b Mon Sep 17 00:00:00 2001 From: "cek@posta.indivia.net" Date: Wed, 29 Mar 2017 23:25:34 +0200 Subject: [PATCH 2/9] sistemato il loader --- www/js/crud.events.js | 10 +++++----- www/js/main.js | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/www/js/crud.events.js b/www/js/crud.events.js index 3b0cc95..75d1f90 100644 --- a/www/js/crud.events.js +++ b/www/js/crud.events.js @@ -30,11 +30,11 @@ EVENTS.eventsLoaded = 0; EVENTS.render = function() { EVENTS.eventsLoaded = 0; - //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); +// //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); var ret = checkConnection('ERR_EVENT'); if (ret) { diff --git a/www/js/main.js b/www/js/main.js index 57f20fa..e5bacb5 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -63,7 +63,20 @@ function displayLastUpdateDate() { function alterContent(url) { var paginacorrente = $("body").pagecontainer("getActivePage").attr("id"); - switch (url) { + var oldUrl = url; + + $( "#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); + + //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"); $("#navfooter").addClass("hide"); @@ -108,10 +121,10 @@ 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); +// $( "#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) { @@ -147,6 +160,10 @@ function initMainPage() { document.addEventListener("deviceready", onDeviceReady, false); //le cose all'inizio +$(document).on("pagecontainershow", function (e, ui) { + $.mobile.loading('show'); +}); + $(document).on("mobileinit", function () { $("body").pagecontainer({ defaults: true From 5bc376f05498bca50601b1c12169c5a171e3773f Mon Sep 17 00:00:00 2001 From: Renato Gabriele Date: Wed, 29 Mar 2017 23:26:11 +0200 Subject: [PATCH 3/9] pp --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5deb4be..a768ade 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Refresh: ADK (android developer kit) e ### Cordova CLI ### - +. Cordova si intalla con npm, packager di nodejs `npm install -g cordova` From 813d70c23f077dc6ee7906f95520c4f9c5e46f5f Mon Sep 17 00:00:00 2001 From: "cek@posta.indivia.net" Date: Wed, 29 Mar 2017 23:31:29 +0200 Subject: [PATCH 4/9] fixato loader (di nuovo) --- www/js/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/js/main.js b/www/js/main.js index e5bacb5..c96c517 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -161,7 +161,10 @@ document.addEventListener("deviceready", onDeviceReady, false); //le cose all'inizio $(document).on("pagecontainershow", function (e, ui) { - $.mobile.loading('show'); + var pageId = $('body').pagecontainer('getActivePage').prop('id'); + if (pageId != 'about') { + $.mobile.loading('show'); + } }); $(document).on("mobileinit", function () { From f8e63e7271f16ae79c0af9f29069e38d58b93c30 Mon Sep 17 00:00:00 2001 From: Renato Gabriele Date: Wed, 29 Mar 2017 23:34:26 +0200 Subject: [PATCH 5/9] ppp --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a768ade..5deb4be 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Refresh: ADK (android developer kit) e ### Cordova CLI ### -. + Cordova si intalla con npm, packager di nodejs `npm install -g cordova` From 224c7e795e9eec26b2df92da427abe27a855143e Mon Sep 17 00:00:00 2001 From: Renato Gabriele Date: Wed, 29 Mar 2017 23:41:22 +0200 Subject: [PATCH 6/9] pp --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5deb4be..a768ade 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Refresh: ADK (android developer kit) e ### Cordova CLI ### - +. Cordova si intalla con npm, packager di nodejs `npm install -g cordova` From 522e879626c47c9035d51ec8ff3d5d00271f8092 Mon Sep 17 00:00:00 2001 From: Renato Gabriele Date: Thu, 30 Mar 2017 00:05:11 +0200 Subject: [PATCH 7/9] p --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a768ade..5deb4be 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Refresh: ADK (android developer kit) e ### Cordova CLI ### -. + Cordova si intalla con npm, packager di nodejs `npm install -g cordova` From bb84dd74516d2ddd53aaf1e4e6b95614f3b3f5bc Mon Sep 17 00:00:00 2001 From: Renato Gabriele Date: Thu, 30 Mar 2017 00:08:39 +0200 Subject: [PATCH 8/9] p --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5deb4be..a8dd8dd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ ADK (android developer kit) e ### Cordova CLI ### -Cordova si intalla con npm, packager di nodejs +Cordova si intalla con npm, packager di nodejs: `npm install -g cordova` From 86c0a9bfc7d69f6c82ac9e967f1083a1fb451a52 Mon Sep 17 00:00:00 2001 From: "cek@posta.indivia.net" Date: Thu, 30 Mar 2017 00:11:55 +0200 Subject: [PATCH 9/9] sistemato loader un'altra volta --- www/js/main.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/www/js/main.js b/www/js/main.js index c96c517..b4ce1b8 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -39,6 +39,8 @@ FONTE.hrefseguente = ""; FONTE.contentListId = '#mostralistainfo'; FONTE.contentListClass = '.news'; FONTE.ajaxError = false; + +FONTE.back_pressed = false; /* * data ultimo aggiornamento */ @@ -160,9 +162,20 @@ function initMainPage() { document.addEventListener("deviceready", onDeviceReady, false); //le cose all'inizio + +$(window).on("navigate", function (event, data) { + var direction = data.state.direction; + if (direction == 'back') { + FONTE.back_pressed = true; + } + else { + FONTE.back_pressed = false; + } +}); + $(document).on("pagecontainershow", function (e, ui) { var pageId = $('body').pagecontainer('getActivePage').prop('id'); - if (pageId != 'about') { + if ((pageId == 'ilove' || pageId == 'info' || pageId == 'events') && !FONTE.back_pressed) { $.mobile.loading('show'); } });