PageSourceSearch

https://www.waveenergyscotland.co.uk/scripts/h-notificationbanner.js?d=3175

js waveenergyscotland.co.uk collected 2026-09-24 18:52:18 UTC 4,735 bytes, 121 lines download raw bytes

1(function ($, window, document) {
2    // The $ is now locally scoped
3    $(function () {
4        
5        const notificationBanner = document.getElementById('notificationBanner');
6        if (!notificationBanner) return
7        
8        const closeNotificationBtn = notificationBanner.querySelector('.h-notificationbanner__btn');
9        let bannerActive = getCookie('bannerState');
10
11        // if (bannerActive == 'disabled' || !$('div').hasClass('h-notificationbanner')) {
12        //     $('.h-notificationbanner').setAttribute('aria-hidden', false);
13        //     $('body').addClass('notification');
14
15        // } else {
16        //     $('.h-notificationbanner').setAttribute('aria-hidden', true);
17        //     $('body').removeClass('notification');
18
19            
20        // }
21
22        if(bannerActive === 'disabled') {
23            document.body.classList.remove('notification');
24        } else {
25            notificationBanner.classList.remove('h-notificationbanner--hidden');
26        }
27
28        closeNotificationBtn.addEventListener('click', (event) => {
29            event.preventDefault();
30            setCookie('bannerState', 'disabled', 1);
31            notificationBanner.classList.add('h-notificationbanner--hidden');
32            // notificationBanner.setAttribute('aria-hidden', true);
33            document.body.classList.remove('notification');
34
35            var headerHeight = $('header').outerHeight();
36            var browserHeight = $(window).outerHeight();
37
38            enquire.register('screen and (max-width:1280px)', {
39                unmatch: function () {
40                    $('.n-main').css({
41                        'top' : 'auto',
42                        'height' : ' auto'
43                    });
44                    $('.n-main .e-sub').css({
45                        'top' : 'auto',
46                        'height' : ' auto'
47                    });
48                },
49
50                match: function () {
51                    $('.n-main').css({
52                        'top' : headerHeight + 'px',
53                        'height' : browserHeight - headerHeight +'px'
54                    });
55                    $('.n-main .e-sub').css({
56                        'top' : headerHeight + 'px',
57                        'height' : browserHeight - headerHeight +'px'
58                    });
59                }
60            });
61        })
62
63        //Hide Banner
64        // $('.h-notificationbanner__btn').on('click', function (event) {
65        //     event.preventDefault();
66        //     setCookie('bannerState', 'disabled', 1);
67        //     $('.h-notificationbanner').hide();
68        //     $('body').removeClass('notification');
69
70        //     var headerHeight = $('header').outerHeight();
71        //     var browserHeight = $(window).outerHeight();
72
73        //     enquire.register('screen and (max-width:1280px)', {
74        //         unmatch: function () {
75        //             $('.n-main').css({
76        //                 'top' : 'auto',
77        //                 'height' : ' auto'
78        //             });
79        //             $('.n-main .e-sub').css({
80        //                 'top' : 'auto',
81        //                 'height' : ' auto'
82        //             });
83        //         },
84
85        //         match: function () {
86        //             $('.n-main').css({
87        //                 'top' : headerHeight + 'px',
88        //                 'height' : browserHeight - headerHeight +'px'
89        //             });
90        //             $('.n-main .e-sub').css({
91        //                 'top' : headerHeight + 'px',
92        //                 'height' : browserHeight - headerHeight +'px'
93        //             });
94        //         }
95        //     });
96        // });
97
98        function setCookie(name, value, days) {
99            var expires = "";
100            if (days) {
101                var date = new Date();
102                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
103                expires = "; expires=" + date.toUTCString();
104            }
105            document.cookie = name + "=" + (value || "") + expires + "; path=/";
106        }
107
108        function getCookie(name) { // #TODO - can we make this global.
109            var nameEQ = name + "=";
110            var ca = document.cookie.split(';');
111            for (var i = 0; i < ca.length; i++) {
112                var c = ca[i];
113                while (c.charAt(0) == ' ') c = c.substring(1, c.length);
114                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
115            }
116            return null;
117        }
118
119    });
120
121})(window.jQuery, window, document);

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.