var larLogin;
var isAppWebView;
var matomo_visitor_id;
var checkLarLoginJwtExecuted = false;
var isRuningZephr = false;
var newuser_mailChecked = 0;
var intervalIdMailChecked;
var benutzerId = 0;
var swiper = new Swiper(".larAgendaSwiper", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
// check parameters get isAppWebView
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
isAppWebView = urlParams.get('isAppWebView') || 0;
if (isAppWebView==-1) {
localStorage.removeItem('larIsAppWebView');
}
if (isAppWebView==0) {
isAppWebView = localStorage.getItem('larIsAppWebView') || 0;
}
if (isAppWebView==1) {
window.localStorage.setItem('larIsAppWebView', 1);
/** funzione di rimozione dei elementi che in app non devono essere visti (header e footer) */
$('#h').hide();
$('#f').hide();
$('header').hide();
$('footer').hide();
}
$(document).ready(function() {
const divUserCheckValidationEmail = $("#divUserCheckValidationEmail");
if (divUserCheckValidationEmail.length > 0) {
userCheckValidationEmail(0);
}
const textContainers = $(".text-container-candidato");
if (textContainers.length > 0) {
// Itera su tutti gli elementi con la classe .text-container
textContainers.each(function() {
const textContainer = $(this);
const divs = textContainer.find(".candidato");
let currentIndex = 0;
function showNextDiv() {
divs.eq(currentIndex).hide(); // Nascondi il div corrente
currentIndex = (currentIndex + 1) % divs.length; // Passa al successivo (ciclico)
divs.eq(currentIndex).show(); // Mostra il nuovo div
}
// Imposta un intervallo per cambiare i div ogni 2 secondi (puoi regolare il tempo)
if (divs.length > 0) {
setInterval(showNextDiv, 2000);
}
});
}
});
function userCheckValidationEmail(benutzerIdVal) {
if (benutzerIdVal > 0) {
benutzerId = benutzerIdVal;
} else {
benutzerId = $('#benutzerId').html() || 0;
}
console.log('userCheckValidationEmail benutzerId',benutzerId);
if (benutzerId == 0 && benutzerId == '') {
return false;
}
let count = 1;
let secondsPassed = 0;
const maxCalls = 20;
$('#divUserCheckValidationEmail').html('
In attesa verifica email ... '+count+' di '+maxCalls+'.');
ajaxUserCheckValidationEmail(count);
// Imposta l'intervallo ogni 10 secondi fa una richiesta
if (newuser_mailChecked == 0) {
intervalIdMailChecked = setInterval(function() {
secondsPassed++;
if (newuser_mailChecked == 1) {
clearInterval(intervalIdMailChecked);
count = 0;
secondsPassed = 0;
} else {
restSeconds = 20 - secondsPassed;
txtSecondi = restSeconds == 1 ? restSeconds+' secondo' : restSeconds+' secondi';
nextCount = count + 1;
$('#divUserCheckValidationEmail').html('Stiamo aspettando che tu abbia seguito la verifica del tuo indirizzo email tramite la procedura che ti abbiamo spedito.
Prossima verifica ('+nextCount+' di '+maxCalls+') tra ... '+txtSecondi+'. ');
if (restSeconds <= 1) {
secondsPassed = 0;
count++;
$('#divUserCheckValidationEmail').html('
In attesa verifica email ... '+count+' di '+maxCalls+'.');
ajaxUserCheckValidationEmail(count);
}
if (count >= maxCalls || newuser_mailChecked == 1) {
clearInterval(intervalIdMailChecked);
console.log("Massimo numero di richiami raggiunto.");
$('#divBtnReCheckValidationEmail').show(); // visualizzo i tasti manuali - login e verifica
$('#divUserCheckValidationEmail').hide(); // nascondo il box dopo i tentativi fatti
count = 0;
secondsPassed = 0;
}
}
}, 2000);
}
}
async function ajaxUserCheckValidationEmail(count) {
if (newuser_mailChecked==1) {
return false;
}
var urlApiCheck = $('#urlApiCheck').text();
console.log('chiamo url',urlApiCheck);
var idContent = $('#idContent').html() || 0;
var toRedirect = idContent > 0 ? true : false;
try {
await $.ajax({
type : 'GET',
url : urlApiCheck,
jsonp: "callback",
success: function (js) {
jsMailChecked = js.mailChecked || 0;
jsBenutzerId = js.benutzerId || 0;
jsLocalStorageLarLogin = js.localStorageLarLogin || '';
if (js.status=="ok" && jsBenutzerId > 0 && jsMailChecked == 1) {
console.log('risposta da urlApiCheck ');
$('#divUserCheckValidationEmail').html(' Email verificata. Redirect in corso ...');
clearInterval(intervalIdMailChecked);
console.log("Intervallo interrotto.");
// faccio il redirect //
if (jsLocalStorageLarLogin !== '') {
nuovoUtenteLoginJwt(jsLocalStorageLarLogin,toRedirect,idContent)
}
}
},
error: function(e) {
e = e || '';
console.log('ajaxUserCheckValidationEmail operazione non riuscita errore: '+e);
}
});
} catch(e) {
e = e || '';
console.log('ajaxUserCheckValidationEmail Operazione non riuscita: '+e);
}
}
document.addEventListener('DOMContentLoaded', (event) => {
/*
// faccio partire zephr dopo il controllo dell'utente
let opt = {
jwt : larGetCookies('larJwt')
}
//console.log('Running Zephr', opt);
console.log('Running Zephr');
zephrBrowser.run(opt);
*/
// zephr();
});
App.prototype.larMapContainer = function(){
jQuery.ajax({
url: 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBQC4r19eMkdMBhL8MbH08u6dtAtxCmDFI&callback=initMapGoogle',
dataType: 'script',
async: false,
success: function(){
}
});
}
function zephr() {
if (isRuningZephr) {
return true;
}
let opt = {
jwt : larGetCookies('larJwt')
}
//console.log('Running Zephr', opt);
console.log('Running Zephr');
zephrBrowser.run(opt);
isRuningZephr = true;
}
function larPro65ChangeFormato() {
if (jQuery('#inputFormato').val()=='solo cartaceo') {
jQuery('#zoneEmail').hide();
jQuery('#inputEmail').removeAttr('required');
jQuery('#inputPassword').removeAttr('required');
} else {
jQuery('#zoneEmail').show();
jQuery('#inputEmail').addAttr('required');
jQuery('#inputPassword').addAttr('required');
}
}
function initMapGoogle() {
// The location of Uluru,
//46.1903972,9.016531,
//52R9+5F Bellinzona
var iconBase = 'https://www.laregione.ch/img/laregione.ch/favicons/favicon-32x32.png';
var uluru = {lat: 46.190401, lng: 9.018783};
// The map, centered at Uluru
var map = new google.maps.Map(
document.getElementById('larMapContainer'), {zoom: 18, center: uluru});
// The marker, positioned at Uluru
var marker = new google.maps.Marker({position: uluru, map: map,title:'laRegione',icon: iconBase});
}
App.prototype.showPassword = function(el, event) {
var id = '';
if (typeof jQuery(el).attr('data-id') !== undefined){
id = jQuery(el).attr('data-id');
}
if (jQuery('#'+id).attr('type') == 'password') {
jQuery('#'+id).attr('type','text');
jQuery('#'+id+'Btn').attr('class','fa fa-eye-slash');
} else {
jQuery('#'+id).attr('type','password');
jQuery('#'+id+'Btn').attr('class','fa fa-eye');
}
}
App.prototype.laregGdpr = function(){
_this.addJs('https://cdn.opencmp.net/tcf-v2/cmp-stub-latest.js',function(){},'open-cmp-stub');
return false;
}
App.prototype.laregGdprForce = function(){
$('#gdprBanner').hide();
_this.gdpr('','','save');
this.addJs('https://cdn.opencmp.net/tcf-v2/cmp-stub-latest.js',function(){},'open-cmp-stub');
}
App.prototype.larSubmitForm = function() {
debug.log('eseguo');
return false;
}
App.prototype.larFormLoginInputInit = function() {
// faccio il test se è loggato allora, mostro il logout
jQuery('#inputPwd').keypress(function (e) {
if (e.which == 13) {
jQuery('#btnInviaFormLogin').trigger('click');
return false; //<---- Add this line
}
});
}
App.prototype.laregUser = null;
App.prototype.laregLogout = function(){
var checkUrl = '/ext/faros.php';
if(this.m.config.widgetMode || this.m.config.appMode){
if(checkUrl.indexOf(this.m.config.baseUrl) === -1){
checkUrl = this.m.config.baseUrl + checkUrl ;
}
}
jQuery.ajax({
url: checkUrl+'?auid='+this.getlaregLoginSession()+'&logout=1',
cache: false,
success: function(successCallBack){
app.laregUser = {login : false};
if(successCallBack.logout){
app.removefromLocalStorage(hex_md5(app.getlaregLoginSession()));
app.removefromLocalStorage("laregLoginSession");
app.reloadPage();
}
}
});
};
App.prototype.laregLoginCheck = function(){
debug.log('laregLoginCheck');
if(!this.getlaregLoginSession()){
this.laregUser = {login : false};
return false;
}
var checkUrl = '/ext/faros.php';
if(this.m.config.widgetMode || this.m.config.appMode){
if(checkUrl.indexOf(this.m.config.baseUrl) === -1){
checkUrl = this.m.config.baseUrl + checkUrl ;
}
}
jQuery.ajax({
url: checkUrl+'?auid='+this.getlaregLoginSession(),
cache: false,
success: function(successCallBack){
app.laregUser = successCallBack;
debug.log('faros success');
if(successCallBack.error){
var savedLogin = app.getStorage(hex_md5(app.getlaregLoginSession()));
if(savedLogin){
successCallBack = JSON.parse(savedLogin.base64Decode());
}
}
if(successCallBack.login){
app.setStorage(hex_md5(app.getlaregLoginSession()), JSON.stringify(successCallBack).base64Encode());
jQuery('.logout').css('display', 'inline-block');
if(successCallBack.infos[1]){
jQuery('.loginName').html(successCallBack.infos[1]);
}else if(successCallBack.infos[2]){
jQuery('.loginName').html(successCallBack.infos[2]);
}
// per debug dell'app
if (successCallBack.infos[0]) {
if (successCallBack.infos[0]==108913 || successCallBack.infos[0]==110706)
jQuery('.loginNewDebugMobile').show();
}
if(successCallBack.services && successCallBack.services.length > 0 && successCallBack.services[0][2]){
switch (successCallBack.services[0][2]){
case 'lro':
jQuery('.abbonati').css('display', 'none');
break;
case 'lr':
case 'lrop':
jQuery('.abbonati').css('display', 'none');
jQuery('.leggi').css('display', 'inline-block');
break;
}
}
jQuery('#leggi_lareg').show();
jQuery('#leggi_lareg_out').hide();
/*
// PAYWALL VECCHIO
if(app.payWallData){
app.payWallData.logged_user = 1;
if(successCallBack.services && successCallBack.services.length > 0){
app.payWallData.services = successCallBack.services;
}
}
*/
}else{
app.removefromLocalStorage("laregLoginSession");
}
/*
// PAYWALL VECCHIO
if(app.payWallData){
app.smartWallStart();
}
*/
}
});
};
App.prototype.getlaregLoginSession = function(create_new){
debug.log('getlaregLoginSession');
create_new = create_new || false;
var laregLoginSession = this.getStorage('laregLoginSession');
if(!laregLoginSession && create_new){
laregLoginSession = this.randomString()+'_'+this.m.device.analyticsUserID;
this.setStorage('laregLoginSession',laregLoginSession);
}
return laregLoginSession;
};
App.prototype.laregLogin = function(){
debug.log('laregLogin');
if(!this.laregUser || !this.laregUser.login){
var referer = this.m.page.protocol+'://'+this.m.page.host+this.m.page.url;
if(this.m.config.appMode){
referer = 'https://aboshop.laregione.ch/?login%20app';
}
this.forceWakeUp = true;
window.location.href='https://aboshop.laregione.ch/rawlogin?sessionid='+this.getlaregLoginSession(true)+'&referer='+referer;
return;
}
window.location.href='https://aboshop.laregione.ch/?panoramica_abo';
return;
};
App.prototype.openContactTab = function(el, event){
if(this.m.config.type == 'web'){
if(this.animationStatus != 'running'){
this.animationStatus = 'running';
if(jQuery('.contact_tab').width() == 345){
jQuery('.contact_tab_form').show();
jQuery('.contact_tab_form').animate({'margin-left': '-260'}, 200,function(){
jQuery('.contact_tab_form').hide();
jQuery('.contact_tab_form').css('margin-left', '0px');
});
jQuery('.contact_tab').animate({'width': '55px'}, 200, function(){
_this.animationStatus = 'ended';
});
}else{
jQuery('.contact_tab_form').css('margin-left', '-260px');
jQuery('.contact_tab_form').show();
jQuery('.contact_tab_form').animate({'margin-left':'0px'},500);
jQuery('.contact_tab').animate({'width': '345px'}, 500, function(){
_this.animationStatus = 'ended';
jQuery('.contact_tab_form').show();
});
}
}
}
};
App.prototype.openSearch = function(el, event){
if(this.m.config.type == 'web'){
if( this.animationStatus != 'running'){
this.animationStatus = 'running';
jQuery('#menu-search').css('width', 0);
jQuery('#menu-search').show().animate({'width':'283px'}, 500, function(){
jQuery('#menu-search #q').focus();
_this.animationStatus = 'ended';
});
}
}
};
App.prototype.larPromoTypeScelta = function(el, event){
var type = 'cartaceo';
var price = '380';
var action = 'scelta';
if (jQuery(el).attr('data-type') !== undefined){
type = jQuery(el).attr('data-type');
}
if (jQuery(el).attr('data-price') !== undefined){
price = jQuery(el).attr('data-price');
}
if (jQuery(el).attr('data-action') !== undefined){
action = jQuery(el).attr('data-action');
}
switch (action) {
case 'chiudi':
jQuery('#formformatoScelto').hide();
jQuery('#formSceltaFormato').show();
break;
default:
jQuery('#formPrice').html(price+'.-');
jQuery('#formType').html(type);
jQuery('#formformatoScelto').show();
jQuery('#formSceltaFormato').hide();
jQuery('#formBase').show();
jQuery('#inputFormato').val(type);
}
return false;
}
App.prototype.larGamesViewSolution = function(el, event){
var type = 'open';
if (jQuery(el).attr('data-type') !== undefined){
type = jQuery(el).attr('data-type');
}
switch (type) {
case 'close':
jQuery('#gamesSolution').hide();
jQuery('#btnViewGamesSolution').show();
break;
default:
jQuery('#gamesSolution').show();
jQuery('#btnViewGamesSolution').hide();
}
}
/*
this.pollViewVote = function (el,params) {
jQuery('#pollForm').hide();
jQuery('#pollDetail').show();
if(app.m.config.nativeFrame && window.updateSize) {
window.updateSize();
}
};
*/
function setMaxFormChar(idInput,idSpan,idMaxChar) {
if ($('#check_consiglio_di_stato').is(":checked")) {
jQuery('#'+idMaxChar).html(3000);
} else {
jQuery('#'+idMaxChar).html(1800);
}
formContactCountChar(idInput,idSpan,idMaxChar);
}
function formContactCountChar(idInput,idSpan,idMaxChar) {
var max = jQuery('#'+idMaxChar).html() || 1800;
//var max = idMaxChar;
var inputMsg = jQuery('#'+idInput).val();
var lenIM = max - inputMsg.length;
jQuery('#'+idSpan).html(lenIM);
}
App.prototype.larInitPushNotifications = function(){
if(this.m.config.appMode){
return;
}
var firebaseConfig = {
apiKey: "AIzaSyDf9v5IWA1Q0_rwUq_VztXdCUc4IeyR81Y",
authDomain: "laregionetest.firebaseapp.com",
projectId: "laregionetest",
storageBucket: "laregionetest.appspot.com",
messagingSenderId: "83998732477",
appId: "1:83998732477:web:1359547fa001cf5e6607d4",
measurementId: "G-EC50FPJBG6"
};
if(this.m.config.production){
firebaseConfig = {
apiKey: "AIzaSyDy08ZvwU1EffyCajNxRs_yCP0R4ToVBm8",
authDomain: "laregioneapi.firebaseapp.com",
databaseURL: "https://laregioneapi.firebaseio.com",
projectId: "laregioneapi",
storageBucket: "laregioneapi.appspot.com",
messagingSenderId: "607400260523",
appId: "1:607400260523:web:410b1a7736c18ae5b818ee",
measurementId: "G-E94V35DP3P"
};
}
if(!window.firebase || !this.initPushNotifications){
return;
}
window.firebase.initializeApp(firebaseConfig);
this.initPushNotifications();
};
App.prototype.initSquidCheck = function(){
// verifico i dati di login
// il login è già stato checkcato (da sapere)
// se non sono loggato
larLogin = app.getStorage('larLogin') || '-1'
//larLogin = larGetCookies('larLogin') || '-1';
if (larLogin == '-1') {
jQuery('#squidGame').html($('#squidGameLoginDiv').html());
return true;
}
//jQuery('#squidGame').html('ricevo i dati dalla funzione checkissquid');
onlineJson = larLogin;
var json = '{"onlineData":'+onlineJson+'}';
var url = '/ext/lar/aboApi.php?action=checkSquidAjax';
// devo gogliere questa parte per il momento forzo in test
//this.m.config.production = false;
if (this.m.config.production) {
url = this.m.config.aboApiUrl+url;
} else {
url = this.m.config.aboApiUrlDev+url;
}
//url = 'https://www.cmstest.laregione.ch/ext/lar/aboApi.php?action=checkSquidAjax';
//debug.log(url);
try {
$.ajax({
type : 'POST',
url : url,
cache : false,
data: {"data_out":json},
jsonp: "callback",
success: function (js) {
//debug.log(js); // da cancellare, questa è la risposta che ricevo da api.squid
js = js || '-1';
if (js !== '-1') {
htmlResponse = js.html || '-1';
if (js.status=="ok" && htmlResponse !== '-1') {
// aspetto la risposto e la metto in #squidGame
// devo fare attenzione alla scadenza
jQuery('#squidGame').html(htmlResponse);
} else {
jQuery('#squidGame').html($('#squidGameError').html());
debug.log('initSquidCheck-0: operazione non riuscita errore');
}
} else {
jQuery('#squidGame').html($('#squidGameError').html());
debug.log('initSquidCheck-1: operazione non riuscita errore di procedura api');
}
},
error: function(e) {
jQuery('#squidGame').html($('#squidGameError').html());
debug.log('initSquidCheck-2: operazione non riuscita errore: ');
debug.log(e);
}
});
} catch(e) {
jQuery('#squidGame').html($('#squidGameError').html());
e = e || '';
debug.log('initSquidCheck-3: Operazione non riuscita: ');
debug.log(e);
}
}
function larChangeBtnOnOff(name) {
var val = $('#'+name+'-val').html() || -1;
var colorbackground = $('#'+name).attr('data-colorbackground') || '#ACACAC';
var dataColorOff = $('#'+name).attr('data-coloroff') || '#262626';
var dataColorOn = $('#'+name).attr('data-coloron') || '#262626';
switch (val) {
case '0':
$('#'+name+'-toggle-on').show();
$('#'+name+'-toggle-off').hide();
$('#'+name+'-on').css('background-color',dataColorOn);
$('#'+name+'-off').css('background-color',colorbackground);
$('#'+name+'-off').html(' ');
$('#'+name+'-on').html('ON');
$('#'+name+'-val').html('1');
break;
default:
$('#'+name+'-toggle-on').hide();
$('#'+name+'-toggle-off').show();
$('#'+name+'-on').css('background-color',colorbackground);
$('#'+name+'-off').css('background-color',dataColorOff);
$('#'+name+'-off').html('OFF');
$('#'+name+'-on').html(' ');
$('#'+name+'-val').html('0');
}
}
function toggleCaccia(action,cosa,classBorderWhite) {
if (action=='show') {
$('#div'+cosa).show();
$('#txt'+cosa).addClass('borderTopBottomYellow');
$('#txt'+cosa).removeClass(classBorderWhite);
$('#btn'+cosa+'Plus').hide();
$('#btn'+cosa+'Minus').show();
} else {
$('#div'+cosa).hide();
$('#txt'+cosa).addClass(classBorderWhite);
$('#txt'+cosa).removeClass('borderTopBottomYellow');
$('#btn'+cosa+'Plus').show();
$('#btn'+cosa+'Minus').hide();
}
}
function toggleLar(action,cosa) {
if (action=='show') {
$('#div'+cosa).show();
$('#btn'+cosa+'Plus').hide();
$('#btn'+cosa+'Minus').show();
} else {
$('#div'+cosa).hide();
$('#btn'+cosa+'Plus').show();
$('#btn'+cosa+'Minus').hide();
}
}
App.prototype.changeNewsletterSubscribe = function(el,event) {
idList = '';
user_code = '';
email = '';
var htmlBtn = jQuery(el).html();
jQuery(el).html(' ');
if (typeof jQuery(el).attr('data-idList') !== undefined){
idList = jQuery(el).attr('data-idList');
}
if (typeof jQuery(el).attr('data-usercode') !== undefined){
user_code = jQuery(el).attr('data-usercode');
}
if (typeof jQuery(el).attr('data-email') !== undefined){
email = jQuery(el).attr('data-email');
}
var onlineData = {};
onlineData['idlist'] = idList;
onlineData['email'] = email;
onlineData['user_code'] = user_code;
var onlineJson = JSON.stringify(onlineData);
var json = '{"onlineData":'+onlineJson+'}';
var url = '/ext/lar/newsletterApi.php?action=changeStatus';
try {
$.ajax({
type : 'POST',
url : url,
cache : false,
data: {"data_out":json},
jsonp: "callback",
success: function (js) {
jQuery(el).html(htmlBtn);
app.debugLarLogin('risposta da newsletter change
');
if (js.status==1) {
larChangeBtnOnOff('btnNewsletter-'+idList);
} else {
debug.log('I01-cambio newsletter non fattibile');
app.debugLarLogin('I01-cambio newsletter non fattibile');
app.debugLarLogin(js);
}
},
error: function(e) {
app.debugLarLogin('I02-cambio newsletter non fattibile');
jQuery(el).html(htmlBtn);
}
});
} catch(e) {
e = e || '';
app.debugLarLogin('I03-cambio newsletter non fattibile: '+e);
jQuery(el).html(htmlBtn);
}
}
// get cookies
function larGetCookies(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
/**
* set cookies cross domain
* @param {*} name
* @param {*} value
* @param {*} days
* @param {*} hours
*/
function larSetCookies(name, value, days,hours) {
var expires = "";
var date = new Date();
if (hours && hours > 0) {
date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
} else
if (days && days > 0) {
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
}
expires = "; expires=" + date.toUTCString();
document.cookie = name + "=" + (value || "") + expires + "; path=/;domain=.laregione.ch";
}
function larRequestResetToken(spanName,idlar_users,daytoken,url) {
var onlineData = {} ;
onlineData['idlar_users'] = idlar_users || '';
onlineData['daytoken'] = daytoken || '';
var onlineJson = JSON.stringify(onlineData);
var json = '{"onlineData":'+onlineJson+'}';
url = url+'abo/sendEmail?u='+idlar_users+'&dt='+daytoken;
try {
$.ajax({
type : 'POST',
url : url,
cache : false,
data: {"data_out":json},
jsonp: "callback",
success: function (js) {
jsStatus = js.status || -1;
jsHtml = js.html || 'In corso';
if (jsStatus==1) {
jQuery('#'+spanName).html(jsHtml);
}
if (jsStatus!==0 && jsHtml !== 'inCorso') {
console.log(jsHtml);
jQuery('#'+spanName).html(jsHtml);
}
},
error: function(e) {
debug.log('larRequestResetToken-1: operazione non riuscita errore: ');
debug.log(e);
}
});
} catch(e) {
e = e || '';
debug.log('larRequestResetToken-2: Operazione non riuscita: ');
debug.log(e);
}
return false;
}
function larGetSearchParameters() {
var prmstr = window.location.search.substr(1);
return prmstr != null && prmstr != "" ? larTransformToAssocArray(prmstr) : {};
}
function larTransformToAssocArray( prmstr ) {
var params = {};
var prmarr = prmstr.split("&");
for ( var i = 0; i < prmarr.length; i++) {
var tmparr = prmarr[i].split("=");
params[tmparr[0]] = tmparr[1];
}
return params;
}
function changeFormDestination() {
var inputDestinatario = $('#inputDestinatario').val();
switch (inputDestinatario) {
case 'abbonamenti':
window.location.href='/servizi/abbonamenti';
break;
}
}
function captchaFormCallbackNuovoUtente() {
// devo andare a recuperare dei dati dal form
console.log('cosa posso recuperare i dati ?');
console.log(dataResult);
var resStatus = dataResult.result.status || 'not ok';
var resHtml = dataResult.result.html || '-1';
var benutzerId = dataResult.result.benutzerId || '-1';
var toRedirect = dataResult.result.toRedirect || false;
var larRedirectContent_id = dataResult.result.larRedirectContent_id || 0;
var localStorageLarLogin = dataResult.result.localStorageLarLogin || -1;
/*
console.log('toRedirect',toRedirect);
console.log('larRedirectContent_id',larRedirectContent_id);
console.log('localStorageLarLogin',localStorageLarLogin);
*/
if (resStatus == 'ok' && resHtml !== '-1') {
if (localStorageLarLogin !== '-1' && toRedirect) {
nuovoUtenteLoginJwt(localStorageLarLogin,toRedirect,larRedirectContent_id);
return true;
}
$('#divConfirm').html(resHtml);
$('#divConfirm').show();
$('#divForm').hide();
}
$('#boxSuccessMsg').hide();
userCheckValidationEmail(benutzerId);
}
function nuovoUtenteBackForm() {
clearInterval(intervalIdMailChecked);
$('#divConfirm').hide();
$('.btnAction').show();
$('#divForm').show();
$('#boxSuccessMsg').hide();
$('#boxErrorMsg').hide();
}
function nuovoUtenteResend(elementName) {
waitingMessage();
clearInterval(intervalIdMailChecked);
dataUrl = jQuery('#'+elementName).attr('data-url') || '-1';
if (dataUrl == '-1') {
$('#boxErrorMsg').html('Richiesta non possibile');
$('#boxErrorMsg').show();
$('.btnAction').show();
return false;
}
$('#'+elementName).hide();
// mando in ajax e poi pubblico in in $('#divConfirm').html(resHtml); il
$.ajax({
type: 'GET',
url: dataUrl,
cache: false,
data: {},
jsonp: "callback",
success: function (js) {
console.log(js);
resStatus = js.status || 'not ok';
resHtml = js.html || '-1';
localStorageLarLogin = js.localStorageLarLogin || '-1';
toRedirect = js.toRedirect || 0;
benutzerId = js.benutzerId || benutzerId;
larRedirectContent_id = js.larRedirectContent_id || 0;
if (resStatus == 'ok' && resHtml !== '-1') {
if (localStorageLarLogin !== '-1') {
nuovoUtenteLoginJwt(localStorageLarLogin,toRedirect,larRedirectContent_id);
return true;
}
$('#divConfirm').html(resHtml);
$('#divConfirm').show();
$('.btnAction').show();
userCheckValidationEmail(benutzerId);
} else {
$('#boxErrorMsg').html('Operazione non possibile');
$('#boxErrorMsg').show();
$('.btnAction').show();
$('#divConfirm').show();
}
$('#boxSuccessMsg').hide();
},
error: function (e) {
debug.log('nuovoUtenteResend-1: operazione non riuscita errore: ');
debug.log(e);
app.debugLarLogin('nuovoUtenteResend-1: operazione non riuscita errore e: ' + e);
$('#boxSuccessMsg').hide();
$('.btnAction').show();
$('#divConfirm').show();
}
});
}
function waitingMessage() {
$('.btnAction').hide();
$('#boxErrorMsg').hide();
$('#divConfirm').hide();
$('#boxSuccessMsg').html('