mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-27 23:17:37 -04:00
Fix a regression on some images in ServiceWorker mode.
Fixes #329 It was affecting all <img> tags of the first displayed article, only in ServiceWorker mode.
This commit is contained in:
parent
2a4de89693
commit
0e80e6f353
@ -806,9 +806,11 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
|
|||||||
// Scroll the iframe to its top
|
// Scroll the iframe to its top
|
||||||
$("#articleContent").contents().scrollTop(0);
|
$("#articleContent").contents().scrollTop(0);
|
||||||
|
|
||||||
|
if (contentInjectionMode === 'jquery') {
|
||||||
|
// Fast-replace img src with data-kiwixsrc [kiwix-js #272]
|
||||||
|
htmlArticle = htmlArticle.replace(/(<img\s+[^>]*\b)src(\s*=)/ig, "$1data-kiwixsrc$2");
|
||||||
|
}
|
||||||
// Display the article inside the web page.
|
// Display the article inside the web page.
|
||||||
//Fast-replace img with data-img and hide image [kiwix-js #272]
|
|
||||||
htmlArticle = htmlArticle.replace(/(<img\s+[^>]*\b)src(\s*=)/ig, "$1data-kiwixsrc$2");
|
|
||||||
$('#articleContent').contents().find('body').html(htmlArticle);
|
$('#articleContent').contents().find('body').html(htmlArticle);
|
||||||
|
|
||||||
// If the ServiceWorker is not useable, we need to fallback to parse the DOM
|
// If the ServiceWorker is not useable, we need to fallback to parse the DOM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user