1(function(window) { 2 3 if (!!window.cookieChoices) { 4 return window.cookieChoices; 5 } 6 7 var document = window.document; 8 // IE8 does not support textContent, so we should fallback to innerText. 9 var supportsTextContent = 'textContent' in document.body; 10 11 var cookieChoices = (function() { 12 13 var cookieName = 'mrw_cookielaw'; 14 var cookieConsentId = 'mrw_cookielaw_banner'; 15 var dismissLinkId = 'mrw_cookielaw_dismiss'; 16 var policyLinkId = 'mrw_cookielaw_policy'; 17 18 var subDomainCookie = true; 19 var scrollStartPos = 0; 20 var screenWidth = screen.width; 21 22 function _getDomainName() { 23 var domain; 24 var host = location.hostname; 25 var domain_array = host.split('.'); 26 var domain_parts = domain_array.length; 27 if (domain_parts == 2) domain = host; 28 else{ 29 domain = domain_array[domain_parts-2] + '.' + domain_array[domain_parts-1]; 30 } 31 return domain; 32 } 33 34 function _setElementText(element, text) { 35 if (supportsTextContent) { 36 element.textContent = text; 37 } else { 38 element.innerText = text; 39 } 40 } 41 42 function _getScroll() { 43 var px = 0; 44 if (typeof(window.pageYOffset) == 'number') px = window.pageYOffset; 45 else if (document.body && document.body.scrollTop) px = document.body.scrollTop; 46 else if (document.documentElement && document.documentElement.scrollTop) px = document.documentElement.scrollTop; 47 return px; 48 } 49 50 function _createHeaderElement(cookieText, dismissText, linkText, linkHref) { 51 var cookieConsentElement = document.createElement('div'); 52 cookieConsentElement.id = cookieConsentId; 53 cookieConsentElement.style.cssText = 'position: fixed; width: 100%; background-color: rgba(0,0,0,0.7);' 54 + 'margin: 0; left: 0; top: 0; padding: 10px 0; z-index: 1000;'; 55 56 var cookieConsentContainer = document.createElement('div'); 57 cookieConsentContainer.style.cssText = 'position: relative; width: ' + (screenWidth >= 980 ? '980px' : '98%') + '; margin: 0 auto;'; 58 cookieConsentContainer.appendChild(_createConsentText(cookieText)); 59 60 cookieConsentElement.appendChild(cookieConsentContainer); 61 62 if (!!linkText && !!linkHref) { 63 cookieConsentContainer.appendChild(_createPolicyLink(linkText, linkHref)); 64 } 65 cookieConsentContainer.appendChild(_createDismissLink(dismissText)); 66 return cookieConsentElement; 67 } 68 69 function _createConsentText(cookieText) { 70 var consentText = document.createElement('span'); 71 consentText.style.cssText = 'display: block; width: ' + (screenWidth >= 980 ? '800px' : '70%') + '; line-height: 20px; color: #FFF;' 72 + 'font-family: verdana, arial, tahoma, sans-serif; font-size: 12px;'; 73 _setElementText(consentText, cookieText); 74 return consentText; 75 } 76 77 function _createDismissLink(dismissText) { 78 var dismissLink = document.createElement('a'); 79 _setElementText(dismissLink, dismissText);
80 dismissLink.id = dismissLinkId; 81 dismissLink.href = '#'; 82 dismissLink.style.cssText = 'position: absolute; top: 0; right: 0; display: block; width: ' + (screenWidth >= 980 ? '140px' : '28%') + '; line-height: 30px;' 83 + 'color: #FF9900; text-align: center; font-size: 14px; font-weight: bold; text-decoration: none;'; 84 return dismissLink; 85 } 86 87 function _createPolicyLink(linkText, linkHref) { 88 var infoLink = document.createElement('a'); 89 _setElementText(infoLink, linkText); 90 infoLink.id = policyLinkId; 91 infoLink.href = linkHref; 92 infoLink.target = '_blank'; 93 infoLink.style.cssText = 'position: absolute; top: 30px; right: 0; display: block; width: ' + (screenWidth >= 980 ? '140px' : '28%') + '; line-height: 30px;' 94 + 'color: #fff; text-align: center; font-size: 12px; text-decoration: underline;'; 95 return infoLink; 96 } 97 98 function _dismissLinkClick() { 99 _saveUserPreference(); 100 _removeCookieConsent(); 101 return false; 102 } 103 104 function _dismissAfterScroll() { 105 var px = _getScroll(); 106 if (px >= (scrollStartPos+50)) _dismissLinkClick(); 107 } 108 109 function _removeCookieConsent() { 110 var cookieChoiceElement = document.getElementById(cookieConsentId); 111 if (cookieChoiceElement != null) { 112 cookieChoiceElement.parentNode.removeChild(cookieChoiceElement); 113 } 114 if (window.addEventListener) { 115 window.removeEventListener('scroll', _dismissAfterScroll); 116 } 117 else if (window.attachEvent) { 118 window.detachEvent('onscroll', _dismissAfterScroll); 119 }else{ 120 window.onscroll = null; 121 } 122 } 123 124 function _saveUserPreference() { 125 // Set the cookie expiry to one year after today. 126 var expiryDate = new Date(); 127 expiryDate.setFullYear(expiryDate.getFullYear() + 1); 128 if (subDomainCookie) { 129 document.cookie = cookieName + '=y; expires=' + expiryDate.toGMTString() + '; path=/; domain=' + _getDomainName(); 130 }else{ 131 document.cookie = cookieName + '=y; expires=' + expiryDate.toGMTString(); 132 } 133 } 134 135 function _shouldDisplayConsent() { 136 // Display the header only if the cookie has not been set. 137 return !document.cookie.match(new RegExp(cookieName + '=([^;]+)')); 138 } 139 140 /* 141 Funzione pubblica 142 */ 143 function showCookieConsentBar(cookieText, dismissText, linkText, linkHref) { 144 if (_shouldDisplayConsent()) { 145 _removeCookieConsent(); 146 scrollStartPos = _getScroll(); 147 var consentElement = _createHeaderElement(cookieText, dismissText, linkText, linkHref); 148 var fragment = document.createDocumentFragment(); 149 fragment.appendChild(consentElement); 150 document.body.appendChild(fragment.cloneNode(true)); 151 document.getElementById(dismissLinkId).onclick = _dismissLinkClick; 152 var allLinks = document.getElementsByTagName('a'); 153 if (window.addEventListener) { 154 window.addEventListener('scroll', _dismissAfterScroll); 155 window.addEventListener('load', function() { 156 for (var i = 0; i < allLinks.length; i++) { 157 if (allLinks[i].id != policyLinkId) { 158 allLinks[i].addEventListener('click', _dismissLinkClick); 159 } 160 } 161 }); 162 } 163 else if (window.attachEvent) { 164 window.attachEvent('onscroll', _dismissAfterScroll); 165 window.attachEvent('onload', function() { 166 for (var i = 0; i < allLinks.length; i++) { 167 if (allLinks[i].id != policyLinkId) { 168 allLinks[i].attachEvent('onclick', _dismissLinkClick); 169 } 170 } 171 }); 172 }else{ 173 window.onscroll = _dismissAfterScroll; 174 } 175 } 176 } 177 178 var exports = {}; 179 exports.showCookieConsentBar = showCookieConsentBar; 180 return exports; 181 })(); 182 183 window.cookieChoices = cookieChoices; 184 return cookieChoices; 185})(this); 186 187 document.addEventListener('DOMContentLoaded', function(event) { 188 cookieChoices.showCookieConsentBar( 189 'Questo sito e/o gli strumenti terzi utilizzati, possono avvalersi di cookie per migliorare la navigazione e la fornitura dei servizi offerti. Proseguendo nella navigazione accetti di utilizzare i cookie. Per maggiori informazioni invitiamo a leggere l\'informativa estesa.', 190 'chiudi', 191 'informativa estesa', 192 'http://www.santacroceonline.com/infoSito/Staff/dirittiautore/privacy.htm'); 193 });
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.