/** * * JQUERY EU COOKIE LAW POPUPS * version 1.0.0 * * Code on Github: * https://github.com/wimagguc/jquery-eu-cookie-law-popup * * To see a live demo, go to: * http://www.wimagguc.com/2015/04/jquery-eu-cookie-law-popup/ * * by Richard Dancsi * http://www.wimagguc.com/ * */ (function($) { // for ie9 doesn't support debug console >>> if (!window.console) window.console = {}; if (!window.console.log) window.console.log = function () { }; // ^^^ var EuCookieLawPopup = (function() { var _self = this; /////////////////////////////////////////////////////////////////////////////////////////////// // PARAMETERS (MODIFY THIS PART) ////////////////////////////////////////////////////////////// _self.params = { cookiePolicyUrl : 'TermsAndConditionsInPopUp.asp?cl=beethoven', popupPosition : 'top', colorStyle : 'default', compactStyle : false, popupTitle : 'Diese Website verwendet Cookies', popupText : 'Indem Sie weiter auf dieser Website navigieren, ohne die Cookie-Einstellungen Ihres Internet Browsers zu ändern, stimmen Sie unserer Verwendung von Cookies zu.', buttonContinueTitle : 'OK', buttonLearnmoreTitle : 'Mehr Info', buttonLearnmoreOpenInNewWindow : true, agreementExpiresInDays : 180, autoAcceptCookiePolicy : false, htmlMarkup : null }; /////////////////////////////////////////////////////////////////////////////////////////////// // VARIABLES USED BY THE FUNCTION (DON'T MODIFY THIS PART) //////////////////////////////////// _self.vars = { INITIALISED : false, HTML_MARKUP : null, COOKIE_NAME : 'EU_COOKIE_LAW_CONSENT' }; /////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS FOR MANIPULATING DATA //////////////////////////////////////////////////// // Overwrite default parameters if any of those is present var parseParameters = function(object, markup, settings) { if (object) { var className = $(object).attr('class') ? $(object).attr('class') : ''; if (className.indexOf('eupopup-top') > -1) { _self.params.popupPosition = 'top'; } else if (className.indexOf('eupopup-fixedtop') > -1) { _self.params.popupPosition = 'fixedtop'; } else if (className.indexOf('eupopup-bottomright') > -1) { _self.params.popupPosition = 'bottomright'; } else if (className.indexOf('eupopup-bottomleft') > -1) { _self.params.popupPosition = 'bottomleft'; } else if (className.indexOf('eupopup-bottom') > -1) { _self.params.popupPosition = 'bottom'; } else if (className.indexOf('eupopup-block') > -1) { _self.params.popupPosition = 'block'; } if (className.indexOf('eupopup-color-default') > -1) { _self.params.colorStyle = 'default'; } else if (className.indexOf('eupopup-color-inverse') > -1) { _self.params.colorStyle = 'inverse'; } if (className.indexOf('eupopup-style-compact') > -1) { _self.params.compactStyle = true; } } if (markup) { _self.params.htmlMarkup = markup; } if (settings) { if (typeof settings.cookiePolicyUrl !== 'undefined') { _self.params.cookiePolicyUrl = settings.cookiePolicyUrl; } if (typeof settings.popupPosition !== 'undefined') { _self.params.popupPosition = settings.popupPosition; } if (typeof settings.colorStyle !== 'undefined') { _self.params.colorStyle = settings.colorStyle; } if (typeof settings.popupTitle !== 'undefined') { _self.params.popupTitle = settings.popupTitle; } if (typeof settings.popupText !== 'undefined') { _self.params.popupText = settings.popupText; } if (typeof settings.buttonContinueTitle !== 'undefined') { _self.params.buttonContinueTitle = settings.buttonContinueTitle; } if (typeof settings.buttonLearnmoreTitle !== 'undefined') { _self.params.buttonLearnmoreTitle = settings.buttonLearnmoreTitle; } if (typeof settings.buttonLearnmoreOpenInNewWindow !== 'undefined') { _self.params.buttonLearnmoreOpenInNewWindow = settings.buttonLearnmoreOpenInNewWindow; } if (typeof settings.agreementExpiresInDays !== 'undefined') { _self.params.agreementExpiresInDays = settings.agreementExpiresInDays; } if (typeof settings.autoAcceptCookiePolicy !== 'undefined') { _self.params.autoAcceptCookiePolicy = settings.autoAcceptCookiePolicy; } if (typeof settings.htmlMarkup !== 'undefined') { _self.params.htmlMarkup = settings.htmlMarkup; } } }; var createHtmlMarkup = function() { if (_self.params.htmlMarkup) { return _self.params.htmlMarkup; } var html = '