PageSourceSearch

https://www.southwell-lions.org/wp-content/plugins/aubergine-cookies/aubergine-cookies.js?ver=1.91

js southwell-lions.org collected 2026-10-04 02:10:24 UTC 4,735 bytes, 179 lines download raw bytes

1function removeCookiesAfterConsentWithdrawal() {
2    let cookieSettings = aubCookies.Settings;
3    if (!cookieSettings.length > 0) {
4        return;
5    }
6
7    let necessary = aubCookies.Necessary;
8    if (document.cookie.split(';')) {
9        document.cookie.split(';').forEach(cookie => {
10            let [name, value] = cookie.split('=');
11            name = name.trim();
12            // skip necessary cookies
13            if (necessary.includes(name)) {
14                return;
15            }
16            // skip Wordpress core cookies
17            if (name.startsWith('wordpress_')) {
18                return;
19            }
20            // are the cookies in the consented list
21            if (this.isCookieConsented(name)) {
22                return;
23            }
24
25            let domainList = [
26                document.domain,
27                '.' + document.domain,
28                document.domain.replace('www', ''),
29                document.domain.replace('www.', ''),
30                '.wcagwebsites.org',
31                'wcagwebsites.org'
32            ];
33
34            domainList.forEach(domain => {
35                document.cookie = name + "=; expires=" + 'Thu, 01 Jan 1970 00:00:01 GMT' + "; path=/; domain=" + domain + ";";
36                document.cookie = name + "=; expires=" + 'Thu, 01 Jan 1970 00:00:00 GMT' + "; path=/";
37            });
38        });
39    }
40}
41function isCookieConsented(cookieName) {
42    let consent = aubCookies.Consent;
43    if (!consent) {
44        return false;
45    }
46    let cookieSettings = aubCookies.Settings;
47    if (!cookieSettings.length > 0) {
48        return false;
49    }
50
51    for (let oc of cookieSettings['optional']) {
52        if (oc['cookies'].includes(cookieName)) {
53            if(typeof consent['categories'] === 'undefined'){
54                continue;
55            }
56            if(typeof consent['categories'][oc['name']] === 'undefined'){
57                continue;
58            }
59            if(consent['categories'][oc['name']] === 1) {
60                return true;
61            }
62        }
63    }
64
65    return false;
66}
67
68removeCookiesAfterConsentWithdrawal();
69function getCookieConsent(){
70    var cookie_consent = Cookies.get('aubergine_cookie_consent');
71    if(!cookie_consent || typeof cookie_consent === "undefined"){
72        cookie_consent = 'e30=';
73    }
74    var json = window.atob(cookie_consent);
75    // console.log(cookie_consent);
76    // console.log(JSON.parse(json));
77    return JSON.parse(json);
78}
79
80/*
81* php
82* */
83
84function maybeLoadCookieBanner($){
85
86
87    let cookieSettings = aubCookies.Settings;
88    if(!cookieSettings){
89        return '';
90    }
91
92    var j = jQuery;
93
94    let consent = getCookieConsent();
95
96    var b = $('body');
97
98    // console.log(consent);
99    // console.log(cookieSettings['optional']);
100
101    if(!consent.consent){
102
103        console.log('no consent set');
104
105        if(!cookieSettings['optional'].length){
106            b.prepend($('#tmpl-no-optional-cookies-banner').html());
107        }else{
108            b.prepend($('#tmpl-consent-banner').html());
109        }
110    }
111
112}
113
114
115
116jQuery(document).ready(function($){
117
118    maybeLoadCookieBanner($);
119
120    $('body').on('click','.hide-cookie-message',function(e){
121        e.preventDefault();
122        $('.govuk-cookie-banner').remove();
123        if($(this).hasClass('no-optional-cookies-consent')){
124            jQuery.ajax({
125                type : "post",
126                dataType : "text",
127                url :  aubAjax.ajaxurl,
128                data : {'action': "no_optional_cookies_consent" },
129            });
130        }
131    });
132
133
134
135    /*
136    * Accept all click
137    * */
138    $('.accept-all-cookies').click(function(e){
139        e.preventDefault();
140        Object.keys(cookieObjects).forEach(function(key,index) {
141            cookieObjects[key].onAccept();
142        });
143        allAcceptRejectAllCookies('yes');
144    });
145
146    /*
147    * Reject all click
148    * */
149    $('.reject-all-cookies').click(function(e){
150        e.preventDefault();
151        Object.keys(cookieObjects).forEach(function(key,index) {
152            cookieObjects[key].onRevoke();
153        });
154        allAcceptRejectAllCookies('no');
155    });
156
157
158    /*
159    * Set the cookie preference cookie
160    * */
161    function allAcceptRejectAllCookies(Accept) {
162        jQuery.ajax({
163        	type : "GET",
164        	dataType : "html",
165        	url :  aubAjax.ajaxurl,
166        	data : {'action': "aubergine_cookie_consent",'cookies[all]':Accept,'ajax':'1' },
167        	success: function(response) {
168                $('#govuk-cookie-banner').replaceWith($(response));
169        	}
170        });
171
172    }
173
174
175
176
177
178
179});

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.