PageSourceSearch

https://difesa.it/assets/cookie_banner/gdpr-cookie-fra.js

js difesa.it collected 2026-10-02 02:25:14 UTC 30,924 bytes, 618 lines download raw bytes

1(function (root, factory) {
2    if (typeof define === "function" && define.amd) {
3        define(["jquery"], factory);
4    }
5    else if (typeof module === "object" && module.exports) {
6        module.exports = function (root, jQuery) {
7            if (jQuery === undefined) {
8                if (typeof window !== "undefined") {
9                    jQuery = require("jquery");
10                }
11                else {
12                    jQuery = require("jquery")(root);
13                }
14            }
15            factory(jQuery);
16            return jQuery;
17        };
18    }
19    else {
20        factory(root.jQuery);
21    }
22}(this, function ($) {
23    "use strict";
24
25    var settings, showing = false, display, isAdvanced = false, seenAdvanced = false;
26
27    var setCookie = function (name, value, expires) {
28        var d = new Date();
29        d.setTime(d.getTime() + expires * 24 * 60 * 60 * 1000);
30        document.cookie = name + "=" + value + ";expires=" + d.toUTCString() + ";path=/";
31        return getCookie(name);
32    };
33
34    // Get cookie
35    var getCookie = function (name) {
36        var ca = decodeURIComponent(document.cookie).split(";");
37        name += "=";
38        for (var i = 0; i < ca.length; i++) {
39            var c = ca[i];
40            while (c.charAt(0) == " ") {
41                c = c.substring(1);
42            }
43            if (c.indexOf(name) === 0) {
44                return c.substring(name.length, c.length);
45            }
46        }
47    };
48
49    var validateCookieName = function (name) {
50        return name.replace(/[^\u0021-\u007e]|[,;=\s]/g, "");
51    };
52
53    var getPreferences = function () {
54        var preferences = getCookie(settings.cookieName);
55        try {
56            preferences = JSON.parse(preferences);
57        }
58        catch (ex) {
59            return;
60        }
61
62        if (!Array.isArray(preferences) || !preferences.length) {
63            return;
64        }
65
66        var knownTypes = settings.cookieTypes.map(function (type) {
67            return type.value;
68        });
69        preferences = preferences.filter(function (pref) {
70            return knownTypes.indexOf(pref) >= 0;
71        });
72
73
74        var currentURL = window.location.href;
75
76        if (preferences.indexOf('twitter') <= 0) {
77            $(".twitter_cookie .timeline").hide();
78            if (!$(".twitter_cookie").find('.textCookie').length) {
79                $(".twitter_cookie").append("<p class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
80            }
81        } else {
82            if (!$(".twitter_cookie").find('.timeline').length) {
83                $(".twitter_cookie").empty();
84                if (currentURL.toLowerCase().search('/smd/index.html') > 0) {
85                    $(".twitter_cookie").append('<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
86                        + '<a style="width:100%;" class="twitter-timeline" href="https://twitter.com/SM_Difesa?ref_src=twsrc%5Etfw">Tweets by SM_Difesa</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
87                    );
88                }
89
90                else {
91                    $(".twitter_cookie").append('<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
92                        + '<div class= "timeline" style = "height:331px" > <a class="twitter-timeline" data-lang="it" data-width="331" data-height="331" data-theme="light" href="https://twitter.com/MinisteroDifesa" data-chrome="nofooter"><span class="socialtw"></span></a></div>'
93                    );
94                }
95            }
96        }
97        if (preferences.indexOf('facebook') <= 0) {
98            $(".facebook_cookie .fb-page").hide();
99            if (!$(".facebook_cookie").find('.textCookie').length) {
100                $(".facebook_cookie").append("<p class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
101            }
102        } else {
103            if (!$(".facebook_cookie").find('#fb-root').length) {
104                $(".facebook_cookie").empty();
105                if (currentURL.toLowerCase().search('/smd/index.html') > 0) {
106                    $(".facebook_cookie").append('<div id="fb-root"></div>'
107                        + '<iframe title="Facebook" src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FStatoMaggioreDifesaOfficial%2F&tabs=timeline&width=340&height=331&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=400421123730613" width="340" height="331" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>'
108                    );
109                }
110
111                else {
112                    $(".facebook_cookie").append('<div id="fb-root"></div>'
113                        + '<script async defer crossorigin="anonymous" src="https://connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v4.0"></script>'
114                        + '<div style=" border: solid 1px #d3d3d3 !important; border-radius: 15px !important;" class="fb-page" data-href="https://www.facebook.com/ministerodifesa/" data-tabs="timeline" data-width="331" data-height="331" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">'
115                        + '<blockquote style=" border: solid 1px #d3d3d3 !important; border-radius: 15px !important;" cite="https://www.facebook.com/ministerodifesa/" class="fb-xfbml-parse-ignore"></blockquote>'
116                        + '</div>'
117                    );
118                }
119
120            }
121        }
122        if (preferences.indexOf('instagram') <= 0) {
123            $(".instagram_cookie #feed").hide();
124            if (!$(".instagram_cookie").find('.textCookie').length) {
125                $(".instagram_cookie").append("<p class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
126            }
127        } else {
128            if (!$(".instagram_cookie").find('#feed').length) {
129                $(".instagram_cookie").append('<div id="feed"></div>'
130
131                    + '<blockquote title="Instagram" class="instagram-media" data-instgrm-permalink="https://www.instagram.com/p/CuoWLDkolwc/?utm_source=ig_embed&amp;utm_campaign=loading" data-instgrm-version="14" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:540px; min-width:326px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">'
132                    + ' <div style="padding:16px;">'
133                    + '<a title="Instagram" href="https://www.instagram.com/p/CuoWLDkolwc/?utm_source=ig_embed&amp;utm_campaign=loading" style=" background:#FFFFFF; line-height:0; padding:0 0; text-align:center; text-decoration:none; width:100%;" target="_blank">'
134                    + '<div style=" display: flex; flex-direction: row; align-items: center;">'
135                    + '<div style="background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 40px; margin-right: 14px; width: 40px;">'
136                    + '</div>'
137                    + '<div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center;">'
138                    + '<div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 100px;">'
139                    + '</div>'
140                    + '<div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 60px;">'
141                    + '</div>'
142                    + '</div>'
143                    + '</div>'
144                    + '<div style="padding: 19% 0;"></div>'
145                    + '<div style="padding-top: 8px;">'
146                    + '<div style=" color:#3897f0; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:550; line-height:18px;">'
147                    + 'Visualizza questo post su Instagram</div>'
148                    + '</div>'
149                    + '<div style="padding: 12.5% 0;"></div>'
150                    + '<div style="display: flex; flex-direction: row; margin-bottom: 14px; align-items: center;">'
151                    + '<div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(0px) translateY(7px);"> </div>'
152                    + '<div style="background-color: #F4F4F4; height: 12.5px; transform: rotate(-45deg) translateX(3px) translateY(1px); width: 12.5px; flex-grow: 0; margin-right: 14px; margin-left: 2px;">'
153                    + '</div> <div style="background-color: #F4F4F4; border-radius: 50%; height: 12.5px; width: 12.5px; transform: translateX(9px) translateY(-18px);"> </div>'
154                    + '</div> <div style="margin-left: 8px;"> <div style=" background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px;
154 width: 20px;"> </div>'
155                    + '<div style=" width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)">'
156                    + '</div> </div> <div style="margin-left: auto;"> <div style=" width: 0px; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);">'
157                    + '</div> <div style=" background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);"> </div>'
158                    + '<div style=" width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);"> </div>'
159                    + '</div> </div> <div style="display: flex; flex-direction: column; flex-grow: 1; justify-content: center; margin-bottom: 24px;">'
160                    + '<div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; margin-bottom: 6px; width: 224px;"> </div>'
161                    + '<div style=" background-color: #F4F4F4; border-radius: 4px; flex-grow: 0; height: 14px; width: 144px;"> </div>'
162                    + '</div> </a> <p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">'
163                    + '<a title="Instagram" href="https://www.instagram.com/p/CuoWLDkolwc/?utm_source=ig_embed&amp;utm_campaign=loading" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">Un post condiviso da Ministero Difesa (@ministerodifesa_official)</a></p>'
164                    + '</div></blockquote>'
165                    + '<script async src="//www.instagram.com/embed.js"></script>'
166
167                );
168            }
169        }
170        if (preferences.indexOf('youtube') <= 0) {
171            $(".youtubeIframe iframe").hide();
172            if (!$(".youtubeIframe").find('.textCookie').length) {
173                $(".youtubeIframe").append("<p class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
174            }
175        } else {
176            if (!$(".youtubeIframe").find('iframe').length) {
177                $(".youtubeIframe").append("<iframe title='You Tube' width='1200px' height='600px' src='' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard - write; encrypted - media; gyroscope; picture -in -picture' allowfullscreen></iframe>");
178            }
179        }
180        if (preferences.indexOf('webtv') <= 0) {
181            $(".webtv .webtv__video").hide();
182            if (!$(".webtv_cookie").find('.textCookie').length) {
183                $(".webtv_cookie").append("<p style='margin-bottom: 300px;' class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
184            }
185        } else {
186            if (!$(".webtv_cookie").find('#webtv').length) {
187
188                fetch('/mdd/hp/web_tv.json')
189                    .then(response => response.json())
190                    .then(data => {
191                        $(".webtv_cookie").empty();
192                        $(".webtv_cookie").append('<div id="webtv"></div>'
193                            + '<iframe width="331" height="331" style="border:solid 1px #8a8a8a; border-radius:10px;" src="' + data[0].video.src + '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>'
194                        );
195                    });
196
197            }
198        }
199        if (preferences.indexOf('linkedin') <= 0) {
200            $(".linkedin_cookie iframe").hide();
201            if (!$(".linkedin_cookie").find('.textCookie').length) {
202                $(".linkedin_cookie").append("<p class='textCookie'>Vous ne pouvez pas afficher ce contenu. Pour le consulter, modifiez vos <a href='javascript:$.gdprcookie.display();'>préférences en matière de cookies</a></p>");
203            }
204        } else {
205            if (!$(".linkedin_cookie").find('iframe').length) {
206                $(".linkedin_cookie").empty();
207                if (currentURL.toLowerCase().search('/smd/index.html') > 0) {
208                    $(".linkedin_cookie").append('<iframe title="Linkedin" style="width:100%;" src="https://www.linkedin.com/embed/feed/update/urn:li:share:7075081385501163520" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>'
209                    );
210                }
211
212                else {
213                    $(".linkedin_cookie").append("<iframe title='Linkedin' src='https://www.linkedin.com/embed/feed/update/urn:li:share:7071810851887824896' style='width:100%; height: 100% !important;' frameborder='0' allowfullscreen='' title='Embedded post'></iframe>");
214                }
215
216
217            }
218        }
219
220        return preferences;
221
222    };
223
224    $.gdprcookie = {};
225
226    $.gdprcookie.init = function (options) {
227
228        //Twitter, Facebook, Instagram, Youtube e WebTv
229        var defaultSettings = {
230            cookieTypes: [
231                {
232                    type: "Difesa.it",
233                    value: "essential",
234                    description: "Cookies li�s au site Difesa pour le bon fonctionnement.",
235                    checked: true,
236                },
237                {
238                    type: "Twitter",
239                    value: "twitter",
240                    description: "Cookies li�s � votre compte Twitter.",
241                    checked: false,
242                },
243                {
244                    type: "Facebook",
245                    value: "facebook",
246                    description: "Cookies li�s � votre compte Facebook.",
247                    checked: false,
248                },
249                {
250                    type: "Instagram",
251                    value: "instagram",
252                    description: "Cookies li�s � votre compte Instagram.",
253                    checked: false,
254                },
255                {
256                    type: "Youtube",
257                    value: "youtube",
258                    description: "Cookies li�s � votre compte Youtube.",
259                    checked: false,
260                },
261                {
262                    type: "WebTv",
263                    value: "webtv",
264                    description: "Cookies li�s � WebTv D�fense.",
265                    checked: false,
266                },
267                {
268                    type: "Linkedin",
269                    value: "linkedin",
270                    description: "Cookies li�s � votre compte Linkedin.",
271                    checked: false,
272                }
273            ],
274            title: "Cookies e privacy",
275            subtitle: "S�lectionnez les cookies � accepter",
276            message: "Les cookies vous permettent de personnaliser votre exp�rience sur le portail Difesa.it et nous aident � am�liorer notre communication et les services propos�s.",
277            submessage: "Les cookies vous permettent de personnaliser votre exp�rience sur le portail Difesa.it et nous aident � am�liorer notre communication et les services propos�s.",
278            delay: 2000,
279            expires: 185,
280            cookieName: "cookieControlPrefs",
281            acceptReload: true,
282            acceptBeforeAdvanced: ["essential", "twitter", "facebook", "instagram", "youtube", "webtv", "linkedin"],
283            acceptAfterAdvanced: ["essential"],
284            allowUnadvanced: false,
285            switchAdvanced: true,
286            acceptBtnLabel: "J'accepte",
287            advancedBtnLabel: "Personnaliser",
288            unadvancedBtnLabel: "X",
289            declineBtnLabel: "Tout refuser",
290            customShowMessage: undefined,
291            customHideMessage: undefined,
292            customShowChecks: undefined,
293            customHideChecks: undefined
294        };
295
296        // Set defaults
297        settings = $.extend(defaultSettings, window.GdprCookieSettings, options);
298
299        // Coerce into a string because this is poured into innerHTML
300        settings.message = String(settings.message);
301
302        // Coerce into a positive number because it is passed to setTimeout
303        settings.delay = Math.max(0, +settings.delay) || 0;
304
305        // Coerce into a positive whole number between 0 and 730 (2-ish years), to ensure a well-formed cookie value
306        settings.expires = Math.round(Math.min(Math.max(0, +settings.expires), 730)) || 0;
307
308        // Coerce cookieTypes into an array containing plain objects
309        if (Array.isArray(settings.cookieTypes)) {
310            settings.cookieTypes = settings.cookieTypes.filter(function (cookieType) {
311                return $.isPlainObject(cookieType);
312            });
313            if (!settings.cookieTypes.length) {
314                settings.cookieTypes = defaultSettings.cookieTypes;
315            }
316        }
317        else {
318            settings.cookieTypes = defaultSettings.cookieTypes;
319        }
320
321        // Coerce into a string and valid cookie name
322        settings.cookieName = validateCookieName(String(settings.cookieName || "")) || "cookieControlPrefs";
323
324        // Coerce acceptBeforeAdvanced and acceptAfterAdvanced into arrays of str
324ings, that exist in settings.cookieTypes[].value
325        var coerce = (function () {
326            var values = settings.cookieTypes.map(function (cookieType) { return cookieType.value; }),
327                exists = function (item) { return values.indexOf(item) >= 0; };
328
329            return function (setting) {
330                // Convert a single string into an array of 1
331                setting = typeof setting === "string" ? [setting] : setting;
332
333                // If it's an array, make sure it only contains known cookie types
334                return Array.isArray(setting) ? setting.map(String).filter(exists) : undefined;
335            };
336        }());
337        settings.acceptBeforeAdvanced = coerce(settings.acceptBeforeAdvanced);
338        settings.acceptAfterAdvanced = coerce(settings.acceptAfterAdvanced);
339
340        $(function () { display(); });
341    };
342
343    display = function (alwaysShow) {
344        if (showing) {
345            return;
346        }
347
348
349        var body = $("body"),
350            myCookiePrefs = getPreferences();
351
352        var elements = {
353            container: undefined,
354            introContainer: undefined,
355            types: undefined,
356            typesContainer: undefined,
357            buttons: {
358                accept: undefined,
359                advanced: undefined
360            },
361            allChecks: [],
362            nonessentialChecks: []
363        };
364
365        var hide = function (canreload) {
366            if (elements.container) {
367                if ($.isFunction(settings.customHideMessage)) {
368                    settings.customHideMessage.call(elements.container, elements.container);
369                    showing = false;
370                }
371                else {
372                    elements.container.fadeOut("fast", function () {
373                        $(this).remove();
374                        showing = false;
375                    });
376                }
377            }
378            if (canreload && settings.acceptReload) {
379                document.location.reload();
380            }
381        };
382
383        if (!Array.isArray(myCookiePrefs) || !myCookiePrefs.length) {
384            myCookiePrefs = undefined;
385        }
386
387        if (alwaysShow || !myCookiePrefs) {
388            elements.types = $("<ul/>").append(
389                $.map(settings.cookieTypes, function (field, index) {
390                    if (!field.type || !field.value) {
391                        return;
392                    }
393                    var isEssential = field.value === "essential",
394                        isChecked;
395
396                    if (Array.isArray(myCookiePrefs)) {
397                        isChecked = myCookiePrefs.indexOf(field.value) >= 0;
398                    }
399                    else {
400                        isChecked = field.checked === true;
401                    }
402
403                    var input = $("<input/>", {
404                        type: "checkbox",
405                        id: "gdpr-cookietype-" + index,
406                        name: "gdpr[]",
407                        value: field.value,
408
409                        // The essential cookies checkbox is checked and cannot be unchecked
410                        checked: isEssential || isChecked,
411                        disabled: isEssential
412                    });
413
414                    elements.allChecks.push(input.get(0));
415                    if (!isEssential) {
416                        elements.nonessentialChecks.push(input.get(0));
417                    }
418
419                    var label = $("<label/>", {
420                        "for": "gdpr-cookietype-" + index,
421                        text: field.type,
422                        title: field.description
423                    });
424
425                    return $("<li/>").append([
426                        input.get(0),
427                        label.get(0)
428                    ]).get(0);
429                })
430            );
431            elements.allChecks = $(elements.allChecks);
432            elements.nonessentialChecks = $(elements.nonessentialChecks);
433
434            // When accept button is clicked drop cookie
435            var acceptClick = function () {
436                var prefsFromCheckboxes = function () {
437                    return elements.allChecks
438                        .filter(function () { return this.checked || this.disabled; })
439                        .map(function () { return this.value; })
440                        .get();
441                };
442                var prefsOutsideAdvanced = function (where) {
443                    var setting = "accept" + where + "Advanced";
444                    return Array.isArray(settings[setting]) ? settings[setting] : prefsFromCheckboxes();
445                };
446
447                // Hide the cookie message
448                hide(true);
449
450                // Save user cookie preferences (in a cookie!)
451                var prefs = isAdvanced ? prefsFromCheckboxes() : prefsOutsideAdvanced(seenAdvanced ? "After" : "Before");
452                setCookie(settings.cookieName, JSON.stringify(prefs), settings.expires);
453
454                // Trigger cookie accept event
455                body.trigger("gdpr:accept");
456
457                $('.gdprcookie-buttons-foo').show();
458
459                window.location.reload();
460            };
461
462            // When decline button is clicked drop cookie
463            var declineClick = function () {
464                var prefsFromCheckboxes = function () {
465                    return elements.allChecks
466                        .filter(function () { return this.checked || this.disabled; })
467                        .map(function () { return this.value; })
468                        .get();
469                };
470                var prefsOutsideAdvanced = function (where) {
471                    var setting = "acceptAfterAdvanced";
472                    return Array.isArray(settings[setting]) ? settings[setting] : prefsFromCheckboxes();
473                };
474
475                // Hide the cookie message
476                hide(true);
477
478                // Save user cookie preferences (in a cookie!)
479                var prefs = isAdvanced ? prefsFromCheckboxes() : prefsOutsideAdvanced(seenAdvanced = "After");
480                setCookie(settings.cookieName, JSON.stringify(prefs), settings.expires);
481
482                // Trigger cookie accept event
483                body.trigger("gdpr:decline");
484
485                $('.gdprcookie-buttons-foo').show();
486
487                window.location.reload();
488            };
489
490            // Toggle advanced cookie options
491            var advancedClick = function () {
492                var showAdvanced = function () {
493                    if (!settings.allowUnadvanced) {
494                        elements.buttons.advanced.prop("disabled", true);
495                        elements.buttons.decline.prop("disabled", true);
496                        elements.buttons.accept.text("Accetto");
497                    }
498
499                    if ($.isFunction(settings.customShowChecks)) {
500                        settings.customShowChecks.call(elements.typesContainer, elements.typesContainer, elements.introContainer);
501                    }
502                    else {
503                        if (settings.switchAdvanced) {
504                            elements.introContainer.slideUp("fast");
505                        }
506                        elements.typesContainer.slideDown("fast");
507                    }
508
509                    isAdvanced = seenAdvanced = true;
510                    if (settings.allowUnadvanced && settings.unadvancedBtnLabel && settings.advancedBtnLabel !== settings.unadvancedBtnLabel) {
511                        elements.buttons.advanced.text(settings.unadvancedBtnLabel);
512                    }
513
514                    // Trigger advanced show event
515                    body.trigger("gdpr:advanced");
516                };
517                var hideAdvanced = function () {
518                    if ($.isFunction(settings.customHideChecks)) {
519                        settings.customHideChecks.call(elements.typesContainer, elements.typesContainer, elements.introContainer);
520                    }
521                    else {
522                        if (settings.switchAdvanced) {
523                            elements.introContainer.slideDown("fast");
524                        }
525                        elements.typesContainer.slideUp("fast");
526                    }
527
528                    isAdvanced = false;
529                    if (settings.allowUnadvanced && settings.unadvancedBtnLabel && settings.advancedBtnLabel !== settings.unadvancedBtnLabel) {
530                        elements.buttons.advanced.text(settings.advancedBtnLabel);
531                    }
532
533                    // Trigger advanced show event
534                    body.trigger("gdpr:unadvanced");
535                };
536
537                if (isAdvanced) {
538                    if (settings.allowUnadvanced) {
539                        hideAdvanced();
540                    }
541                }
542                else {
543                    showAdvanced();
544                }
545            };
546
547            // Build cookie message to display later on
548            var cookieMessage = (elements.container = $("<div class=gdprcookie>")).append([
549                (elements.introContainer = $("<div class=gdprcookie-intro/>")).append([
550                    settings.title ? $("<h1/>", { text: settings.title }).get(0) : undefined,
551                    settings.message ? $("<p/>", { html: settings.message }).get(0) : undefined
552                ]).get(0),
553                (elements.typesContainer = $("<div class=gdprcookie-types/>")).hide().append([
554                    settings.subtitle ? $("<h2/>", { text: settings.subtitle }).get(0) : undefined,
555                    settings.submessage ? $("<p/>", { html: settings.submessage }).get(0) : undefined,
556                    elements.types.get(0)
557                ]).get(0),
558                $("<div class='gdprcookie-buttons'/>").append([
559                    (elements.buttons.accept = $("<button/>", { type: "button", text: settings.acceptBtnLabel, click: acceptClick })).get(0),
560                    (elements.buttons.advanced = $("<button/>", { type: "button", text: settings.advancedBtnLabel, click: advancedClick })).get(0),
561                    (elements.buttons.decline = $("<button/>", { type: "button", text: settings.declineBtnLabel, click: declineClick })).get(0),
562                ]).get(0),
563                $("<div class='gdprcookie-buttons-main'/>").append([
564                    (elements.buttons.unadvanced = $("<button/>", { type: "button", text: settings.unadvancedBtnLabel, click: declineClick })).get(0),
565                ]).get(0)
566            ]);
567
568            var show = function () {
569                body.append(cookieMessage);
570                showing = true;
571                isAdvanced = seenAdvanced = false;
572                if ($.isFunction(settings.customShowMessage)) {
573                    settings.customShowMessage.call(elements.container, elements.container);
574                }
575                else {
576                    elements.container.hide().fadeIn("slow");
577                }
578
579                // Trigger container show event
580                body.trigger("gdpr:show");
581            };
582
583            if (!settings.delay || alwaysShow) {
584                show();
585            }
586            else {
587                window.setTimeout(show, settings.delay);
588            }
589        }
590        else {
591            hide(false);
592        }
593    };
594
595    $.gdprcookie.display = function () {
596        display(true);
597    };
598
599    // Method to check if user cookie preference exists
600    $.gdprcookie.preference = function (value) {
601        var preferences = getPreferences();
602
603        if (value === "essential") {
604            return true;
605        }
606        else if (!preferences) {
607            return false;
608        }
609        else if (value !== undefined) {
610            return preferences.indexOf(value) >= 0;
611        }
612        return preferences;
613    };
614
615    // Protection against malicious scripts, e.g. monkey patching
616    $.gdprcookie = Object.freeze($.gdprcookie);
617
618}));

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.