1$(function(){ 2 $(window).resize(update16_9boxes); 3 update16_9boxes(); 4}); 5 6/* 7bootbox.setDefaults({ 8 locale: "it" 9}); 10*/ 11 12function showAlert(msg){ 13 bootbox.alert(msg); 14} 15 16jQuery.fn.extend({ 17showAjaxLoading: function (){ 18 jQuery(this).html('<div class="ajaxloader" style="text-align:center;"><img src="/images/ajax-loader_big.gif"></div>'); 19 }, 20 21 22 showAjaxLoadingSmall: function (){ 23 jQuery(this).html('<div class="ajaxloader" style="text-align:center;"><img src="/images/ajax-loader.gif"></div>'); 24 }, 25 ajaxload: function(url){ 26 jQuery(this).show(); 27 jQuery(this).showAjaxLoading(); 28 jQuery(this).load(url); 29 } 30}); 31 32$.fn.isInViewport = function() { 33 var elementTop = $(this).offset().top; 34 var elementBottom = elementTop + $(this).outerHeight(); 35 36 var viewportTop = $(window).scrollTop(); 37 var viewportBottom = viewportTop + $(window).height(); 38 39 return elementBottom > viewportTop && elementTop < viewportBottom; 40}; 41 42/*jQuery( document ).ajaxError(function( event, request, settings ) { 43 //alert("Sono avvenuti errori durante l'esecuzione dell'operazione, ti invitiamo a riprovare più tardi"); 44 alert("Some errors occurred, please try again later"); 45}); 46*/ 47 48function showServiceError(result) { 49 if (result && result['errormsg']) alert(result['errormsg']); 50 else alert("Sono avvenuti alcuni errori durante l'esecuzione dell'operazione, ti invitiamo a riprovare più tardi"); 51} 52 53 54function showOperationNotAllowed() { 55 bootbox.alert("Operazione non consentita"); 56} 57 58function pathencode(str){ 59 return str.replace(/\//g,'|'); 60} 61 62// Numeric only control handler 63jQuery.fn.forceNumericOnly = 64function() 65{ 66 return this.each(function() 67 { 68 $(this).keydown(function(e) 69 { 70 var key = e.charCode || e.keyCode || 0; 71 // allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY 72 return ( 73 key == 8 || 74 key == 9 || 75 key == 46 || 76 (key >= 37 && key <= 40) || 77 (key >= 48 && key <= 57) || 78 (key >= 96 && key <= 105)); 79 }); 80 }); 81}; 82 83 84/** 85 * sincronizza il contenuto dell'editor con la texarea 86 */ 87function nicEditorSync(editorObj){ 88 for(var i=0;i<editorObj.nicInstances.length;i++){editorObj.nicInstances[i].saveContent();} 89} 90 91 92/** 93 * visualizza un iframe in una finestra modale tramite SimpleModal 94 */ 95function modalIframe(url,width,height,$obj){ 96 if (typeof $obj=='undefined') { 97 if ($('#modaliframe').length==0) $('body').append('<div id="modaliframe"></div>'); 98 $obj=$('#modaliframe'); 99 } 100 101 if (width!=undefined) $obj.css('width',width); 102 else $obj.css('width',$(window).width()*80/100); 103 if (height!=undefined) $obj.css('height',height); 104 else $obj.css('height',$(window).height()*80/100); 105 106 $obj.css('overflow','auto'); 107 $obj.modal({ 108 overlayClose: true 109 }); 110 $obj.showAjaxLoading(); 111 //$obj.('<iframe style="width:100%;height:100%;border:0px" src="/images/ajax-loader_big.gif"></iframe>'); 112 $obj.append('<iframe style="width:100%;height:99%;border:0px " src="'+url+'" frameBorder="0"></iframe>'); 113 $obj.find('iframe').one('load',function(){$obj.find('.ajaxloader').remove();}); 114 115 setTimeout(function(){$obj.find('.ajaxloader').remove();},3000); //per sicurezza togliamo il loader topo 3 secondi 116} 117 118/** 119 * visualizza una finestra modal in una finestra modale tramite SimpleModal 120 */ 121function modalWindow(obj,width,height){ 122 if ($('#modaliframe').length==0) $('body').append('<div id="modaliframe"></div>'); 123 124 if (width!=undefined) $('#modaliframe').css('width',width); 125 else $("#modaliframe").css('width',$(window).width()*80/100); 126 if (height!=undefined) $('#modaliframe').css('height',height); 127 else $("#modaliframe").css('height',$(window).height()*80/100); 128 129 var $oldparent=$(obj).parent(); 130 131 $('#modaliframe').modal({ 132 overlayClose: true, 133 onClose: function(){ 134 obj.hide(); 135 $oldparent.append(obj); 136 $.modal.close(); 137 } 138 }); 139 $('#modaliframe').append(obj); 140 obj.show(); 141} 142 143 144 145function zeroPad(num, places) { 146 var zero = places - num.toString().length + 1; 147 return Array(+(zero > 0 && zero)).join("0") + num; 148} 149 150function getCookie(cname) { 151 var name = cname + "="; 152 var ca = document.cookie.split(';'); 153 for(var i=0; i<ca.length; i++) { 154 var c = ca[i]; 155 while (c.charAt(0)==' ') c = c.substring(1); 156 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 157 } 158 return ""; 159} 160 161function setCookie(cname, cvalue, exdays) { 162 var d = new Date(); 163 if (exdays>0){ 164 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 165 var expires = "expires="+d.toUTCString(); 166 document.cookie = cname + "=" + cvalue + "; " + expires; 167 } 168 else document.cookie = cname + "=" + cvalue; 169 170} 171 172Request = { 173 parameter: function(name) { 174 return this.parameters()[name]; 175 }, 176 parameters: function(uri) { 177 var i, parameter, params, query, result; 178 result = {}; 179 if (!uri) { 180 uri = window.location.search; 181 } 182 if (uri.indexOf("?") === -1) { 183 return {}; 184 } 185 query = uri.slice(1); 186 params = query.split("&"); 187 i = 0; 188 while (i < params.length) { 189 parameter = params[i].split("="); 190 result[parameter[0]] = parameter[1]; 191 i++; 192 } 193 return result; 194 } 195}; 196 197function getIntroJS(){ 198 var intro=introJs(); 199 intro.setOptions({ 200 nextLabel: 'Avanti', 201 prevLabel: 'Indietro', 202 skipLabel: 'Termina', 203 doneLabel: 'Fine'}); 204 return intro; 205} 206 207 208function update16_9boxes(){ 209 $('.r16_9').each(function(){ 210 $(this).css({'height': $(this).width()/16*9}); 211 }); 212} 213 214 215function counter(elm,targetVal,totalmilliseconds){ 216 val=0; 217 var stepNum=0; 218 var numsteps=500; 219 var stepIncrement=targetVal/numsteps; 220 var func=function(){ 221 var isLastStep=stepNum==numsteps; 222 if(isLastStep){ 223 $(elm).text(targetVal); 224 } 225 else { 226 $(elm).text(Math.round(stepNum*stepIncrement)); 227 stepNum++; 228 var stepPecent=stepNum/numsteps; 229 setTimeout(func,totalmilliseconds/numsteps*(1+stepPecent)); 230 } 231 232 }; 233 234 func(); 235 236} 237 238function getLeafletMapTileLayer(){ 239 /* return L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 240 maxZoom: 19, 241 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' 242 }); 243*/ 244 return L.tileLayer('https://api.mapbox.com/styles/v1/maneditrice/ckfpohhfo1a0u19rr8senm216/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFuZWRpdHJpY2UiLCJhIjoiY2xqZWszYTZ5MmpiczNldGVmaHNoN2N5cCJ9.pw3EUQt2adkgH2XKwcVt_Q', { 245 attribution: '© <a href="https://www.mapbox.com/feedback/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', 246 maxZoom: 25, 247 //tileSize: 512 248 //id: 'mapbox.streets', 249 }) 250 251 252}
252 253 254function formatCurrencyEuro(number){ 255 return new Intl.NumberFormat('it-IT', { style: 'currency', currency: 'EUR' }).format(number); 256} 257 258
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.