kagorastidis
10/19/2016 - 8:07 AM

init function for cookie message

init function for cookie message

var cookieOptions = {
        "palette": {
            "popup": {
                "background": "#efefef",
                "text": "#404040"
            },
            "button": {
                "background": "transparent",
                "border": "#fcaf17",
                "text": "#fcaf17"
            }
        },
        "showLink": false,
        "position": "bottom-right",
        "content": {
            "message": "Αυτο το site χρησιμοποιεί cookies για να σας προσφέρει καλύτερη πλοήγηση",
            "dismiss": "ΟΚ",
            "link": "null"
        }
        // more info and config options @ https://cookieconsent.insites.com/download/
    }

    _initCookies(cookieOptions);
    
    var _addCookieScripts = function () {
    var headID = document.getElementsByTagName('head')[0];
    var js = document.createElement('script');
    var css = document.createElement('link');

    js.src = '//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js';

    css.type = 'text/css';
    css.rel = 'stylesheet';
    css.href = '//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css';

    headID.appendChild(css);
    headID.appendChild(js);
}

var _initCookies = function (options) {
    _addCookieScripts();
    setTimeout(function () {
        window.cookieconsent.initialise(options)
    }, 1000)
}