ui: Updated LTC coin icons, JS fixes.
- Fixed display of LTC MWEB coin icons. - Fixes JS errors with rates table. - Fix LTC and LTC-MWEB error with lookup rates (JSON)
This commit is contained in:
		
							parent
							
								
									192aff221e
								
							
						
					
					
						commit
						671e626551
					
				
							
								
								
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin%MWEB.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin%MWEB.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin-MWEB-20.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin-MWEB-20.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin-MWEB.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								basicswap/static/images/coins/Litecoin-MWEB.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 7.9 KiB  | 
@ -437,13 +437,12 @@
 | 
			
		||||
          xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24"><g fill="#556987"><path fill="#556987" d="M12,3c1.989,0,3.873,0.65,5.43,1.833l-3.604,3.393l9.167,0.983L22.562,0l-3.655,3.442 C16.957,1.862,14.545,1,12,1C5.935,1,1,5.935,1,12h2C3,7.037,7.037,3,12,3z"></path><path data-color="#556987" d="M12,21c-1.989,0-3.873-0.65-5.43-1.833l3.604-3.393l-9.167-0.983L1.438,24l3.655-3.442 C7.043,22.138,9.455,23,12,23c6.065,0,11-4.935,11-11h-2C21,16.963,16.963,21,12,21z"></path></g></svg><span>Show Rates Table</span></button></div>-->
 | 
			
		||||
          {% if show_chart %}
 | 
			
		||||
          <div class="w-full md:w-auto p-1.5">
 | 
			
		||||
            <button name="loadPrices" type="button" value="Lookup Rates (RAW)" onclick="loadPrices();" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md focus:ring-0 focus:outline-none dark:text-white dark:hover:text-white dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-600 dark:hover:border-gray-600">
 | 
			
		||||
          <span>Check Current Prices/Rates (TABLE)</span>
 | 
			
		||||
              <button name="loadPrices" id="loadPricesButton" type="button" value="Check Current Prices/Rates (TABLE)" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md focus:ring-0 focus:outline-none dark:text-white dark:hover:text-white dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-600 dark:hover:border-gray-600"><span>Check Current Prices/Rates (TABLE)</span>
 | 
			
		||||
            </button>
 | 
			
		||||
          </div>
 | 
			
		||||
          {% endif %}
 | 
			
		||||
         <div class="w-full md:w-auto p-1.5">
 | 
			
		||||
          <button name="check_rates" type="button" value="Lookup Rates (RAW)" onclick='lookup_rates();' class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md focus:ring-0 focus:outline-none dark:text-white dark:hover:text-white dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-600 dark:hover:border-gray-600"><span>Check Current Prices/Rates (JSON)</span>
 | 
			
		||||
          <button name="check_rates" type="button" value="Check Current Prices/Rates (JSON)" onclick='lookup_rates();' class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md focus:ring-0 focus:outline-none dark:text-white dark:hover:text-white dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-600 dark:hover:border-gray-600"><span>Check Current Prices/Rates (JSON)</span>
 | 
			
		||||
          </button>
 | 
			
		||||
         </div>
 | 
			
		||||
         <div class="w-full md:w-auto p-1.5">
 | 
			
		||||
