PageSourceSearch

https://www.kisseo.com/js/cookiechoices.js

js kisseo.com collected 2026-09-26 11:18:58 UTC 5,882 bytes, 160 lines download raw bytes

1
2(function(window) {
3
4  if (!!window.cookieChoices) {
5    return window.cookieChoices;
6  }
7
8  var document = window.document;
9  // IE8 does not support textContent, so we should fallback to innerText.
10  var supportsTextContent = 'textContent' in document.body;
11
12  var cookieChoices = (function() {
13
14    var cookieName = (window.dMode ? '' : '__Secure-' ) + 'displayCookieConsent';
15    var cookieConsentId = 'cookieChoiceInfo';
16    var dismissLinkId = 'cookieChoiceDismiss';
17
18    function _createHeaderElement(cookieText, dismissText, linkText, linkHref) {
19      var butterBarStyles = 'position:fixed;width:100%;background-color:#333;opacity:0.9;' +
20          'margin:0; left:0; bottom:0;padding:12px;z-index:1000;text-align:center;color:#DDD';
21
22      var cookieConsentElement = document.createElement('div');
23      cookieConsentElement.id = cookieConsentId;
24      cookieConsentElement.style.cssText = butterBarStyles;
25      cookieConsentElement.appendChild(_createConsentText(cookieText));
26
27      if (!!linkText && !!linkHref) {
28        cookieConsentElement.appendChild(_createInformationLink(linkText, linkHref));
29      }
30      cookieConsentElement.appendChild(_createDismissLink(dismissText));
31      return cookieConsentElement;
32    }
33
34    function _createDialogElement(cookieText, dismissText, linkText, linkHref) {
35      var glassStyle = 'position:fixed;width:100%;height:100%;z-index:999;' +
36          'top:0;left:0;opacity:0.5;filter:alpha(opacity=50);' +
37          'background-color:#ccc;';
38      var dialogStyle = 'z-index:1000;position:fixed;left:50%;top:50%';
39      var contentStyle = 'position:relative;left:-50%;margin-top:-25%;' +
40          'background-color:#fff;padding:20px;box-shadow:4px 4px 25px #888;';
41
42      var cookieConsentElement = document.createElement('div');
43      cookieConsentElement.id = cookieConsentId;
44
45      var glassPanel = document.createElement('div');
46      glassPanel.style.cssText = glassStyle;
47
48      var content = document.createElement('div');
49      content.style.cssText = contentStyle;
50
51      var dialog = document.createElement('div');
52      dialog.style.cssText = dialogStyle;
53
54      var dismissLink = _createDismissLink(dismissText);
55      dismissLink.style.display = 'block';
56      dismissLink.style.textAlign = 'right';
57      dismissLink.style.marginTop = '8px';
58
59      content.appendChild(_createConsentText(cookieText));
60      if (!!linkText && !!linkHref) {
61        content.appendChild(_createInformationLink(linkText, linkHref));
62      }
63      content.appendChild(dismissLink);
64      dialog.appendChild(content);
65      cookieConsentElement.appendChild(glassPanel);
66      cookieConsentElement.appendChild(dialog);
67      return cookieConsentElement;
68    }
69
70    function _setElementText(element, text) {
71      if (supportsTextContent) {
72        element.textContent = text;
73      } else {
74        element.innerText = text;
75      }
76    }
77
78    function _createConsentText(cookieText) {
79      var consentText = document.createElement('span');
80      _setElementText(consentText, cookieText);
81      return consentText;
82    }
83
84    function _createDismissLink(dismissText) {
85      var dismissLink = document.createElement('a');
86      _setElementText(dismissLink, dismissText);
87      dismissLink.id = dismissLinkId;
88      dismissLink.href = '#';
89      dismissLink.style.marginLeft = '24px';
90	  dismissLink.style.color = '#FFF';
91	  dismissLink.style.textDecoration = 'underline';
92      return dismissLink;
93    }
94
95    function _createInformationLink(linkText, linkHref) {
96      var infoLink = document.createElement('a');
97      _setElementText(infoLink, linkText);
98      infoLink.href = linkHref;
99      infoLink.target = '_blank';
100      infoLink.style.marginLeft = '8px';
101	  infoLink.style.color = '#FFF';
102	  infoLink.style.textDecoration = 'underline';
103      return infoLink;
104    }
105
106    function _dismissLinkClick() {
107      _saveUserPreference();
108      _removeCookieConsent();
109      return false;
110    }
111
112    function _showCookieConsent(cookieText, dismissText, linkText, linkHref, isDialog) {
113      if (_shouldDisplayConsent()) {
114        _removeCookieConsent();
115        var consentElement = (isDialog) ?
116            _createDialogElement(cookieText, dismissText, linkText, linkHref) :
117            _createHeaderElement(cookieText, dismissText, linkText, linkHref);
118        var fragment = document.createDocumentFragment();
119        fragment.appendChild(consentElement);
120        document.body.appendChild(fragment.cloneNode(true));
121        document.getElementById(dismissLinkId).onclick = _dismissLinkClick;
122      }
123    }
124
125    function showCookieConsentBar(cookieText, dismissText, linkText, linkHref) {
126      _showCookieConsent(cookieText, dismissText, linkText, linkHref, false);
127    }
128
129    function showCookieConsentDialog(cookieText, dismissText, linkText, linkHref) {
130      _showCookieConsent(cookieText, dismissText, linkText, linkHref, true);
131    }
132
133    function _removeCookieConsent() {
134      var cookieChoiceElement = document.getElementById(cookieConsentId);
135      if (cookieChoiceElement != null) {
136        cookieChoiceElement.parentNode.removeChild(cookieChoiceElement);
137      }
138    }
139
140    function _saveUserPreference() {
141      // Set the cookie expiry to one year after today.
142      var expiryDate = new Date();
143      expiryDate.setFullYear(expiryDate.getFullYear() + 1);
144      document.cookie = cookieName + '=y; ' + (window.dMode ? '' : 'secure; ' ) + 'expires=' + expiryDate.toGMTString();
145    }
146
147    function _shouldDisplayConsent() {
148      // Display the header only if the cookie has not been set.
149      return !document.cookie.match(new RegExp(cookieName + '=([^;]+)'));
150    }
151
152    var exports = {};
153    exports.showCookieConsentBar = showCookieConsentBar;
154    exports.showCookieConsentDialog = showCookieConsentDialog;
155    return exports;
156  })();
157
158  window.cookieChoices = cookieChoices;
159  return cookieChoices;
160})(this);

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.