1// Trigger Cookie on button Click 2function bstcmfw_set_cookie_consent( cname , exdays, cvalue ) { 3 bstcmfw_set_cookie_arguments( cname , exdays, cvalue ); 4 bstcmfw_set_cookie_scripts(); 5 6 if ( 1 == cvalue ) { 7 dataLayer.push( { 8 'event' : 'cookies_accepted' 9 } ); 10 11 jQuery('[src*=bstcmfw-embed-consent]').each( 12 function() { 13 var iframe_source = jQuery(this).attr('src'); 14 jQuery(this).attr( 'src', iframe_source ); 15 } 16 ); 17 } 18} 19 20// Set default scripts based on cookie settings (1: print accept scripts, 0: print decline scripts) 21jQuery( document ).ready( 22 function() { 23 'use strict'; 24 25 // Get first two characters 26 var cookie_lang = document.documentElement.lang.substring(0, 2); 27 28 jQuery.ajax( 29 { 30 type: "POST", 31 url: bstcmfw_ajax_cookie.ajaxurl, 32 dataType: "JSON", 33 data: { 34 action: 'get_scripts_hook', 35 cookie_accept: bstcmfw_get_cookie( 'bstcmfw_cookie_accept' ), 36 cookie_lang: cookie_lang 37 }, 38 success: function( data ) { 39 jQuery( data.header ).appendTo( "head" ); 40 jQuery( data.footer ).appendTo( "body" ); 41 42 if ( 1 != bstcmfw_get_cookie( 'bstcmfw_cookie_accept' ) && '0' != bstcmfw_get_cookie( 'bstcmfw_cookie_accept' ) ) { 43 jQuery('.bstcmfw-cookie-wrapper').show(); 44 jQuery('.bstcmfw-cookie-overlay').show(); 45 } 46 } 47 } 48 ); 49 } 50); 51 52// Set cookie 53function bstcmfw_set_cookie_arguments(cname , exdays, cvalue) { 54 var d = new Date(); 55 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 56 var expires = "expires="+ d.toUTCString(); 57 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 58} 59 60 61// Get cookie 62function bstcmfw_get_cookie(cname) { 63 var name = cname + "="; 64 var decodedCookie = decodeURIComponent(document.cookie); 65 var ca = decodedCookie.split(';'); 66 for(var i = 0; i <ca.length; i++) { 67 var c = ca[i]; 68 while (c.charAt(0) == ' ') { 69 c = c.substring(1); 70 } 71 if (c.indexOf(name) == 0) { 72 return c.substring(name.length, c.length); 73 } 74 } 75 return ""; 76} 77 78 79// Collapse CookieContainer on click 80function bstcmfw_toggle_cookiebar() { 81 var checkbox = document.getElementById("bstcmfw-cookie-enable"); 82 var container = document.getElementById("bstcmfw-cookie-collapse-div"); 83 84 if (checkbox.checked){ 85 container.style.display = "block"; 86 } else { 87 container.style.display = "none"; 88 } 89} 90 91// Check if CookieCheckbox is checked on pageload 92document.addEventListener("DOMContentLoaded", function() { 93 if(document.getElementById("bstcmfw-cookie-enable") !== null) { 94 var checkbox = document.getElementById("bstcmfw-cookie-enable"); 95 var container = document.getElementById("bstcmfw-cookie-collapse-div"); 96 97 if (checkbox.checked){ 98 container.style.display = "block"; 99 } else { 100 container.style.display = "none"; 101 } 102} 103 104}); 105 106 107// Set JavaSripts 108function bstcmfw_set_cookie_scripts() { 109 var cookie_accept = bstcmfw_get_cookie("bstcmfw_cookie_accept"); 110 111 // Get first two characters 112 var cookie_lang = document.documentElement.lang.substring(0, 2); 113 114 jQuery.ajax( 115 { 116 type: "POST", 117 url: bstcmfw_ajax_cookie.ajaxurl, 118 dataType: "JSON", 119 data: { 120 action: 'get_scripts_hook', 121 cookie_accept: cookie_accept, 122 cookie_lang: cookie_lang 123 }, 124 success: function( data ) 125 { 126 if ( jQuery( '[data-type=decline]').length ) { 127 jQuery( '[data-type=decline]').remove(); 128 } 129 130 jQuery( data.header ).appendTo( "head" ); 131 jQuery( data.footer ).appendTo( "body" ); 132 133 jQuery('.bstcmfw-cookie-wrapper').hide(); 134 jQuery('.bstcmfw-cookie-overlay').hide(); 135 } 136 } 137 ); 138} 139 140// Fire event a few seconds after page load 141function bstcmfw_fire_event() { 142 dataLayer = window.dataLayer || []; 143 144 dataLayer.push( { 145 'event' : 'ready_for_scripts' 146 } ); 147} 148 149setTimeout( bstcmfw_fire_event, 1500 );
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.