mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
Reduce confusion
This commit is contained in:
committed by
Andrew Camilleri
parent
1626bd7a18
commit
267905b5e7
@@ -32,7 +32,7 @@
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200 && this.responseText) {
|
||||
window.btcpay.showInvoice(JSON.parse(this.responseText).invoiceId);
|
||||
window.btcpay.appendInvoiceFrame(JSON.parse(this.responseText).invoiceId);
|
||||
}
|
||||
};
|
||||
xhttp.open('POST', event.target.getAttribute('action'), true);
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
delegate('click', '.showInvoice', e => {
|
||||
e.preventDefault();
|
||||
const { invoiceId } = e.target.dataset;
|
||||
btcpay.showInvoice(invoiceId);
|
||||
btcpay.appendInvoiceFrame(invoiceId);
|
||||
})
|
||||
|
||||
$('#btnCustomRangeDate').on('click', function (sender) {
|
||||
|
||||
@@ -219,8 +219,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
|
||||
this.sound = this.srvModel.soundsEnabled;
|
||||
this.animation = this.srvModel.animationsEnabled;
|
||||
eventAggregator.$on("invoice-created", function (invoiceId) {
|
||||
btcpay.showInvoice(invoiceId);
|
||||
btcpay.showFrame();
|
||||
btcpay.appendAndShowInvoiceFrame(invoiceId);
|
||||
|
||||
self.contributeModalOpen = false;
|
||||
self.setLoading(false);
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
onModalReceiveMessageMethod(event);
|
||||
}
|
||||
|
||||
function showInvoice(invoiceId, params) {
|
||||
function appendInvoiceFrame(invoiceId, params) {
|
||||
showingInvoice = true;
|
||||
window.document.body.appendChild(iframe);
|
||||
var invoiceUrl = origin + '/invoice?id=' + invoiceId + '&view=modal';
|
||||
@@ -115,6 +115,11 @@
|
||||
iframe.src = invoiceUrl;
|
||||
}
|
||||
|
||||
function appendAndShowInvoiceFrame(invoiceId, params) {
|
||||
appendInvoiceFrame(invoiceId, params);
|
||||
showFrame();
|
||||
}
|
||||
|
||||
function setButtonListeners() {
|
||||
var buttons = window.document.querySelectorAll('[data-btcpay-button]');
|
||||
for (var i = 0; i < buttons.length; i++) {
|
||||
@@ -133,7 +138,9 @@
|
||||
window.btcpay = {
|
||||
showFrame: showFrame,
|
||||
hideFrame: hideFrame,
|
||||
showInvoice: showInvoice,
|
||||
showInvoice: appendInvoiceFrame,
|
||||
appendInvoiceFrame: appendInvoiceFrame,
|
||||
appendAndShowInvoiceFrame: appendAndShowInvoiceFrame,
|
||||
onModalWillEnter: onModalWillEnter,
|
||||
onModalWillLeave: onModalWillLeave,
|
||||
setApiUrlPrefix: setApiUrlPrefix,
|
||||
|
||||
@@ -128,8 +128,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
|
||||
|
||||
eventAggregator.$on("invoice-created", function (invoiceId) {
|
||||
self.setLoading(false);
|
||||
btcpay.showInvoice(invoiceId);
|
||||
btcpay.showFrame();
|
||||
btcpay.appendAndShowInvoiceFrame(invoiceId);
|
||||
});
|
||||
eventAggregator.$on("invoice-cancelled", function (){
|
||||
self.setLoading(false);
|
||||
|
||||
@@ -132,8 +132,7 @@ window.BTCPayShopifyIntegrationModule = function () {
|
||||
handleInvoiceData(d, {backgroundCheck: true})
|
||||
});
|
||||
});
|
||||
window.btcpay.showInvoice(currentInvoiceData.invoiceId);
|
||||
window.btcpay.showFrame();
|
||||
btcpay.appendAndShowInvoiceFrame(currentInvoiceData.invoiceId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
window.onload = function(){
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const myParam = urlParams.get('invoice');
|
||||
btcpay.showInvoice(myParam);
|
||||
btcpay.appendInvoiceFrame(myParam);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user