$(document).ready(function($) { setShoppingCartBackButtonURL(); initCookiesBar(); iButtonProductsCheck(); }); function setShoppingCartBackButtonURL() { var previousUrl = 'http://www.wildkamp.nl/'; if ((typeof $.cookie('previous_url') != 'undefined')) { previousUrl = $.cookie('previous_url'); } $("#shopping-cart-backtostore").attr('href', previousUrl); var currentUrl = location.href; if (currentUrl.toLowerCase().indexOf("viewrequisition") < 0) { // store non-checkout urls only $.cookie("previous_url", currentUrl, { expires: 365, path: '/' }); } } function initCookiesBar() { $.getJSON("//jsonip.com?callback=?", function(data) { var noCookiesBarIps = [ "77.60.46.89", "188.207.248.225", "77.60.4.65", "188.207.248.205", "77.60.40.209", "188.207.248.225", "77.60.4.65", "77.60.40.209", "77.60.5.241", "77.61.171.17" ]; // Show cookies bar if the external IP of the browser client is not in the list of the noCookiesBarIps and if the cookies_accepted cookie is not set if ( ($.inArray(data.ip, noCookiesBarIps) == -1 ) && ($.cookie('cookies_accepted') == null) ) { $("#cookiesbar").css('background-color', 'rgb(157,157,157)'); $("#cookiesbar").css('background-color', 'rgba(157,157,157, 0.6)'); $("#cookiesbar").css('filter', 'progid:DXImageTransform.Microsoft.Alpha(opacity=60)').show(); $("#cookiesbar-placeholder").show(); } $("#cookiesbar div a.cta").click(function() { $.cookie('cookies_accepted', 'true', { expires: 365, path: '/' }); $("#cookiesbar-placeholder").hide(); $("#cookiesbar").hide(); }); }); }