diff --git a/profile/app.js b/profile/app.js deleted file mode 100644 index 03e64ba..0000000 --- a/profile/app.js +++ /dev/null @@ -1,155 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - // Function to parse URL parameters - function getQueryParam(param) { - const urlParams = new URLSearchParams(window.location.search); - return urlParams.get(param); - } - - // Get the alias from the URL - const alias = getQueryParam('alias'); - - // Set the alias in the search input - const searchBox = document.getElementById('searchBox'); - if (alias) { - searchBox.value = decodeURIComponent(alias); - } - - const suggestions = document.getElementById('suggestions'); - const dataView = document.getElementById('dataView'); - let csvData = []; - - // Fetching and parsing CSV data - fetch('https://raw.githubusercontent.com/sorukumar/plebdashboard/site/data/node_profile.csv') - .then(response => response.text()) - .then(data => { - csvData = data.split('\n').map(row => { - const columns = row.split(','); - return { - pub_key: columns[0], - alias: columns[1], - address_1: columns[2], - address_2: columns[3], - Source: columns[4], - last_update_dt: columns[5], - capacity: columns[6], - avg_chnl_size: columns[7], - med_chnl_size: columns[8], - min_chnl_size: columns[9], - max_chnl_size: columns[10], - Active_channel_cnt: columns[11], - Clearnet_Tor_Status: columns[12], - active_chnl_y_n: columns[13], - Capacity_Y_N: columns[14], - formatted_capacity: columns[15], - avg_base_fee: columns[16], - med_base_fee: columns[17], - max_base_fee: columns[18], - min_base_fee: columns[19], - avg_fee_rate: columns[20], - med_fee_rate: columns[21], - max_fee_rate: columns[22], - min_fee_rate: columns[23], - bin5_bfee: columns[24], - bin5_rfee: columns[25], - bin5_chnl: columns[26], - bin10_chnl: columns[27], - bin20_chnl: columns[28], - bin5_cpcty: columns[29], - bin10_cpcty: columns[30], - bin20_cpcty: columns[31], - bin100_cpcty: columns[32], - bin200_cpcty: columns[33], - // Add more fields as necessary - Degree_Centrality: columns[34], - Betweenness_Centrality: columns[35], - Closeness_Centrality: columns[36], - Eigenvector_Centrality: columns[37], - Degree_Centrality_Rank: columns[38], - Betweenness_Centrality_Rank: columns[39], - Closeness_Centrality_Rank: columns[40], - Eigenvector_Centrality_Rank: columns[41], - Active_channel_cnt_Rank: columns[42], - Capacity_Rank: columns[43] - }; - }); - }); - - searchBox.addEventListener('input', () => { - const value = searchBox.value.toLowerCase(); - const filteredData = csvData.filter(row => { - if (row.alias && row.pub_key) { - return row.alias.toLowerCase().includes(value) || row.pub_key.toLowerCase().includes(value); - } else if (row.alias) { - return row.alias.toLowerCase().includes(value); - } else if (row.pub_key) { - return row.pub_key.toLowerCase().includes(value); - } else { - return false; - } - }); - suggestions.innerHTML = ''; - - filteredData.forEach(row => { - const div = document.createElement('div'); - if (row.alias) { - div.textContent = row.alias; - } else { - div.textContent = row.pub_key; - } - div.onclick = () => selectAlias(row); - suggestions.appendChild(div); - }); -}); - - - - - function selectAlias(row) { - searchBox.value = row.alias; - suggestions.innerHTML = ''; - dataView.innerHTML = `