Bug fixes

This commit is contained in:
sairaj mote 2023-01-12 22:27:30 +05:30
parent f2f69a83b8
commit 7302255578

View File

@ -197,7 +197,12 @@
document.addEventListener('copy', () => { document.addEventListener('copy', () => {
notify('copied', 'success') notify('copied', 'success')
}) })
routeTo(window.location.hash) getAllSuggestions().then(suggestions => {
routeTo(window.location.hash)
}).catch(e => {
console.error(e)
notify(e, 'error')
})
getRef("main_search_field").addEventListener("keydown", function (e) { getRef("main_search_field").addEventListener("keydown", function (e) {
if (e.key === 'Enter') { if (e.key === 'Enter') {
processNavbarSearch() processNavbarSearch()
@ -226,8 +231,6 @@
getRef("main_search_field").value = document.activeElement.textContent.trim() getRef("main_search_field").value = document.activeElement.textContent.trim()
}); });
getAllSuggestions();
this.addEventListener("click", (e) => { this.addEventListener("click", (e) => {
if (e.target.closest('.suggestion')) { if (e.target.closest('.suggestion')) {
let searchBox = document.getElementById('main_search_field'); let searchBox = document.getElementById('main_search_field');
@ -1478,15 +1481,17 @@
location.href = `#/contract/${text}` location.href = `#/contract/${text}`
resolve('contract') resolve('contract')
} else if (text.length == 64 && returnHexNumber(text)) { } else if (text.length == 64 && returnHexNumber(text)) {
fetch(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text) fetchJson(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text)
.then(function (myJson) { .then(function (myJson) {
console.log(`${window.tokenApiUrl}/api/v1.0/categoriseString/` + text)
console.log(myJson) console.log(myJson)
if (myJson['type'] == 'transaction') { if (myJson['type'] == 'transaction') {
//console.log('data entered is a transaction hash'); //console.log('data entered is a transaction hash');
location.href = `#/transaction/${text}` location.href = `#/transaction/${text}`
} else if (myJson['type'] == 'block') { } else if (myJson['type'] == 'block') {
//console.log('data entered is a block hash'); console.log('data entered is a block hash');
location.href = `#/block/${myJson['blockNumber']}`
location.href = `#/block/${text}`
} else { } else {
//console.log('data entered is noise'); //console.log('data entered is noise');
} }