Parcourir la source

Fixed Manga reader firefox bug

Toby Chui il y a 2 semaines
Parent
commit
20be9a96a6
1 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 9 1
      src/web/Manga/viewComic.html

+ 9 - 1
src/web/Manga/viewComic.html

@@ -392,7 +392,11 @@ if (typeof applocale !== 'undefined') {
     });
     });
 }
 }
 
 
-var chapterPath  = decodeURIComponent(window.location.hash.substr(1));
+// Firefox inside a desktop float window does not reload the new chapter when
+// the iframe hash changes, so there the chapter travels in ?chapter= instead.
+var useQueryNav  = ao_module_virtualDesktop && /firefox/i.test(navigator.userAgent);
+var chapterPath  = new URLSearchParams(window.location.search).get("chapter") ||
+                   decodeURIComponent(window.location.hash.substr(1));
 var allChapters  = [];   // [{name, path}] natural-sorted
 var allChapters  = [];   // [{name, path}] natural-sorted
 var currentChIdx = -1;
 var currentChIdx = -1;
 var mangaRootPath = '';  // set once getMangaInfo returns; used for back-navigation
 var mangaRootPath = '';  // set once getMangaInfo returns; used for back-navigation
@@ -593,6 +597,10 @@ function updateNavButtons() {
 }
 }
 
 
 function gotoChapter(path) {
 function gotoChapter(path) {
+    if (useQueryNav) {
+        window.location.href = window.location.pathname + "?chapter=" + encodeURIComponent(path);
+        return;
+    }
     window.location.hash = encodeURIComponent(path);
     window.location.hash = encodeURIComponent(path);
     window.location.reload();
     window.location.reload();
 }
 }