PageSourceSearch

https://www.italia.it/etc.clientlibs/tdh/components/editorials/sha…-c2ff507868e260935ee493c0698b1a89-lc.min.js

js italia.it collected 2026-10-01 07:21:29 UTC 6,343 bytes, 41 lines download raw bytes

1{ //al document ready (da public)
2    'use strict';
3    const socialSelector = document.querySelectorAll(".sharing-button");
4    const modifyButton = document.querySelector(".button-for-change-cookies");
5    const modifyCookies = modifyButton && modifyButton.addEventListener("click", openModifyCookies);
6    socialSelector.forEach(function(social) {
7        social.addEventListener("click", () => {
8
9			if (social.getAttribute('data-url')) {
10			    if (!(social.getAttribute('data-url').indexOf("http") >= 0)) {
11                    social.dataset.url = (social.getAttribute('data-url') != null) ?
12                        window.location.origin + social.getAttribute('data-url') : window.location.href;
13                }
14            } else {
15                social.dataset.url = window.location.href;
16            }
17
18        	controlCookies();
19        });
20    });
21
22    function controlCookies(){
23        const sharingModal = document.querySelector('.sharing-modal-container');
24        const modalToShow = document.querySelector('.sharing-modal-social');
25        if (consentProfilingGranted()){
26            modalToShow.dataset.showError=false;
27        } else {
28            modalToShow.dataset.showError=true;
29        }
30    }
31
32    function openModifyCookies(){
33        const errorSharingModal = document.querySelector('.error-sharing-modal-container');
34        errorSharingModal.classList.remove("overlay-mitur--visible");
35        const modifyCookies = document.querySelector("#ot-sdk-btn-floating button");
36        modifyCookies.click();
37    }
38
39}(document)
40
41MiTur.sharing={urls:{whatsapp:"https://wa.me/?text=",messenger:"https://www.facebook.com/dialog/send?link=",telegram:"https://t.me/share/url?",facebook:"https://facebook.com/sharer/sharer.php?u=",twitter:"https://twitter.com/intent/tweet?"},copyUrl:function(){const e=document.querySelector(".sharing-modal-container .sharing-modal__footer .sharing-modal__footer-btn-copy");if(e.getAttribute("data-copied"))return;e.setAttribute("data-copied","true");const t=e.getAttribute("data-url"),o=t||window.location.href;navigator.clipboard?navigator.clipboard.writeText(o).then(()=>{MiTur.sharing.showSuccessLabel()},()=>{console.log("Clipboard write failed")}):MiTur.sharing.unsecuredCopyToClipboard(o)},showSuccessLabel:function(){const e=document.querySelector(".sharing-modal__input");if(e.querySelector(".sharing-modal__input__success-label"))return;const t=document.createElement("div");t.className="sharing-modal__input__success-label";const o=document.querySelector(".sharing-modal-container")?.getAttribute("data-success-label");t.textContent=o||"Il Link è stato salvato con successo",e.appendChild(t)},hideSuccessLabel:function(){const e=document.querySelector(".sharing-modal__input__success-label");e?.remove()},unsecuredCopyToClipboard:function(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{document.execCommand("copy")}catch(e){console.error("Unable to copy to clipboard",e)}document.body.removeChild(t),MiTur.sharing.showSuccessLabel()},openModal:function(e){const t=document.querySelector(".sharing-modal__input input"),o=e.getAttribute("data-url");t.value=o,MiTur.sharing.initSocialLinks(e);const r=document.querySelector(".sharing-modal-container");r.classList.add("overlay-mitur--visible"),r.querySelector(".sharing-modal__footer .sharing-modal__footer-btn-copy").setAttribute("data-url",o)},openErrorModal:function(){MiTur.sharing.closeModal();document.querySelector(".error-sharing-modal-container").classList.add("overlay-mitur--visible")},closeModal:function(){document.querySelector(".sharing-modal-container").classList.remove("overlay-mitur--visible"),MiTur.sharing.hideSuccessLabel();const e=document.querySelector(".sharing-modal__footer-btn-copy");e?.removeAttribute("data-copied")},closeErrorModal:function(){document.querySelector(".error-sharing-modal-container").classList.remove("overlay-mitur--visible")},initSocialLinks:function(e){const t=document.querySelector(".sharing-modal-social"),o=t.getAttribute("data-show-error"),r=t.querySelector(".sharing-modal__cover-social");if(o&&JSON.parse(o))r.classList.remove("d-none"),r.addEventListener("click",()=>MiTur.sharing.openErrorModal());
41else{[...t.querySelectorAll("a")].forEach(t=>{const o=e.getAttribute("data-url"),r=e.getAttribute("data-text"),n=e.getAttribute("data-twitter-text");switch(t.getAttribute("data-social")){case"whatsapp":t.href=MiTur.sharing.urls.whatsapp,t.href+=encodeURIComponent(r)+" - "+encodeURIComponent(o);break;case"messenger":t.href=MiTur.sharing.urls.messenger,t.href+=encodeURIComponent(o);const e=document.querySelector('meta[name="fc_app_it"]')?.content;e&&(t.href+="&app_id="+encodeURIComponent(e));const a=window.location.href;t.href+="&redirect_uri="+encodeURIComponent(a);break;case"telegram":t.href=MiTur.sharing.urls.telegram,t.href+="url="+encodeURIComponent(o),t.href+="&text="+encodeURIComponent(r);break;case"facebook":t.href=MiTur.sharing.urls.facebook,t.href+=encodeURIComponent(o),t.href+="&quote="+encodeURIComponent(r);break;case"twitter":t.href=MiTur.sharing.urls.twitter,t.href+="url="+encodeURIComponent(o),t.href+="&text="+encodeURIComponent(n)}}),r.classList.add("d-none")}},init:function(){[...document.querySelectorAll(".sharing-button")].forEach(e=>{e.getAttribute("data-initialized")||(e.setAttribute("data-initialized",!0),e.addEventListener("click",function(){MiTur._runComponentCallback(e),MiTur.sharing.openModal(e)},!1),e.addEventListener("keydown",function(t){"Enter"===t.code&&e.click()}))});[...document.querySelectorAll(".sharing-modal__close")].forEach(e=>{e.getAttribute("data-initialized")||(e.setAttribute("data-initialized",!0),e.addEventListener("click",function(){MiTur._runComponentCallback(e),MiTur.sharing.closeModal()},!1))});[...document.querySelectorAll(".error-sharing-modal__close")].forEach(e=>{e.getAttribute("data-initialized")||(e.setAttribute("data-initialized",!0),e.addEventListener("click",function(){MiTur._runComponentCallback(e),MiTur.sharing.closeErrorModal()},!1))});[...document.querySelectorAll(".sharing-modal__footer button")].forEach(e=>{e.getAttribute("data-initialized")||(e.setAttribute("data-initialized",!0),e.addEventListener("click",function(){MiTur._runComponentCallback(e)},!1))})}},document.addEventListener("DOMContentLoaded",MiTur.sharing.init);

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.