1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 connect() { 5 feather.replace(); 6 closeMenu(); 7 topFunction(); 8 this.pingLocations(); 9 } 10 11 showJoinInformation() { 12 const useNew = document.getElementById('farmer-new').checked; 13 const useCli = document.getElementById('method-cli').checked; 14 const farmerElement = useNew ? 'new' : 'existing'; 15 const methodElement = useCli ? 'cli' : 'gui'; 16 const element = `join-${farmerElement}-farm-${methodElement}`; 17 var elements = document.getElementsByClassName("join-farm"); 18 elements && Array.from(elements).forEach(function (el) { 19 el.classList.add("d-none"); 20 }); 21 document.getElementById(element).classList.remove('d-none'); 22 } 23 24 pingLocation(pingUrl, location) { 25 var p = new Ping(); 26 27 p.ping(pingUrl) 28 .then(data => { 29 document.getElementById(`ping-${location}`).innerHTML = data; 30 document.getElementById(`ping-${location}`).parentElement.classList.remove('d-none'); 31 document.getElementById(`spinner-${location}`).classList.add('d-none'); 32 }) 33 .catch(data => { 34 document.getElementById(`ping-${location}`).parentElement.classList.remove('d-none'); 35 document.getElementById(`ping-${location}`).innerHTML = "Failed to ping"; 36 document.getElementById(`spinner-${location}`).classList.add('d-none'); 37 }); 38 } 39 40 pingLocations() { 41 this.pingLocation("https://xch.spacefarmers.io", "europe"); 42 this.pingLocation("https://xch-cn.spacefarmers.io", "china"); 43 this.pingLocation("https://xch-na.spacefarmers.io", "north-america"); 44 this.pingLocation("https://xch-asia.spacefarmers.io", "asia"); 45 } 46};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.