(function($) { var stoppy = 0; qaddrectocookie = function(glas){ var favlist = $.cookie("recfav"); var test = glas; if(!!favlist){ //alert("hej"); if (favlist.indexOf(glas) >= 0){ var Path='https://www.kaffe.se/pics/empty.jpg'; //if($.cookie("glasfav")) { var nylist = favlist.replace(test, ""); nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("recfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("recfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("recfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } countfavs(); } })(jQuery); (function($) { var stoppy = 0; qaddlinstocookie = function(glas){ //alert("hej"); var favlist = $.cookie("linsfav"); var test = glas; if(!!favlist){ //alert("hej"); if (favlist.indexOf(glas) >= 0){ var Path='https://www.kaffe.se/pics/empty.jpg'; //if($.cookie("glasfav")) { var nylist = favlist.replace(test, ""); nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("linsfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("linsfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",0,", ","); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("linsfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } countfavs(); } })(jQuery); (function($) { var stoppy = 0; qaddtocookie = function(glas){ var favlist = $.cookie("glasfav"); var test = glas; if(!!favlist){ //alert("hej"); if (favlist.indexOf(glas) >= 0){ var Path='https://www.kaffe.se/pics/empty.jpg'; //if($.cookie("glasfav")) { var nylist = favlist.replace(test, ""); nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("glasfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("glasfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } } else{ var Path='https://www.kaffe.se/pics/full.jpg'; //if($.cookie("glasfav")) { var nylist = favlist+","+glas; nylist = nylist.replace("null", ""); nylist = nylist.replace(",,", ","); nylist = nylist.replace(",,", ","); $.cookie("glasfav", nylist, { expires: 30 }, { path: '/' }); //alert(nylist); //alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); //alert(glas); //} //showCustomerFav(); document.getElementById('favimage'+glas).src=Path; } countfavs(); } })(jQuery); (function($) { qpageaddtocookie = function(glas){ var nylist = $.cookie("glasfav")+","+glas; $.cookie("glasfav", nylist, { expires: 30 }, { path: '/' }); alert('OK, ny favorit noterad. Favoritlistan ser du genom att klicka på den röda länken "Favoriter" i övre menyn.'); } })(jQuery); (function($) { qremovetocookie = function(glas){ var Path='https://www.kaffe.se/pics/empty.jpg'; //if($.cookie("glasfav")) { var removelist = $.cookie("removefav")+","+glas; removelist = removelist.replace("null", ""); removelist = removelist.replace(",,", ","); removelist = removelist.replace(",,", ","); $.cookie("removefav", removelist, { expires: 30 },{ path: '/' }); document.getElementById('favimage'+glas).src=Path; //alert(nylist); //alert('OK, modellen borttagen från din favoritlista.'); //alert(glas); //} //showCustomerFav(); countfavs(); } })(jQuery); (function($) { qpageremovetocookie = function(glas){ var removelist = $.cookie("removefav")+","+glas; $.cookie("removefav", removelist, { expires: 30 },{ path: '/' }); alert('OK, modellen borttagen från din favoritlista.'); } })(jQuery); (function($) { qremovetocookiefavela = function(glas){ //if($.cookie("glasfav")) { var removelist = $.cookie("removefav")+","+glas; removelist = removelist.replace("null", ""); removelist = removelist.replace(",,", ","); removelist = removelist.replace(",,", ","); $.cookie("removefav", removelist, { expires: 30 },{ path: '/' }); //alert(nylist); //alert( $.cookie("removefav") ); //alert(glas); //} showCustomer(); } })(jQuery); (function($) { kundbildcookie = function(glas){ var nylist = glas; $.cookie("kundbildfav", nylist, { expires: 30 }, { path: '/' }); //alert('OK, ny standardbildfavorit noterad.'); } })(jQuery); (function($) { antalppq2cookiefunk = function(glas){ var nylist = glas; $.cookie("antalppq2cookie", nylist, { expires: 30 }, { path: '/' }); //alert('OK, ny standardbildfavorit noterad.'); } })(jQuery); (function($) { kundglascookie = function(glas){ var nylist = glas; $.cookie("kundglasfav", nylist, { expires: 30 }, { path: '/' }); //alert('OK, ny standardbildfavorit noterad.'); } })(jQuery); (function($) { bildcolor = function(glas){ var nylist = glas; $.cookie("javacolorcookie", nylist, { expires: 30 }, { path: '/' }); //alert('OK, ny standardbildfavorit noterad.'); } })(jQuery); (function($) { deletecookie = function(thecookie){ $.cookie(thecookie, "", { expires: -1 }, { path: '/' }); } })(jQuery); (function($) { zoomin = function(){ wplays('zoomin1'); } })(jQuery); (function($) { zoomut = function(){ wplays('zoomut1'); } })(jQuery); $(document).ready(function() { //hiding tab content except first one $(".tabContent").not(":first").hide(); // adding Active class to first selected tab and show $("ul.tabs li:first").addClass("active").show(); // Click event on tab $("ul.tabs li").click(function() { // Removing class of Active tab $("ul.tabs li.active").removeClass("active"); // Adding Active class to Clicked tab $(this).addClass("active"); // hiding all the tab contents $(".tabContent").hide(); // showing the clicked tab's content using fading effect $($('a',this).attr("href")).fadeIn('slow'); return false; }); }); (function($) { countfavs = function(){ var commas = ','; var favlist = $.cookie("linsfav"); //var favlist = $.cookie("linsfav"); favlist = favlist.replace(",0,", ","); favlist = favlist.replace("null", ""); favlist = favlist.replace(",,", ","); favlist = favlist.replace(",,", ","); //alert(favlist); var numbers = favlist.split(','); let clean_numbers = numbers.filter(function(value) { return value != 'null'; }); let clean_numbersq = clean_numbers.filter(function(value) { return value != ''; }); //alert(clean_numbers.length); document.getElementById('favvyqtp').innerHTML=clean_numbersq.length; document.getElementById('favvyqt').style.visibility = 'visible'; $('#favvyqt').addClass('active'); $('#favvyqt').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){ $(this).removeClass('active'); }); } })(jQuery);