From 3f799ca13a894b7e0b716bc43b3174b2f9f35ee4 Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Wed, 26 Jun 2019 20:23:29 +0200 Subject: Improved mobile layout --- js/main.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'js/main.ts') diff --git a/js/main.ts b/js/main.ts index 5bbcd97..765aa25 100644 --- a/js/main.ts +++ b/js/main.ts @@ -46,22 +46,25 @@ const settings = new KeyValueStore({ })(); (() => { - const locationPrefixEl = document.getElementsByClassName('location__prefix')[0]; - locationPrefixEl.addEventListener('click', e => { - e.preventDefault(); + const locationPrefixEls = document.getElementsByClassName('location__prefix'); + let i = locationPrefixEls.length; + while (i--) { + locationPrefixEls[i].addEventListener('click', e => { + e.preventDefault(); - let resp = prompt('Please enter new location: ', ''); - if ((resp !== null) && (resp.trim() !== "")) { - resp = resp.trim(); - if (resp.indexOf('gopher://') === 0) { - resp = resp.substring(9); - } + let resp = prompt('Please enter new location: ', ''); + if ((resp !== null) && (resp.trim() !== "")) { + resp = resp.trim(); + if (resp.indexOf('gopher://') === 0) { + resp = resp.substring(9); + } - window.location.href = window.location.origin + '/' + resp; - } + window.location.href = window.location.origin + '/' + resp; + } - return false; - }); + return false; + }); + } })(); (() => { -- cgit v1.2.3-54-g00ecf