function resetAni(){ $('.fa-shopping-cart').last().removeClass('faa-tada faa-fast animated'); //not used }; function doCart(ani,itemid,iterid,modality,amount){ //ls and minicart update var s=localStorage.getItem('cartJs') var iterid=iterid var amount=amount if (s===null||s===''){ localStorage.setItem('cartJs','{}'); s='{}' }; if (iterid===null||iterid===undefined){ iterid='' }; var isValidJSON = true; try {JSON.parse(s)} catch(e) {isValidJSON = false}; //var isValidJSON = false; if (isValidJSON) { var jqxhr = $.ajax( { method: 'POST', async: true, url: 'injectables/minicart.htm', data: { action: '', psession: '', c: s} } ) .done(function(callback) { $('#content_mcart').html(callback); //console.log(s + ' status:minicart updated'); if (ani===1){ //$('.fa-shopping-cart').last().addClass('faa-tada faa-fast animated'); //setTimeout(resetAni,1000); //don't show on iterid if($.isNumeric(itemid)&&itemid!=0&&iterid==''){ $('#AddtoCartModal').foundation('reveal', 'open', { method: 'POST', url: 'injectables/addtocart_modal.htm', data: {psession: '', itemid: itemid, amount: amount} }); } else{ $('#UpdateModal').foundation('reveal', 'open', 'injectables/update_modal.htm?res=it&msg='+iterid); }; if (modality==1){ //refresh cart content too if modal on cart page var jqxhr2 = $.ajax( { method: 'POST', async: true, url: 'injectables/mandje.htm', data: { action: '', psession: '', c:s} } ) .done(function(callback) { $('#template1').html(callback).fadeIn(); //console.log(s + ' status:cart updated, modality'); }) .fail(function() { console.log('error xhr fail mcart_doCart'); }) .always(function() { }); }; }; }) .fail(function() { console.log('error xhr fail mcart_doCart'); }) .always(function() { }); }; } function updateCart(){ //fullcart update var s=localStorage.getItem('cartJs') var jqxhr = $.ajax( { method: 'POST', async: true, url: 'injectables/mandje.htm', data: { action: '', psession: '', c:s} } ) .done(function(callback) { $('#template1').html(callback).fadeIn(); //console.log(s + ' status:cart updated'); }) .fail(function() { console.log('error xhr fail mcart_update'); }) .always(function() { doCart(0,0); }); } function showCartMobile(){ //fullcart show in right canvas var s=localStorage.getItem('cartJs') var jqxhr = $.ajax( { method: 'POST', async: true, url: 'injectables/minicart_right_canvas.htm', data: { action: '', psession: '', c:s} } ) .done(function(callback) { $('#template_right_canvas').html(callback).fadeIn(); }) .fail(function() { console.log('error xhr fail mobilecart_canvas'); }) .always(function() { doCart(0,0); }); } function headerStatus(loggedin){ if (loggedin===1){ $('ul.tl > li:eq(0)').addClass('tl_shown'); $('ul.tl > li:eq(1)').addClass('tl_shown'); $('ul.tl > li:eq(2)').addClass('tl_hidden'); $('ul.tl > li:eq(3)').addClass('tl_hidden'); } else{ $('ul.tl > li:eq(0)').addClass('tl_shown'); $('ul.tl > li:eq(1)').addClass('tl_hidden'); $('ul.tl > li:eq(2)').addClass('tl_shown'); $('ul.tl > li:eq(3)').addClass('tl_shown'); }; } $(document).ready(function(){ $('a[name^="account_"]' ).click(function(){ localStorage.setItem('funnel','account'); }); });