PageSourceSearch

http://www.hno-forum.de/typo3conf/ext/aip_cookie_law/Resources/Public/Javascript/CookieLaw.js?1698072972

js hno-forum.de collected 2026-10-08 16:53:31 UTC 57,866 bytes, 1,568 lines download raw bytes

1/*
2 Copyright 2012-2013 Silktide Ltd.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16*/
17
18var cc =
19{
20    version: '1.0.10',
21    jqueryversionrequired: '1.4.4',
22    initobj: false,
23    ismobile: false,
24    setupcomplete: false,
25    allasked: false,
26    checkedlocal: false,
27    frommodal: false,
28    hassetupmobile: false,
29    noclosewin: false,
30    closingmodal: false,
31    jqueryattempts: 0,
32    reloadkey: false,
33    forcereload: false,
34    allagree: true,
35    refreshOnConsent: true,
36    hideallsitesbutton: false,
37    cookies: {},
38    uniqelemid: 0,
39    executionblock: 0,
40    defaultCookies: { social: {}, analytics: {}},
41    cookieAnalytics: ['_ga', '_gat' ,'__utmt' ,'__utma' ,'__utmb' ,'__utmc' ,'__utmz'],
42    approved: {},
43    onlyshowbanneronce: false,
44    scriptdelay: 800,
45    bindfunctions: {},
46    eumemberstates: [
47        "BE",//"Belgium"
48        "BG",//"Bulgaria"
49        "CS",//"Czech Republic"
50        "DK",//"Denmark"
51        "DE",//"Germany"
52        "EE",//"Estonia"
53        "IE",//"Ireland"
54        "EL",//"Grecia"
55        "GR",//"Greece"
56        "ES",//"Spain"
57        "FR",//"France"
58        "IT",//"Italy"
59        "CY",//"Cyprus"
60        "LV",//"Latvia"
61        "LT",//"Lithuania"
62        "LU",//"Luxembourg"
63        "HU",//"Hungary"
64        "MT",//"Malta"
65        "NL",//"Netherlands" (Paesi Bassi-Olanda)
66        "AT",//"Austria"
67        "PL",//"Poland"
68        "PT",//"Portugal"
69        "RO",//"Romania"
70        "SI",//"Slovenia"
71        "SK",//"Slovakia"
72        "FI",//"Finland"
73        "SE",//"Sweden"
74        "UK",// "Regno Unito"
75        "GB",// "United Kingdom"
76        "EU" //"Europe"
77    ],
78    noteumemberstates: [
79        "A1",//"Anonymous Proxy"
80        "A2",//"Satellite Provider"
81        "O1",//"Other Country"
82        "AD",//"Andorra"
83        "AE",//"United Arab Emirates"
84        "AF",//"Afghanistan"
85        "AG",//"Antigua and Barbuda"
86        "AI",//"Anguilla"
87        "AL",//"Albania"
88        "AN",// antille olandesi
89        "AM",//"Armenia"
90        "AO",//"Angola"
91        "AP",//"Asia/Pacific Region"
92        "AQ",//"Antarctica"
93        "AR",//"Argentina"
94        "AS",//"American Samoa"
95        "AU",//"Australia"
96        "AW",//"Aruba"
97        "AX",//"Aland Islands"
98        "AZ",//"Azerbaijan"
99        "BA",//"Bosnia and Herzegovina"
100        "BB",//"Barbados"
101        "BD",//"Bangladesh"
102        "BF",//"Burkina Faso"
103        "BH",//"Bahrain"
104        "BI",//"Burundi"
105        "BJ",//"Benin"
106        "BL",//"Saint Bartelemey"
107        "BM",//"Bermuda"
108        "BN",//"Brunei Darussalam"
109        "BO",//"Bolivia"
110        "BQ",//"Bonaire, Saint Eustatius and Saba"
111        "BR",//"Brazil"
112        "BS",//"Bahamas"
113        "BT",//"Bhutan"
114        "BV",//"Bouvet Island"
115        "BW",//"Botswana"
116        "BY",//"Belarus"
117        "BZ",//"Belize"
118        "CA",//"Canada"
119        "CC",//"Cocos (Keeling) Islands"
120        "CD",//"Congo, The Democratic Republic of the"
121        "CF",//"Central African Republic"
122        "CG",//"Congo"
123        "CH",//"Switzerland"
124        "CI",//"Cote d'Ivoire"
125        "CK",//"Cook Islands"
126        "CL",//"Chile"
127        "CM",//"Cameroon"
128        "CN",//"China"
129        "CO",//"Colombia"
130        "CR",//"Costa Rica"
131        "CU",//"Cuba"
132        "CV",//"Cape Verde"
133        "CW",//"Curacao"
134        "CX",//"Christmas Island"
135        "DJ",//"Djibouti"
136        "DM",//"Dominica"
137        "DO",//"Dominican Republic"
138        "DZ",//"Algeria"
139        "EC",//"Ecuador"
140        "EG",//"Egypt"
141        "EH",//"Western Sahara"
142        "ER",//"Eritrea"
143        "ET",//"Ethiopia"
144        "FJ",//"Fiji"
145        "FK",//"Falkland Islands (Malvinas)"
146        "FM",//"Micronesia, Federated States of"
147        "FO",//"Faroe Islands"
148        "GA",//"Gabon"
149        "GD",//"Grenada"
150        "GE",//"Georgia"
151        "GF",//"French Guiana"
152        "GG",//"Guernsey"
153        "GH",//"Ghana"
154        "GI",//"Gibraltar"
155        "GL",//"Greenland"
156        "GM",//"Gambia"
157        "GN",//"Guinea"
158        "GP",//"Guadeloupe"
159        "GQ",//"Equatorial Guinea"
160        "GS",//"South Georgia and the South Sandwich Islands"
161        "GT",//"Guatemala"
162        "GU",//"Guam"
163        "GW",//"Guinea-Bissau"
164        "GY",//"Guyana"
165        "HK",//"Hong Kong"
166        "HM",//"Heard Island and McDonald Islands"
167        "HN",//"Honduras"
168        "HR",//"Croatia"
169        "HT",//"Haiti"
170        "ID",//"Indonesia"
171        "IL",//"Israel"
172        "IM",//"Isle of Man"
173        "IN",//"India"
174        "IO",//"British Indian Ocean Territory"
175        "IQ",//"Iraq"
176        "IR",//"Iran, Islamic Republic of"
177        "IS",//"Iceland"
178        "JE",//"Jersey"
179        "JM",//"Jamaica"
180        "JO",//"Jordan"
181        "JP",//"Japan"
182        "KE",//"Kenya"
183        "KG",//"Kyrgyzstan"
184        "KH",//"Cambodia"
185        "KI",//"Kiribati"
186        "KM",//"Comoros"
187        "KN",//"Saint Kitts and Nevis"
188        "KP",//"Korea, Democratic People's Republic of"
189        "KR",//"Korea, Republic of"
190        "KW",//"Kuwait"
191        "KY",//"Cayman Islands"
192        "KZ",//"Kazakhstan"
193        "LA",//"Lao People's Democratic Republic"
194        "LB",//"Lebanon"
195        "LC",//"Saint Lucia"
196        "LI",//"Liechtenstein"
197        "LK",//"Sri Lanka"
198        "LR",//"Liberia"
199        "LS",//"Lesotho"
200        "LY",//"Libyan Arab Jamahiriya"
201        "MA",//"Morocco"
202        "MC",//"Monaco"
203        "MD",//"Moldova, Republic of"
204        "ME",//"Montenegro"
205        "MF",//"Saint Martin"
206        "MG",//"Madagascar"
207        "MH",//"Marshall Islands"
208        "MK",//"Macedonia"
209        "ML",//"Mali"
210        "MM",//"Myanmar"
211        "MN",//"Mongolia"
212        "MO",//"Macao"
213        "MP",//"Northern Mariana Islands"
214        "MQ",//"Martinique"
215        "MR",//"Mauritania"
216        "MS",//"Montserrat"
217        "MU",//"Mauritius"
218        "MV",//"Maldives"
219        "MW",//"Malawi"
220        "MX",//"Mexico"
221        "MY",//"Malaysia"
222        "MZ",//"Mozambique"
223        "NA",//"Namibia"
224        "NC",//"New Caledonia"
225        "NE",//"Niger"
226        "NF",//"Norfolk Island"
227        "NG",//"Nigeria"
228        "NI",//"Nicaragua"
229        "NO",//"Norway"
230        "NP",//"Nepal"
231        "NR",//"Nauru"
232        "NU",//"Niue"
233        "NZ",//"New Zealand"
234        "OM",//"Oman"
235        "PA",//"Panama"
236        "PE",//"Peru"
237        "PF",//"French Polynesia"
238        "PG",//"Papua New Guinea"
239        "PH",//"Philippines"
240        "PK",//"Pakistan"
241        "PM",//"Saint Pierre and Miquelon"
242        "PN",//"Pitcairn"
243        "PR",//"Puerto Rico"
244        "PS",//"Palestinian Territory"
245        "PW",//"Palau"
246        "PY",//"Paraguay"
247        "QA",//"Qatar"
248        "RE",//"Reunion"
249        "RS",//"Serbia"
250        "RU",//"Russian Federation"
251        "RW",//"Rwanda"
252        "SA",//"Saudi Arabia"
253        "SB",//"Solomon Islands"
254        "SC",//"Seychelles"
255        "SD",//"Sudan"
256        "SG",//"Singapore"
257        "SH",//"Saint Helena"
258        "SJ",//"Svalbard and Jan Mayen"
259        "SL",//"Sierra Leone"
260        "SM",//"San Marino"
261        "SN",//"Senegal"
262        "SO",//"Somalia"
263        "SR",//"Suriname"
264        "SS",//"South Sudan"
265        "ST",//"Sao Tome and Principe"
266        "SV",//"El Salvador"
267        "SX",//"Sint Maarten"
268        "SY",//"Syrian Arab Republic"
269        "SZ",//"Swaziland"
270        "TC",//"Turks and Caicos Islands"
271        "TD",//"Chad"
272        "TF",//"French Southern Territories"
273        "TG",//"Togo"
274        "TH",//"Thailand"
275        "TJ",//"Tajikistan"
276        "TK",//"Tokelau"
277        "TL",//"Timor-Leste"
278        "TM",//"Turkmenistan"
279        "TN",//"Tunisia"
280        "TO",//"Tonga"
281        "TR",//"Turkey"
282        "TT",//"Trinidad and Tobago"
283        "TV",//"Tuvalu"
284        "TW",//"Taiwan"
285        "TZ",//"Tanzania, United Republic of"
286        "UA",//"Ukraine"
287        "UG",//"Uganda"
288        "UM",//"United States Minor Outlying Islands"
289        "US",//"United States"
290        "UY",//"Uruguay"
291        "UZ",//"Uzbekistan"
292        "VA",//"Città del Vaticano"
293        "VC",//"Saint Vincent e Grenadine"
294        "VE",//"Venezuela"
295        "VI",//"Isole Vergini Americane"
296        "VG",//"Isole Vergini Britanniche"
297        "VN",//"Vietnam"
298        "VU",//"Vanuatu"
299        "WF",//"Wallis e Futuna"
300        "WS",//"Samoa"
301        "YE",//"Yemen"
302        "YT",//"Mayotte"
303        "ZA",//"Sud Africa"
304        "ZM",//"Zambia"
305        "ZW"//"Zimbabwe"
306    ],
307
308    settings: {
309
310        style: "light",
311        bannerPosition: "bottom",
312        tagPosition: 'bottom-right',
313        hideprivacysettingstab: 1,
314        hidepopupprivatesettings: 1,
315        onlyshowwithineu: 1,
316        httpserviceapilocation:'http://api.wipmania.com/jsonp?',
317        consenttype: 'explicit',
318        confirmClick:1,
319        confirmScroll:1,
320        idPageInformation:47,
321        cookieExpire:365
322
323    },
324
325    strings: {
326        jqueryWarning: "Developer: Caution! You need to use jQuery 1.4.4 or higher.",
327        invalidKeyWarning: "Developer: Warning! You must provide a valid API.",
328        socialDefaultTitle: "Social media",
329        analyticsDefaultTitle: "Analytics",
330        socialDefaultDescription: "Facebook, Twitter and other social websites need to know who you are to work properly.",
331        analyticsDefaultDescription: "We anonymously measure your use of this website to improve your experience.",
332        notificationTitle: "Your experience on this site will be improved by allowing cookies",
333        seeDetails: "see details",
334        seeDetailsImplicit: "change your settings",
335        hideDetails: "hide details",
336        savePreference: 'Save preference',
337        allowCookies: 'Allow cookies',
338        allowCookiesImplicit: 'Close',
339        privacySettings: "Privacy settings",
340        privacySettingsDialogTitleA: "Privacy settings",
341        privacySettingsDialogSubtitle: "Some features of this website need your consent to remember who you are.",
342        closeWindow: "Close window",
343        preferenceConsent: "I consent",
344        preferenceDecline: "I decline",
345        notificationTitleImplicit: "We use cookies to ensure you get the best experience on our website",
346        informationCookies:"Information on Cookies",
347        textOff: "player off press cookies"
348    },
349
350    geturlparameter: function (name) {
351        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
352        var regexS = "[\\?&]" + name + "=([^&#]*)";
353        var regex = new RegExp(regexS);
354        var results = regex.exec(window.location.search);
355        if (results == null)
356            return false;
357        else
358            return decodeURIComponent(results[1].replace(/\+/g, " "));
359    },
360
361    isfunction: function (functionToCheck) {
362        var getType = {};
363        return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
364    },
365
366    setup: function () {
367        jQuery.each(cc.bindfunctions, function (key, value) {
368            for (i = 0; i < value.length; i++) {
369                jQuery(document).bind("cc_" + key, value[i]);
370            }
371        });
372        verstr = jQuery().jquery;
373        parts = verstr.split('.');
374        versionRequired = cc.jqueryversionrequired.split('.');
375        jqueryOk = true;
376        for (i = 0; i < parts.length && i < versionRequired.length; i++) {
377            currentpart = parseInt(parts[i]);
378            requiredpart = parseInt(versionRequired[i]);
379            if (currentpart < requiredpart) {
380                /* Unsatisfied - this part of the version string is less than the version we require */
381                jqueryok = false;
382                break;
383            }
384            if (currentpart > requiredpart) {
385                /* Satisfied - this part of the version string is greater than the version we require */
386                break;
387            }
388            /* This version is the same as the one we require.  Check the next part of the version number. */
389        }
390        if (!jqueryOk) {
391            alert(cc.strings.jqueryWarning);
392        }
393
394        jQuery.each(cc.defaultCookies, function (key, value) {
395             if (key == "social") {
396                cc.defaultCookies[key].title = cc.strings.socialDefaultTitle;
397                cc.defaultCookies[key].description = cc.strings.socialDefaultDescription;
398            }
399            else if (key == "analytics") {
400                cc.defaultCookies[key].title = cc.strings.analyticsDefaultTitle;
401                cc.defaultCookies[key].description = cc.strings.analyticsDefaultDescription;
402            }
403
404        });
405        jQuery.each(cc.initobj.cookies, function (key, value) {
406
407            if (!value.title) {
408                if (key == "social") {
409                    cc.initobj.cookies[key].title = cc.strings.socialDefaultTitle;
410                }
411                else if (key == "analytics") {
412                    cc.initobj.cookies[key].title = cc.strings.analyticsDefaultTitle;
413                }
414               else {
415                    cc.initobj.cookies[key].title = cc.strings.defaultTitle;
416                }
417            }
418            if (!value.description) {
419                if (key == "social") {
420                    cc.initobj.cookies[key].description = cc.strings.socialDefaultDescription;
421                }
422                else if (key == "analytics") {
423                    cc.initobj.cookies[key].description = cc.strings.analyticsDefaultDescription;
424                }
425                else {
426                    cc.initobj.cookies[key].description = cc.strings.defaultDescription;
427                }
428            }
429
430// dligo
431    //        cc.initobj.cookies[key].asked = false;
432    //        cc.initobj.cookies[key].approved = false;
433    //        cc.initobj.cookies[key].executed = false;
434
435    //        if (value.defaultstate) {
436    //            cc.initobj.cookies[key].defaultstate = "on";
437    //        } else {
438    //            cc.initobj.cookies[key].defaultstate = "off";
439    //            cc.executeoff(key);
440    //    }
441
442            if (!value.defaultstate) {
443                cc.initobj.cookies[key].defaultstate = "on";
444            }
445
446            cc.initobj.cookies[key].asked = false;
447            cc.initobj.cookies[key].approved = false;
448            cc.initobj.cookies[key].executed = false;
449            cc.executeoff(key);
450// dligo
451        });
452
453        testmode = cc.geturlparameter('cctestmode');
454        if (testmode == 'accept' || testmode == 'decline') {
455            cc.settings.testmode = testmode;
456        }
457       /* if (cc.settings.disableallsites) {
458            cc.hideallsitesbutton = true;
459        }*/
460        for (var attrname in cc.initobj.cookies) {
461            cc.cookies[attrname] = cc.initobj.cookies[attrname];
462            if (cc.settings.testmode == "accept") {
463                cc.approved[attrname] = "yes";
464            }
465            if (cc.settings.testmode == "decline") {
466                cc.approved[attrname] = "no";
467            }
468        }
469
470    },
471
472    initialise: function (obj) {
473
474        /* controlla che l'oggetto abbia il suo vettore di lingua valorizzato
475           altrimenti utilizza quello di default
476        */
477        var stringLanguage = cc.messageLanguage();
478// dligo
479        if (stringLanguage != '' && stringLanguage != 'error')
480            for (var attrname in stringLanguage) {
481                this.strings[attrname] = stringLanguage[attrname];
482            }
483        cc.initobj = obj;
484// dligo
485
486        if (obj.settings !== undefined) {
487            for (var attrname in obj.settings) {
488                this.settings[attrname] = obj.settings[attrname];
489            }
490        }
491        if (obj.strings !== undefined) {
492            for (var attrname in obj.strings) {
493                this.strings[attrname] = obj.strings[attrname];
494            }
495        }
496
497
498        cc.settings.style = "cc-" + cc.settings.style;
499        cc.settings.bannerPosition = "cc-" + cc.settings.bannerPosition;
500
501
502        if (window.jQuery) {
503           cc.setupcomplete = true;
504           cc.setup();
505
506        }
507    },
508    insertscript: function (script) {
509        var newfile = document.createElement('script');
510        newfile.setAttribute("type", "text/javascript");
511        newfile.setAttribute("src", script);
512        document.getElementsByTagName("head")[0].appendChild(newfile);
513    },
514
515    insertscripttag: function (content) {
516        var newfile = document.createElement('script');
517        newfile.setAttribute("type", "text/javascript");
518        newfile.innerHTML = content;
519        document.getElementsByTagName("head")[0].appendChild(newfile);
520    },
521
522    checklocal: function () {
523        this.checkedlocal = true;
524        jQuery.each(cc.cookies, function (key, value) {
525            cookieval = cc.getcookie('cc_' + key);
526            if (cookieval) {
527                cc.approved[key] = cookieval;
528            }
529        });
530        this.checkapproval();
531    },
532
533
534    deletecookie: function (key) {
535        date = new Date();
536        date.setDate(date.getDate() - 1);
537        document.cookie = escape("cc_" + key) + '=; path=/; expires=' + date;
538
539    },
540
541    removecookieAnalytics: function (key, sPath, sDomain) {
542        for (var i = 0; i < cc.cookieAnalytics.length; i++){
543            if (key == cc.cookieAnalytics[i]){
544                document.cookie = key + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "");
545
546            }
547        }
548    },
549
550
551    reloadifnecessary: function () {
552        if (cc.refreshOnConsent || cc.ismobile || cc.forcereload) {
553            setTimeout("location.reload(true);", 0);
554        }
555    },
556
557    onkeyup: function (e) {
558        if (e.keyCode == 27) {
559            cc.closemodals();
560        }
561    },
562
563    closemodals: function () {
564        if (!cc.closingmodal) {
565            if (cc.noclosewin) {
566                cc.noclosewin = false;
567            } else {
568                    if (jQuery('#cc-modal').is(":visible")) {
569                        jQuery('#cc-modal .cc-modal-closebutton a').click();
570                    }
571
572                    if (jQuery('#cc-settingsmodal').is(":visible")) {
573                        jQuery('#cc-settingsmodal #cc-settingsmodal-closebutton a').click();
574                    }
575
576            }
577        }
578    },
579
580    showbanner: function () {
581
582// dligo
583    //jQuery('#pageOverlay').stop().css("display", "block").animate({
584    //    'opacity': 0.6
585    //}, 500);
586//    jQuery('#fullpage').addClass('overlay');
587//    jQuery('body').prepend('<div id="cc-modal-overlay"></div>');
588//    jQuery('#cc-modal-overlay').fadeIn();
589// dligo
590
591        jQuery('#cc-tag').fadeOut(null, function () {
592            jQuery(this).remove();
593        });
594        jQuery('#cc-notification').remove();
595        if (cc.ismobile) {
596            cc.setupformobile();
597            jQuery('head').append('<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">');
598
599        }
600        data = '<div id="cc-notification">' +
601            '<div id="cc-notification-wrapper">' +
602            '<h2><span>' + cc.strings.notificationTitle + '</span></h2>' +
603            '<div id="cc-notification-permissions">' +
604            '</div>' +
605            '<ul class="cc-notification-buttons">' +
606            '<li>' +
607            '<a class="cc-link" href="#" id="cc-approve-button-thissite">' + cc.strings.allowCookies + '</a>' +
608            '</li>' +
609            '</ul>' +
610            '<div class="cc-clear"></div>' +
611            '</div>' +
612            '</div>';
613
614        jQuery('body').prepend(data);
615        if (cc.hideallsitesbutton) {
616            jQuery('#cc-approve-button-allsites').hide();
617        }
618        if (cc.settings.consenttype == 'implicit') {
619            jQuery('#cc-notification h2 span').html(cc.strings.notificationTitleImplicit)
620            jQuery('#cc-approve-button-thissite').html(cc.strings.allowCookiesImplicit);
621            jQuery('#cc-approve-button-thissite').parent().after(jQuery('#cc-approve-button-allsites').parent());
622            jQuery('#cc-approve-button-allsites').hide();
623        }
624        jQuery('#cc-notification-logo').hide();
625        jQuery('#cc-notification').addClass(cc.settings.style).addClass(cc.settings.bannerPosition);
626        bannerh = jQuery('#cc-notification').height();
627        jQuery('#cc-notification').hide();
628        if (cc.ismobile) {
629            jQuery('#cc-notification').addClass("cc-mobile");
630        }
631        jQuery('#cc-notification-permissions').prepend('<ul></ul>');
632        allcustom = true;
633        jQuery.each(cc.cookies, function (key, value) {
634            if (!value.asked) {
635                jQuery('#cc-notification-permissions ul').append('<li><input type="checkbox" checked="checked" id="cc-checkbox-' + key + '" /> <label id="cc-label-' + key + '" for="cc-checkbox-' + key + '"><strong>' + value.title + '</strong> ' + value.description + '</label></li>');
636                if (value.link) {
637                    jQuery('#cc-label-' + key).append(' <a target="_blank" href="' + value.link + '" class="cc-learnmore-link">' + cc.strings.learnMore + '</a>');
638                }
639                if (key == "social" || key == "analytics" ) {
640                    allcustom = false;
641                }
642                jQuery('#cc-checkbox-' + key).change(function () {
643                    if (jQuery(this).is(':checked')) {
644                        jQuery(this).parent().removeClass('cc-notification-permissions-inactive');
645                    } else {
646                        jQuery(this).parent().addClass('cc-notification-permissions-inactive');
647
648                    }
649                });
650                if (value.defaultstate == "off") {
651                    jQuery('#cc-checkbox-' + key).removeAttr("checked").parent().addClass('cc-notification-permissions-inactive');
652                }
653                if (key == "necessary") {
654                    jQuery('#cc-checkbox-' + key).attr("disabled", "disabled");
655                }
656            }
657        });
658        jQuery('#cc-notification-wrapper h2').append(' <a class="cc-link" href="#" id="cc-notification-moreinfo">' + cc.strings.seeDetails + '</a>');
659        jQuery('#cc-notification-wrapper h2').append(' <br><a href="/index.php?id=' + cc.settings.idPageInformation + '">' +cc.strings.informationCookies+'</a>');
660
661        if (cc.settings.consenttype == "implicit") {
662            jQuery('#cc-notification-moreinfo').html(cc.strings.seeDetailsImplicit);
663        }
664
665        jQuery('#cc-notification-moreinfo').click(function () {
666            if (jQuery(this).html() == cc.strings.seeDetails || jQuery(this).html() == cc.strings.seeDetailsImplicit) {
667                if (cc.settings.consenttype == 'implicit') {
668                    if (!cc.hideallsitesbutton) {
669                        jQuery('#cc-approve-button-allsites').show();
670                    }
671                }
672                jQuery('#cc-approve-button-thissite').html(cc.strings.savePreference);
673                jQuery(this).html(cc.strings.hideDetails);
674            } else {
675                jQuery.each(cc.cookies, function (key, value) {
676                    if (value.defaultstate == "off") {
677                        jQuery('#cc-checkbox-' + key).removeAttr("checked");
678                        jQuery(this).parent().addClass('cc-notification-permissions-inactive');
679                    } else {
680                        jQuery('#cc-checkbox-' + key).attr('checked', 'checked');
681                        jQuery(this).parent().removeClass('cc-notification-permissions-inactive');
682
683                    }
684                });
685
686                if (cc.settings.consenttype == 'implicit') {
687                    jQuery(this).html(cc.strings.seeDetailsImplicit);
688                    jQuery('#cc-approve-button-thissite').html(cc.strings.allowCookiesImplicit);
689                    jQuery('#cc-approve-button-allsites').hide();
690                } else {
691                    jQuery(this).html(cc.strings.seeDetails);
692                    jQuery('#cc-approve-button-thissite').html(cc.strings.allowCookies);
693                    jQuery('#cc-approve-button-allsites').html(cc.strings.allowForAllSites);
694                }
695
696            }
697
698            jQuery('#cc-notification-logo').fadeToggle();
699            jQuery('#cc-notification-permissions').slideToggle();
700// dligo
701            jQuery('.cc-notification-permissions-fake').slideToggle();
702
703            jQuery('#cc-checkbox-social').click();
704            jQuery('#cc-checkbox-analytics').click();
705            jQuery('#cc-notification-moreinfo').hide();
706// dligo
707            jQuery(this).blur();
708            return false;
709        });
710// dligo
711//        jQuery('#cc-notification-moreinfo').click();
712
713// dligo
714
715        if (!cc.ismobile) {
716            if (cc.settings.bannerPosition == "cc-push") {
717                jQuery('html').animate({marginTop: bannerh}, 400);
718            }
719            jQuery('#cc-notification').slideDown();
720        } else {
721            jQuery('#cc-notification').show();
722        }
723
724
725
726        if (cc.settings.confirmClick == 1 && cc.settings.consenttype == 'implicit'){
727            jQuery(window).addClass(cc.settings.style).click(cc.onlocalconsentgiven);
728        }
729        if (cc.settings.confirmScroll == 1 && cc.settings.consenttype == 'implicit'){
730            jQuery(window).addClass(cc.settings.style).scroll(cc.onlocalconsentgiven);
731        }
732        jQuery('#cc-approve-button-thissite').click(cc.onlocalconsentgiven);
733
734       if (allcustom) {
735            jQuery('#cc-notification h2 span').html(cc.strings.customCookie);
736
737        }
738
739    },
740
741    timestamp: function () {
742        return Math.round((new Date()).getTime() / 1000);
743    },
744
745    locationcallback: function (data) {
746        status = cc.jsonserviceapi(data);
747        if (status != "error") {
748            ineu = "yes";
749            if (jQuery.inArray(status, cc.eumemberstates) == -1) {
750                //Visitor is from outside EU
751                ineu = "no";
752                jQuery.each(cc.cookies, function (key, value) {
753                    cc.approved[key] = "yes";
754                });
755                cc.settings.hideprivacysettingstab = 1;
756                cc.settings.hidepopupprivatesettings = 1;
757            }
758            cc.setcookie('cc_ineu', ineu, cc.settings.cookieExpire);
759        }else{
760            alert(cc.strings.invalidKeyWarning)
761        }
762
763        cc.checkapproval();
764    },
765
766
767
768    checkapproval: function () {
769
770        if (cc.settings.onlyshowwithineu != 1) {
771            ineu = cc.getcookie('cc_ineu');
772            if (ineu) {
773                if (ineu == "no") {
774                    jQuery.each(cc.cookies, function (key, value) {
775                        cc.approved[key] = "yes";
776                    });
777                    cc.settings.hideprivacysettingstab = 1;
778                    cc.settings.hidepopupprivatesettings = 1;
779
780
781
782                }
783            } else {
784                if (navigator.geolocation) {
785                    navigator.geolocation.getCurrentPosition(cc.success);
786                }
787            }
788        }
789        cc.allasked = true;
790        jQuery.each(cc.cookies, function (key, value) {
791            if (cc.approved[key]) {
792                if (cc.approved[key] == "yes" ){
793                    cc.cookies[key].asked = true;
794                    cc.cookies[key].approved = true;
795                    cc.execute(key);
796            } else if ( cc.approved[key] == "no") {
797                    cc.cookies[key].asked = true;
798                    cc.cookies[key].approved = false;
799                    cc.executeoff(key);
800            } else {
801
802                    cc.allasked = false;
803                }
804            } else {
805
806                cc.allasked = false;
807            }
808        });
809        if (!cc.allasked) {
810            if (!cc.checkedlocal) {
811                cc.checklocal();
812                return;
813            }
814            if (cc.settings.consenttype == "implicit") {
815                jQuery.each(cc.cookies, function (key, value) {
816                    if (!cc.cookies[key].asked) {
817                        if (cc.onlyshowbanneronce) {
818                            cc.setcookie('cc_' + key, 'yes', cc.settings.cookieExpire);
819                        }
820                        cc.execute(key);
821                    }
822                });
823            }
824            // visualizzare il banner iniziale
825           if (cc.settings.hideprivacysettingstab == 1){
826                cc.showbanner();
827            }
828
829        } else {
830            if (cc.settings.hidepopupprivatesettings == 1) {
831                cc.showminiconsent();
832            }
833        }
834    },
835
836    success:function(position) {
837        if (position){
838            jQuery.getScript(cc.settings.httpserviceapilocation+"callback=cc.locationcallback");
839            return;
840        }
841
842    },
843
844
845    execute: function (cookieType) {
846        if (cookieType == "necessary") {
847            return;
848        }
849        jQuery('.cc-placeholder-' + cookieType).remove();
850        jQuery('script.cc-onconsent-' + cookieType + '[type="text/plain"]').each(function () {
851
852            var str = jQuery(this).text();
853            var initframe = str.indexOf("<iframe");
854            if (initframe > -1){
855                var theframe = str.indexOf("</iframe>");
856                var strframe = str.substring(initframe, theframe+9);
857                jQuery(this).after(strframe)
858            }else{
859//dligo
860                var audio = str.indexOf("<audio");
861            var video = str.indexOf("<video");
862        if (audio > -1 || video > -1){
863            var thestr = str.indexOf(".html(");
864            jQuery(this).next().hide()
865            var strnew = str.substring(thestr+7, str.length-2);
866                jQuery(this).after(strnew)
867        }else{
868                var initframe = str.indexOf("<form");
869            if (initframe > -1){
870                var theframe = str.indexOf("</form>");
871                var strframe = str.substring(initframe, theframe+7);
872            jQuery(this).after(strframe)
873            }else{
874                var initframe = str.indexOf("<figure");
875            if (initframe > -1){
876                    var theframe = str.indexOf("</figure>");
877                    var strframe = str.substring(initframe, theframe+9);
878                jQuery(this).after(strframe)
879            }else{
880//dligo
881                if (jQuery(this).attr('src')) {
882                    jQuery(this).next().hide();
883                jQuery(this).after('<script type="text/javascript" src="' + jQuery(this).attr('src') + '"></script>');
884                } else {
885                        jQuery(this).next().hide();
886                        jQuery(this).after('<script type="text/javascript">' + jQuery(this).html() + '</script>');
887                }
888            }
889                    }
890            }
891        }
892        });
893
894    jQuery('.image_off_'+cookieType).hide();
895        cc.cookies[cookieType].executed = true;
896        jQuery(document).trigger("cc_" + cookieType);
897
898        cc.executescriptinclusion(cookieType);
899
900    },
901
902
903    executeoff: function (cookieType) {
904        if (cookieType == "necessary") {
905            return;
906        }
907        var i = 0;
908
909        jQuery('script.cc-onconsent-' + cookieType + '[type="text/plain"]').each(function () {
910                i++;
911                var str_id ="id_"+cookieType+"_"+i;
912                if ($('#'+str_id).length == 0){
913                    var vuoto = "<div class='image_off image_off_"+cookieType+"' id="+str_id+"><span class='text_off'><span class='bg_text'>"+cc.strings.textOff+"</span></span></div>" ;
914                    jQuery(this).after(vuoto);
915                }
916
917        });
918
919    },
920
921
922    executescriptinclusion: function (cookieType) {
923        timetaken = jQuery('script.cc-onconsent-inline-' + cookieType + '[type="text/plain"]').length * cc.scriptdelay;
924        now = new Date().getTime();
925        if (now < cc.executionblock) {
926            setTimeout(cc.executescriptinclusion, cc.executionblock - now, [cookieType]);
927            return;
928        }
929        cc.executionblock = now + timetaken;
930
931        cc.insertscripts(cookieType);
932    },
933
934    insertscripts: function (cookieType) {
935
936        jQuery('script.cc-onconsent-inline-' + cookieType + '[type="text/plain"]').first().each(function () {
937            cc.uniqelemid++;
938
939            if (jQuery(this).parents('body').length  > 0) {
940                jQuery(this).after('<div id="cc-consentarea-' + cc.uniqelemid + '" class="' + cookieType + '"></div>');
941                document.write = function (g) {
942                    jQuery('#cc-consentarea-' + cc.uniqelemid).append(g);
943                };
944                document.writeln = function (g) {
945                    jQuery('#cc-consentarea-' + cc.uniqelemid).append(g);
946                };
947            }
948
949            if (jQuery(this).attr('src')) {
950                jQuery(this).after('<script type="text/javascript" src="' + jQuery(this).attr('src') + '"></script>');
951            } else {
952                jQuery(this).after('<script type="text/javascript">' + jQuery(this).html() + '</script>');
953            }
954            jQuery(this).remove();
955
956
957        });
958
959        if (jQuery('script.cc-onconsent-inline-' + cookieType + '[type="text/plain"]').length > 0) {
960            setTimeout(cc.insertscripts, cc.scriptdelay, [cookieType]);
961        }
962
963    },
964
965    getcookie: function (c_name) {
966        var i, x, y, ARRcookies = document.cookie.split(";");
967        for (i = 0; i < ARRcookies.length; i++) {
968            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
969            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
970            x = x.replace(/^\s+|\s+$/g, "");
971            if (x == c_name) {
972                return unescape(y);
973            }
974        }
975        return false;
976    },
977
978    setcookie: function (name, value, expirydays) {
979        var exdate = new Date();
980        exdate.setTime(exdate.getTime()+(expirydays*24*60*60*1000));
981        document.cookie = name + '=' + value + '; expires=' + exdate.toGMTString() + '; path=/'
982    },
983
984
985
986
987    onremoteconsentgiven: function () {
988        cc.allagree = true;
989        jQuery.each(cc.cookies, function (key, value) {
990            if (!value.approved && !value.asked) {
991                if (jQuery('#cc-checkbox-' + key).is(':checked')) {
992
993                    cc.approved[key] = "yes";
994
995                    cc.cookies[key].asked = true;
996                } else {
997
998                    cc.approved[key] = "no";
999
1000                    cc.allagree = false;
1001                    cc.cookies[key].asked = true;
1002
1003                }
1004                cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1005            } else {
1006            }
1007        });
1008
1009
1010        if (!cc.ismobile) {
1011            jQuery('#cc-notification').slideUp();
1012            if (cc.settings.bannerPosition == "cc-push") {
1013                //detect body margin
1014                jQuery('html').animate({marginTop: 0}, 400);
1015            }
1016        }
1017// dligo
1018    //jQuery('#pageOverlay').stop().animate({
1019    //    'opacity': 0
1020    //}, 500, function() {
1021    //    jQuery(this).css("display", "none")
1022    //});
1023//    jQuery('#pageOverlay').removeClass('overlay');
1024// dligo
1025        cc.checkapproval();
1026
1027        return false;
1028    },
1029
1030    onlocalconsentgiven: function () {
1031        enableall = false;
1032        enablejustone = false;
1033        if (jQuery(this).hasClass('cc-button-enableall') || jQuery(this).hasClass('cc-button-enable-all')) {
1034            enableall = true;
1035            jQuery.each(cc.cookies, function (key, value) {
1036                cc.cookies[key].asked = false;
1037            });
1038        }
1039        elem = this;
1040        jQuery.each(cc.cookies, function (key, value) {
1041            if (jQuery(elem).hasClass('cc-button-enable-' + key)) {
1042                enablejustone = true;
1043                cc.approved[key] = "yes";
1044                cc.cookies[key].asked = true;
1045                cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1046            }
1047        });
1048
1049        cc.allagree = true;
1050        if (!enablejustone) {
1051            jQuery.each(cc.cookies, function (key, value) {
1052                if (!value.approved && !value.asked) {
1053                    if (enableall || jQuery('#cc-checkbox-' + key).is(':checked')) {
1054                        cc.approved[key] = "yes";
1055                        cc.cookies[key].asked = true;
1056                    } else {
1057                        cc.approved[key] = "no";
1058                        cc.cookies[key].asked = true;
1059                        cc.allagree = false;
1060                    }
1061                    cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1062                } else {
1063                }
1064            });
1065        }
1066
1067        if (!cc.allagree && cc.settings.consenttype == "implicit") {
1068            cc.forcereload = true;
1069        }
1070
1071        if (!cc.ismobile) {
1072            jQuery('#cc-notification').slideUp();
1073            if (cc.settings.bannerPosition == "cc-push") {
1074                //detect body margin
1075                jQuery('html').animate({marginTop: 0}, 400);
1076            }
1077        }
1078// dligo
1079    //jQuery('#pageOverlay').stop().animate({
1080    //    'opacity': 0
1081    //}, 500, function() {
1082    //    jQuery(this).css("display", "none")
1083    //});
1084//    jQuery('#fullpage').addClass('overlay');
1085//        jQuery('body').prepend('<div id="cc-modal-overlay"></div>');
1086//        jQuery('#cc-modal-overlay').fadeIn();
1087// dligo
1088        cc.checkapproval();
1089        cc.reloadifnecessary();
1090
1091        return false;
1092    },
1093
1094    showminiconsent: function () {
1095        if (jQuery('#cc-tag').length == 0) {
1096            var data = '<div id="cc-tag" class="cc-tag-' + cc.settings.tagPosition + '"><a class="cc-link" href="#" id="cc-tag-button" title="' + cc.strings.privacySettings + '"><span>' + cc.strings.privacySettings + '</span></a></div>';
1097            jQuery('body').prepend(data);
1098            jQuery('#cc-tag').addClass(cc.settings.style);
1099            if (cc.settings.hideprivacysettingstab == 1) {
1100                if (cc.settings.hidepopupprivatesettings == 1){
1101                    jQuery('#cc-tag').fadeIn();
1102                }
1103            } else {
1104                jQuery('#cc-tag').hide();
1105            }
1106            jQuery('.cc-privacy-link').click(cc.showmodal);
1107            jQuery('#cc-tag-button').click(cc.showmodal);
1108
1109
1110
1111            // disabilito tutti gli iframe id_social_
1112            if (cc.approved['social'] == 'no'){
1113                var iframe_id_social = jQuery("div[id^='id_social']")
1114                iframe_id_social.each(function(){
1115                    jQuery(this).children().click(cc.showmodal);
1116                })
1117            }
1118
1119            // disabilito tutti gli iframe id_analytics_
1120            if (cc.approved['analytics'] == 'no'){
1121                var iframe_id_analytics = jQuery("div[id^='id_analytics']")
1122                iframe_id_analytics.each(function(){
1123                    jQuery(this).children().click(cc.showmodal);
1124                })
1125            }
1126        }
1127
1128    },
1129    getsize: function (obj) {
1130        var size = 0, key;
1131        for (key in obj) {
1132            if (obj.hasOwnProperty(key)) size++;
1133        }
1134        return size;
1135    },
1136
1137
1138
1139    showmodal: function () {
1140
1141        jQuery(document).bind('keyup', cc.onkeyup);
1142//        jQuery('body').prepend('<div id="cc-modal-overlay"></div>');
1143        jQuery(this).blur();
1144        if (cc.ismobile) {
1145            cc.setupformobile();
1146        }
1147        data = '<div id="cc-modal">' +
1148            '<div id="cc-modal-wrapper">' +
1149            '<h2>' + cc.strings.privacySettingsDialogTitleA + '</h2>' +
1150            '<p class="cc-subtitle">' + cc.strings.privacySettingsDialogSubtitle + '</p>' +
1151
1152            '<div class="cc-content">' +
1153            '</div>' +
1154
1155            '<div class="cc-clear"></div>' +
1156
1157            '<p id="cc-modal-closebutton" class="cc-modal-closebutton"><a class="cc-link" href="#" title="' + cc.strings.closeWindow + '"><span>' + cc.strings.closeWindow + '</span></a></p>' +
1158            '<div id="cc-modal-footer-buttons">' +
1159            '<div class="cc-clear"></div>' +
1160            '</div>' +
1161            '</div>';
1162        jQuery('body').prepend(data);
1163        if (cc.settings.confirmClick == 1)
1164            jQuery('#cc-modal').addClass(cc.settings.style).click(cc.closemodals);
1165        if (cc.settings.confirmScroll == 1)
1166           jQuery(window).addClass(cc.settings.style).scroll(cc.closemodals);
1167
1168        if (cc.ismobile) {
1169            jQuery('#cc-modal').addClass("cc-mobile");
1170        }
1171        cc.reloadmodal();
1172        jQuery('#cc-modal').fadeIn();
1173//        jQuery('#cc-modal-overlay').fadeIn();
1174        jQuery('#cc-modal-wrapper').click(function () {
1175            cc.noclosewin = true;
1176        });
1177        jQuery('#cc-modal .cc-modal-closebutton a').click(function () {
1178            cc.showhidemodal();
1179            cc.reloadifnecessary();
1180            return false;
1181        });
1182
1183        jQuery('#cc-modal-global').click(function () {
1184            cc.frommodal = true;
1185            cc.gotosettings();
1186            return false;
1187        });
1188        jQuery('#cc-tag-button').unbind('click').click(cc.showhidemodal);
1189        jQuery('.cc-privacy-link').unbind('click').click(cc.showhidemodal);
1190
1191        //parte aggiuntiva
1192        if (cc.approved['social'] == 'no'){
1193            var iframe_id_social = jQuery("div[id^='id_social']")
1194            iframe_id_social.each(function(){
1195                jQuery(this).children().unbind('click').click(cc.showmodal);
1196            })
1197        }
1198        if (cc.approved['analytics'] == 'no'){
1199            var iframe_id_analytics = jQuery("div[id^='id_analytics']")
1200            iframe_id_analytics.each(function(){
1201                jQuery(this).children().unbind('click').click(cc.showmodal);
1202            })
1203        }
1204
1205        return false;
1206    },
1207
1208    closepreferencesmodal: function () {
1209        jQuery.each(cc.defaultCookies, function (key, value) {
1210            value = jQuery('#cc-globalpreference-selector-' + key).val();
1211            if (cc.approved[key] != "yes" && cc.approved[key] != "no") {
1212                cc.approved[key] = value;
1213                cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1214            }
1215
1216        });
1217
1218
1219        jQuery('#cc-notification').hide().remove();
1220        jQuery(this).blur();
1221        jQuery('#cc-settingsmodal').fadeOut(null, function () {
1222            jQuery('#cc-settingsmodal').remove();
1223        });
1224        if (!cc.frommodal) {
1225            cc.checkapproval();
1226            cc.reloadifnecessary();
1227        } else {
1228            cc.frommodal = false;
1229            cc.showhidemodal();
1230        }
1231        return false;
1232    },
1233
1234    showhidemodal: function () {
1235        jQuery(this).blur();
1236        cc.checkedlocal = false;
1237        if (jQuery('#cc-modal').is(":visible") && !cc.frommodal) {
1238            cc.closingmodal = true;
1239            jQuery('#cc-modal-overlay').fadeToggle(null, function () {
1240                cc.closingmodal = false;
1241            });
1242            jQuery.each(cc.cookies, function (key, value) {
1243                thisval = jQuery('#cc-preference-selector-' + key).val();
1244
1245                if (key == "necessary") {
1246                    thisval = "yes";
1247                }
1248
1249                if (thisval == "no") {
1250                    var str_domain = window.location.hostname;
1251                    var id = str_domain.indexOf("www");
1252                    if (id != -1)
1253                        var s_domain = str_domain.substring(id+3);
1254                    cc.cookies[key].approved = false;
1255                    cc.approved[key] = "no";
1256                    cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1257                    var i, x, Arraycookie = document.cookie.split(";");
1258                    for (i = 0; i < Arraycookie.length; i++) {
1259                        x = Arraycookie[i].substr(0, Arraycookie[i].indexOf("="));
1260                        x = x.replace(/^\s+|\s+$/g, "");
1261                        if (key == 'analytics'){
1262                            cc.removecookieAnalytics(x,'/',s_domain);
1263                        }
1264                    }
1265
1266                } else if (thisval == "yes") {
1267                    cc.cookies[key].approved = true;
1268                    cc.approved[key] = "yes";
1269                    cc.setcookie('cc_' + key, cc.approved[key], cc.settings.cookieExpire);
1270
1271
1272                } else {
1273                    cc.cookies[key].approved = false;
1274                    cc.deletecookie(key);
1275                    delete cc.approved[key];
1276                }
1277                cc.cookies[key].asked = false;
1278
1279            });
1280            cc.checkapproval();
1281        } else if (!jQuery('#cc-settingsmodal').is(":visible") && !jQuery('#cc-modal').is(":visible")) {
1282            cc.closingmodal = true;
1283            jQuery('#cc-modal-overlay').fadeToggle(null, function () {
1284                cc.closingmodal = false;
1285            });
1286        }
1287        if (cc.ismobile) {
1288            jQuery('#cc-modal').toggle();
1289        } else {
1290            jQuery('#cc-modal').fadeToggle();
1291        }
1292        return false;
1293    },
1294
1295
1296    reloadmodal: function () {
1297        jQuery('#cc-modal-wrapper .cc-content').html('');
1298        if (cc.getsize(cc.cookies) > 0) {
1299            jQuery('#cc-modal-wrapper .cc-content').append('<ul></ul>');
1300            jQuery.each(cc.cookies, function (key, value) {
1301                jQuery('#cc-modal-wrapper ul').append('<li id="cc-preference-element-' + key + '"><label for="cc-preference-selector-' + key + '"><strong>' + value.title + '</strong><span>' + value.description + '</span></label><select id="cc-preference-selector-' + key + '"><option value="yes">' + cc.strings.preferenceConsent + '</option><option value="no">' + cc.strings.preferenceDecline + '</option></select></li>');
1302                if (value.link) {
1303                    jQuery('#cc-preference-element-' + key + ' label span').append(' <a target="_blank" href="' + value.link + '" class="cc-learnmore-link">' + cc.strings.learnMore + '</a>');
1304                }
1305                jQuery('#cc-change-button-allsites').unbind('click').click(function () {
1306                    cc.frommodal = true;
1307                    cc.gotosettings();
1308                    return false;
1309                });
1310                jQuery('#cc-preference-selector-' + key).change(function () {
1311
1312                });
1313                if (key == "necessary") {
1314                    jQuery('#cc-preference-selector-' + key).remove();
1315                }
1316                if (cc.approved[key] == "yes") {
1317                    jQuery('#cc-preference-selector-' + key).val("yes")
1318                }
1319                else if (cc.approved[key] == "no") {
1320                    jQuery('#cc-preference-selector-' + key).val("no")
1321                }
1322                else {
1323                    jQuery('#cc-preference-selector-' + key).val("global")
1324                }
1325
1326            });
1327        } else {
1328            jQuery('#cc-modal-wrapper .cc-content').append('<p>' + cc.strings.notUsingCookies + '</p>');
1329        }
1330        jQuery('.cc-content').append('<div class="cc-clear"></div>');
1331    },
1332
1333    gotosettings: function () {
1334        if (jQuery('#cc-modal').is(":visible")) {
1335            cc.showhidemodal();
1336        }
1337        jQuery(this).blur();
1338        if (cc.ismobile) {
1339            cc.setupformobile();
1340            jQuery('#cc-notification').remove();
1341        }
1342        if (cc.frommodal) {
1343            buttontext = cc.strings.backToSiteSettings;
1344        } else {
1345            buttontext = cc.strings.closeWindow;
1346        }
1347
1348        data = '<div id="cc-settingsmodal">' +
1349            '<div id="cc-settingsmodal-wrapper">' +
1350            '<div class="cc-content">' +
1351            '</div>' +
1352            '<div class="cc-clear"></div>' +
1353            '<p id="cc-settingsmodal-closebutton" class="cc-settingsmodal-closebutton"><a class="cc-link" href="#" title="' + buttontext + '"><span>' + buttontext + '</span></a></p>' +
1354            '<div id="cc-settingsmodal-footer-buttons">' +
1355            '<p id="cc-settingsmodal-secondclosebutton" class="cc-settingsmodal-closebutton"><a class="cc-link" href="#" title="' + buttontext + '"><span>' + buttontext + '</span></a></p>' +
1356            '</div>' +
1357            '</div>' +
1358            '</div>';
1359        jQuery('body').prepend(data);
1360        if (cc.settings.confirmClick == 1)
1361            jQuery('#cc-settingsmodal').addClass(cc.settings.style).click(cc.closemodals);
1362        if (cc.settings.confirmScroll == 1)
1363            jQuery('#cc-settingsmodal').addClass(cc.settings.style).scroll(cc.closemodals);
1364
1365        jQuery('#cc-settingsmodal-wrapper').click(function () {
1366            cc.noclosewin = true;
1367        });
1368        if (cc.ismobile) {
1369            jQuery('#cc-settingsmodal').addClass("cc-mobile");
1370        }
1371        jQuery('#cc-settingsmodal').fadeIn();
1372        jQuery('.cc-settingsmodal-closebutton').click(cc.closepreferencesmodal);
1373
1374        return false;
1375    },
1376
1377    setupformobile: function () {
1378        if (!cc.hassetupmobile) {
1379            cc.hassetupmobile = true;
1380            jQuery('head').append('<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">');
1381            if (cc.settings.style == 'cc-light') {
1382                bgcol = '#e1e1e1';
1383            } else {
1384                bgcol = '#1d1d1d'
1385            }
1386        }
1387    },
1388
1389    onfirstload: function () {
1390        if (!cc.setupcomplete && cc.initobj) {
1391
1392            if (!(window.jQuery)) {
1393                cc.jqueryattempts++;
1394                if (cc.jqueryattempts >= 5) {
1395                    return;
1396                }
1397                setTimeout(cc.onfirstload, 200);
1398                return;
1399            }
1400
1401            cc.setupcomplete = true;
1402            cc.setup();
1403
1404        }
1405        setTimeout(cc.afterload, 50);
1406        cc.checkapproval();
1407
1408    },
1409
1410    afterload: function () {
1411        jQuery('.cc-button-enableall').addClass('cc-link').click(cc.onlocalconsentgiven);
1412        jQuery('.cc-button-enable-all').addClass('cc-link').click(cc.onlocalconsentgiven);
1413        jQuery.each(cc.cookies, function (key, value) {
1414            jQuery('.cc-button-enable-' + key).addClass('cc-link').click(cc.onlocalconsentgiven);
1415        });
1416    },
1417
1418
1419    jsonserviceapi:function(data){
1420        var searchstates = '';
1421        var acronyms_countries = jQuery.map(data, function(value, index) { return[value]; });
1422         for (var i = 0; i <= acronyms_countries.length; i++){
1423
1424            if (acronyms_countries[i] instanceof Object){
1425                var elem_acronyms_countries = jQuery.map(acronyms_countries[i], function(value, index) { return[value]; });
1426                for (var j = 0; j <= elem_acronyms_countries.length; j++){
1427                    if (jQuery.inArray(elem_acronyms_countries[j], cc.eumemberstates) >=0){
1428                        searchstates = elem_acronyms_countries[j]
1429                        break;
1430                    }else if(jQuery.inArray(elem_acronyms_countries[j], cc.noteumemberstates) >= 0){
1431                        searchstates = elem_acronyms_countries[j]
1432                        break;
1433                    }
1434                }
1435            }else{
1436                // controllo se il paese è della comunità europea
1437                 if (jQuery.inArray(acronyms_countries[i], cc.eumemberstates) >=0){
1438                     searchstates = acronyms_countries[i]
1439                     break;
1440                 }else if(jQuery.inArray(acronyms_countries[i], cc.noteumemberstates) >= 0){
1441                     searchstates = acronyms_countries[i]
1442                     break;
1443                 }
1444            }
1445        }
1446        if (searchstates == '') searchstates = 'error'
1447        return searchstates;
1448
1449    },
1450
1451
1452    messageLanguage :function () {
1453        var ajaxResponse = '';
1454        var objectLanguage = '';
1455        var lang = cc.localeLanguage();
1456        var url = '';
1457        if (lang != 0) {
1458            url = lang+'/?type=1525962364';
1459        }else{
1460            url =  window.location.protocol + '//' + window.location.hostname + '/?type=1525962364';
1461        }
1462//        var url = window.location.protocol + '//' + window.location.hostname + '/?type=1525962364';
1463//        if (lang != 0) {
1464//            url = url + '&L='+lang;
1465//        }
1466        
1467            
1468        jQuery.ajax({
1469            async: false,
1470            type:'POST',
1471            //inserire indirizzo della root
1472            url: url,
1473            dataType : 'text',
1474            success : function (response)
1475            {
1476                ajaxResponse = response;
1477            },
1478            error: function( req, status, err ) {
1479                console.log( 'something went wrong:', status, err );
1480                ajaxResponse = 'error'
1481            }
1482        });
1483        if (ajaxResponse != 'error'){
1484            var indResponse = ajaxResponse.split('","')
1485            var strMessage = [];
1486            for (var i = 0; i < indResponse.length; i++){
1487                strMessage[i] = indResponse[i].replace('["','');
1488                if (i == 21){
1489                    idx = indResponse[i].indexOf('"]');
1490                    strMessage[i] = indResponse[i].substring(0, idx);
1491                }
1492            }
1493
1494            objectLanguage = {
1495                strings:{
1496                    jqueryWarning: strMessage[0],
1497                    invalidKeyWarning: strMessage[1],
1498                    socialDefaultTitle: strMessage[2],
1499                    analyticsDefaultTitle: strMessage[3],
1500                    socialDefaultDescription: strMessage[4],
1501                    analyticsDefaultDescription: strMessage[5],
1502                    notificationTitle: strMessage[6],
1503                    seeDetails: strMessage[7],
1504                    seeDetailsImplicit: strMessage[8],
1505                    hideDetails: strMessage[9],
1506                    savePreference: strMessage[10],
1507                    allowCookies: strMessage[11],
1508                    allowCookiesImplicit: strMessage[12],
1509                    privacySettings: strMessage[13],
1510                    privacySettingsDialogTitleA: strMessage[14],
1511                    privacySettingsDialogSubtitle: strMessage[15],
1512                    closeWindow: strMessage[16],
1513                    preferenceConsent: strMessage[17],
1514                    preferenceDecline: strMessage[18],
1515                    notificationTitleImplicit: strMessage[19],
1516                    informationCookies:strMessage[20],
1517                    textOff:strMessage[21]
1518                }
1519            }
1520            return objectLanguage.strings;
1521        }
1522        else
1523           return ajaxResponse;
1524    },
1525
1526    localeLanguage :function () {
1527
1528        var aip_cookie_language = jQuery('meta[name=aip_cookielaw_language]').attr('content');
1529        if (aip_cookie_language !== undefined)
1530            return aip_cookie_language;
1531        else
1532           return 0;
1533
1534    }
1535
1536}
1537
1538if (!(window.jQuery)) {
1539    var s = document.createElement('script');
1540    s.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
1541    s.setAttribute('type', 'text/javascript');
1542    document.getElementsByTagName('head')[0].appendChild(s);
1543
1544    if (window.onload != null) {
1545        var oldOnload = window.onload;
1546        window.onload = function (e) {
1547            oldOnload(e);
1548            cc.onfirstload();
1549        };
1550    } else {
1551
1552            window.onload = cc.onfirstload;
1553    }
1554
1555} else {
1556     jQuery(document).ready(cc.onfirstload);
1557}
1558
1559/**
1560 * jQuery.browser.mobile (http://detectmobilebrowser.com/)
1561 *
1562 * jQuery.browser.mobile will be true if the browser is a mobile device - modified so that cc.ismobile is true
1563 *
1564 **/
1565(function (a) {
1566    cc.ismobile = /android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))
1567  if(jQuery(window).width()<720)cc.ismobile=true;
1568})(navigator.userAgent || navigator.vendor || window.opera);

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.