Skip to content

Commit

Permalink
add \jquery-ui.js to minter/wallet, add select coin with autofill and…
Browse files Browse the repository at this point in the history
… more
  • Loading branch information
denis-skripnik committed Jan 21, 2021
1 parent 3c216db commit ad2201e
Show file tree
Hide file tree
Showing 4 changed files with 18,745 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blockchains/minter/apps/wallet/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<form class="form" name="postForm">
<p><label for="convert_to">Монета получения:</label></p>
<p><input type="text" name="convert_to" id="action_convert_to" placeholder="BIP"></p>
<p><label for="convert_amount">Сумма конвертации (<span id="max_token_convert">Обменять все доступные <span id="max_convert_amount"></span> <span class="convert_modal_token"></span></span>):</label></p>
<p><label for="convert_amount">Сумма конвертации (<span id="max_token_convert">Обменять все доступные <span id="max_convert_amount"></span> <span class="convert_modal_token"></span></span>):</label></p>
<p><input type="text" name="convert_amount" id="action_convert_amount" placeholder="Введите сумму в формате 1.000"></p>
<p><strong>Комиссия: <span id="convert_fee">1</span> <span class="convert_modal_token"></span>
Сумма покупки: <span id="buy_amount"></span></strong></p>
Expand Down
38 changes: 37 additions & 1 deletion blockchains/minter/apps/wallet/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
async function links(token) {
function compareCoins(a, b)
{
if(parseFloat(a.reserve_balance) > parseFloat(b.reserve_balance))
{
return -1;
}
else{
return 1;
}
}



async function links(token) {
$('#actions').html(`<li><a data-fancybox class="transfer_modal" data-src="#transfer_modal" href="javascript:;" data-token="${token}" onclick="getTransferTemplates('${token}');">Перевести ${token}</a></li>
<li><a data-fancybox class="convert_modal" data-src="#convert_modal" href="javascript:;" data-token="${token}">Конвертировать ${token}</a></li>
<li><a data-fancybox class="delegate_modal" data-src="#delegate_modal" href="javascript:;" data-token="${token}" onclick="getDelegateTemplates('${token}');">Делегировать ${token}</a></li>
Expand Down Expand Up @@ -659,4 +672,27 @@ if(0<$('input[type=range]').length){
bind_range();
}

try {
$(async function() {
let result = await axios.get('https://explorer-api.minter.network/api/v2/coins');
let res = result.data.data;
res.sort(compareCoins);
let coins = res.reduce(function(p,c){return p + ',' +c.symbol;},[]).split(',');
$("#action_convert_to").autocomplete({ //на какой input:text назначить результаты списка
source: function(request, response) {
var term = request.term;
var pattern = new RegExp("^" + term, "i");

var results = $.map(coins, function(elem) {
if (pattern.test(elem)) {
return elem;
}
})
response(results);
}
})
});
} catch(e) {
console.log(e);
}
});
Loading

0 comments on commit ad2201e

Please sign in to comment.