Implementati eventi repeat. Implementati tab. Inizio implementazione logica load more.

This commit is contained in:
gine 2017-03-23 19:51:21 +01:00
parent 02b0aa2a51
commit 76dbff7bc5
6 changed files with 286 additions and 185 deletions

View file

@ -72,11 +72,8 @@
<!--footer -->
<div data-position="fixed" id="navfooter" data-role="footer" data-theme="b" role="contentinfo" class="hide ui-footer ui-bar-a ui-footer-fixed slideup">
<ul>
<!--li><a href="#">&#60; precedente</a></li-->
<li><a data-rel="back" href="#" data-ajax="false"><h3>INDIETRO</h3></a></li>
<!--li><a href="#">successiva &#62;</a></li-->
</ul>
</div>
@ -93,80 +90,16 @@
</div>
<!-- /header -->
<!-- Home page -->
<!-- <div data-role="page" id="index" data-dom-cache="true" data-theme="a" class="ui-page">
<center><p><img src="image/xm-logo.png" class="rwd" /></p>
<ul data-role="listview" data-inset="true">
<li>
<a class="nav" href="#ilove">
<img src="./image/ilovexm24_puzzle-300x300.jpg" class="ui-li-thumb">
<h2>I love XM24</h2>
<p>Bla blabla</p>
<!-p class="ui-li-aside">iOS</p-=>
</a>
</li>
<li>
<a class="nav" href="#info">
<img src="./image/xm24-particolare2.jpeg" class="ui-li-thumb">
<h2>Info e comunicati</h2>
<p>Bla Bla blabla</p>
<!--p class="ui-li-aside">BlackBerry</p-=>
</a>
</li>
<li>
<a class="nav" href="#events">
<img src="./image/xm24-particolare2.jpeg" class="ui-li-thumb">
<h2>Eventi</h2>
<p>Bla Bla blabla</p>
</a>
</li>
</ul>
</center>
<!=-a class="minibox orange nav" href="#eventi"> Eventi</a>
<a class="minibox green nav" href="#lab"> Laboratori</a>
<a class="minibox green nav" href="#ultime"> News</a>
<a class="minibox green nav" href="#tag"> Tag</a>
<a class="minibox blue nav" href="#quotidiano"> Un post a caso</a ==>
<br/ style="clear:both;">
<div id="aggiornahome">Aggiorna i contenuti dal sito XM24 di tanto in tanto.
<br/> Per iniziare da capo e riscaricare tutti i contenuti clicca su reset. </p>
<center>
<img src="./image/ilovexm24_puzzle-300x300.jpg" width="50px" id="aggiorna" />
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<input value="Aggiorna" data-theme="a" type="Submit" onclick="checkAndUpdate();" id="aggiorna2">
</div>
<div class="ui-block-b">
<input value="Reset" data-theme="b" type="Reset" onclick="checkAndReset();" id="resetta">
</div>
</fieldset>
</div>
<div data-role="popup" id="benvenuta" data-dismissible="false">
<p>Questa è la prima volta che apri l'app I LOVE XM, aspetta un minuto che si scarichi i contenuti dal sito. POi ricordati di tanto in tanto di andare nella sezione Aggiorna!
<p><img class="gifloader" src="./image/ajax_loader_red_512.gif" /></p>
</p>
<input type="button" value="OK" onclick='$("#benvenuta").popup("close");alterContent(#info);' />
</div>
</div> -->
<div data-role="page" id="info" data-prev="index" data-next="" data-dom-cache="true" data-theme="a" class="ui-page">
<div role="main" class="ui-content">
<!-- <center><p><img src="image/xm-logo.png" class="rwd" /></p></center> -->
<div class="ui-body">
<p class="introlettera">News</p>
<p id="mostralistainfo" class="listatovirgole listevoci">
<img class="gifloader" src="./image/ajax_loader_red_512.gif" />
<span class="preload">
<i>Non è stato attalmente caricato alcun contenuto</i>
</span>
</p>
<button onclick="loadMore()">LoadMore</button>
</div>
<!-- chiude body-->
</div>
@ -178,10 +111,25 @@
<div role="main" class="ui-content">
<div class="ui-body">
<p class="introlettera">EVENTI</p>
<p id="mostralista" class="listatovirgole listevoci">
<div data-role="tabs">
<div data-role="navbar">
<ul>
<li><a href="#single" data-theme="a" data-ajax="false">Iniziative</a></li>
<li><a href="#repeat" data-theme="a" data-ajax="false">Fissi</a></li>
</ul>
</div>
<div id="single" >
<p id="mostralista-34" class="listatovirgole listevoci">
</p>
</div>
<div id="repeat" >
<p id="mostralista-87" class="listatovirgole listevoci">
</p>
</div>
</div>
</div>
<!-- chiude body-->
</div>
<!--chiude content -->
@ -233,45 +181,7 @@
</div>
<!--chiude content -->
</div>
<!-- chiude pagina -->
<!--div data-role="page" id="aggiorna" data-transition="slide" data-prev="index" data-next="" data-dom-cache="true" data-theme="a" class="ui-page">
<div role="main" class="ui-content">
<div class="ui-body">
<p class="introlettera" id="">Aggiornamenti</p>
<p>
Aggiorna i contenuti dal sito XM24 di tanto in tanto.
<br/> Per iniziare da capo e riscaricare tutti i contenuti clicca su reset. </p>
<center>
<img src="./image/icona_aggiorna.png" id="aggiorna" />
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<input value="Aggiorna" data-theme="a" type="Submit" onclick="checkAndUpdate();" id="aggiorna2">
</div>
<div class="ui-block-b">
<input value="Reset" data-theme="b" type="Reset" onclick="checkAndReset();" id="resetta">
</div>
</fieldset>
</center>
<p id="boxdata" style="display:none;">I tuoi diritti sono stati aggiornati l'ultima volta il <span id="datadiritti">2016/07/18</span> alle <span id="datadirittiora">00:00</span>.</p>
<img src="image/icona_aggiorna.gif" style="visibility:hidden;" id="aggiornamento" />
</div>
</div>
</div>
chiude pagina -->
<div data-role="page" id="singleQpost" data-prev="index" data-next="" data-dom-cache="true" data-theme="a" class="ui-page">
<div role="main" class="ui-content">
@ -363,7 +273,6 @@
<p><img src="image/xm-logo.png" class="rwd" /></p>
<h1 class="introlettera" id="alert-title"></h1>
<h2 id="alert-message"></h2>
<!--<button onclick="spengimi()" id="spegni-musica">Ferma Musica</button>-->
</div>
<!-- chiude body-->
</div>

