From 74a45e62b10e1633bdd68501b3e12bce9faa66e3 Mon Sep 17 00:00:00 2001 From: ppoffice Date: Tue, 25 Jun 2019 23:00:04 -0400 Subject: [PATCH] fix(style): long table overflow --- source/css/style.styl | 36 ++++++++++++++++++++++-------------- source/js/main.js | 12 +++++++++--- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/source/css/style.styl b/source/css/style.styl index c5fccdf..92df2f3 100644 --- a/source/css/style.styl +++ b/source/css/style.styl @@ -417,21 +417,29 @@ figure.highlight display: block /* --------------------------------- - * Fix Video + * Overflow Table * --------------------------------- */ -.video-container { - position: relative; - padding-bottom: 56.25%; - padding-top: 25px; - height: 0; -} -.video-container iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} +.table-overflow + overflow-x: auto + table + width: auto!important + th + word-break: keep-all + +/* --------------------------------- + * Fix Video + * --------------------------------- */ +.video-container + position: relative + padding-bottom: 56.25% + padding-top: 25px + height: 0 + iframe + position: absolute + top: 0 + left: 0 + width: 100% + height: 100% /* --------------------------------- * Fix Gist Snippet diff --git a/source/js/main.js b/source/js/main.js index 6d88232..3c1861b 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -1,4 +1,4 @@ -(function($){ +(function ($) { $('.article img:not(".not-gallery-item")').each(function () { // wrap images with link and add caption if possible if ($(this).parent('a').length === 0) { @@ -9,12 +9,18 @@ } }); - if (typeof(moment) === 'function') { + if (typeof (moment) === 'function') { $('.article-meta time').each(function () { $(this).text(moment($(this).attr('datetime')).fromNow()); }); } + $('.article > .content > table').each(function () { + if ($(this).width() > $(this).parent().width()) { + $(this).wrap('
'); + } + }); + function adjustNavbar() { const navbarWidth = $('.navbar-main .navbar-start').outerWidth() + $('.navbar-main .navbar-end').outerWidth(); if ($(document).outerWidth() < navbarWidth) { @@ -28,7 +34,7 @@ var $toc = $('#toc'); if ($toc.length > 0) { - var $mask = $('
'); + var $mask = $('
'); $mask.attr('id', 'toc-mask'); $('body').append($mask);