diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/main.ts | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -46,22 +46,25 @@ const settings = new KeyValueStore({ | |||
46 | })(); | 46 | })(); |
47 | 47 | ||
48 | (() => { | 48 | (() => { |
49 | const locationPrefixEl = document.getElementsByClassName('location__prefix')[0]; | 49 | const locationPrefixEls = document.getElementsByClassName('location__prefix'); |
50 | locationPrefixEl.addEventListener('click', e => { | 50 | let i = locationPrefixEls.length; |
51 | e.preventDefault(); | 51 | while (i--) { |
52 | locationPrefixEls[i].addEventListener('click', e => { | ||
53 | e.preventDefault(); | ||
52 | 54 | ||
53 | let resp = prompt('Please enter new location: ', ''); | 55 | let resp = prompt('Please enter new location: ', ''); |
54 | if ((resp !== null) && (resp.trim() !== "")) { | 56 | if ((resp !== null) && (resp.trim() !== "")) { |
55 | resp = resp.trim(); | 57 | resp = resp.trim(); |
56 | if (resp.indexOf('gopher://') === 0) { | 58 | if (resp.indexOf('gopher://') === 0) { |
57 | resp = resp.substring(9); | 59 | resp = resp.substring(9); |
58 | } | 60 | } |
59 | 61 | ||
60 | window.location.href = window.location.origin + '/' + resp; | 62 | window.location.href = window.location.origin + '/' + resp; |
61 | } | 63 | } |
62 | 64 | ||
63 | return false; | 65 | return false; |
64 | }); | 66 | }); |
67 | } | ||
65 | })(); | 68 | })(); |
66 | 69 | ||
67 | (() => { | 70 | (() => { |