cryptfolio/template.html

108 lines
2.2 KiB
HTML
Raw Normal View History

2024-05-09 10:00:56 -07:00
<!DOCTYPE html>
<html>
<head>
2024-06-28 08:52:11 -07:00
<title>Crypto Portfolio</title>
<style>
table.crypto {
font-family: "Lucida Console", Monaco, monospace;
border: 2px solid #4F7849;
background-color: #EEEEEE;
width: 100%;
text-align: right;
border-collapse: collapse;
}
table.crypto td, table.crypto th {
border: 1px solid #4F7849;
padding: 2px 2px;
}
table.crypto tbody td {
font-size: 16px;
font-weight: bold;
color: #4F7849;
}
table.crypto tr:nth-child(even) {
background: #CEE0CC;
}
table.crypto thead {
background: #4F7849;
}
table.crypto thead th {
font-size: 18px;
color: #FFFFFF;
text-align: center;
}
table.crypto tfoot {
font-size: 20px;
font-weight: bold;
color: #FFFFFF;
background: #4F7849;
background: -moz-linear-gradient(top, #7b9a76 0%, #60855b 66%, #4F7849 100%);
background: -webkit-linear-gradient(top, #7b9a76 0%, #60855b 66%, #4F7849 100%);
background: linear-gradient(to bottom, #7b9a76 0%, #60855b 66%, #4F7849 100%);
border-top: 4px solid #444444;
}
table.crypto tfoot td {
font-size: 20px;
}
td.left {
text-align: left;
}
</style>
2024-05-09 10:00:56 -07:00
</head>
<body>
2024-06-28 08:52:11 -07:00
<table class="crypto">
<thead>
<tr>
<th>Token</th>
<th>Balance</th>
<th>Price</th>
<th>Investment</th>
<th>Value</th>
<th>Margin</th>
<th>Movement</th>
</tr>
</thead>
<tbody>
%row%
</tbody>
<tfoot>
<tr>
<td class="left">Total</td>
<td></td>
<td></td>
<td>%inv%</td>
<td>%val%</td>
<td>%mar%</td>
<td>%mov%</td>
</tr>
</tfoot>
</table>
<p><i>%dts%</i></p>
<button onclick="download_csv_file()"> Download CSV </button>
2024-05-09 10:00:56 -07:00
</body>
<script>
2024-06-28 08:52:11 -07:00
var csvFileData = [
%csv_data%
];
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
function download_csv_file() {
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
var csv = 'Date,Time,Zone,Token,Balance,Price,Investment,Value,Margin,Movement\n';
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
csvFileData.forEach(function(row) {
csv += row.join(',');
csv += "\n";
});
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
document.write(csv);
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
hiddenElement.target = '_blank';
2024-05-09 10:00:56 -07:00
2024-06-28 08:52:11 -07:00
hiddenElement.download = 'CSV_Portfolio_%dts_fln%.csv';
hiddenElement.click();
}
2024-05-09 10:00:56 -07:00
</script>
</html>