diff --git a/www/js/app.js b/www/js/app.js index fbdbe15d..e572221e 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -6099,23 +6099,20 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) { var i; // Dirty patches that improve performance or layout with Wikimedia ZIMs. DEV: review regularly and remove when no longer needed. if (appstate.wikimediaZimLoaded && params.cssCache) { - // Reduce weight of unused JS archives for mediawiki ZIMs. This patch also removes mediawiki.page.ready.js which breakds the iframe kiwix-js #972 - htmlArticle = htmlArticle.replace(//gi, ''); + // Reduce weight of unused JS archives for mediawiki ZIMs and troublesome JS in mobile-html endpoint ZIMs. This patch also removes mediawiki.page.ready.js which breakds the iframe kiwix-js #972 + htmlArticle = htmlArticle.replace(//gi, ''); // @TODO - remove this when issue fixed: VERY DIRTY PATCH FOR HTML IN PAGE TITLES on Wikivoyage htmlArticle = htmlArticle.replace(/<a href[^"]+"\/wiki\/([^"]+)[^<]+>([^<]+)<\/a>/ig, '$2'); htmlArticle = htmlArticle.replace(/<(\/?)(i|b|em|strong)>/ig, '<$1$2>'); // @TODO - remove when fixed on mw-offliner: dirty patch for removing extraneous tags in ids htmlArticle = htmlArticle.replace(/(\bid\s*=\s*"[^\s}]+)\s*\}[^"]*/g, '$1'); - // @TODO - remove when fixed in MDwiki ZIM: dirty patch for removing erroneously hard-coded style - // if (/^mdwiki/.test(appstate.selectedArchive.file.name)) htmlArticle = htmlArticle.replace(/(class=['"]thumbinner[^>]+style=['"]width\s*:\s*)\d+px/ig, '$1320px'); + // Remove erroneous content frequently on front page + htmlArticle = htmlArticle.replace(/]+>[^/]*?User:Popo[^<]+<\/h1>\s*/i, ''); + htmlArticle = htmlArticle.replace(/]+>[^/]*?User:Popo[^<]+<\/span>\s*/i, ''); // Remove landing page scripts that don't work in SW mode htmlArticle = htmlArticle.replace(/]+-\/[^>]*((?:images_loaded|masonry)\.min|article_list_home)\.js"[^<]*<\/script>/gi, ''); // Remove wm_mobile_override script that intercepts all clicks and causes CORS errors htmlArticle = htmlArticle.replace(/]+wm_mobile_override_script\.js[^<]*<\/script>/i, ''); - // Set max-width for infoboxes (now set in -/s/styles.css) - // htmlArticle = htmlArticle.replace(/(\s*/gi, ''); // Edit sidebar style to make it an infobox htmlArticle = htmlArticle.replace(/(]+(?:section-heading|article-header)/i.test(htmlArticle) ? htmlArticle.replace(/(]+>\s*)/i, '$1

' + dirEntry.getTitleOrUrl().replace(/</g, '<') + '

') : htmlArticle; - // Remove hard-coded image widths for new mobile html endpoint ZIMs + // Remove hard-coded image widths for new mobile-html endpoint ZIMs htmlArticle = htmlArticle.replace(/(]+?width=)[^>]+?height=['"][^'"]+?['"]/ig, '$1$2"320px"'); htmlArticle = htmlArticle.replace(/(]+(?:min-width:\s*|width=['"]))(\d+px)([^>]+>\s*]+style=['"])/ig, '$1$2$3max-width: $2; '); + // Remove reference to unusued pcs scripts (onBodyStart and onBodyEnd) in mobile-html endpoint ZIMs (causes unhandled type error) + htmlArticle = htmlArticle.replace(/]*>[^<]*pcs\.c1\.Page\.onBody[^<]+<\/script>\s*/ig, ''); if (!params.isLandingPage) { // Convert section tags to details tags (we have to loop because regex only matches innermost
...
) for (i = 5; i--;) { @@ -6156,10 +6155,6 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) { // Gutenberg ZIMs try to initialize before all assets are fully loaded. Affect UWP app. htmlArticle = htmlArticle.replace(/(]+>[^/]*?User:Popo[^<]+<\/h1>\s*/i, ''); - htmlArticle = htmlArticle.replace(/]+>[^/]*?User:Popo[^<]+<\/span>\s*/i, ''); - // Put misplaced disambiguation header back in its correct position @TODO remove this when fixed in mw-offliner var noexcerpt = htmlArticle.match(/)){1,50}?(?:For\sother\s.{5,20}\swith\s|Not\sto\sbe\sconfused\swith|mw-redirect[^<]+travel\stopic|This\sarticle\sis\sa|See\salso:)(?:[^<]|<(?!\/dl>))+<\/dl>\s*)/i); if (noexcerpt && noexcerpt[1] && noexcerpt[1].length) {