From 59b6bac2a6d8a44accdf02b949ef904f0fce835b Mon Sep 17 00:00:00 2001 From: gamebeaker Date: Tue, 8 Oct 2024 18:32:13 +0200 Subject: [PATCH] Revert "Create convertTableToDiv to fix royalroad tables on tolino" This reverts commit 4a400f998532e4a338189cb818c9c11d901b54b5. --- plugin/js/Parser.js | 7 ------- plugin/js/Util.js | 30 +----------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/plugin/js/Parser.js b/plugin/js/Parser.js index 40e903d9..72f88d80 100644 --- a/plugin/js/Parser.js +++ b/plugin/js/Parser.js @@ -89,7 +89,6 @@ class Parser { util.decodeCloudflareProtectedEmails(content); this.removeNextAndPreviousChapterHyperlinks(webPage, content); this.removeUnwantedElementsFromContentElement(content); - this.convertTabletoDiv(content); this.addTitleToContent(webPage, content); util.fixBlockTagsNestedInInlineTags(content); this.imageCollector.replaceImageTags(content); @@ -151,12 +150,6 @@ class Parser { util.removeLeadingWhiteSpace(element); }; - convertTabletoDiv(element) { - if (this.userPreferences.styleSheet.value.includes(".WebToEpub-table")) { - util.convertTableToDiv(element); - } - }; - customRawDomToContentStep(chapter, content) { // eslint-disable-line no-unused-vars // override for any custom processing } diff --git a/plugin/js/Util.js b/plugin/js/Util.js index 688ef3a7..37661d50 100644 --- a/plugin/js/Util.js +++ b/plugin/js/Util.js @@ -234,33 +234,6 @@ var util = (function () { node.remove(); } - var convertTableToDiv = function(element) { - for(let table of [...element.querySelectorAll("table")]) { - replaceTableToDivHelper(table, "td", "WebToEpub-cell"); - replaceTableToDivHelper(table, "tr", "WebToEpub-row"); - replaceTableToDivHelper(table, "tbody", ""); - replaceTableToDivHelper(table.parentNode, "table", "WebToEpub-table"); - } - } - - var replaceTableToDivHelper = function(element, elementtoreplace, divclass) { - if (element == null || element == undefined) { - return; - } - for(let node of [...element.querySelectorAll(elementtoreplace)]) { - let elementchildren = [...node.childNodes]; - let div = document.createElement("div"); - div.append(...elementchildren); - if (elementtoreplace == "table") { - node.parentNode.style.overflow = "visible"; - } - if (divclass != "") { - div.classList.add(divclass); - } - node.replaceWith(div); - } - } - /** * @todo expand to remove ALL event handlers */ @@ -1062,8 +1035,7 @@ var util = (function () { createChapterTab: createChapterTab, syncLoadSampleDoc : syncLoadSampleDoc, xmlToString: xmlToString, - zeroPad: zeroPad, - convertTableToDiv: convertTableToDiv + zeroPad: zeroPad }; })();