function max(selector) { var max=null; $(selector).each(function() { var id = parseInt($(this).data("step"), 10); if ((max===null) || (id > max)) { max = id; } }); return max; } //inserts element to let configure the steps function insertStepForm(element){ var steps = parseInt($(element).val()); if(element.min > steps || (element.max && element.max < steps)){ element.reportValidity(); return; } if(NaN == steps) $(".step").remove(); else{ if($(".step").length > steps){ for(i = $(".step").length - 1; i >= steps; i--) $("#step"+i).remove(); } else{ for(i = $(".step").length; i < steps; i++){ var t_step = "
Tappa "+(i+1)+""; t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat(''); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("

Se come formato è stato scelto \"Other\" specificare qua che formato personalizzato sarà utilizzato

"); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("

Formato data: gg/mm/yyyy

"); t_step = t_step.concat("
"); if("undefined" === typeof activity_id || !activity_id){ t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("

Se si vuole, si può specificare una scaletta bonus esclusiva per questa tappa, lasciare vuoto altrimenti. Inserisci i bonus da dare a partire dal primo classificato separarti da \"::\": puntiprimo::puntisecondo::puntiterzo etc.

"); t_step = t_step.concat("
"); } else { t_step = t_step.concat(""); } t_step = t_step.concat("
"); $("#submit").before(t_step); const options = {dateFormat : "dd/mm/yy", firstDay: 1} if(typeof activity_id !== "undefined"){ options.minDate = activityStartDate; options.maxDate = activityEndDate; } $("#step_"+i+"_date").datepicker(options); } } } } function addStepForm(){ //TODO: verifica che sia utilizzabile per la funzione precedente (ossia se รจ codice duplicato) i = (max(".step[data-step]") + 1) var t_step = "
Tappa "+(i+1)+""; t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat(''); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("

Se come formato è stato scelto \"Other\" specificare qua che formato personalizzato sarà utilizzato

"); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("
"); t_step = t_step.concat("

Formato data: gg/mm/yyyy

"); t_step = t_step.concat("
"); if("undefined" === typeof activity_id || !activity_id){ t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat(""); t_step = t_step.concat("
"); t_step = t_step.concat("

Se si vuole, si può specificare una scaletta bonus esclusiva per questa tappa, lasciare vuoto altrimenti. Inserisci i bonus da dare a partire dal primo classificato separarti da \"::\": puntiprimo::puntisecondo::puntiterzo etc.

"); t_step = t_step.concat("
"); } else { t_step = t_step.concat(""); } t_step = t_step.concat("
Elimina tappa
"); t_step = t_step.concat("
"); $("#submit").before(t_step); const options = {dateFormat : "dd/mm/yy", firstDay: 1} if(typeof activity_id !== "undefined"){ options.minDate = activityStartDate; options.maxDate = activityEndDate; } $("#step_"+i+"_date").datepicker(options); } function cercamap(region_id){ $.ajax({ url : "https://fxistudio.it/luduschampionshipseries/tms/sys/ajax/get_page.php", data : {op : "get_region", region : region_id}, success : function(data){ $("#organizer_div").html(data); $('html,body').animate({ scrollTop: $('#organizer_div').offset().top },'slow'); }}); } function pad(num, size){ var s = num+""; while (s.length < size) s = "0" + s; return s; } $(document).ready(function(){ /*for(i = 0; i < $(".step").length; i++) $("#step_"+i+"_date").datepicker({dateFormat : "dd/mm/yy"}); //$("#step_date").datepicker({dateFormat : "dd/mm/yy"});*/ /*$(".logo_container").append("
LOADING
"); var interval = setInterval(function(){ datetime = new Date(); eventdatetime = new Date(2015,11,20,11,30,0); timeleft = eventdatetime - datetime; timeleft = Math.floor(timeleft / 1000); days = Math.floor(timeleft / (60*60*24)); hours = Math.floor((timeleft - (days*60*60*24)) / (60*60)); mins = Math.floor((timeleft - (days*60*60*24) - (hours*60*60)) / (60)); secs = Math.floor((timeleft - (days*60*60*24) - (hours*60*60) - (mins*60))); $("#timer").html(pad(days,2)+":"+pad(hours,2)+":"+pad(mins,2)+":"+pad(secs,2)); }, 100);*/ $.datepicker.setDefaults({ showOtherMonths : true, selectOtherMonths : true }); $(".step_bonus_info").popover({trigger : "hover click"}); $(".share_button").click(function(event){ event.preventDefault(); if (navigator.share) { $this = $(this); navigator.share({ title: $this.data("share-title"), text: $this.data("share-text"), url: location.href, }) .then(() => console.log('Successful share')) .catch((error) => console.log('Error sharing', error)); } }); if(undefined === navigator.share){ $(".share_button").remove(); } });