diff options
author | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 18:51:19 +0200 |
---|---|---|
committer | Feuerfuchs <git@feuerfuchs.dev> | 2020-05-18 18:51:19 +0200 |
commit | c772716e98e11181d301deadeca52856ac18f085 (patch) | |
tree | 25039bd7739039c000ab748b1547b5e5514d0b7a /js | |
parent | WIP: Refactoring (diff) | |
download | gopherproxy-c772716e98e11181d301deadeca52856ac18f085.tar.gz gopherproxy-c772716e98e11181d301deadeca52856ac18f085.tar.bz2 gopherproxy-c772716e98e11181d301deadeca52856ac18f085.zip |
Improved Gemini support
Diffstat (limited to 'js')
-rw-r--r-- | js/main.ts | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -246,10 +246,11 @@ function generateImageThumbnails() { | |||
246 | const linkImgEl = linkImgEls[i] as HTMLAnchorElement; | 246 | const linkImgEl = linkImgEls[i] as HTMLAnchorElement; |
247 | const thumbnailUrl = linkImgEl.href.replace(/^(.*?)\/I/, '$1/T'); | 247 | const thumbnailUrl = linkImgEl.href.replace(/^(.*?)\/I/, '$1/T'); |
248 | 248 | ||
249 | const lineBreakEl = document.createTextNode('\n'); | 249 | const sectionEl = document.createElement('div'); |
250 | sectionEl.classList.add('section'); | ||
250 | 251 | ||
251 | const typeAnnotEl = document.createElement('span'); | 252 | const typeAnnotEl = document.createElement('span'); |
252 | typeAnnotEl.classList.add('type-annotation'); | 253 | typeAnnotEl.classList.add('section__type'); |
253 | typeAnnotEl.textContent = ' -> '; | 254 | typeAnnotEl.textContent = ' -> '; |
254 | 255 | ||
255 | const thumbnailEl = document.createElement('img'); | 256 | const thumbnailEl = document.createElement('img'); |
@@ -259,6 +260,7 @@ function generateImageThumbnails() { | |||
259 | }); | 260 | }); |
260 | 261 | ||
261 | const thumbnailAnchorEl = document.createElement('a'); | 262 | const thumbnailAnchorEl = document.createElement('a'); |
263 | thumbnailAnchorEl.classList.add('section__content'); | ||
262 | thumbnailAnchorEl.classList.add('img-preview'); | 264 | thumbnailAnchorEl.classList.add('img-preview'); |
263 | thumbnailAnchorEl.href = linkImgEl.href; | 265 | thumbnailAnchorEl.href = linkImgEl.href; |
264 | thumbnailAnchorEl.addEventListener('click', e => { | 266 | thumbnailAnchorEl.addEventListener('click', e => { |
@@ -278,9 +280,9 @@ function generateImageThumbnails() { | |||
278 | }); | 280 | }); |
279 | 281 | ||
280 | thumbnailAnchorEl.append(thumbnailEl); | 282 | thumbnailAnchorEl.append(thumbnailEl); |
281 | linkImgEl.parentNode!.insertBefore(thumbnailAnchorEl, linkImgEl.nextSibling); | 283 | sectionEl.append(typeAnnotEl); |
282 | linkImgEl.parentNode!.insertBefore(typeAnnotEl, thumbnailAnchorEl); | 284 | sectionEl.append(thumbnailAnchorEl); |
283 | linkImgEl.parentNode!.insertBefore(lineBreakEl, typeAnnotEl); | 285 | linkImgEl.parentNode!.parentNode!.insertBefore(sectionEl, linkImgEl.parentNode!.nextSibling); |
284 | } | 286 | } |
285 | } | 287 | } |
286 | 288 | ||
@@ -288,12 +290,7 @@ function removeImageThumbnails() { | |||
288 | const linkImgEls = document.querySelectorAll('.link--IMG, .link--GIF'); | 290 | const linkImgEls = document.querySelectorAll('.link--IMG, .link--GIF'); |
289 | let i = linkImgEls.length; | 291 | let i = linkImgEls.length; |
290 | while (i--) { | 292 | while (i--) { |
291 | const linkImgEl = linkImgEls[i]; | 293 | linkImgEls[i].parentNode!.nextSibling!.remove(); |
292 | let j = 3; | ||
293 | |||
294 | while (j-- && linkImgEl.nextSibling) { | ||
295 | linkImgEl.nextSibling.remove(); | ||
296 | } | ||
297 | } | 294 | } |
298 | } | 295 | } |
299 | 296 | ||