diff --git a/www/-/mw/skins.vector.styles.css b/www/-/mw/skins.vector.styles.css index b276aab0..aacd9f3c 100644 --- a/www/-/mw/skins.vector.styles.css +++ b/www/-/mw/skins.vector.styles.css @@ -293,6 +293,21 @@ figure[typeof~='mw:File/Thumb'] > figcaption:empty { vertical-align: text-bottom } +summary.section-heading { + display: list-item !important; + cursor: pointer; +} + +.section-heading > h1, +.section-heading > h2, +.section-heading > h3, +.section-heading > h4, +.section-heading > h5, +.section-heading > h6 { + display: inline; + border: none; +} + @media screen { div.thumbinner { border: 1px solid var(--border-color-subtle,#c8ccd1); diff --git a/www/js/app.js b/www/js/app.js index 64e20bcb..47cec2f1 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -6355,8 +6355,9 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) { 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
...
) + // Convert section tags to details tags if we're not on the landing page and if the ZIM style is mobile + if (!params.isLandingPage && (appstate.zimThemeType === 'mobile' || params.cssSource === 'mobile') && /]*data-mw-section-id=["'][1-9]/i.test(htmlArticle)) { + // We have to loop because regex only matches innermost
...
for (i = 5; i--;) { htmlArticle = htmlArticle.replace(/]*data-mw-section-id=["'][1-9][^>]*)>((?:(?=([^<]+))\3|<(?!section\b[^>]*>))*?)<\/section>/ig, function (m0, m1, m2) { var summary = m2.replace(/(?:]+>)?(<(h[2-9])\b[^>]*>(?:[^<]|<(?!\2))+?<\/\2>)(?:<\/div>)?/i, '$1'); @@ -6380,12 +6381,6 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) { // Gutenberg ZIMs try to initialize before all assets are fully loaded. Affect UWP app. htmlArticle = htmlArticle.replace(/()){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) { - htmlArticle = htmlArticle.replace(noexcerpt[1], ''); - htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, '$1' + noexcerpt[1]); - } if (appstate.zimThemeType === 'mobile') { // Put misplaced hatnote headers inside

block back in correct position @TODO remove this when fixed in mw-offliner var hatnote; @@ -6406,6 +6401,12 @@ function displayArticleContentInContainer (dirEntry, htmlArticle) { for (i = hatnotes.length; i--;) { htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, '$1' + hatnotes[i].replace(/()){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) { + htmlArticle = htmlArticle.replace(noexcerpt[1], ''); + htmlArticle = htmlArticle.replace(/(<\/h1>\s*)/i, '$1' + noexcerpt[1]); + } } // Remove white background colour (causes flashes in dark mode) htmlArticle = htmlArticle.replace(/(]+style=["'][^"']*)background-color\s*:\s*[^;]+;\s*/i, '$1'); diff --git a/www/js/lib/transformStyles.js b/www/js/lib/transformStyles.js index 4e069337..3bc3b196 100644 --- a/www/js/lib/transformStyles.js +++ b/www/js/lib/transformStyles.js @@ -178,15 +178,17 @@ function toMobileCSS (html, zim, cc, cs, css) { // We already deleted the table above html = ''; // First try to move the lead paragraph + /* NOTE CODE BELOW CAUSES HATNOTES TO GET SWAPPED TOO, so we will only use the simple swap method instead html = temphtml.replace(/(]*?\bid\s*=\s*["']mw-content-text\s*[^>]*>\s*)/i, '$1\r\n' + paras[g].replace(/(', infobox[0]); } else { - // So there was no match, let's try just swapping para and infobox - html = temphtml.replace(paras[g], paras[g].replace(/(', ''); - } + */ + // So there was no match, let's try just swapping para and infobox + html = temphtml.replace(paras[g], paras[g].replace(/(', ''); + // } // End of commented else block } } }