Merge branch 'master' of code.areya.de:Areya/areya-energy
commit
1c3e21c8c1
|
@ -245,7 +245,12 @@
|
|||
}
|
||||
function isJson(str) {
|
||||
try { JSON.parse(str); }
|
||||
catch (e) { return false; }
|
||||
catch(e) { return false; }
|
||||
return true;
|
||||
}
|
||||
function isEncoded(str){
|
||||
try { atob(str); }
|
||||
catch(e) { return false; }
|
||||
return true;
|
||||
}
|
||||
$(window).on('load', function(){
|
||||
|
@ -256,16 +261,18 @@
|
|||
let urlPath = window.location.pathname;
|
||||
let code = urlPath.split("/");
|
||||
code = code[code.length-1];
|
||||
let productLink = atob(code);
|
||||
if(isJson(productLink)){
|
||||
if(objProducts.length > 0) $('#modal-confirm-product-replacement').modal('show');
|
||||
else $('#modal-confirm-addition-of-products').modal('show');
|
||||
if(isEncoded(code)){
|
||||
let productLink = atob(code);
|
||||
if(isJson(productLink)){
|
||||
if(objProducts.length > 0) $('#modal-confirm-product-replacement').modal('show');
|
||||
else $('#modal-confirm-addition-of-products').modal('show');
|
||||
}
|
||||
$('.btn-confirm-product-link').click(function(){
|
||||
objProducts = JSON.parse(productLink);
|
||||
updateProductsInLocalStorage();
|
||||
window.location.replace($('meta[name="checkout"]').attr('content'));
|
||||
});
|
||||
}
|
||||
$('.btn-confirm-product-link').click(function(){
|
||||
objProducts = JSON.parse(productLink);
|
||||
updateProductsInLocalStorage();
|
||||
window.location.replace($('meta[name="checkout"]').attr('content'));
|
||||
});
|
||||
updateProductsInLocalStorage();
|
||||
$(document).on('click', '.btn-remove-product', function(){
|
||||
let productId = $(this).attr('data-id');
|
||||
|
|
Loading…
Reference in New Issue