@ -540,22 +539,34 @@ xhr_rates_table.onload = () => {
 | 
			
		||||
function lookup_rates() {
 | 
			
		||||
    const coin_from = document.getElementById('coin_from').value;
 | 
			
		||||
    const coin_to = document.getElementById('coin_to').value;
 | 
			
		||||
    if (coin_from == '-1' || coin_to == '-1') {
 | 
			
		||||
    
 | 
			
		||||
    if (coin_from === '-1' || coin_to === '-1') {
 | 
			
		||||
        alert('Coins from and to must be set first.');
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    const selectedCoin = (coin_from === '15') ? '3' : coin_from;
 | 
			
		||||
    
 | 
			
		||||
    inner_html = '<p>Updating...</p>';
 | 
			
		||||
    document.getElementById('rates_display').innerHTML = inner_html;
 | 
			
		||||
 | 
			
		||||
    // Remove the 'hidden' class
 | 
			
		||||
    document.querySelector(".pricejsonhidden").classList.remove("hidden");
 | 
			
		||||
 | 
			
		||||
    const xhr_rates = new XMLHttpRequest();
 | 
			
		||||
    xhr_rates.onreadystatechange = function() {
 | 
			
		||||
        if (xhr_rates.readyState === XMLHttpRequest.DONE) {
 | 
			
		||||
            if (xhr_rates.status === 200) {
 | 
			
		||||
                document.getElementById('rates_display').innerHTML = xhr_rates.responseText;
 | 
			
		||||
            } else {
 | 
			
		||||
                console.error('Error fetching data:', xhr_rates.statusText);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    xhr_rates.open('POST', '/json/rates');
 | 
			
		||||
    xhr_rates.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 | 
			
		||||
    xhr_rates.send('coin_from=' + coin_from + '&coin_to=' + coin_to);
 | 
			
		||||
    xhr_rates.send('coin_from=' + selectedCoin + '&coin_to=' + coin_to);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function lookup_rates_table() {
 | 
			
		||||
    const coin_from = document.getElementById('coin_from').value;
 | 
			
		||||
    const coin_to = document.getElementById('coin_to').value;
 | 
			
		||||
@ -652,17 +663,10 @@ document.addEventListener("DOMContentLoaded", function() {
 | 
			
		||||
    const swap_type = document.getElementById('swap_type');
 | 
			
		||||
    set_swap_type_enabled(coin_from, coin_to, swap_type);
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
<script src="static/js/new_offer.js"></script>
 | 
			
		||||
<script src="static/js/coin_icons.js"></script>
 | 
			
		||||
<script src="static/js/coin_icons_2.js"></script>
 | 
			
		||||
</div>
 | 
			
		||||
{% include 'footer.html' %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
{% if show_chart %}
 | 
			
		||||
<script>
 | 
			
		||||
document.addEventListener('DOMContentLoaded', function() {
 | 
			
		||||
    document.querySelector("button[name='loadPrices']").addEventListener("click", loadPrices);
 | 
			
		||||
    const loadPricesButton = document.getElementById("loadPricesButton");
 | 
			
		||||
 | 
			
		||||
    function loadPrices() {
 | 
			
		||||
        const api_key = '{{chart_api_key}}';
 | 
			
		||||
@ -678,25 +682,27 @@ document.addEventListener('DOMContentLoaded', function() {
 | 
			
		||||
                    const priceBTC = data.RAW[coin].BTC.PRICE;
 | 
			
		||||
 | 
			
		||||
                    const tableRow = document.createElement("tr");
 | 
			
		||||
                    tableRow.classList.add("opacity-100", "text-gray-500", "dark:text-gray-100", "dark:text-gray-100", "hover:bg-coolGray-200", "dark:hover:bg-gray-600");
 | 
			
		||||
                    tableRow.classList.add("opacity-100", "text-gray-500", "dark:text-gray-100",
 | 
			
		||||
                                            "dark:text-gray-100", "hover:bg-coolGray-200",
 | 
			
		||||
                                            "dark:hover:bg-gray-600");
 | 
			
		||||
 | 
			
		||||
                    const coinCell = document.createElement("td", "py-3", "px-6");
 | 
			
		||||
                    const coinCell = document.createElement("td");
 | 
			
		||||
                    coinCell.textContent = coin;
 | 
			
		||||
                    coinCell.classList.add("py-3", "px-6", "bold");
 | 
			
		||||
                    tableRow.appendChild(coinCell);
 | 
			
		||||
 | 
			
		||||
                    const usdPriceCell = document.createElement("td", "py-3", "px-6");
 | 
			
		||||
                    const usdPriceCell = document.createElement("td");
 | 
			
		||||
                    usdPriceCell.textContent = priceUSD.toFixed(2) + ' USD';
 | 
			
		||||
                    coinCell.classList.add("py-3", "px-6");
 | 
			
		||||
                    usdPriceCell.classList.add("py-3");
 | 
			
		||||
                    tableRow.appendChild(usdPriceCell);
 | 
			
		||||
 | 
			
		||||
                    const btcPriceCell = document.createElement("td");
 | 
			
		||||
                    btcPriceCell.classList.add("py-3");
 | 
			
		||||
                    if (coin !== 'BTC') {
 | 
			
		||||
                        btcPriceCell.textContent = priceBTC.toFixed(8) + ' BTC';
 | 
			
		||||
                    } else {
 | 
			
		||||
                        btcPriceCell.textContent = '-';
 | 
			
		||||
                    }
 | 
			
		||||
                    coinCell.classList.add("py-3", "px-6");
 | 
			
		||||
                    tableRow.appendChild(btcPriceCell);
 | 
			
		||||
 | 
			
		||||
                    document.getElementById("priceTableBody").appendChild(tableRow);
 | 
			
		||||
@ -704,15 +710,19 @@ document.addEventListener('DOMContentLoaded', function() {
 | 
			
		||||
                .catch(error => console.error(`Error fetching ${coin} data:`, error));
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Remove the 'hidden' class from the section when the button is clicked
 | 
			
		||||
        document.querySelector(".pricetablehidden").classList.remove("hidden");
 | 
			
		||||
 | 
			
		||||
        // Disable the button to prevent multiple clicks
 | 
			
		||||
        const button = document.querySelector("button[name='loadPrices']");
 | 
			
		||||
        button.disabled = true;
 | 
			
		||||
        loadPricesButton.disabled = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    loadPricesButton.addEventListener("click", loadPrices);
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
{% endif %}
 | 
			
		||||
</script>
 | 
			
		||||
<script src="static/js/new_offer.js"></script>
 | 
			
		||||
<script src="static/js/coin_icons.js"></script>
 | 
			
		||||
<script src="static/js/coin_icons_2.js"></script>
 | 
			
		||||
</div>
 | 
			
		||||
{% include 'footer.html' %}
 | 
			
		||||
</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user