Signin  Pricing  Examples  Support

Libraries > cookie-bar.js

cookie-bar.js - Search Live Website Code
It's like doing CTRL+F on millions of websites' source code



NerdyData is a search engine for source code. Search the source code of 200 million websites.


JAVASCRIPT FILE http://game-legends.com/engine/Shopware/Plugins/Community/Frontend/SwagCookiePermission/Views/frontend/_resources/javascript/cookie-bar.js

Function Explorer





Libraries on game-legends.com


ArboroGoogleAnalytics.js

cookie-bar.js

jquery.swag_live_shopping.js

bootstrap.min.js

jquery.1.9.min.js

jquery-ui-1.10.3.custom.min.js

respond.min.js

scripts.js

shopware-responsive.min.js



Explore More


jquery-1.5.js

jquery.jfontsize-1.0.js

analytics.js

jcopyright.js

cookie-bar.js
				
$(document).ajaxStop(function (e) {
    //If cookies are not allowed
    //show cookie bar
    var allowCookie = getCookie('allowCookie');
    if (allowCookie != 1) {
        $(document).off('ajaxStop');
        $.ajax({
            url: cookiePermissionUrl,
            dataType: 'json',
            'success': function(result) {
                if (result.isAffectedUser) {
                    $('.cookie-bar').show();
                    //If cookie mode is "remove cookies"
                    //page should be overlayed
                    if (isRemoveCookies && isForwarded() === false) {
                        $('body').append('<div class="cookie-overlay"></div>');
                    }
                }
            }
        });
    }

    /**
     * Returns cookie value
     * by name
     *
     * @param {string} name
     * @returns {string}
     */
    function getCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }

    /**
     * Checks if the user
     * is forwarded
     *
     * @returns {Boolean}
     */
    function isForwarded()
    {
        if (cookieForwardTo == window.location.href ||
            cookieForwardTo == window.location.pathname) {
            return true;
        }

        return false;
    }
});

$(document).ready(function() {
    //enable cookies button
    $('.cp-enable').on('click', function() {
        setCookie('allowCookie', 1);
        $( ".cookie-bar" ).slideToggle( "slow" );
        $( ".cookie-overlay" ).remove();
    });

    //disable cookies button
    $('.cp-disable').on('click', function() {
        var loc = window.location;
        if (cookieForwardTo.search('http://') > -1 || cookieForwardTo.search('https://') > -1) {
            window.location = cookieForwardTo;
        } else {
            window.location = loc.protocol+"//"+loc.hostname+"/" + cookieForwardTo;
        }

    });

    /**
     * Creates cookie
     *
     * @param {string} key
     * @param {type} value
     */
    function setCookie(key, value) {
        var expires = new Date();
        expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
        document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';path=/';
    }
});



A B C D E F G H I J K L M N O P Q R S T U V W X Y Z