diff --git a/BTCPayServer/Views/Stores/PayButton.cshtml b/BTCPayServer/Views/Stores/PayButton.cshtml index 244760271..f5cc179e8 100644 --- a/BTCPayServer/Views/Stores/PayButton.cshtml +++ b/BTCPayServer/Views/Stores/PayButton.cshtml @@ -159,22 +159,22 @@ Please fix errors shown in order for code generation to successfully execute. + +@section HeadScripts { + + - @section HeadScripts { - - + + - - + - + +} - - } - - @section Scripts { - - } + +} + + + + + + + + + diff --git a/BTCPayServer/wwwroot/paybutton/paybutton.js b/BTCPayServer/wwwroot/paybutton/paybutton.js index 047aaae90..eda819f62 100644 --- a/BTCPayServer/wwwroot/paybutton/paybutton.js +++ b/BTCPayServer/wwwroot/paybutton/paybutton.js @@ -72,16 +72,9 @@ function inputChanges(event, buttonSize) { } else if (srvModel.buttonType == 2) { html += '\n
'; - - // Input price html += addInputPrice(srvModel.price, width, 'onchange="document.querySelector(\'#btcpay-input-range\').value = document.querySelector(\'#btcpay-input-price\').value"'); html += addSelectCurrency(); - // Slider - html += ''; - - // Slider style - html += ''; + html += addSlider(srvModel.price, srvModel.min, srvModel.max, srvModel.step, width); html += '
'; } @@ -126,7 +119,7 @@ function addinput(name, value) { } function addPlusMinusButton(type) { - var button = ''; + var button = document.getElementById('template-button-plus-minus').innerHTML.trim(); if (type === "+") { return button.replace(/TYPE/g, '+'); } else { @@ -135,10 +128,11 @@ function addPlusMinusButton(type) { } function addInputPrice(price, widthInput, customFn) { - var input = ''; + var input = document.getElementById('template-input-price').innerHTML.trim(); + + input = input.replace(/PRICEVALUE/g, price); + input = input.replace("WIDTHINPUT", widthInput); + if (customFn) { return input.replace("CUSTOM", customFn); } @@ -146,10 +140,15 @@ function addInputPrice(price, widthInput, customFn) { } function addSelectCurrency() { - return ''; + return document.getElementById('template-select-currency').innerHTML.trim(); +} + +function addSlider(price, min, max, step, width) { + var input = document.getElementById('template-input-slider').innerHTML.trim(); + input = input.replace("PRICE", price); + input = input.replace("MIN", min); + input = input.replace("MAX", max); + input = input.replace("STEP", step); + input = input.replace("WIDTH", width); + return input; }