diff options
| author | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-26 20:23:29 +0200 |
|---|---|---|
| committer | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-26 20:23:29 +0200 |
| commit | 3f799ca13a894b7e0b716bc43b3174b2f9f35ee4 (patch) | |
| tree | 14006f9ddfc2ba98a2049bf7bfd8c25ffd6ad603 /js | |
| parent | New feature: Clickable links in plain text (opt) (diff) | |
| download | gopherproxy-3f799ca13a894b7e0b716bc43b3174b2f9f35ee4.tar.gz gopherproxy-3f799ca13a894b7e0b716bc43b3174b2f9f35ee4.tar.bz2 gopherproxy-3f799ca13a894b7e0b716bc43b3174b2f9f35ee4.zip | |
Improved mobile layout
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 | (() => { |
