Wrap tables in an overflow-x: auto; div

This commit is contained in:
Nate Weaver 2019-12-28 00:05:16 -06:00
parent 8a85b18d09
commit cbbb46a776
2 changed files with 20 additions and 0 deletions

View File

@ -21,6 +21,19 @@ function convertImgSrc() {
});
}
// Wrap tables in an overflow-x: auto; div
function wrapTables() {
var tables = document.querySelectorAll("div.articleBody")[0].getElementsByTagName("table");
for (table of tables) {
var wrapper = document.createElement("div");
wrapper.className = "nnw-overflow";
var tableCopy = table.cloneNode(true);
wrapper.appendChild(tableCopy);
table.parentNode.replaceChild(wrapper, table);
}
}
function reloadArticleImage() {
var image = document.getElementById("nnwImageIcon");
image.src = "nnwImageIcon://";
@ -39,6 +52,7 @@ function render(data, scrollY) {
wrapFrames()
stripStyles()
convertImgSrc()
wrapTables()
postRenderProcessing()
}

View File

@ -131,6 +131,12 @@ pre {
word-break: normal;
-webkit-hyphens: none;
}
.nnw-overflow {
overflow-x: auto;
}
td > pre {
overflow-x: hidden;
}
code, pre {
font-family: "SF Mono", Menlo, "Courier New", Courier, monospace;
font-size: 14px;