PageSourceSearch

https://www.spacewinner.nl/wp-content/plugins/tatof-cookie-code/tatof-cookie-code.js?ver=6.12.5

js spacewinner.nl collected 2026-10-06 15:05:23 UTC 11,478 bytes, 265 lines download raw bytes

1
2// Run disabled scripts
3function tfInjectScriptsBase(selector, target, position) {
4    document.querySelectorAll(selector).forEach(function(s) {
5        var newScript = document.createElement('script');
6        newScript.innerHTML = s.innerHTML;
7        Array.from(s.attributes).forEach(function(attr) {
8            if (attr.name !== 'type' && attr.name !== 'data-tf-cookiecode') {
9                newScript.setAttribute(attr.name, attr.value);
10            }
11        });
12        if (position === 'top') {
13            target.prepend(newScript);
14        } else {
15            target.appendChild(newScript);
16        }
17        s.remove();
18    });
19}
20
21
22(function ($, root, undefined) {
23    $(function () { 'use strict';
24
25
26        // =================================================
27        // [Referrer] Set Referrer for Analytics
28        // =================================================
29        // Cookie not accepted & first time visit
30        // region
31
32            // if($('script[data-tfcookie="gtm"]').length){
33            //     console.log('TF cookie: GTM enabled');
34            //
35            //     if((sessionStorage.getItem("tfFirstVisit") != 1) && (Cookies.get('tf_cookie_popup') != 1)){
36            //
37            //         // Check if referrer exists
38            //         if(document.referrer){
39            //
40            //             // Set first time visite to true
41            //             sessionStorage.setItem("tfFirstVisit", 1);
42            //
43            //             // Set custom Referrer
44            //             sessionStorage.setItem("tfReferrer", document.referrer);
45            //         }
46            //
47            //         // Cookie is accepted
48            //     }else if((sessionStorage.getItem("tfFirstVisit") == 1) && (Cookies.get('tf_cookie_popup') == 1)){
49            //
50            //         // Set gtag referrer
51            //         gtag('set', { referrer: sessionStorage.getItem("tfReferrer") });
52            //
53            //         // Set custom document.referrer
54            //         Object.defineProperty(document, "referrer", {
55            //             get: function () { return sessionStorage.getItem("tfReferrer") },
56            //         });
57            //
58            //         console.log('TF cookie: Referrer set');
59            //
60            //         // Remove first time visit
61            //         sessionStorage.removeItem("tfFirstVisit");
62            //     }
63            // }
64
65        // endregion
66
67
68        // Does cookie popup exist
69        if($(".tf-cookie-popup-holder").length){
70
71            // =================================================
72            // [Popup] Show if no cookie is set
73            // =================================================
74            // region
75
76                if(Cookies.get('tf_cookie_popup') != 1){
77                    $('.tf-cookie-popup-holder').fadeIn();
78                    $('.tf-cookie-top .tf-cookie-tabplace').focus();
79                }
80
81            // endregion
82
83
84            // =================================================
85            // [Popup] Cookie Decline click
86            // =================================================
87            // region
88
89                $(document).on('click', '.tf-cookie-btn-decline', function(ev){
90                    ev.preventDefault();
91
92                    // Remove popup
93                    $('.tf-cookie-popup-holder').fadeOut();
94
95                    // Set popup cookie
96                    Cookies.set('tf_cookie_popup', 1, { expires: 365 });
97
98                    // Remove first time visit
99                    // if(sessionStorage.getItem("tfFirstVisit")){
100                    //     sessionStorage.removeItem("tfFirstVisit");
101                    //     sessionStorage.removeItem("tfReferrer");
102                    // }
103                });
104
105            // endregion
106
107
108            // =================================================
109            // [Popup] Cookie Accept click
110            // =================================================
111            // region
112
113                $(document).on('click', '.tf-cookie-btn-accept', function(ev){
114                    ev.preventDefault();
115
116                    var tfCookieStatus_accept = '';
117
118                    // Check Client Settings
119                    if($(".tf-cookie-settings").length){
120
121                        // Get checkboxes
122                        var checkboxAnalytics = $('.tf-cookie-set-box[data-cookiepref="analytics"]');
123                        var checkboxMarketing = $('.tf-cookie-set-box[data-cookiepref="marketing"]');
124
125                        // Set cookie value
126                        if(checkboxAnalytics.hasClass('tf-cookie-enabled') && checkboxMarketing.hasClass('tf-cookie-enabled')){
127                            Cookies.set('tf_cookie_consent', 'all', { expires: 365 });
128                            tfCookieStatus_accept = 'all';
129                        }else if(checkboxAnalytics.hasClass('tf-cookie-enabled')){
130                            Cookies.set('tf_cookie_consent', 'analytics', { expires: 365 });
131                            tfCookieStatus_accept = 'analytics';
132                        }else if(checkboxMarketing.hasClass('tf-cookie-enabled')){
133                            Cookies.set('tf_cookie_consent', 'marketing', { expires: 365 });
134                            tfCookieStatus_accept = 'marketing';
135                        }
136                    }else{
137                        Cookies.set('tf_cookie_consent', 'all', { expires: 365 });
138                        tfCookieStatus_accept = 'all';
139                    }
140
141                    // Remove popup
142                    $('.tf-cookie-popup-holder').fadeOut();
143
144                    // Set popup cookie
145                    Cookies.set('tf_cookie_popup', 1, { expires: 365 });
146
147                    // Load scripts
148                    if(tfCookieStatus_accept === 'analytics' || tfCookieStatus_accept === 'all'){
149                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="header-analytics"]', document.head);
150                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="body-analytics"]', document.body,'top');
151                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="footer-analytics"]', document.body);
152                    }
153                    if(tfCookieStatus_accept === 'marketing' || tfCookieStatus_accept === 'all'){
154                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="header-marketing"]', document.head);
155                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="body-marketing"]', document.body,'top');
156                        tfInjectScriptsBase('script[type="text/plain"][data-tf-cookiecode="footer-marketing"]', document.body);
157                    }
158
159                    // Update Tagmanager
160                    if($('script[data-tf-gtm="gtm-default"]').length){
161                        if (tfCookieStatus_accept === 'analytics') {
162                            gtag('consent', 'update', {
163                                'analytics_storage': 'granted'
164                            });
165                        }
166                        if (tfCookieStatus_accept === 'marketing') {
167                            gtag('consent', 'update', {
168                                'ad_storage': 'granted',
169                                'ad_user_data': 'granted',
170                                'ad_personalization': 'granted'
171                            });
172                        }
173                        if (tfCookieStatus_accept === 'all') {
174                            gtag('consent', 'update', {
175                                'analytics_storage': 'granted',
176                                'ad_storage': 'granted',
177                                'ad_user_data': 'granted',
178                                'ad_personalization': 'granted'
179                            });
180                        }
181                        dataLayer.push({ 'event': 'tf_consent_update' });
182                    }
183
184                });
185
186            // endregion
187
188
189            // =================================================
190            // [Popup] Cookie Settings
191            // =================================================
192            // region
193
194                if($(".tf-cookie-settings").length){
195
196                    // Open up settings and clear default value
197                    var FirstTimeSetting = true;
198
199                    $(document).on('click', '.tf-cookie-btn-settings', function(ev){
200                        ev.preventDefault();
201
202                        if ($(this).hasClass("active")){
203                            $('.tf-cookie-settings').removeClass("active");
204                            $(this).removeClass("active");
205                            $('.tf-cookie-btn-accept').focus();
206                        }else{
207                            $('.tf-cookie-settings').addClass("active");
208                            $(this).addClass("active");
209
210                            $('.tf-cookie-set-box[data-cookiepref="analytics"]').focus();
211
212                            if(FirstTimeSetting && !$(this).hasClass('autoaan')){
213                                $('.tf-cookie-set-box').removeClass('tf-cookie-enabled').addClass('tf-cookie-disabled');
214                            }
215                            FirstTimeSetting = false;
216                        }
217                    });
218
219                    // Change value switches
220                    $(document).on('click', '.tf-cookie-set-box', function(ev){
221                        ev.preventDefault();
222                        if ($(this).hasClass("tf-cookie-enabled")){
223                            $(this).removeClass('tf-cookie-enabled').addClass('tf-cookie-disabled');
224                        }else{
225                            $(this).removeClass('tf-cookie-disabled').addClass('tf-cookie-enabled');
226                        }
227                    });
228                }
229
230            // endregion
231        }
232
233
234
235        // =================================================
236        // [Popup] Reopen popup / RESET ALL
237        // =================================================
238        if($(".tf-cookie-popup-holder").length){
239            // [onload] If has #cookiesettings in url
240            if(window.location.hash) {
241                if (window.location.hash.indexOf('cookiesettings') > -1 || window.location.hash.indexOf('cookiereset') > -1) {
242                    resetCookies();
243                }
244            }
245            // [onclick] If has #cookiesettings in link
246            $(document).on('click', 'a[href*="#cookiesettings"], a[href*="#cookiereset"]', function(ev){
247                ev.preventDefault();
248                resetCookies();
249            });
250        }
251
252        function resetCookies(){
253            // Clear all cookies
254            Cookies.remove('tf_cookie_consent');
255            Cookies.remove('tf_cookie_popup');
256
257            // Redirect to clean url
258            var trueLocation = location.protocol+'//'+location.host+(location.search?location.search:"");
259            window.location.replace(trueLocation);
260        }
261
262    });
263
264
265})(jQuery, this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.