Update app.js
This commit is contained in:
parent
257a23d212
commit
351f4d3b4d
|
@ -53,10 +53,12 @@ function getAjax(url, thekey, success) {
|
|||
return xhr
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sendfundsinput() {
|
||||
document.getElementById('sendfunds').innerHTML =
|
||||
"<div class='modal fade sends' tabindex='-1' role='dialog' aria-labelledby='myLargeModalLabel' aria-hidden='true'>"+
|
||||
"<div class='modal-dialog' style='background:#fff;'>"+
|
||||
"<div class='modal-dialog' >"+
|
||||
"<div id='sendfunds2' style='padding: 0 10px 0 10px;'><div class='modal-content'>"+
|
||||
"<br/><br/>" +
|
||||
"<textarea id='pasteinvoice' class='form-control' rows='3' placeholder='Paste an invoice'></textarea></div>" +
|
||||
|
@ -103,7 +105,7 @@ function sendfundspaste() {
|
|||
function receive() {
|
||||
document.getElementById('receive').innerHTML =
|
||||
"<div class='modal fade receives' tabindex='-1' role='dialog' aria-labelledby='myLargeModalLabel' aria-hidden='true'>"+
|
||||
"<div class='modal-dialog' style='background:#fff;'><div id='QRCODE'><div class='modal-content' style='padding: 0 10px 0 10px;'>"+
|
||||
"<div class='modal-dialog' ><div id='QRCODE' ><div class='modal-content' style='padding: 0 10px 0 10px;'>"+
|
||||
"<br/><center><input style='width:80%' type='number' class='form-control' id='amount' placeholder='Amount' max='1000000' required>" +
|
||||
"<input style='width:80%' type='text' class='form-control' id='memo' placeholder='Memo' required></center></div>" +
|
||||
"<div class='modal-footer'>"+
|
||||
|
@ -125,8 +127,8 @@ function received() {
|
|||
theinvoice = JSON.parse(data).pay_req
|
||||
thehash = JSON.parse(data).payment_hash
|
||||
document.getElementById('QRCODE').innerHTML =
|
||||
"<div class='modal-content' style='padding: 10px 10px 0 10px;'>"+
|
||||
"<center><a href='lightning:" +
|
||||
"<center><div class='modal-content' style='width:360px; padding: 10px 10px 0 10px;'>"+
|
||||
"<a href='lightning:" +
|
||||
theinvoice +
|
||||
"'><div id='qrcode'></div></a>" +
|
||||
"<p style='word-wrap: break-word;'>" +
|
||||
|
@ -141,6 +143,8 @@ function received() {
|
|||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.M
|
||||
})
|
||||
document.getElementById("qrcode").style.backgroundColor = "white";
|
||||
document.getElementById("qrcode").style.padding = "20px";
|
||||
|
||||
|
||||
setInterval(function(){
|
||||
|
@ -163,7 +167,7 @@ function cancelsend() {
|
|||
function processing() {
|
||||
document.getElementById('processing').innerHTML =
|
||||
"<div class='modal fade proc' tabindex='-1' role='dialog' aria-labelledby='myLargeModalLabel' aria-hidden='true'>"+
|
||||
"<div class='modal-dialog' style='background:#fff;'>"+
|
||||
"<div class='modal-dialog'>"+
|
||||
"<div style='padding: 0 10px 0 10px;'><div class='modal-content'>"+
|
||||
"<h3><b>Processing...</b></br/></br/></br/></h3></div>"+
|
||||
"</div></div></div>"
|
||||
|
@ -188,7 +192,7 @@ function sendfunds(invoice) {
|
|||
|
||||
document.getElementById('sendfunds2').innerHTML =
|
||||
"<div class='modal-content'></br/></br/>"+
|
||||
'<h3><b>Processing...</b></h3><</br/></br/></div> ';
|
||||
'<h3><b>Processing...</b></h3><</br/></br/></br/></div> ';
|
||||
|
||||
postAjax(
|
||||
'/v1/channels/transactions',
|
||||
|
@ -235,7 +239,8 @@ function scanQRsend() {
|
|||
video.play()
|
||||
requestAnimationFrame(tick)
|
||||
})
|
||||
function tick() {
|
||||
|
||||
function tick() {
|
||||
loadingMessage.innerText = '⌛ Loading video...'
|
||||
if (video.readyState === video.HAVE_ENOUGH_DATA) {
|
||||
loadingMessage.hidden = true
|
||||
|
@ -253,7 +258,7 @@ function scanQRsend() {
|
|||
var code = jsQR(imageData.data, imageData.width, imageData.height, {
|
||||
inversionAttempts: 'dontInvert'
|
||||
})
|
||||
if (code) {
|
||||
if (code) {
|
||||
|
||||
outputMessage.hidden = true
|
||||
outputData.parentElement.hidden = false
|
||||
|
@ -314,6 +319,8 @@ function scanQRsend() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function copyfunc(){
|
||||
var copyText = document.getElementById("invoiceinput");
|
||||
copyText.select();
|
||||
|
@ -409,3 +416,52 @@ if (transactions.length) {
|
|||
if (wallet) {
|
||||
postAjax('/v1/checkpending', '', wallet.adminkey, function(data) {})
|
||||
}
|
||||
|
||||
|
||||
function download_csv(csv, filename) {
|
||||
var csvFile;
|
||||
var downloadLink;
|
||||
|
||||
// CSV FILE
|
||||
csvFile = new Blob([csv], {type: "text/csv"});
|
||||
|
||||
// Download link
|
||||
downloadLink = document.createElement("a");
|
||||
|
||||
// File name
|
||||
downloadLink.download = filename;
|
||||
|
||||
// We have to create a link to the file
|
||||
downloadLink.href = window.URL.createObjectURL(csvFile);
|
||||
|
||||
// Make sure that the link is not displayed
|
||||
downloadLink.style.display = "none";
|
||||
|
||||
// Add the link to your DOM
|
||||
document.body.appendChild(downloadLink);
|
||||
|
||||
// Lanzamos
|
||||
downloadLink.click();
|
||||
}
|
||||
|
||||
function export_table_to_csv(html, filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr");
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [], cols = rows[i].querySelectorAll("td, th");
|
||||
|
||||
for (var j = 0; j < cols.length; j++)
|
||||
row.push(cols[j].innerText);
|
||||
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
|
||||
// Download CSV
|
||||
download_csv(csv.join("\n"), filename);
|
||||
}
|
||||
|
||||
function exportbut(){
|
||||
var html = document.querySelector("table").outerHTML;
|
||||
export_table_to_csv(html, "table.csv");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user