PageSourceSearch

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

js provincia.alessandria.it collected 2026-09-25 00:32:07 UTC 15,676 bytes, 484 lines download raw bytes

1// Configurazione globale SweetAlert2 - scrollbarPadding + allowOutsideClick di default
2(function() {
3    if (typeof Swal !== 'undefined') {
4        const originalSwalFire = Swal.fire.bind(Swal);
5        Swal.fire = function(options) {
6            if (typeof options === 'object' && options !== null) {
7                if (options.scrollbarPadding === undefined) {
8                    options.scrollbarPadding = false;
9                }
10                if (options.allowOutsideClick === undefined) {
11                    options.allowOutsideClick = false;
12                }
13            }
14            return originalSwalFire(options);
15        };
16    }
17})();
18
19jQuery( document ).ready( function( $ ) {
20    // $('img.svg').each(function(){
21    // 	var $img = $(this);
22    // 	var imgID = $img.attr('id');
23    // 	var imgURL = $img.attr('src');
24    // 	//var imgClass = $img.attr('class');
25
26    // 	$.get(imgURL, function(data) {
27    // 		var $svg = $(data).find('svg');				
28    //         // Add replaced image's ID to the new SVG
29    //         if(typeof imgID !== 'undefined') {
30    //             $svg = $svg.attr('id', imgID);
31    //         }
32    //         // Add replaced image's classes to the new SVG
33    // 		if(typeof imgClass !== 'undefined') {
34    //             $svg = $svg.attr('class', imgClass + ' replaced-svg');
35    //         }
36
37    // 		$svg = $svg.removeAttr('xmlns:a');
38    // 		$img.replaceWith($svg);
39    // 	}, 'xml');
40
41    // });			
42
43    //$('svg').removeClass("u-hidden");
44
45
46    /*
47    document.querySelectorAll('div.dropdownTD').forEach(dropdown => {
48      dropdown.addEventListener('click', function (e) {
49        e.preventDefault(); // evita il salto in cima
50        e.stopPropagation(); // evita che clic fuori chiuda subito
51        this.classList.toggle('open');
52      });
53    });
54    */
55
56    document.addEventListener('click', function (e) {
57      // se il click non è su un div.dropdownTD o dentro di esso, esci
58      if (!e.target.closest('div.dropdownTD')) return;
59
60      e.preventDefault(); // evita il salto in cima
61      e.stopPropagation(); // evita che clic fuori chiuda subito
62
63      const dropdown = e.target.closest('div.dropdownTD');
64      dropdown.classList.toggle('open');
65    });
66    
67
68    document.addEventListener('click', function () {
69      document.querySelectorAll('div.dropdownTD').forEach(d => d.classList.remove('open'));
70    });
71
72
73    function VisualizzaCubottiAut(){
74      $('div.CubottoAut').removeClass('u-hidden');
75      $('#divCubotti').removeClass('heightCubotti');
76      $('#h1AccessoServivi').removeClass('u-hidden');
77    }
78
79    $('img.svg').on("load",function(){
80        var $img = $(this);
81        var imgID = $img.attr('id');
82        var imgURL = $img.attr('src');
83        var imgClass = $img.attr('class');
84        $img.css("visibility", "hidden");
85
86        $.get(imgURL, function(data) {
87            var $svg = $(data).find('svg');				
88            // Add replaced image's ID to the new SVG
89            if(typeof imgID !== 'undefined') {
90                $svg = $svg.attr('id', imgID);
91            }
92            // Add replaced image's classes to the new SVG
93            if(typeof imgClass !== 'undefined') {
94                $svg = $svg.attr('class', imgClass + ' replaced-svg');
95            }
96
97            $svg = $svg.removeAttr('xmlns:a');
98			
99			// se sono in procedimento imposto colore del titolo
100			if($(".single-su_procedimento").length > 0){
101				$svg = $svg.css("fill", $("h1").css("color"));
102			}
103			// se sono in scrivania digitale imposto il colore delle altre icone
104			if($("#divScrivaniaDigitaleTools").length > 0){
105				setTimeout(function(){ 
106					$svg = $svg.css("fill", $("#profilo i").css("color"));
107					$("svg path").css("fill", $("#profilo i").css("color"));
108
109
110          
111
112
113				}, 80);
114				
115			}
116			
117			$svg = $svg.removeClass("u-hidden");
118            $img.replaceWith($svg);			
119        }, 'xml');		
120    }).each(function(){
121        if(this.complete) {
122            $(this).trigger('load');
123        }
124    });
125
126
127    
128
129    function CheckSportello(){
130      var strUrl = "";
131      strUrl = $(location).attr('href');
132      return (strUrl.includes("/sportello-unico-digitale/")||strUrl.includes("/su_ambito/")||strUrl.includes("/su_procedimento/")||strUrl.includes("/su_news/")||strUrl.includes("/su_riferimento_norm/")||strUrl.includes("/su_approfon_procedim/"));
133    }
134
135    function CheckTastoEntraSportello(){
136      if(CheckSportello()){
137        if($("#hIsAut").val()=='1'){
138          $("#buttonEsci").removeClass("u-hidden");
139        }
140        else{
141          $("#buttonAccesso").removeClass("u-hidden");
142        }
143      } 
144      else {
145        $("#buttonEsci").addClass("u-hidden");
146        $("#buttonScrivania").addClass("u-hidden");
147        $("#buttonAccesso").addClass("u-hidden");
148      }
149    }
150  
151  //Lo faccio fare alla pagina php (header.php)
152  //CheckTastoEntraSportello();
153
154  
155  function CheckSingleSignOn(){
156
157    let singleSignOn = $("[id$=hSingleSignOn]").val()||"";
158
159    if(singleSignOn == "SI" && CheckSportello()){
160
161      VisualizzaCubottiAut()
162
163      let IsAut = $("#hIsAut").val()||"";
164      let idCliente = $("[id$=hfiIdCliente]").val()||"";
165      let siteUrl = $("[id$=hfiSiteUrl]").val()||"";
166      let idSU = $("[id$=hfiIdSU]").val()||"";
167      let urlCheckIsAut = $("[id$=hCheckIsAut]").val()||"";
168      
169      let fd = new FormData();
170      fd.append('idCliente', idCliente);
171      fd.append('ssoToken', '');
172      fd.append('urlRed', window.location.href);
173     
174      //if(IsAut != '1'){
175        jQuery.ajax({
176          type: 'POST',
177          url: urlCheckIsAut,
178          async: true,
179          dataType: 'JSON',
180          data: fd,
181          contentType: false,
182          processData: false,
183          xhrFields: {
184            withCredentials: true
185          },
186          crossDomain: true,
187          beforeSend: function(xhr){
188           
189          },
190          success: function(response){
191            //console.log(response);
192            if (typeof response !== 'undefined' && response !== null){
193              if (typeof response.token !== 'undefined' && response.token !== null){
194                if(IsAut != '1'){
195                  let urlRed = window.location.href;
196                  
197                  if(urlRed.includes("/autenticazione")){
198                    urlRed = siteUrl + "/sportello-unico-digitale/pagina/scrivania-digitale/"
199                  }
200                  
201                  let urlCheckSSO = siteUrl + "/auth-checker?idsu=red&IdGuIDAut=" + response.token + "&red=" + urlRed;
202                  location.href = urlCheckSSO;
203                }
204              }
205            }
206          },
207          error: function(xhr, status, error){
208            // gestione dell'errore
209            console.log('[SSO] check IsAut fallito:', status, error, 'httpStatus:', xhr.status);
210            // xhr.status == 0 -> la risposta non e' mai arrivata al JS (blocco CORS,
211            // rete, timeout, preflight). NON e' una risposta di "non autenticato":
212            // sloggare in questo caso butta fuori un utente valido.
213            // xhr.status == 401 -> IsAut.ashx risponde 401 con corpo vuoto quando non
214            // esiste una sessione ASP.NET su pratiche (timeout 30 min): significa
215            // "nessuna sessione SSO", non "l'utente si e' sloggato dall'IdP".
216            // xhr.status >= 500 -> guasto/indisponibilita' del servizio (misurato dal
217            // vivo un 503): non dice nulla sull'autenticazione dell'utente.
218            if(IsAut == '1' && xhr.status !== 0 && xhr.status !== 401 && xhr.status < 500){
219              su_ajax_logout(window.location);
220            }
221          }
222        });
223      //}
224    } 
225  }
226  
227  CheckSingleSignOn();
228
229	// homepage
230	$("#divAmbiti .Entrypoint-item")
231	.on("mouseenter", function(){
232
233    if(jQuery("#hfiPNRRStyle").val()=="1") {
234     //$(this).children().children().removeClass("u-color-50");
235     //$(this).children().children().addClass("u-color-black");
236     //$(this).find('svg *').attr('style', 'fill: black !important');
237     $(this).find('.textamb').attr('style', 'text-decoration: underline;');
238     //$(this).find('.textamb').addClass("u-textWeight-600");
239    } else {
240      $(this).addClass("u-background-40").removeClass("u-background-60");
241    }
242
243		
244	})
245	.on("mouseleave", function(){
246		
247
248    if(jQuery("#hfiPNRRStyle").val()=="1") {
249      //let color = $('.u-color-50').css( "color" );
250      //$(this).children().children().removeClass("u-color-black");
251      //$(this).children().children().addClass("u-color-50");
252      //$(this).find('svg *').attr('style', 'fill: ' + color + ' !important');
253      $(this).find('.textamb').attr('style', 'text-decoration: unset;');
254      //$(this).find('.textamb').removeClass("u-textWeight-600");
255    } else {
256      $(this).addClass("u-background-60").removeClass("u-background-40");
257    }
258
259  });    
260    
261    // scrivania digitale
262	// $("#divScrivaniaDigitaleTools a")
263	// .on("mouseenter", function(){
264	// 	$(this).addClass("u-color-60").removeClass("u-color-40");
265	// })
266	// .on("mouseleave", function(){
267	// 	$(this).addClass("u-color-40").removeClass("u-color-60");
268    // });    
269    
270    // scrivania digitale
271	$(".TD-ScrivaniaDigitale-Caselloni a")
272	.on("mouseenter", function(){
273		$(this).addClass("u-color-60").removeClass("u-color-40");
274	})
275	.on("mouseleave", function(){
276		$(this).addClass("u-color-40").removeClass("u-color-60");
277	});   
278
279	$("#buttonEsci,#aEsci").on('click', function(e){
280    if ( $("#iframeCompilazione").length ) {
281      Swal.fire({
282        title: "Attenzione!",
283        text: "Stai per uscire dalla pagina, eventuali modifiche non salvate andranno perdute. Continuare?",
284        icon: "warning",
285        showCancelButton: true,
286        confirmButtonText: "Si",
287        cancelButtonText: "No",
288        confirmButtonColor: "#d33",
289        allowOutsideClick: false
290        })
291        .then((result) => {
292          if (result.isConfirmed) {
293            e.preventDefault();
294            su_ajax_logout();
295          }
296        });
297    } else {
298      e.preventDefault();
299      su_ajax_logout();
300    }
301	});
302
303});
304
305function CorrezioneGlitch(){
306	// DISABILITATO: il padding-top è gestito interamente via CSS (position:sticky).
307	// La correzione JS causava sfarfallamento.
308}
309
310function TestGet(){
311	jQuery.ajax({
312			type: "GET",
313			//url: "https://localhost:44342/api/infosu/TD0258/sue",
314			//url: "https://localhost:44342/api/infosu/" + idcliente + "/" + idsu,
315			// url: appPathRestAPI + "api/infosu/" + idcliente + "/" + idsu,
316			//contentType: "application/json",
317			// url: "https://localhost:44342/api/scrivania/pratiche/TD0258/SRVLSN81E08A984F",
318			url: "https://localhost:44342/api/scrivania/pratiche/TD0258/DTTLCU80E01D205V",
319			data: {
320				// Oggetto: "concorso",
321				Ambito: "sue",
322				// Modello: 123,
323				MostraArchiviate : true,
324				// CodiceIstanza: "COD_MODELLO_PIPPO",
325				DataDa: "01/05/1980",
326				NumMaxElementi: 50,
327				TipoRicerca: "P"
328			},
329			success: function (data) {
330				console.log("Stato comunicazione: OK.", data);
331			},
332			error: function (jqXHR, textStatus, errorThrown) {
333				console.log("Stato comunicazione: KO Errore.", textStatus);
334			},
335			complete: function (jqXHR, textStatus) {
336				console.log("Stato", textStatus);
337			}
338		});
339	
340	
341}
342
343//Imposta classe di errore e relativo messaggio.
344function setObjErrClass(obj,title) {
345	title = title || obj.attr("data-msg") || "";
346	var formField = obj.parents(".Form-field");
347	formField.find("div.xAlert").addClass("Alert Alert--error Alert--withBg u-padding-right-s u-padding-bottom-s");
348	formField.addClass("is-invalid");
349	formField.find("p").removeClass("u-hidden");
350	if(title !== "") formField.find("p").text(title);
351	//obj.trigger('checkfield:ko');
352  }
353    
354
355
356//Rimuove classe di errore ed imposta relativo messaggio.
357function remObjClass(obj) {
358	var formField = obj.parents(".Form-field");
359	formField.find("div.xAlert").removeClass("Alert Alert--error Alert--withBg u-padding-right-s u-padding-bottom-s");
360	formField.removeClass("is-invalid");
361	formField.find("p").addClass("u-hidden");
362	//obj.trigger('checkfield:ok');
363	}
364
365function remObjErrClass(obj){
366	remObjClass(obj);
367}
368
369function CheckObl(){
370	var controlloOK = true;
371
372	jQuery("[data-obl]:visible").each(function(){
373		var controllo = jQuery(this).val() != "";
374		if (controllo){
375			remObjErrClass(jQuery(this));
376		} else {
377			setObjErrClass(jQuery(this));
378		}
379
380		controlloOK = controlloOK && controllo;
381	});
382
383	return controlloOK;
384}
385
386
387function TestAperturaIFrame(){
388	var div = jQuery("<div style='z-index:100; background-color:red; position: absolute; height: 200px;width: 200px;margin:0 auto'></div>");
389	div.appendTo(jQuery("section#main"));
390	
391	
392	
393	
394}
395
396
397function RegistraMessageListener(onMessage){
398	// ascolto per PostMessage dalla pagina inclusa
399	if (window.addEventListener) {
400		window.addEventListener("message", onMessage, false);        
401	} 
402	else if (window.attachEvent) {
403		window.attachEvent("onmessage", onMessage, false);
404	};
405}
406
407function ResizeIFrame(idframe, size){
408	jQuery("iframe#" + idframe ).height(size);
409}
410
411function IFrameLoaded(){
412	console.log("iframe loaded");
413
414}
415
416function CheckProfiloPassword(){
417  var psw = "";
418
419  remObjClass(jQuery("#password"));
420  remObjClass(jQuery("#repassword"));
421
422  psw = jQuery("#password").val();
423  repsw = jQuery("#repassword").val();
424  
425  if (psw!="") {
426    if (psw != repsw) {
427      setObjErrClass(jQuery("#repassword"),"Password non corrispondente!");
428      return false
429    } else {
430      remObjClass(jQuery("#repassword"));
431      var checkPwd = checkPasswordFormat(psw, 8);
432      if (!checkPwd.controllo) {
433          setObjErrClass(jQuery("#password"), checkPwd.msg);
434      } else {
435        remObjClass(jQuery("#password"));
436      }
437      return checkPwd.controllo;
438    }
439  } else {
440    if (repsw!="") {
441      setObjErrClass(jQuery("#repassword"),"Password non corrispondente!");
442      return false;
443    } else {
444      remObjClass(jQuery("#repassword"));
445    }
446  }
447  return true;
448}
449
450// verifica il formato di una password
451// restituisce un oggetto: obj.controllo -> true|false, obj.msg -> stringa di errore
452function checkPasswordFormat(pwd, minLength) {
453  var r = { controllo: true, msg: "" };
454
455  if (pwd.length >= parseInt(minLength)) {
456    var pwdCheckLowerCase = /[a-z]+/;
457    var pwdCheckUpperCase = /[A-Z]+/;
458    var pwdCheckNumbers = /[0-9]+/;
459    var pwdCheckSpecialChars = /[\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\072\073\074\075\076\077\100\133\135\137\173\174\175]+/;  //caratteri speciali
460    if (!pwdCheckLowerCase.test(pwd)) {
461      r.controllo = false;
462      r.msg = 'La password deve contenere almeno 1 carattere minuscolo. ';
463    }
464    if (!pwdCheckUpperCase.test(pwd)) {
465      r.controllo = false;
466      r.msg += 'La password deve contenere almeno 1 carattere maiuscolo. ';
467    }
468    if (!pwdCheckNumbers.test(pwd)) {
469      r.controllo = false;
470      r.msg += 'La password deve contenere almeno 1 carattere numerico. ';
471    }
472    if (!pwdCheckSpecialChars.test(pwd)) {
473      r.controllo = false;
474      r.msg += 'La password deve contenere almeno 1 carattere speciale. ';
475    }
476  } else {
477    r.controllo = false;
478    r.msg = 'La password deve contenere almeno ' + parseInt(minLength) + ' caratteri.';
479  }
480
481  return r
482}
483
484

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.