1/** 2 * version 2 3 * @release development 4*/ 5 6 7//eprivacy modal 8 $ = jQuery; 9 function ePrivacy() { 10 this.config = false; 11 this.modal = false; 12 13 /** 14 * Function to create styles on a HTML dom element 15 * @return {Boolean} success 16 * @private 17 * @method 18 */ 19 20 this.onDocumentReady = function(){ 21 $('body').addClass('eprivacy-plugin'); 22 23 if(window.ePrivacy.checkUrl() == false) { 24 if(window.ePrivacy.hasCookies() == false) { 25 //window.ePrivacy.showConsent(); 26 window.ePrivacy.show(); 27 } else if(window.ePrivacy.config.onSubmission) { 28 window.ePrivacy.config.onSubmission(window.ePrivacy.getCookie()); 29 window.ePrivacy.toggleShow(); 30 //window.ePrivacy.eprivacySetting(); 31 } 32 } 33 34 $(document).on("click", '.epp-button.epp-secondary', window.ePrivacy.saveCookies); 35 $(document).on("click", '.epp-button.epp-primary', window.ePrivacy.saveAllCookies); 36 }; 37 38 /** 39 * Holt sich die deactivatedSites & überprüft ob es sich bei der Seite um einer dieser Links handel. 40 * Wenn nein dann Cookie show wenn Ja dann kein Cookie show 41 */ 42 this.checkUrl = function(check) { 43 check = false; 44 deactivatedSites = window.ePrivacy.config.deactivatedSites; 45 url = window.location.href 46 $.each(deactivatedSites, function(key, value) { 47 if(value == url) { 48 check = true; 49 } 50 }) 51 return check; 52 } 53 54 /* 55 * Bei click auf einstellungen im toggleShow, 56 * animiert & remove toggleShow. Ãffnet show 57 * */ 58 _onCookieButtonClick = function() { 59 $('.epp-cookie-text').addClass('epp-blur').delay(1000).queue(function(next){ 60 $(this).removeClass('epp-blur'); 61 next(); 62 }); 63 $('.epp-cookie .epp-cookie-wrapper').delay(400).animate({ width: "toggle" },400); 64 65 direction = window.ePrivacy.config.toggleAlign; 66 67 if(!(direction == 'right' || direction == 'left')) { 68 direction = 'right'; 69 } 70 71 options = {}; 72 options[direction] = '-100px'; 73 74 _cookieButtonToggleShow(options); 75 } 76 77 _cookieButtonToggleShow = function(direction) { 78 $('.epp-cookie').delay(1400).animate(direction,500, (function(){ 79 window.ePrivacy.show(); 80 $('.epp-cookie').remove(); 81 })); 82 } 83 84 /* 85 * Setzt den geklickten Button auf disabled. Animiert den Modalwrapper 86 * und löscht die Klasse "eprivay-plugin" vom body 87 * */ 88 this._submitButtonEffect = function() { 89 $('.epp-modal-buttons').parent().find('button').attr('disabled','disabled') 90 $('.epp-modal .epp-modal-wrapper').delay(500).animate({top: '-100%'}).queue(function(next){ 91 window.ePrivacy.modal.hide(); 92 $('body').removeClass('epp-overflow').children().removeClass('epp-wrapper-blur'); 93 $('body .epp-modal').remove(); 94 next(); 95 }); 96 } 97 98 this.showConsent = function() { 99 var firstTime = 0; 100 101 if(Cookies.get("epp-cookie") === undefined) { 102 firstTime = 1; 103 } 104 105 $desc = this.config.lang.COOKIE_DESCRIPTION; 106 $cookieExpireDay = this.config.lang.COOKIE_DETAILSHOURS; 107 108 $('.eprivacy-plugin').append('<div class="epp-consent"></div>'); 109 110 this.consent = $('body .epp-consent'); 111 this.consent.append('<div class="epp-consent-wrapper" data-firstTime='+firstTime+'></div>') 112 .append('<div class="epp-consent-content"></div>'); 113 114 this.consent.content = $('body .epp-consent-content'); 115 this.consent.content.append('<div class="epp-consent-disclaimer"><p>
115'+ $desc +'</p></div>') 116 .append('<div class="epp-consent-button"><button class="epp-button epp-btn-consent">Akzeptieren</button><button class="epp-button epp-settings"><i class="fas fa-cog"></i></button></div>') 117 118 119 $('.epp-button.epp-btn-consent').on('click', function() { 120 window.ePrivacy.animateConsentWrapper(); 121 window.ePrivacy.getAllLevels(); 122 }) 123 $('.epp-button.epp-settings').on('click', function() { 124 window.ePrivacy.animateConsentWrapper(); 125 window.ePrivacy.show(); 126 }) 127 } 128 129 /** 130 * Holt alle levels, speichert diese in ein Array und übergibt dieses an saveCookies 131 * */ 132 this.getAllLevels = function() { 133 var acceptedLevels = []; 134 $.each(this.config.levels, function() { 135 var cookieName = this.name; 136 acceptedLevels.push(cookieName) 137 }) 138 window.ePrivacy.saveCookies(acceptedLevels, true); 139 } 140 /** 141 * Holt alle levels, speichert diese in ein Array und übergibt dieses an saveCookies 142 * */ 143 this.animateConsentWrapper = function() { 144 $('.epp-consent').delay(400).animate({ bottom: "-300px" },400); 145 setTimeout(function(){ 146 $('.epp-consent').remove(); 147 }, 1000) 148 } 149 150 /* 151 * Erstellt die Html struktur & öffnet das Modal 152 * mit allen Informationen. 153 * */ 154 this.show = function() { 155 var firstTime = 0; 156 157 if(Cookies.get("epp-cookie") === undefined) { 158 firstTime = 1; 159 } 160 161 $headline = this.config.lang.COOKIE_HEADLINE; 162 $desc = this.config.lang.COOKIE_DESCRIPTION; 163 $btnSaveAll = this.config.lang.COOKIE_BTNSAVEALL; 164 $btnSave = this.config.lang.COOKIE_BTNSAVE; 165 166 $impressText = this.config.lang.COOKIE_IMPRESS; 167 $dataPrivacyText = this.config.lang.COOKIE_DATAPRIVACY; 168 169 $cookieDetails = this.config.lang.COOKIE_DETAILS; 170 $cookieDetailsActive = this.config.lang.COOKIE_DETAILSACTIVE; 171 172 $cookieName = this.config.lang.COOKIE_DETAILSNAME; 173 $cookiePublisher = this.config.lang.COOKIE_DETAILSPUBLISHER; 174 $cookiePurpose = this.config.lang.COOKIE_DETAILSPURPOSE; 175 $cookieExpire = this.config.lang.COOKIE_DETAILSEXPIRE; 176 $cookieExpireDay = this.config.lang.COOKIE_DETAILSHOURS; 177 178 $impress = '<a href="'+ this.config.impressLink +'" target="_blank" class="epp-info-impress">'+ $impressText +'</a>'; 179 $dataPrivacyLink = '<a href="'+ this.config.dataPrivacyLink +'" target="_blank" class="epp-info-data-privacy">'+ $dataPrivacyText +'</a>'; 180 181 $('.eprivacy-plugin').append('<div class="epp-modal"></div>'); 182 //wenn div#wrapper vorhanden hängt class für blur an 183 $('body').find('div#wrapper').toggleClass('epp-wrapper-blur'); 184 $('body').toggleClass('epp-overflow'); 185 186 this.modal = $('body .epp-modal'); 187 this.modal.append('<div class="epp-modal-wrapper" data-firstTime='+firstTime+'></div>').append('<div class="epp-modal-wrapper-bg"></div>'); 188 this.modal.find(".epp-modal-wrapper") 189 .append('<div class="epp-modal-header"><h3>'+ $headline +'</h3></div>') 190 .append('<div class="epp-modal-description"><p>'+ $desc +'</p></div>') 191 //hier sollen alle levels + namen angezeigt werden, als checkbox 192 .append('<div class="epp-modal-content"></div>') 193 //buttons für alle akzeptieren bzw speichern 194 .append('<div class="epp-modal-buttons"><button class="epp-button epp-primary">'+ $btnSaveAll +'</button><button class="epp-button epp-secondary">'+ $btnSave +'</button></div>') 195 //impressum - Datenschutz - Cookie-Detail 196 .append('<div class="epp-modal-info">'+ $impress +''+ $dataPrivacyLink +'</div>'); 197 198 $.each(this.config.levels, function() { 199 var $hiddenlevelName = this.hiddenName; 200 var $levelName = this.name; 201 var $levelDesc = this.descriptions; 202 var $levelAlways = this.always; 203 204 var $cookies = this.cookieDetail; 205 206 if($levelAlways == true) { 207 $levelAlways = "checked disabled" 208 } else { 209 $levelAlways = ""; 210 } 211 212 $('.epp-modal-content').append('<div class="epp-content-checkbox"><label for="checkbox-'+ $levelName +'" class="epp-content-label"><input type="checkbox" levelName="'+ $hiddenlevelName +'" name="'+ $levelName +'" id="checkbox-'+ $levelName +'" '+ $levelAlways +'><span class="epp-checkbox-checkmark"></span></label><div class="epp-content-toggle"><p>'+ $levelName +'</p><div id="epp-toggle-'+ $levelName +'" class="epp-cookie-desc-toggle"></div></div></div>') 213 .append('<div id="epp-cookie-desc-'+ $levelName +'" class="epp-content-cookie-desc" style="display:none; opacity: 0;"><p>'+ $levelDesc +'</p></div>'); 214 $('#epp-cookie-desc-' + $levelName).append('<div id="epp-cookie-details-'+ $levelName +'" class="epp-cookie-details"><span class="epp-detail-titel">'+ $cookieDetails +'</span><div class="epp-cookie-detail-content"></div></div>') 215 216 217 218 219 220 221 /* 222 * Ãffnet die Cookiedetails und 223 * ändern den Text im Button 224 * */ 225 $('#epp-cookie-details-'+ $levelName +' .epp-detail-titel').click(function() { 226 227 // erstellt ein Modal im modal welches dann die einzelnen co
227okies mit beschreibung etc anzeigt 228 // erstellt dann auch ein x icon mit dem man das modal wieder verlassen kann. 229 230 $('.epp-cookie-content').slideUp(); 231 var target = $(this).parent().next('.epp-content-cookie-desc'); 232 target.slideToggle().toggleClass('epp-show'); 233 $('.epp-content-cookie-desc').not(target).slideUp().removeClass('epp-show'); // hide other open elements 234 $('.epp-modal').click(function(event) { 235 if(target.has(event.target).length == 0) { 236 target.slideUp().removeClass('epp-show'); 237 target.find('.epp-cookie-content').slideUp(); 238 $('.epp-cookie-desc-toggle').removeClass('epp-toggle-up'); 239 } 240 }); 241 event.stopPropagation(); 242 243 $('.epp-modal-wrapper').append('<div class="cookie-desc-content test-'+ $levelName +'"></div>') 244 $('.test-'+ $levelName +'' ).append('<span class="cookie-desc-exit"></span>'); 245 $('.test-'+ $levelName +'' ).append('<p class="cookie-desc-lvlname">'+ $levelName +'</p>'); 246 $.each($cookies, function() { 247 $('.test-'+ $levelName +'' ) 248 .append('<div class="epp-cookie-content show-'+ $levelName +'"><span>'+ $cookieName +'</span><p>'+ this.name +'</p><span>'+ $cookiePublisher +'</span><p>'+ this.publisher +'</p><span>'+ $cookiePurpose +'</span><p>'+ this.purpose +'</p><span>'+ $cookieExpire +'</span><p>'+ this.expire +'</p></div>'); 249 }); 250 251 $('.cookie-desc-exit').on('click', function() { 252 $('.cookie-desc-exit').remove(); 253 $('.test-'+ $levelName +'' ).remove(); 254 }); 255 256 257 btn = $(this); 258 if(btn.html() === $cookieDetailsActive) { 259 btn.html($cookieDetails) 260 } else { 261 btn.html($cookieDetailsActive); 262 } 263 264 //$('body').find('.test-'+ $levelName +'' ).slideToggle(); 265 266 }); 267 }) 268 269 /* 270 * Ãffnet die cookiebeschreibung 271 * */ 272 $('.epp-content-toggle').click(function(event){ 273 $('.epp-cookie-content').slideUp(); 274 var target = $(this).parent().next('.epp-content-cookie-desc'); 275 target.slideToggle().toggleClass('epp-show'); 276 $('.epp-content-cookie-desc').not(target).slideUp().removeClass('epp-show'); // hide other open elements 277 $('.epp-modal').click(function(event) { 278 if(target.has(event.target).length == 0) { 279 target.slideUp().removeClass('epp-show'); 280 target.find('.epp-cookie-content').slideUp(); 281 $('.epp-cookie-desc-toggle').removeClass('epp-toggle-up'); 282 } 283 }); 284 event.stopPropagation(); 285 }); 286 287 window.ePrivacy._setCheckedCheckboxes(); 288 } 289 290 /* 291 * Erstellt den Toggler für die fucntion show. 292 */ 293 this.toggleShow = function() { 294 295 if(window.ePrivacy.config.toggle != 0) { 296 var $changeText = this.config.lang.COOKIE_SETTINGS; 297 var $alignToggle = 'right'; 298 299 customPadding = parseInt(window.ePrivacy.config.customPadding); 300 301 $('.eprivacy-plugin').append('<div class="epp-cookie"></div>'); 302 toggleShow = $('body .epp-cookie'); 303 304 $('body .epp-cookie').css({bottom: customPadding}) 305 306 if(this.config.toggleAlign === 'left') { 307 toggleShow.addClass("epp-cookie-left"); 308 $('body .epp-cookie').delay(1400).animate( {left: '' + customPadding + ''} ,500); 309 } else { 310 $('body .epp-cookie').delay(1400).animate( {right: '' + customPadding + ''} ,500); 311 } 312 313 toggleShow.append('<div class="epp-cookie-icon"></div>'); 314 toggleShow.append('<div class="epp-cookie-wrapper"><div class="epp-cookie-text"><p>'+ $changeText +'</p></div><div class="epp-btn-group"><button onClick="_onCookieButtonClick()" class="epp-cookie-button"></button></div></div>'); 315 316 var cookieIcon = $('.epp-cookie-icon'); 317 var cookieWrapper = $('.epp-cookie .epp-cookie-wrapper'); 318 cookieWrapper.hide(); 319 320 cookieIcon.click(window.ePrivacy._slideToggleShow); 321 } 322 } 323 324 /* 325 * Zeigt den Infotext vom toogleShow an. Mit animation 326 */ 327 this._slideToggleShow = function() { 328 var cookieIcon = $('.epp-cookie-icon'); 329 var cookieWrapper = $('.epp-cookie .epp-cookie-wrapper'); 330 cookieIcon.toggleClass("hovered"); 331 $('.epp-cookie-text').addClass('epp-blur').delay(1000).queue(function(next){ 332 $(this).removeClass('epp-blur'); 333 next(); 334 }); 335 cookieWrapper.delay(400).animate({ width: "toggle" },400); 336 } 337 338 this.init = function(options) { 339 window.ePrivacy = this; 340 this.config = options; 341 342 /** 343 * Default language 344 */ 345 var defaultLang = { 346 "COOKIE_SETTINGS": 'Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell, während andere uns helfen, diese Website und Ihre Erfahrung zu verbessern.', 347 "COOKIE_HEADLINE": 'Wir verwenden Cookies', 348 "COOKIE_DESCRIPTION": 'Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell, während andere uns helfen, diese Website und Ihre Erfahrung zu verbessern.',
349 "COOKIE_BTNSAVEALL": 'Alle akzeptieren', 350 "COOKIE_BTNSAVE": 'Speichern', 351 "COOKIE_IMPRESS": 'Impressum', 352 "COOKIE_DATAPRIVACY": 'Datenschutzerklärung', 353 "COOKIE_DETAILS": 'Cookiedetails anzeigen', 354 "COOKIE_DETAILSACTIVE": 'Cookiedetails ausblenden', 355 "COOKIE_DETAILSNAME": 'Cookie Name', 356 "COOKIE_DETAILSPUBLISHER": 'Cookie Anbieter', 357 "COOKIE_DETAILSPURPOSE": 'Cookie Zweck', 358 "COOKIE_DETAILSEXPIRE": 'Cookie Laufzeit', 359 "COOKIE_DETAILSHOURS": 'Tag', 360 }; 361 362 if(this.config.lang) { 363 $.extend(defaultLang, this.config.lang); 364 } 365 366 this.config.lang = defaultLang; 367 368 $(document).ready(this.onDocumentReady); 369 }; 370 371 /* 372 * Holt alle checked Checkboxen und speichert diese im Array acceptedLevels. 373 * Löscht dann den epp-cookie 374 * Speichert dann den epp-cookie mit allen checked Checkboxen als string in values 375 * */ 376 this.saveCookies = function(consent, check) { 377 378 console.log("test"); 379 /* Sucht alle Checkboxen und speichert diese in ein Array */ 380 if (check == true) { 381 var acceptedLevels = consent; 382 } else { 383 384 var acceptedLevelsEl = $('body.eprivacy-plugin .epp-modal-content').find('input:checked'); 385 var acceptedLevels = []; 386 387 $.each(acceptedLevelsEl, function() { 388 // cookieName = $(this).attr('name'); @Funktioniert 389 cookieName = $(this).attr('levelname'); 390 acceptedLevels.push(cookieName) 391 }); 392 } 393 394 /* Löscht dann den epp-cookie */ 395 var cookies = Cookies.get(); 396 for(var cookie in cookies) { 397 //$.removeCookie(cookie); 398 window.ePrivacy.removeCookie(cookie); 399 } 400 401 /* Speichert dann den epp-cookie mit allen checked Checkboxen als string in values */ 402 Cookies.set("epp-cookie", JSON.stringify(acceptedLevels), { 403 path: '/', 404 expires: 60 405 }); 406 407 408 /* 409 * Guckt ob epp-modal-wrapper das erste mal geöffnet ist. 410 * Wenn nein läd er die Seite neu 411 */ 412 if($('body.eprivacy-plugin .epp-modal-wrapper').data("firsttime") == 1 || $('body.eprivacy-plugin .epp-consent-wrapper').data("firsttime") == 1) { 413 if(window.ePrivacy.config.onSubmission) { 414 window.ePrivacy.config.onSubmission(acceptedLevels); 415 } 416 window.ePrivacy.toggleShow(); 417 //window.ePrivacy.eprivacySetting(); 418 } else { 419 if(window.ePrivacy.config.onSubmission) { 420 window.ePrivacy.config.onSubmission(acceptedLevels); 421 } 422 location.reload(); 423 } 424 425 426 window.ePrivacy._submitButtonEffect(); 427 428 }; 429 430 this.saveAllCookies = function() { 431 var allCheckboxes = $('body.eprivacy-plugin .epp-modal-content').find('input:checkbox'); 432 $.each(allCheckboxes, function(){ 433 $(this).prop('checked', true); 434 }); 435 window.ePrivacy.saveCookies(); 436 }; 437 438 this.removeCookie = function(name) { 439 var domain = window.location.hostname.replace("www",""); 440 document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; domain='+domain+'; path=/'; 441 Cookies.remove(name); 442 }; 443 444 /** 445 * checked ob cookies gesetzt sind. Wenn ja übergibt hasCookies = true, wenn nein 446 * übergibt hasCookies = false. 447 */ 448 this.hasCookies = function(hasCookies) { 449 var eppCookie = Cookies.get('epp-cookie'); 450 var hasCookies 451 if(eppCookie) { 452 hasCookies = true; 453 } else { 454 hasCookies = false 455 } 456 return hasCookies; 457 458 } 459 460 /* Holt den epp-cookie und wandelt Ihn in JSON um. 461 * Function gibt den Wert getCookie zurück 462 */ 463 this.getCookie = function(getCookie) { 464 if(!window.ePrivacy.hasCookies() == false ) { 465 var getCookie = $.parseJSON(Cookies.get('epp-cookie')); 466 return getCookie; 467 } return "false"; 468 } 469 470 /** 471 * Sucht alle Checkboxen im Modal und vergleicht diese mit den checked checkboxen 472 * aus dem Cookie & setzt die checkboxen dann checked 473 */ 474 this._setCheckedCheckboxes = function() { 475 var checkedBoxes = window.ePrivacy.getCookie(); 476 var allBoxes = $('.epp-modal .epp-modal-content').find('input
476:checkbox'); 477 478 $.each(allBoxes, function(){ 479 // var name = $(this).attr("name"); @Funktioniert 480 var name = $(this).attr("levelname"); 481 if(checkedBoxes.indexOf(name) != -1 ) { 482 $(this).attr('checked','checked'); 483 } 484 }); 485 }; 486 487 /** 488 * Sucht nach dem Code [eprivacy-cookie-settings] und ersetzt Ihn dann mit einem Button. 489 * Dieser öffnet dann show(). 490 */ 491 this.eprivacySetting = function() { 492 eprivacySettingCode = '[eprivacy-cookie-settings]'; 493 if (window.ePrivacy.config.toggle == false) { 494 if($('p:contains('+ eprivacySettingCode +')').length > 0) { 495 settings = $('p:contains('+ eprivacySettingCode +')'); 496 settings.html('<h2>ePrivavy Einstellungen<h2>') 497 .append('<button type="button" class="eprivacy-settings-btn">Cookie Einstellungen ändern</button>'); 498 $('.eprivacy-settings-btn').on('click', function(){ 499 window.ePrivacy.show(); 500 }); 501 } else { 502 return false; 503 } 504 } 505 } 506 };
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.