Merge branch 'master' of code.areya.de:Areya/areya-energy

master
Benjamin Völkl 2022-09-01 19:35:03 +02:00
commit 1c3e21c8c1
1 changed files with 17 additions and 10 deletions

View File

@ -248,6 +248,11 @@
catch(e) { return false; } catch(e) { return false; }
return true; return true;
} }
function isEncoded(str){
try { atob(str); }
catch(e) { return false; }
return true;
}
$(window).on('load', function(){ $(window).on('load', function(){
if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove(); if(localStorage.getItem("dismiss-message") == 1) $('.alert-dismissible').remove();
else $('.alert-dismissible').show(); else $('.alert-dismissible').show();
@ -256,6 +261,7 @@
let urlPath = window.location.pathname; let urlPath = window.location.pathname;
let code = urlPath.split("/"); let code = urlPath.split("/");
code = code[code.length-1]; code = code[code.length-1];
if(isEncoded(code)){
let productLink = atob(code); let productLink = atob(code);
if(isJson(productLink)){ if(isJson(productLink)){
if(objProducts.length > 0) $('#modal-confirm-product-replacement').modal('show'); if(objProducts.length > 0) $('#modal-confirm-product-replacement').modal('show');
@ -266,6 +272,7 @@
updateProductsInLocalStorage(); updateProductsInLocalStorage();
window.location.replace($('meta[name="checkout"]').attr('content')); window.location.replace($('meta[name="checkout"]').attr('content'));
}); });
}
updateProductsInLocalStorage(); updateProductsInLocalStorage();
$(document).on('click', '.btn-remove-product', function(){ $(document).on('click', '.btn-remove-product', function(){
let productId = $(this).attr('data-id'); let productId = $(this).attr('data-id');