1$(document).ready(function () { 2 /* Questo JS serve per il passaggio da Bootstrap 3 a Bootstrap 5 */ 3 4 5 // ------------------------------------------------------------------------------------------------------------------------ 6 // POPUP MODAL 7 // ------------------------------------------------------------------------------------------------------------------------ 8 // Seleziona tutti gli elementi con l'attributo data-target e data-toggle per aprire popup modali 9 $('[data-target]').each(function () { 10 var target = $(this).data('target'); 11 var toggle = $(this).data('toggle'); 12 PyBootstrapSetTargetModal($(this), target, toggle); 13 }); 14 $('[data-bs-target]').each(function () { 15 var target = $(this).data('bs-target'); 16 var toggle = $(this).data('bs-toggle'); 17 PyBootstrapSetTargetModal($(this), target, toggle); 18 }); 19 20 function PyBootstrapSetTargetModal(obj, target, toggle) { 21 if (toggle == "modal") { 22 //console.log("PyBootstrapSetTargetModal target: " + target); 23 obj.removeAttr('data-target'); 24 obj.removeAttr('data-toggle'); 25 obj.removeAttr('data-bs-target'); 26 obj.removeAttr('data-bs-toggle'); 27 obj.attr('data-openmodalpy', target); 28 } 29 } 30 31 $(document).on("click", "[data-openmodalpy]", function () { 32 var iddiv = $(this).data('openmodalpy').replace('#', ''); 33 openModalPY(iddiv); 34 }); 35 // ------------------------------------------------------------------------------------------------------------------------ 36 // CAROUSEL 37 // ------------------------------------------------------------------------------------------------------------------------ 38 $(".carousel-py.slide").each(function () { 39 var divCarouselIndicators = $(this).find('.div-carousel-indicators-py'); 40 var divCarouselControls = $(this).find('.div-carousel-controls-py'); 41 var idCarousel = $(this).attr('id'); 42 43 //console.log(idCarousel + "\nIndicators: " + divCarouselIndicators.length + "\nControls: " + divCarouselControls.length); 44 45 var divCarouselItems = $(this).find('.item-py'); 46 if (BOOTSTRAPVERSION == 3) { 47 $(this).attr('data-ride', 'carousel'); 48 divCarouselItems.each(function () { 49 $(this).addClass("item"); 50 }) 51 } 52 else if (BOOTSTRAPVERSION == 5) { 53 $(this).attr('data-bs-ride', 'carousel'); 54 divCarouselItems.each(function () { 55 $(this).addClass("carousel-item"); 56 }) 57 } 58 // INDICATORI ------------------------------------------------------------- 59 if (divCarouselIndicators.length > 0 && divCarouselItems.length > 1) { 60 divCarouselIndicators.addClass('hidden-xs'); 61 62 var numItems = divCarouselItems.length; 63 //------------------------------------------------------------------------------------ 64 if (BOOTSTRAPVERSION == 3) { 65 // Crea l'elemento <ol> con le classi desiderate 66 var olIndicators = $('<ol>').addClass('carousel-indicators'); 67 68 // Itera sul numero di slide e crea i <li> indicatori 69 for (var i = 0; i < numItems; i++) { 70 var $li = $('<li>') 71 .attr('data-target', '#' + idCarousel) // Punta all'ID del carousel 72 .attr('data-slide-to', i.toString()) // Indice della slide 73 .attr('title', (i+1).toString()); // Title 74 75 // Aggiungi la classe 'active' al primo indicatore 76 if (i === 0) { 77 $li.addClass('active'); 78 } 79 olIndicators.append($li); // Aggiungi il <li> all'<ol> 80 } 81 // Aggiungi l'<ol> completa al div placeholder 82 divCarouselIndicators.append(olIndicators); 83 } 84 // ------------------------------------------------------------------------------------ 85 else if (BOOTSTRAPVERSION == 5) { 86 var divIndicators = $('<div>').addClass('carousel-indicators'); 87 88 // Itera sul numero di slide e crea i <li> indicatori 89 for (var i = 0; i < numItems; i++) { 90 var $button = $('<button>') 91 .attr('type', 'button') 92 .attr('data-bs-target', '#' + idCarousel) 93 .attr('data-bs-slide-to', i.toString()) 94 .attr('title', (i + 1).toString()); // Title 95 96 97 // Aggiungi la classe 'active' al primo indicatore 98 if (i === 0) { 99 $button.addClass('active'); 100 } 101 divIndicators.append($button); 102 } 103 divCarouselIndicators.append(divIndicators); 104 105 } 106 //------------------------------------------------------------------------------------ 107 108 109 } 110 // Fine INDICATORI ------------------------------------------------------------- 111 112 // FRECCE ------------------------------------------------------------- 113 if (divCarouselControls.length > 0 && divCarouselItems.length > 1) { 114 115 //------------------------------------------------------------------------------------ 116 if (BOOTSTRAPVERSION == 3) { 117 // Crea il pulsante "Precedente" 118 var prevControl = $('<a>') 119 .addClass('left carousel-control') 120 .attr('href', '#' + idCarousel) // ID del carousel 121 .attr('role', 'button')
122 .attr('data-slide', 'prev') 123 .attr('title', "Indietro"); // Title 124 125 var prevIcon = $('<span>') 126 .addClass('glyphicon glyphicon-chevron-left') 127 .attr('aria-hidden', 'true'); 128 129 var prevSrOnly = $('<span>') 130 .addClass('sr-only') 131 .text('Previous'); 132 133 prevControl.append(prevIcon).append(prevSrOnly); 134 135 // Crea il pulsante "Successivo" 136 var nextControl = $('<a>') 137 .addClass('right carousel-control') 138 .attr('href', '#' + idCarousel) // ID del carousel 139 .attr('role', 'button') 140 .attr('data-slide', 'next') 141 .attr('title', "Avanti"); // Title 142 143 var nextIcon = $('<span>') 144 .addClass('glyphicon glyphicon-chevron-right') 145 .attr('aria-hidden', 'true'); 146 147 var nextSrOnly = $('<span>') 148 .addClass('sr-only') 149 .text('Next'); 150 151 nextControl.append(nextIcon).append(nextSrOnly); 152 153 divCarouselControls.append(prevControl).append(nextControl); 154 155 156 } 157 // ------------------------------------------------------------------------------------ 158 else if (BOOTSTRAPVERSION == 5) { 159 160 // Crea il pulsante "Precedente" 161 var prevControl = $('<button>') 162 .addClass('carousel-control-prev carousel-control-prev5') 163 .attr('data-bs-target', '#' + idCarousel) // ID del carousel 164 .attr('type', 'button') 165 .attr('data-bs-slide', 'prev') 166 .attr('title', "Indietro"); // Title 167 168 var prevIcon = $('<span>') 169 .addClass('carousel-control-prev-icon') 170 .attr('aria-hidden', 'true'); 171 172 var prevSrOnly = $('<span>') 173 .addClass('visually-hidden'); 174 175 prevControl.append(prevIcon).append(prevSrOnly); 176 177 // Crea il pulsante "Successivo" 178 var nextControl = $('<button>') 179 .addClass('carousel-control-next carousel-control-next5') 180 .attr('data-bs-target', '#' + idCarousel) // ID del carousel 181 .attr('type', 'button') 182 .attr('data-bs-slide', 'next') 183 .attr('title', "Avanti"); // Title 184 185 var nextIcon = $('<span>') 186 .addClass('carousel-control-next-icon') 187 .attr('aria-hidden', 'true'); 188 189 var nextSrOnly = $('<span>') 190 .addClass('visually-hidden'); 191 192 nextControl.append(nextIcon).append(nextSrOnly); 193 194 divCarouselControls.append(prevControl).append(nextControl); 195 196 } 197 //------------------------------------------------------------------------------------ 198 } 199 // Fine FRECCE ------------------------------------------------------------- 200 }); 201 202 203 204 205 206 207 208 209 // ------------------------------------------------------------------------------------------------------------------------ 210 // ------------------------------------------------------------------------------------------------------------------------ 211 212 213}); 214
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.