mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-10 04:40:27 -04:00
Post jQuery cleanup and Standards mode
Former-commit-id: 1eb8a258877442727b1ad30352b3ab3c1b91931c [formerly e7adc78770c1bd91652016c389f0cb2d7923dc0b] Former-commit-id: c4b0560ce4253704131b11fd0256e8cafb12ff10
This commit is contained in:
parent
8e2e177d38
commit
e8dc9ae744
@ -2134,7 +2134,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
//Display article in iframe
|
//Display article in iframe
|
||||||
var articleContent = window.frames[0].frameElement.contentDocument;
|
var articleContent = window.frames[0].frameElement.contentDocument;
|
||||||
//articleContent.documentElement.innerHTML = htmlArticle;
|
//articleContent.documentElement.innerHTML = htmlArticle;
|
||||||
articleContent.open();
|
articleContent.open('text/html', 'replace');
|
||||||
|
articleContent.write("<!DOCTYPE html>"); // Ensures browsers parse iframe in Standards mode
|
||||||
articleContent.write(htmlArticle);
|
articleContent.write(htmlArticle);
|
||||||
articleContent.close();
|
articleContent.close();
|
||||||
//Set relative font size + Stackexchange-family multiplier
|
//Set relative font size + Stackexchange-family multiplier
|
||||||
@ -2151,11 +2152,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
|||||||
var collection = articleContent.getElementsByTagName(eles[i]);
|
var collection = articleContent.getElementsByTagName(eles[i]);
|
||||||
for (var j = 0; j < collection.length; j++) {
|
for (var j = 0; j < collection.length; j++) {
|
||||||
//collection[j].classList.add("open-block");
|
//collection[j].classList.add("open-block");
|
||||||
collection[j].addEventListener("click", function () {
|
collection[j].addEventListener("click", function (e) {
|
||||||
var topTag = this.tagName;
|
var that = e.currentTarget;
|
||||||
this.classList.toggle("open-block");
|
var topTag = that.tagName;
|
||||||
var nextElement = this.nextElementSibling;
|
that.classList.toggle("open-block");
|
||||||
if (!nextElement) nextElement = this.parentNode.nextElementSibling;
|
var nextElement = that.nextElementSibling;
|
||||||
|
if (!nextElement) nextElement = that.parentNode.nextElementSibling;
|
||||||
if (!nextElement) return;
|
if (!nextElement) return;
|
||||||
// Decide toggle direction based on first sibling element
|
// Decide toggle direction based on first sibling element
|
||||||
var toggleDirection = nextElement.classList.contains("collapsible-block") && !nextElement.classList.contains("open-block") || nextElement.style.display == "none" ? "block" : "none";
|
var toggleDirection = nextElement.classList.contains("collapsible-block") && !nextElement.classList.contains("open-block") || nextElement.style.display == "none" ? "block" : "none";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user