1(function ($) { 2 "use strict"; 3 4 var cookiePopupHtml = '<div id="cookie-popup-container">' + 5 '<div class="cookie-popup" style="display: none;">' + 6 '<div class="cookie-popup-inner">' + 7 '<div class="cookie-popup-left">' + 8 '<div class="cookie-popup-headline">This website uses cookies</div>' + 9 '<div class="cookie-popup-sub-headline">By using this site, you agree to our use of cookies.</div>' + 10 '</div>' + 11 12 '<div class="cookie-popup-right">' + 13 '<button class="cookie-popup-accept-cookies-btn btn small turquoise">Accept</button>'+ 14 '<a href="#" class="cookie-popup-learn-more">Learn More</a>' + 15 '</div>' + 16 '</div>' + 17 '<div class="cookie-popup-lower" style="display: none;">' + 18 '</div>' + 19 '</div>' + 20 '</div>'; 21 22 var onAccept; 23 24 $.extend({ 25 acceptCookies : function(options) { 26 var cookiesAccepted = getCookie("cookiesAccepted"); 27 28 if (!cookiesAccepted) { 29 var cookiePopup = $(cookiePopupHtml); 30 31 var position = "bottom"; 32 33 if(options != undefined) { 34 position = options.position != undefined ? options.position : "bottom"; 35 36 if(options.title != undefined)
37 cookiePopup.find('.cookie-popup-headline').text(options.title); 38 if(options.text != undefined) 39 cookiePopup.find('.cookie-popup-sub-headline').html(options.text); 40 if(options.acceptButtonText != undefined) 41 cookiePopup.find(".cookie-popup-accept-cookies-btn").text(options.acceptButtonText); 42 if(options.learnMoreButtonText != undefined) 43 cookiePopup.find(".cookie-popup-learn-more").text(options.learnMoreButtonText); 44 if(options.learnMoreInfoText != undefined) 45 cookiePopup.find(".cookie-popup-lower").text(options.learnMoreInfoText); 46 if(options.theme != undefined) 47 cookiePopup.addClass("theme-" + options.theme); 48 if(options.onAccept != undefined) 49 onAccept = options.onAccept; 50 if(options.learnMore != undefined) { 51 if(options.learnMore == false)
52 cookiePopup.find(".cookie-popup-learn-more").remove(); 53 } 54 if(options.learnMoreText != undefined) { 55 cookiePopup.find(".cookie-popup-lower").html(options.learnMoreText); 56 } 57 } 58 59 var fnWidthPopup=false; 60 if(options != undefined && options.class != undefined && options.class) { 61 var popup=cookiePopup.find('.cookie-popup').addClass(options.class); 62 63 if (options.width != undefined && options.width_unit != undefined) { 64 popup.css('width', options.width+options.width_unit); 65 } 66 if (options.position != undefined && options.position && options.position == 'right') { 67 popup.addClass('to_right'); 68 fnWidthPopup=function(){ 69 var $w=$jq('body'), w=$w.width(), d=w-$w[0].clientWidth; 70 popup.css({right:(d+5)+'px'}); 71 } 72 } 73 } else { 74 fnWidthPopup=function(){ 75 var $w=$('.main'), w=$w.width(), d=w-$w[0].clientWidth; 76 w=w-d; 77 $('.cookie-popup').width(w); 78 }
79 cookiePopup.find('.cookie-popup').addClass("position-" + position); 80 } 81 82 cookiePopup.find('.more_link').click(function(){ 83 OpenWindow(this.href,'650','400'); 84 return false; 85 }) 86 $('body').append(cookiePopup); 87 if (typeof fnWidthPopup == 'function') { 88 fnWidthPopup(); 89 $win.on('resize',fnWidthPopup); 90 } 91 92 $('.cookie-popup').delay(100).slideToggle(); 93 94 } 95 } 96 }); 97 98 $(document).on('click', '.cookie-popup-accept-cookies-btn', function(e) { 99 e.preventDefault(); 100 saveCookie(); 101 $('.cookie-popup').slideToggle(); 102 if (typeof onAccept === "function") 103 onAccept(); 104 }).on('click', '.cookie-popup-learn-more', function(e) { 105 e.preventDefault(); 106 $('.cookie-popup-lower').slideToggle(); 107 }); 108 109 function getCookie(cname) { 110 var name = cname + "="; 111 var decodedCookie = decodeURIComponent(document.cookie); 112 var ca = decodedCookie.split(';'); 113 for (var i = 0; i < ca.length; i++) { 114 var c = ca[i]; 115 while (c.charAt(0) == ' ') { 116 c = c.substring(1); 117 } 118 if (c.indexOf(name) == 0) { 119 return c.substring(name.length, c.length); 120 } 121 } 122 return ""; 123 } 124 125 function saveCookie() { 126 var expires = "expires=Tue, 01 Jan 2038 00:00:01 GMT"; 127 document.cookie = "cookiesAccepted=true; " + expires + "; path=/"; 128 } 129}(jQuery));
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.