View file

@ -1,10 +1,10 @@
var ai1ec = (function(){
var API = {}, json = null, events = [];
var API = {}, json = [], events = [];
//Categorie di eventi
API.cats = {
single: 34,
repeat: 25
repeat: 87
};
var getCleanId = function(uid){
@ -57,20 +57,20 @@ var ai1ec = (function(){
},
};
var getXmlData = function(url, callback) {
var getXmlData = function(url, catId, callback) {
$.ajax({
url: url,
dataType: 'xml',
method: 'GET',
success: function(res) {
json = $.xml2json(res);
events = json["#document"].vcalendar.vevent;
console.log(events);
return callback(events);
json[catId] = $.xml2json(res);
events[catId] = json[catId]["#document"].vcalendar.vevent;
console.log(events[catId]);
return callback(events[catId]);
},
error: function(err){
console.log("Err: status ", err.status);
return callback(events);
return callback(events[catId]);
}
});
};
@ -94,13 +94,13 @@ var ai1ec = (function(){
//Torna un array con tutti gli eventi organizzati da xm24, un array vuoto se errore.
getAllEvents : function(catId, callback) {
var url = getDefaultUrl(catId);
getXmlData(url, callback);
getXmlData(url, catId, callback);
},
//Torna un array con gli eventi tra -30 e +30 giorni da oggi, un array vuoto se errore.
getLastEvents : function(catId, callback) {
var url = getDefaultUrl(catId) + '&' + API.remote.win;
getXmlData(url, callback);
getXmlData(url, catId, callback);
},
}

View file

@ -29,8 +29,10 @@ EVENTS.render = function() {
var ret = checkConnection('ERR_EVENT');
if (ret) {
EVENTS.getDataAndLoad(ai1ec.cats.single);
EVENTS.getDataAndLoad(ai1ec.cats.repeat);
} else {
EVENTS.loadFromDb('#mostralista', ai1ec.cats.single);
EVENTS.loadFromDb('#mostralista-'+ ai1ec.cats.single, ai1ec.cats.single);
EVENTS.loadFromDb('#mostralista-'+ ai1ec.cats.repeat, ai1ec.cats.repeat);
}
}
@ -65,7 +67,7 @@ EVENTS.getDataAndLoad = function (type) {
console.log('resultSet.rowsAffected: ' + resultSet.rowsAffected);
if(n_evs_ins + n_evs_err == n_evs - 1) {
if(n_evs_ins > 0) {
EVENTS.loadFromDb('#mostralista', type);
EVENTS.loadFromDb('#mostralista-'+ type, type);
}
}
},
@ -74,7 +76,7 @@ EVENTS.getDataAndLoad = function (type) {
n_evs_err++;
if(n_evs_ins + n_evs_err == n_evs - 1) {
if(n_evs_ins > 0) {
EVENTS.loadFromDb('#mostralista', type);
EVENTS.loadFromDb('#mostralista-'+ type, type);
} else {
toastr.info("Non ci sono nuovi eventi.");
$.mobile.loading('hide');

View file

@ -22,16 +22,20 @@ FONTE.dbName = "xm24";
FONTE.dbHandler;
FONTE.tagsPageInitiated = false;
FONTE.categoriesList = [8, 497];
FONTE.categoriesILove = [497,647,590]; //ilove, 4mar, solid
FONTE.categoriesInfo = [8,42,68,3];
FONTE.updatedCategoriesCount;
FONTE.updatedPostsCount;
FONTE.neededPostsCount;
FONTE.hrefseguente = "";
FONTE.info_page_loaded = 0;
FONTE.ilove_page_loaded = 0;
FONTE.ajaxError = false;
/*
* data ultimo aggiornamento
*/
function ultimoAggiornamento() {
function displayLastUpdateDate() {
var lastUpdate = window.localStorage.getItem('db_update_date');
if (lastUpdate) {
var data = lastUpdate.split('T');
@ -123,17 +127,13 @@ function benvenuta() {
// $("#aggiornaora").popup("open");
//};
function setFirstRun() {
function run() {
initStorage();
overlayblock();
if (window.localStorage.getItem('has_run') != 'true') {
//do some stuff if has not loaded before
overlayblock();
benvenuta();
if (checkConnection()) {
partialUpdate();
//window.localStorage.setItem('has_run', 'true');
}
} else {
}
};
@ -214,7 +214,7 @@ $(function () {
function onDeviceReady() {
// console.log('deviceready');
createDB();
setFirstRun();
run();
$("a.nav").on("click", function (event) {
// Prevent the usual navigation behavior
event.preventDefault();
@ -354,14 +354,15 @@ function cercaMe() {
}
}
function checkloader() {
myJsonLastPage('#mostralistaultime');
var mieultime = $("#mostralistaultime").html();
// console.log("ultime" + mieultime);
if (mieultime == "<span>Non ci sono nuovi contenuti.</span>") {
//feedback
function checkloader(categories) {
var div = '#mostralistainfo';
displayLastUpdateDate(categories);
renderLastNews(div, categories);
if ($(div).html() == "<span>Non ci sono nuovi contenuti.</span>") {
$("#aggiorna").attr("src", "./image/aggiorna.png");
ultimoAggiornamento();
return true
//console.log("ultime2");
}

View file

@ -36,6 +36,96 @@ function myJsonCategory(Qcategory, div, addTagCategory) {
$.mobile.loading('hide');
};
function drawPostsList(div, resultSet, categories, fallback) {
var items = [];
$(div).empty();
if (resultSet.rows.length > 0) {
for (var i = 0; i < resultSet.rows.length; i++) {
var val = JSON.parse(resultSet.rows.item(i).post);
var id = val.id;
var time = val.modified;
var title = val.title.rendered;
var url = val.guid.rendered;
// console.log(Url);
var splitTime = time.split("T");
var cleanTime = splitTime[0];
//key mi dice l'indice'
items.push("<li><a href='#singleQpost' data-post='" + id + "'>" + title + "</a><br/><small>" + cleanTime + "</small>");
}
$("<ul/>", {
"class": "my-new-list"
, html: items.join("")
}).prependTo(div);
} else if (fallback) {
fallback(div, categories);
} else {
drawNoPostsFound(div);
}
};
function drawNoPostsFound(div) {
$(div).empty();
$(div).append('<span>Non ci sono nuovi contenuti.</span>')
}
function sqlErrHandler(error){
console.log(error.message);
}
var getCategoryWhere = function(categories) {
var catsWhere = "";
for(var i = 0, len = categories.length; i < len; i++) {
var cat = categories[i];
var c = 'catid = '+ cat + ' ';
if(i == 0) {
catsWhere = '(' + c;
} else if(i == len -1) {
catsWhere += 'OR ' + c + ')';
} else {
catsWhere += 'OR ' + c;
}
}
return catsWhere;
}
var POST = POST || {};
POST.sql = {
init: "SELECT * FROM xm24_posts JOIN xm24_cats_to_posts USING(id) WHERE ",
end : "ORDER BY date COLLATE NOCASE DESC LIMIT 10"
}
var selectLastNews = function(div, categories) {
var catsWhere = getCategoryWhere(categories);
var sql = POST.sql.init + catsWhere + POST.sql.end;
FONTE.dbHandler.executeSql(sql, [], function (resultSet) {
drawPostsList(div, resultSet);
}, sqlErrHandler);
}
function renderLastNews(div, categories) {
var storage = window.localStorage;
var lastnewsDate = storage.getItem('db_lastnews_date');
var firstTime = storage.getItem('db_lastnews_firsttime');
if (firstTime == 'yes') {
selectLastNews(div, categories);
} else if (firstTime == 'no') {
if (lastnewsDate) {
var sql = POST.sql.init + "date > ? AND " + getCategoryWhere(categories) + POST.sql.end;
FONTE.dbHandler.executeSql(sql, [lastnewsDate], function (resultSet) {
drawPostsList(div, resultSet, categories, selectLastNews);
}, sqlErrHandler);
} else {
selectLastNews(div, categories);
toastr.info("Non ci sono nuovi contenuti");
}
} else {
drawNoPostsFound(div);
}
};
function myJsonLastPage(div) {
var storage = window.localStorage;
var lastnewsDate = storage.getItem('db_lastnews_date');
@ -273,7 +363,11 @@ function createDB() {
name: FONTE.dbName
, location: 'default'
}, function () {
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_posts (id INTEGER PRIMARY KEY, title, date, category, post)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_posts (id INTEGER PRIMARY KEY, title, date, post)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_cats (catid INTEGER PRIMARY KEY, title, cat)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_cats_to_posts (id, catid)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags (id INTEGER PRIMARY KEY, title, tag)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags_to_posts (id, tagid)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_pages (id INTEGER PRIMARY KEY, title, date, page)');
@ -286,6 +380,17 @@ function createDB() {
});
};
function insertOrUpdateCatToPost(id, catId) {
FONTE.dbHandler.executeSql('INSERT OR REPLACE INTO xm24_cats_to_posts VALUES (?,?)', [id, catId], function (resultSet) {
console.log('resultSet.insertId: ' + resultSet.insertId);
console.log('resultSet.rowsAffected: ' + resultSet.rowsAffected);
}, function (error) {
console.log('INSERT error: ' + error.message);
//feedback
$("#aggiorna").attr("src", "./image/aggiorna.png");
});
}
function deleteDB() {
window.sqlitePlugin.deleteDatabase({
name: FONTE.dbName
@ -330,7 +435,7 @@ function getSinglePageRecur(url, category, pagenum) {
FONTE.updatedPostsCount += 1;
console.log('Voci aggiornate: ' + FONTE.updatedPostsCount);
if (FONTE.updatedCategoriesCount >= FONTE.categoriesList.length && FONTE.updatedPostsCount >= FONTE.neededPostsCount) {
window.localStorage.setItem('has_run', 'true');
//window.localStorage.setItem('has_run', 'true');
var date = new Date();
var currentUpdate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
@ -345,7 +450,7 @@ function getSinglePageRecur(url, category, pagenum) {
//feedback
$("#aggiorna").attr("src", "./image/aggiorna.png");
ultimoAggiornamento();
displayLastUpdateDate();
} //manca il caso in cui sono stati cancellati dei post online, vanno cancellati anche dall'app.
}, function (error) {
FONTE.updatedPostsCount += 1;

View file

@ -1,3 +1,7 @@
var REST_PARAMS = REST_PARAMS || {};
REST_PARAMS.per_page = 'per_page=10';
FONTE.page_loaded = 0;
function aggiornaPages() {
var jsonurl = weburl + "wp-json/wp/v2/pages/";
$.ajax({
@ -25,7 +29,7 @@ function aggiornaSingleCategory(category) {
//resetta la variabile d'errore per le chiamate ajax asincrone
FONTE.ajaxError = false;
var jsonurl = weburl + "wp-json/wp/v2/posts?per_page=100";
var jsonurl = weburl + "wp-json/wp/v2/posts?" + REST_PARAMS.per_page;
var storage = window.localStorage;
var lastUpdate = storage.getItem('db_update_date');
@ -96,51 +100,131 @@ function update() {
}
function partialUpdate() {
//feedback
$("#aggiorna").attr("src", "./image/icona_aggiorna.gif");
var storage = window.localStorage;
var jsonurl = weburl + "wp-json/wp/v2/posts?per_page=100&categories=";
var jsonurl = weburl + "wp-json/wp/v2/posts?" + REST_PARAMS.per_page + "&categories=" + FONTE.categoriesInfo.join(',');
FONTE.updatedCategoriesCount = 0;
FONTE.updatedPostsCount = 0;
FONTE.neededPostsCount = 0;
for (var index in FONTE.categoriesList) {
aggiornaSingleCategory(FONTE.categoriesList[index])
}
FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_tags;');
// FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_tags_to_posts;');
FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_pages;');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags (id INTEGER PRIMARY KEY, title, tag)');
// FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags_to_posts (id, tagid)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_pages (id INTEGER PRIMARY KEY, title, date, page)');
aggiornaTags(1);
aggiornaPages();
FONTE.ajaxError = false;
//feedback
$("#aggiorna").attr("src", "./image/icona_aggiorna.gif");
var lastUpdate = storage.getItem('db_update_date');
if (lastUpdate)
jsonurl += "&after=" + lastUpdate;
//jsonurl += "&filter[date_query][column]=post_modified_gmt&filter[date_query][after]=" + lastUpdate;
var firstTime = storage.getItem('db_lastnews_firsttime');
if (firstTime == null) storage.setItem('db_lastnews_firsttime', 'yes');
if (firstTime == 'yes') storage.setItem('db_lastnews_firsttime', 'no');
$("#benvenuta").popup("close");
checkloader();
mygetSinglePageRecur(jsonurl, 1, FONTE.categoriesInfo);
};
/*
* data ultimo aggiornamento
*/
function ultimoAggiornamento() {
var lastUpdate = window.localStorage.getItem('db_update_date');
if (lastUpdate) {
var data = lastUpdate.split('T');
var datagiorno = data[0];
var dataora = data[1];
$("#datadiritti").empty();
$("#datadirittiora").empty();
display_results("#datadiritti", datagiorno)
display_results("#datadirittiora", dataora)
if (data) {
$("#boxdata").css("display", "block");
var updateLocalStorageDate = function(){
var date = new Date();
var currentUpdate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
currentUpdate += 'T' + ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2) + ':' + ('0' + date.getSeconds()).slice(-2);
var lastUpdate = window.localStorage.getItem('db_update_date')
window.localStorage.setItem('db_update_date', currentUpdate);
window.localStorage.setItem('db_lastnews_date', lastUpdate);
}
} else {
toastr.warning('Warn: manca la data del tuo ultimo aggiornamento. Aggiorna al più presto.');
function mygetSinglePageRecur(url, pagenum, categories) {
console.log('url:'+url);
$.ajax({
dataType: "json"
, url: url + "&page=" + pagenum
, success: function (data, textStatus, jqXHR) {
var totalPages = jqXHR.getResponseHeader('X-WP-TotalPages');
if (pagenum == totalPages || totalPages == 0)
FONTE.updatedCategoriesCount += 1;
FONTE.neededPostsCount += data.length;
if (FONTE.neededPostsCount == 0) {
toastr.info('Nessun nuovo articolo.');
updateLocalStorageDate();
$("#aggiorna").attr("src", "./image/aggiorna.png");
if(FONTE.info_page_loaded == 0) {
checkloader(categories);
}
}
var n_error = 0
$.each(data, function (key, val) {
var id = val.id;
var time = val.modified;
var title = val.title.rendered;
var tags = val.tags;
var postCategories = val.categories;
var blob = JSON.stringify(val);
FONTE.dbHandler.executeSql('INSERT OR REPLACE INTO xm24_posts VALUES (?,?,?,?)', [id, title, time, blob], function (resultSet) {
FONTE.updatedPostsCount++;
console.log('Voci aggiornate: ' + FONTE.updatedPostsCount);
if (n_error + FONTE.updatedPostsCount >= FONTE.neededPostsCount) {
updateLocalStorageDate();
toastr.info('Aggiornati ' + FONTE.updatedPostsCount + ' articoli.');
checkloader(categories);
} //manca il caso in cui sono stati cancellati dei post online, vanno cancellati anche dall'app.
}, function (error) {
n_error++;
if (n_error + FONTE.updatedPostsCount >= FONTE.neededPostsCount && FONTE.updatedPostsCount > 0 ) {
updateLocalStorageDate();
toastr.info('Aggiornati ' + FONTE.updatedPostsCount + ' articoli.');
checkloader(categories);
}
});
// $.each(tags, function (key, val) {
// aggiornaTagsToPosts(id, val);
// });
$.each(postCategories, function (key, val) {
insertOrUpdateCatToPost(id, val);
});
});
// if (pagenum < totalPages) {
// pagenum += 1;
// getSinglePageRecur(url, category, pagenum)
// }
}
, error: JSONErrorHandler
});
};
// function partialUpdate() {
// //feedback
// $("#aggiorna").attr("src", "./image/icona_aggiorna.gif");
// var storage = window.localStorage;
// var jsonurl = weburl + "wp-json/wp/v2/posts?" + REST_PARAMS.per_page + "&categories=";
//
// FONTE.updatedCategoriesCount = 0;
// FONTE.updatedPostsCount = 0;
// FONTE.neededPostsCount = 0;
// for (var index in FONTE.categoriesList) {
// aggiornaSingleCategory(FONTE.categoriesList[index])
// }
// FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_tags;');
// // FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_tags_to_posts;');
// FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_pages;');
// FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags (id INTEGER PRIMARY KEY, title, tag)');
// // FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags_to_posts (id, tagid)');
// FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_pages (id INTEGER PRIMARY KEY, title, date, page)');
// aggiornaTags(1);
// aggiornaPages();
//
// var firstTime = storage.getItem('db_lastnews_firsttime');
// if (firstTime == null) storage.setItem('db_lastnews_firsttime', 'yes');
// if (firstTime == 'yes') storage.setItem('db_lastnews_firsttime', 'no');
// $("#benvenuta").popup("close");
// checkloader();
//
// };