diff --git a/src/manifest.json b/src/manifest.json index 05beea4..6e7ac70 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "__MSG_extName__", - "version": "3.0.1", + "version": "3.0.2", "description": "__MSG_extDescription__", "default_locale": "en", "permissions": ["contextMenus"], diff --git a/src/viewer/error.js b/src/viewer/error.js index 133469c..b9594b5 100644 --- a/src/viewer/error.js +++ b/src/viewer/error.js @@ -7,4 +7,9 @@ export function showError(error) { $('error-details').textContent = error.toString(); $('error').classList.remove('hidden'); $('nav').classList.add('hidden'); + + const [firefox, version] = navigator.userAgent.match(/Firefox\/(\d+)/) ?? []; + if (firefox != null && Number(version) < 127) { + $('error-firefox').classList.remove('hidden'); + } } diff --git a/src/viewer/gallery.js b/src/viewer/gallery.js index 3571efd..e5125a7 100644 --- a/src/viewer/gallery.js +++ b/src/viewer/gallery.js @@ -1,16 +1,24 @@ import { $, $e } from './utils.js'; +/** + * @param {string} url + * @returns {string} + */ +function getCaption(url) { + const [, mediaType] = url.match(/data:(.+?)[,;]/) ?? []; + return mediaType ?? url; +} + /** * @param {string[]} images */ export function setupGallery(images) { const figures = images.map((image) => { - const caption = image.startsWith('data:image/svg+xml') ? 'SVG' : image; return $e( 'figure', {}, $e('a', { href: image }, $e('img', { src: image })), - $e('figcaption', {}, caption), + $e('figcaption', {}, getCaption(image)), ); }); diff --git a/src/viewer/index.html b/src/viewer/index.html index 629743d..5b10204 100644 --- a/src/viewer/index.html +++ b/src/viewer/index.html @@ -28,6 +28,16 @@