PageSourceSearch

https://provincia.alessandria.it/wp-content/themes/theme-wpaitaliadigitale-full-child/js/TD.js?ver=3.20.947

js provincia.alessandria.it collected 2026-09-25 00:31:53 UTC 16,235 bytes, 428 lines download raw bytes

1jQuery( document ).ready( function( $ ) {
2    
3    var urlParams = new URLSearchParams(window.location.search);
4
5    if((urlParams.get('IdClienteS')||"")!="") { // se c'è IdClienteS nell'url è il cliente scelto dalla pagina di Super Mario del Sismico
6      var d = new Date();
7      var time = d.getTime();  
8      var clienteSismico = {
9				  idCliente: urlParams.get('IdClienteS'),
10				  expiration: time + (1 * 60 * 60 * 1000) // 1 ora
11			}
12      window.localStorage.setItem("clienteSismico", JSON.stringify(clienteSismico));
13    }
14
15    // rimuove il caricamento di css di Better Font Awesome, aggiusta icone
16    $('#bfa-font-awesome-css').prop('disabled', true);
17    $(".fa.fa-file-o").removeClass("fa fa-file-o").addClass("fal fa-file");
18    $(".fa.fa-link").removeClass("fa").addClass("fal");
19
20    // rimuove eventuali dimensioni impostate per errore nell'editor
21    $('table.Table, table.Table td, table.Table th, table.Table tr').css('width', '').css('height','');
22
23    // aggiunge border a tutte le tabelle + margine inferiore
24    $('table.Table').not(".TabellaOrari, .tableprocmod, .tablenuovofascli, .tablenuovofaspra, .tablegestfaspra, .tableModDettaglio, .tableModAllegati, .no-responsive-fix, .tableModDPR160").addClass('Table--withBorder u-margin-bottom-l');
25
26     // per trasformare tabelle "normali" in responsive
27    $('table.Table').not(".Table--flip, .Table--responsive, .TabellaOrari, .tableprocmod, .tablenuovofascli, .tablenuovofaspra, .tablegestfaspra, .tableModDettaglio, .tableModAllegati, .no-responsive-fix, .tableModDPR160").each(function(){
28        // per ogni tabella di tipo Table non "strana"
29        var table = $(this);
30        
31        table.find("thead > tr > td").replaceWith(function(i, html) {
32            return '<th>' + html + '</th>';
33          });
34
35        if(table.find("thead > tr > th").length > 0){ // trasformo in responsive solo se thead e th corretti
36            table.addClass('TabellaBandi tablesawx tablesaw-stack').attr('data-tablesaw-mode','stack');
37        }
38    })
39
40    // $( ".TabellaBandi tr" ).tooltip({
41    //     track: true
42    //   });
43
44    // aggiunge icona a categorie se presente - event manager
45    // $("div.css-cats-list").prepend($("<i class='fa fa-fw fa-tags' aria-hidden='true'></i>"));
46    // var iconTags = $("<i class='fa fa-fw fa-tags' aria-hidden='true'></i>");
47    // var divTags = $("<div class='waitingForIcon'></div>");
48    // $("ul.event-categories").wrap(divTags );
49    // $("div.waitingForIcon").prepend($("<i class='fa fa-fw fa-tags' aria-hidden='true'></i>"));
50
51    // AT varie
52    // modifico i link in pagina principale amministrazione trasparente trasformandoli in titoli
53    $("div.at-tableclass h3").each(function(){
54        var a = $(this).children("a");
55        $(this).text(a.text());
56        a.remove();
57    });
58    // trasformo gli h3 di AT in h2
59    $('div.at-tableclass h3').replaceWith(function () {
60        return "<h2>" + $(this).html() + "</h2>";
61    });
62
63    // nascondo link OIV AT
64    $("li a[title='Attestazioni OIV o di struttura analoga']").each(function(){
65        $(this).parent().remove();
66    });
67
68
69
70    // homepage
71    $("#divCaselloni .Entrypoint-item")
72    .on("mouseenter", function(){
73        $(this).addClass("u-background-50").removeClass("u-background-40");
74    })
75    .on("mouseleave", function(){
76        $(this).addClass("u-background-40").removeClass("u-background-50");
77    });
78
79    // apertura PDF e altri file in nuova finestra
80    $('a[href$=".bmp"], a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".tiff"],a[href$=".gif"],a[href$=".pdf"], a[href$=".doc"], a[href$=".docx"], a[href$=".rtf"], a[href$=".csv"], a[href$=".xls"], a[href$=".xlsx"]').prop('target', '_blank');
81
82
83    // $("[data-openStart]").each(function(index){
84    //     console.log($(this));
85    //     $(this).click();
86    // });
87
88    if($("#hTestiNeri").val()=="SI"){
89      $(".Breadcrumb-link").each(function() {
90        $(this).removeClass("u-color-50");
91        $(this).addClass("u-color-black");  
92      });
93    }
94
95} );
96
97//Crea immagine di attesa per operazione in corso.
98// function showWait(imgSrc) {
99//     imgSrc = imgSrc || TD_object.uri +  "/icons/TD/StatusWait.gif";
100
101//     jQuery("body").addClass("Wait").append(jQuery('<div class="Overlay"></div>')
102//         .append(jQuery("<div id='divWait' class='Wait'></div>")
103//             .append(jQuery("<img id='imgWait' src='" + imgSrc + "' title='Wait' alt='Wait' />"))));
104//     /* Imposta il cursore wait sul body */
105//     //document.body.style.cursor = 'wait';
106// }
107
108// Ritorna true se in questo momento c'e' uno Swal2 aperto.
109// L'attesa (Overlay + loader) e lo swal non devono mai convivere: l'Overlay si sovrappone alla
110// popup e ne rende i pulsanti non cliccabili, dando l'impressione che la pagina sia bloccata.
111//
112// NON si usa Swal.isVisible(): dopo Swal.close() continua a ritornare true per tutta l'animazione
113// di uscita (misurati ~5 s sul portale, la popup e' gia' sparita da un pezzo). Con quel controllo
114// le showWait richieste subito dopo la chiusura di una popup non partivano, con un ritardo
115// percepito come blocco.
116// Si guarda invece direttamente il DOM: swal2 aggiunge la classe swal2-backdrop-hide al container
117// entro 1 ms dalla chiamata a close(), quindi il predicato diventa falso immediatamente.
118// getElementsByClassName restituisce una HTMLCollection live ed e' la via piu' economica (~0.04 µs
119// contro ~0.5 di jQuery e ~5.7 di querySelector, misurati su una pagina da 12k nodi).
120function isSwalAperto() {
121  try {
122    var cont = document.getElementsByClassName("swal2-container")[0];
123    return !!cont && !cont.classList.contains("swal2-backdrop-hide");
124  } catch (e) {
125    return false;
126  }
127}
128
129//Richiama la showMyWait dopo 200 millisecondi
130function showWait(icon) {
131  // Doppio controllo: qui e allo scadere del timeout. showWait e' ritardata di 200 ms e in quella
132  // finestra lo swal puo' essersi aperto (es. una validazione che risponde subito dopo il click
133  // che aveva chiesto l'attesa): senza il secondo controllo l'overlay comparirebbe sopra la popup.
134  if (isSwalAperto()) { return; }
135
136  setTimeout(function(){
137    if (isSwalAperto()) { return; }
138    showMyWait(icon);
139  }, 200);
140}
141
142// Chiude l'attesa non appena si apre uno swal, anche quando l'attesa era gia' a video.
143// I due controlli dentro showWait coprono solo il caso "swal gia' aperto quando parte l'attesa";
144// qui si copre l'ordine inverso: attesa in corso -> arriva la popup.
145// Si usa un MutationObserver sul body invece di aggiungere didOpen alle singole Swal.fire perche'
146// nel tema ce ne sono oltre 200: un hook centrale le intercetta tutte, incluse quelle future.
147jQuery(document).ready(function () {
148
149  if (typeof MutationObserver === "undefined" || !document.body) { return; }
150
151  // getElementsByClassName invece di jQuery(".Overlay") o querySelector: questa callback scatta a
152  // ogni inserimento di un figlio del body, quindi conviene tenerla il piu' leggera possibile.
153  // Ritorna una HTMLCollection "live", senza costruire l'oggetto jQuery e senza parsing del
154  // selettore CSS (misurato sul portale: ~0.04 µs contro ~0.5 di jQuery e ~5.7 di querySelector).
155  // L'ordine delle condizioni e' voluto: il conteggio e' piu' economico di Swal.isVisible(),
156  // e nella stragrande maggioranza dei casi non c'e' nessuna attesa a video, quindi esce subito.
157  var osservatoreSwal = new MutationObserver(function () {
158    if (document.getElementsByClassName("Overlay").length > 0 && isSwalAperto()) {
159      hideWait();
160    }
161  });
162
163  // Swal2 monta il container come figlio diretto del body: basta osservare i figli di primo
164  // livello, senza subtree, per non farsi carico di ogni modifica del DOM della pagina.
165  osservatoreSwal.observe(document.body, { childList: true });
166});
167
168function BreadCrumbsPNRR() {
169  if(jQuery("#hfiCompilazionePNRRBreadC").val()=="1" ) {
170    let urlParams = new URLSearchParams(window.location.search);
171    let imu = urlParams.get('imu') || "";
172    $("#bComp").remove();
173    $("#bRiep").remove();
174    $("#bDettP").remove();
175    let firstAnchor = $('#bPrecomp a');
176    // Crea un nuovo elemento <span> con il contenuto del <a>
177    let span = $('<span>').html(firstAnchor.html());
178    span.addClass("Breadcrumb-link");
179    span.addClass("u-color-grey-60");
180    if(imu=="1"){
181      span.html("Calcola");
182    } else {
183      span.html("Compilazione");
184    }
185    
186    // Sostituisci il <a> con il nuovo <span>
187    firstAnchor.replaceWith(span);
188    $("#bPrecomp").removeClass("displaynoneprecomp");
189  }
190}
191
192//Salva DocsTag della Pratica
193function SaveDocTags(idcliente,idpratica,azione,codmodello,ctrid,ctrvalore) {
194  var pParams ={
195    idcliente : idcliente,
196    idpratica : idpratica,
197    azione : azione,
198    codmodello : codmodello,
199    ctrid : ctrid,
200    ctrvalore : ctrvalore
201  }
202  AJSaveDocTags(pParams)
203    .done(function(data, textStatus, jqXHR ) {
204      if (data.success) {
205      }
206    })
207    .fail(function( jqXHR, textStatus, errorThrown) {
208
209    })
210    .always(function(data, textStatus) {
211  
212    });
213}
214
215function GetDocTags(idcliente, idpratica, azione, codmodello, ctrid) {
216  return new Promise((resolve, reject) => {
217      var pParams = {
218          idcliente: idcliente,
219          idpratica: idpratica,
220          azione: azione,
221          codmodello: codmodello,
222          ctrid: ctrid,
223      };
224
225      AJGetDocTags(pParams)
226          .done(function (data, textStatus, jqXHR) {
227              if (data.success) {
228                  if(data.data[0]!=undefined) {
229                    resolve(data.data[0].CtrValore);
230                  } else {
231                    resolve("");
232                  }
233                  
234              } else {
235                  reject(new Error('Data not successful'));
236              }
237          })
238          .fail(function (jqXHR, textStatus, errorThrown) {
239              reject(new Error('AJAX request failed: ' + textStatus));
240          });
241  });
242}
243
244//Salva DocsTag della Pratica
245function GetStatoSottomodello(idcliente,idpratica,idmodello,databella=false) {
246  return new Promise((resolve, reject) => {
247    var pParams ={
248      idcliente : idcliente,
249      idpratica : idpratica,
250      idmodello : idmodello,
251      databella : databella
252    }
253    AJGetStatoSottomodello(pParams)
254      .done(function(data, textStatus, jqXHR ) {
255        if (data.success) {
256          resolve(data.data);
257        }
258      })
259      .fail(function( jqXHR, textStatus, errorThrown) {
260
261      })
262      .always(function(data, textStatus) {
263    
264      });
265  });
266}
267
268function GetStatoModelloPrincipale(idcliente,idpratica,databella) {
269  return new Promise((resolve, reject) => {
270    var pParams ={
271      idcliente : idcliente,
272      idpratica : idpratica,
273      databella : databella
274    }
275    AJGetStatoModelloPrincipale(pParams)
276      .done(function(data, textStatus, jqXHR ) {
277        if (data.success) {
278          resolve(data.data);
279        }
280      })
281      .fail(function( jqXHR, textStatus, errorThrown) {
282
283      })
284      .always(function(data, textStatus) {
285    
286      });
287  });
288}
289
290//Crea immagine di attesa per operazione in corso.
291function showMyWait(icon) {
292  icon = icon || "fa-sync";
293
294  // Ultima barriera: showMyWait e' richiamata anche direttamente in giro per il tema, non solo
295  // tramite showWait, quindi il controllo sullo swal aperto va ripetuto anche qui.
296  if (isSwalAperto()) { return; }
297
298  if (jQuery(".Overlay").length === 0) {
299    jQuery("body").append(jQuery('<div class="Overlay"></div>')
300        .append(jQuery("<div id='xdivWait' class='xWait' style='display: flex; justify-content: center; align-items: center; height: 100%'><div id='ximgWait' data-loader='ball-scale' class=''></div></div>")));
301  }
302
303  /*jQuery("body").append(jQuery('<div class="Overlay"></div>')
304      .append(jQuery("<div id='xdivWait' class='xWait' style='display: flex; justify-content: center; align-items: center; height: 100%'><div id='ximgWait' data-loader='ball-scale' class=''></div></div>")));*/
305  /* Imposta il cursore wait sul body */
306  //document.body.style.cursor = 'wait';
307}
308
309//Rimuove immagine di attesa per operazione in corso.
310function hideWait() {
311    jQuery(".Overlay").remove();
312    /* Ripristina il cursore sul body */
313    //document.body.style.cursor = 'default';
314    jQuery("body").removeClass("Wait");
315}
316
317
318// funzioni di logging vincolate a showlogjs globale (wrapper a funzioni standard console)
319// 12-04-2017 AS: ATTENZIONE alcuni browser (es. IE 10) non supportano jsDebug, jsGroup, ..., quindi necessario gestire l'esistenza dell'oggetto.
320// log in console di multipli oggetti - jsLog(obj1,obj2,obj3,...,objn)
321// 31-05-2017 LD: ATTENZIONE su IE11 console.xxxx.apply non funziona più! aggiunto controllo sull'oggetto
322function jsLog() {
323    // if (!showlogjs) return false;
324    if (typeof console.log.apply == 'function') {
325      console.log.apply(console, Array.prototype.slice.call(arguments))
326    }
327    else {
328      console.log(arguments);
329    }
330  }
331  
332  // log (livello debug) in console di multipli oggetti - jsDebug(obj1,obj2,obj3,...,objn)
333  function jsDebug() {
334    // if (!showlogjs) return false;
335    if (console.debug && typeof console.debug.apply == 'function') {
336      console.debug.apply(console, Array.prototype.slice.call(arguments));
337    } else {
338      jsLog();
339    }
340  }
341  
342  // log (livello error) in console di multipli oggetti - jsError(obj1,obj2,obj3,...,objn)
343  function jsError() {
344    // if (!showlogjs) return false;
345    if (console.error && typeof console.error.apply == 'function') {
346      console.error.apply(console, Array.prototype.slice.call(arguments));
347    } else {
348      jsLog();
349    }
350  }
351  
352  // Inizializza un timer di nome "value"
353  function jsTime(value) {
354    // if (!showlogjs) return false;
355    if (console.time) {
356      console.time(value);
357    }else{
358      jsLog('Time start: ' + value);
359    }
360  }
361  
362  // Ferma il timer di nome "value" e visualizza in console il tempo misurato
363  function jsTimeEnd(value) {
364    // if (!showlogjs) return false;
365    if (console.timeEnd) {
366      console.timeEnd(value);
367    } else {
368      jsLog('Time end: ' + value);
369    }
370  }
371  
372  // Apre un gruppo di log in stato chiuso in console con messaggio "value"
373  function jsGroupCollapsed(value) {
374    // if (!showlogjs) return false;
375    if (console.groupCollapsed) {
376      console.groupCollapsed(value);
377    } else {
378      jsLog('Group init: ' + value);
379    }   
380  }
381  
382  // Apre un gruppo di log in console con messaggio "value"
383  function jsGroup(value) {
384    // if (!showlogjs) return false;
385    if (console.group) {
386      console.group(value);
387    } else {
388      jsLog('Group init: ' + value);
389    }   
390  }
391  
392  // chiude un gruppo di log in console - "value" non è necessario
393  function jsGroupEnd(value) {
394    // if (!showlogjs) return false;
395    if (console.groupEnd) {
396      console.groupEnd(value);
397    } else {
398      jsLog('Group end: ' + value);
399    }    
400  }
401
402// imposta colonne per tablesaw dopo ricerca ajax
403// OTTIMIZZAZIONE: Usa createElement nativo invece di parsing HTML jQuery
404function SetTablesawCell(nomeColonna, contenuto, riga, tddata) {
405    if (contenuto == null) { 
406        contenuto = "";
407    }
408    if (tddata === undefined) {
409        tddata = "";
410    }
411
412    // OTTIMIZZAZIONE: createElement è 3-5x più veloce del parsing HTML
413    var td = document.createElement("td");
414    td.setAttribute("data-contenuto", tddata);
415    td.style.wordWrap = "break-word";
416    
417    // Costruisci innerHTML una sola volta
418    td.innerHTML = '<b class="tablesaw-cell-label"><div class="tablesorter-header-inner">' + 
419                   nomeColonna + '</div></b><span class="tablesaw-cell-content">' + 
420                   contenuto + '</span>';
421    
422    // OTTIMIZZAZIONE: appendChild nativo invece di jQuery appendTo
423    if (riga[0]) {
424        riga[0].appendChild(td);
425    } else {
426        riga.appendChild(td);
427    }
428}

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.