PageSourceSearch

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

js provincia.alessandria.it collected 2026-10-02 12:43:38 UTC 17,617 bytes, 513 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            // Accessibilità (WCAG 4.1.1): id univoci per ogni SVG inserito, con i riferimenti url(#...) e href="#...":
89            // gli SVG esportati da Illustrator ripetono Livello_1, SVGID_1_, SVGID_2_ (prima dell'id dell'<img>, che resta sulla radice)
90            var svgRoot = $svg.get(0);
91            if(svgRoot) {
92                window.tdSvgSeq = (window.tdSvgSeq || 0) + 1;
93                var svgPfx = 'isvg' + window.tdSvgSeq + '-';
94                [svgRoot].concat(Array.prototype.slice.call(svgRoot.getElementsByTagName('*'))).forEach(function(n) {
95                    Array.prototype.slice.call(n.attributes).forEach(function(a) {
96                        if(a.name === 'id') {
97                            a.value = svgPfx + a.value;
98                        }
98 else if(a.value.indexOf('url(#') !== -1) {
99                            a.value = a.value.replace(/url\(\s*#([^)\s]+)\s*\)/g, 'url(#' + svgPfx + '$1)');
100                        } else if(a.localName === 'href' && a.value.charAt(0) === '#') {
101                            a.value = '#' + svgPfx + a.value.substring(1);
102                        }
103                    });
104                    if(n.localName === 'style' && n.textContent.indexOf('url(#') !== -1) {
105                        n.textContent = n.textContent.replace(/url\(\s*#([^)\s]+)\s*\)/g, 'url(#' + svgPfx + '$1)');
106                    }
107                });
108            }
109            // Add replaced image's ID to the new SVG
110            if(typeof imgID !== 'undefined') {
111                $svg = $svg.attr('id', imgID);
112            }
113            // Add replaced image's classes to the new SVG
114            if(typeof imgClass !== 'undefined') {
115                $svg = $svg.attr('class', imgClass + ' replaced-svg');
116            }
117            // Accessibilità: l'SVG inline mantiene la semantica dell'alt dell'<img> sostituita
118            // (alt="" = decorativa, nascosta alle tecnologie assistive; alt valorizzato = nome dell'immagine)
119            var imgAlt = $img.attr('alt');
120            if(imgAlt === '') {
121                $svg = $svg.attr({'aria-hidden': 'true', 'focusable': 'false'});
122            } else if(typeof imgAlt !== 'undefined') {
123                $svg = $svg.attr({'role': 'img', 'aria-label': imgAlt});
124            }
125
126            $svg = $svg.removeAttr('xmlns:a');
127			
128			// se sono in procedimento imposto colore del titolo
129			if($(".single-su_procedimento").length > 0){
130				$svg = $svg.css("fill", $("h1").css("color"));
131			}
132			// se sono in scrivania digitale imposto il colore delle altre icone
133			if($("#divScrivaniaDigitaleTools").length > 0){
134				setTimeout(function(){ 
135					$svg = $svg.css("fill", $("#profilo i").css("color"));
136					$("svg path").css("fill", $("#profilo i").css("color"));
137
138
139          
140
141
142				}, 80);
143				
144			}
145			
146			$svg = $svg.removeClass("u-hidden");
147            $img.replaceWith($svg);			
148        }, 'xml');		
149    }).each(function(){
150        if(this.complete) {
151            $(this).trigger('load');
152        }
153    });
154
155
156    
157
158    function CheckSportello(){
159      var strUrl = "";
160      strUrl = $(location).attr('href');
161      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/"));
162    }
163
164    function CheckTastoEntraSportello(){
165      if(CheckSportello()){
166        if($("#hIsAut").val()=='1'){
167          $("#buttonEsci").removeClass("u-hidden");
168        }
169        else{
170          $("#buttonAccesso").removeClass("u-hidden");
171        }
172      } 
173      else {
174        $("#buttonEsci").addClass("u-hidden");
175        $("#buttonScrivania").addClass("u-hidden");
176        $("#buttonAccesso").addClass("u-hidden");
177      }
178    }
179  
180  //Lo faccio fare alla pagina php (header.php)
181  //CheckTastoEntraSportello();
182
183  
184  function CheckSingleSignOn(){
185
186    let singleSignOn = $("[id$=hSingleSignOn]").val()||"";
187
188    if(singleSignOn == "SI" && CheckSportello()){
189
190      VisualizzaCubottiAut()
191
192      let IsAut = $("#hIsAut").val()||"";
193      let idCliente = $("[id$=hfiIdCliente]").val()||"";
194      let siteUrl = $("[id$=hfiSiteUrl]").val()||"";
195      let idSU = $("[id$=hfiIdSU]").val()||"";
196      let urlCheckIsAut = $("[id$=hCheckIsAut]").val()||"";
197      
198      let fd = new FormData();
199      fd.append('idCliente', idCliente);
200      fd.append('ssoToken', '');
201      fd.append('urlRed', window.location.href);
202     
203      //if(IsAut != '1'){
204        jQuery.ajax({
205          type: 'POST',
206          url: urlCheckIsAut,
207          async: true,
208          dataType: 'JSON',
209          data: fd,
210          contentType: false,
211          processData: false,
212          xhrFields: {
213            withCredentials: true
214          },
215          crossDomain: true,
216          beforeSend: function(xhr){
217           
218          },
219          success: function(response){
220            //console.log(response);
221            if (typeof response !== 'undefined' && response !== null){
222              if (typeof response.token !== 'undefined' && response.token !== null){
223                if(IsAut != '1'){
224                  let urlRed = window.location.href;
225                  
226                  if(urlRed.includes("/autenticazione")){
227                    urlRed = siteUrl + "/sportello-unico-digitale/pagina/scrivania-digitale/"
228                  }
229                  
230                  let urlCheckSSO = siteUrl + "/auth-checker?idsu=red&IdGuIDAut=" + response.token + "&red=" + urlRed;
231                  location.href = urlCheckSSO;
232                }
233              }
234            }
235          },
236          error: function(xhr, status, error){
237            // gestione dell'errore
238            console.log('[SSO] check IsAut fallito:', status, error, 'httpStatus:', xhr.status);
239            // xhr.status == 0 -> la risposta non e' mai arrivata al JS (blocco CORS,
240            // rete, timeout, preflight). NON e' una risposta di "non autenticato":
241            // sloggare in questo caso butta fuori un utente valido.
242            // xhr.status == 401 -> IsAut.ashx risponde 401 con corpo vuoto quando non
243            // esiste una sessione ASP.NET su pratiche (timeout 30 min): significa
244            // "nessuna sessione SSO", non "l'utente si e' sloggato dall'IdP".
245            // xhr.status >= 500 -> guasto/indisponibilita' del servizio (misurato dal
246            // vivo un 503): non dice nulla sull'autenticazione dell'utente.
247            if(IsAut == '1' && xhr.status !== 0 && xhr.status !== 401 && xhr.status < 500){
248              su_ajax_logout(window.location);
249            }
250          }
251        });
252      //}
253    } 
254  }
255  
256  CheckSingleSignOn();
257
258	// homepage
259	$("#divAmbiti .Entrypoint-item")
260	.on("mouseenter", function(){
261
262    if(jQuery("#hfiPNRRStyle").val()=="1") {
263     //$(this).children().children().removeClass("u-color-50");
264     //$(this).children().children().addClass("u-color-black");
265     //$(this).find('svg *').attr('style', 'fill: black !important');
266     $(this).find('.textamb').attr('style', 'text-decoration: underline;');
267     //$(this).find('.textamb').addClass("u-textWeight-600");
268    } else {
269      $(this).addClass("u-background-40").removeClass("u-background-60");
270    }
271
272		
273	})
274	.on("mouseleave", function(){
275		
276
277    if(jQuery("#hfiPNRRStyle").val()=="1") {
278      //let color = $('.u-color-50').css( "color" );
279      //$(this).children().children().removeClass("u-color-black");
280      //$(this).children().children().addClass("u-color-50");
281      //$(this).find('svg *').attr('style', 'fill: ' + color + ' !important');
282      $(this).find('.textamb').attr('style', 'text-decoration: unset;');
283      //$(this).find('.textamb').removeClass("u-textWeight-600");
284    } else {
285      $(this).addClass("u-background-60").removeClass("u-background-40");
286    }
287
288  });    
289    
290    // scrivania digitale
291	// $("#divScrivaniaDigitaleTools a")
292	// .on("mouseenter", function(){
293	// 	$(this).addClass("u-color-60").removeClass("u-color-40");
294	// })
295	// .on("mouseleave", function(){
296	// 	$(this).addClass("u-color-40").removeClass("u-color-60");
297    // });    
298    
299    // scrivania digitale
300	$(".TD-ScrivaniaDigitale-Caselloni a")
301	.on("mouseenter", function(){
302		$(this).addClass("u-color-60").removeClass("u-color-40");
303	})
304	.on("mouseleave", function(){
305		$(this).addClass("u-color-40").removeClass("u-color-60");
306	});   
307
308	$("#buttonEsci,#aEsci").on('click', function(e){
309    if ( $("#iframeCompilazione").length ) {
310      Swal.fire({
311        title: "Attenzione!",
312        text: "Stai per uscire dalla pagina, eventuali modifiche non salvate andranno perdute. Continuare?",
313        icon: "warning",
314        showCancelButton: true,
315        confirmButtonText: "Si",
316        cancelButtonText: "No",
317        confirmButtonColor: "#d33",
318        allowOutsideClick: false
319        })
320        .then((result) => {
321          if (result.isConfirmed) {
322            e.preventDefault();
323            su_ajax_logout();
324          }
325        });
326    } else {
327      e.preventDefault();
328      su_ajax_logout();
329    }
330	});
331
332});
333
334function CorrezioneGlitch(){
335	// DISABILITATO: il padding-top è gestito interamente via CSS (position:sticky).
336	// La correzione JS causava sfarfallamento.
337}
338
339function TestGet(){
340	jQuery.ajax({
341			type: "GET",
342			//url: "https://localhost:44342/api/infosu/TD0258/sue",
343			//url: "https://localhost:44342/api/infosu/" + idcliente + "/" + idsu,
344			// url: appPathRestAPI + "api/infosu/" + idcliente + "/" + idsu,
345			//contentType: "application/json",
346			// url: "https://localhost:44342/api/scrivania/pratiche/TD0258/SRVLSN81E08A984F",
347			url: "https://localhost:44342/api/scrivania/pratiche/TD0258/DTTLCU80E01D205V",
348			data: {
349				// Oggetto: "concorso",
350				Ambito: "sue",
351				// Modello: 123,
352				MostraArchiviate : true,
353				// CodiceIstanza: "COD_MODELLO_PIPPO",
354				DataDa: "01/05/1980",
355				NumMaxElementi: 50,
356				TipoRicerca: "P"
357			},
358			success: function (data) {
359				console.log("Stato comunicazione: OK.", data);
360			},
361			error: function (jqXHR, textStatus, errorThrown) {
362				console.log("Stato comunicazione: KO Errore.", textStatus);
363			},
364			complete: function (jqXHR, textStatus) {
365				console.log("Stato", textStatus);
366			}
367		});
368	
369	
370}
371
372//Imposta classe di errore e relativo messaggio.
373function setObjErrClass(obj,title) {
374	title = title || obj.attr("data-msg") || "";
375	var formField = obj.parents(".Form-field");
376	formField.find("div.xAlert").addClass("Alert Alert--error Alert--withBg u-padding-right-s u-padding-bottom-s");
377	formField.addClass("is-invalid");
378	formField.find("p").removeClass("u-hidden");
379	if(title !== "") formField.find("p").text(title);
380	//obj.trigger('checkfield:ko');
381  }
382    
383
384
385//Rimuove classe di errore ed imposta relativo messaggio.
386function remObjClass(obj) {
387	var formField = obj.parents(".Form-field");
388	formField.find("div.xAlert").removeClass("Alert Alert--error Alert--withBg u-padding-right-s u-padding-bottom-s");
389	formField.removeClass("is-invalid");
390	formField.find("p").addClass("u-hidden");
391	//obj.trigger('checkfield:ok');
392	}
393
394function remObjErrClass(obj){
395	remObjClass(obj);
396}
397
398function CheckObl(){
399	var controlloOK = true;
400
401	jQuery("[data-obl]:visible").each(function(){
402		var controllo = jQuery(this).val() != "";
403		if (controllo){
404			remObjErrClass(jQuery(this));
405		} else {
406			setObjErrClass(jQuery(this));
407		}
408
409		controlloOK = controlloOK && controllo;
410	});
411
412	return controlloOK;
413}
414
415
416function TestAperturaIFrame(){
417	var div = jQuery("<div style='z-index:100; background-color:red; position: absolute; height: 200px;width: 200px;margin:0 auto'></div>");
418	div.appendTo(jQuery("section#main"));
419	
420	
421	
422	
423}
424
425
426function RegistraMessageListener(onMessage){
427	// ascolto per PostMessage dalla pagina inclusa
428	if (window.addEventListener) {
429		window.addEventListener("message", onMessage, false);        
430	} 
431	else if (window.attachEvent) {
432		window.attachEvent("onmessage", onMessage, false);
433	};
434}
435
436function ResizeIFrame(idframe, size){
437	jQuery("iframe#" + idframe ).height(size);
438}
439
440function IFrameLoaded(){
441	console.log("iframe loaded");
442
443}
444
445function CheckProfiloPassword(){
446  var psw = "";
447
448  remObjClass(jQuery("#password"));
449  remObjClass(jQuery("#repassword"));
450
451  psw = jQuery("#password").val();
452  repsw = jQuery("#repassword").val();
453  
454  if (psw!="") {
455    if (psw != repsw) {
456      setObjErrClass(jQuery("#repassword"),"Password non corrispondente!");
457      return false
458    } else {
459      remObjClass(jQuery("#repassword"));
460      var checkPwd = checkPasswordFormat(psw, 8);
461      if (!checkPwd.controllo) {
462          setObjErrClass(jQuery("#password"), checkPwd.msg);
463      } else {
464        remObjClass(jQuery("#password"));
465      }
466      return checkPwd.controllo;
467    }
468  } else {
469    if (repsw!="") {
470      setObjErrClass(jQuery("#repassword"),"Password non corrispondente!");
471      return false;
472    } else {
473      remObjClass(jQuery("#repassword"));
474    }
475  }
476  return true;
477}
478
479// verifica il formato di una password
480// restituisce un oggetto: obj.controllo -> true|false, obj.msg -> stringa di errore
481function checkPasswordFormat(pwd, minLength) {
482  var r = { controllo: true, msg: "" };
483
484  if (pwd.length >= parseInt(minLength)) {
485    var pwdCheckLowerCase = /[a-z]+/;
486    var pwdCheckUpperCase = /[A-Z]+/;
487    var pwdCheckNumbers = /[0-9]+/;
488    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
489    if (!pwdCheckLowerCase.test(pwd)) {
490      r.controllo = false;
491      r.msg = 'La password deve contenere almeno 1 carattere minuscolo. ';
492    }
493    if (!pwdCheckUpperCase.test(pwd)) {
494      r.controllo = false;
495      r.msg += 'La password deve contenere almeno 1 carattere maiuscolo. ';
496    }
497    if (!pwdCheckNumbers.test(pwd)) {
498      r.controllo = false;
499      r.msg += 'La password deve contenere almeno 1 carattere numerico. ';
500    }
501    if (!pwdCheckSpecialChars.test(pwd)) {
502      r.controllo = false;
503      r.msg += 'La password deve contenere almeno 1 carattere speciale. ';
504    }
505  } else {
506    r.controllo = false;
507    r.msg = 'La password deve contenere almeno ' + parseInt(minLength) + ' caratteri.';
508  }
509
510  return r
511}
512
513

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.