From 88c42ee6bd5d8970e63b44231a0169697e490ea7 Mon Sep 17 00:00:00 2001 From: BTS Date: Mon, 16 Sep 2019 17:13:26 -0400 Subject: [PATCH] Manual: fixes for High DPI and icon short code --- doc/user/sass/book.scss | 10 ++++++++++ doc/user/static/image.js | 11 ++++++++++- doc/user/templates/shortcodes/icon.html | 5 +++++ doc/user/templates/shortcodes/lightbox.html | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 doc/user/templates/shortcodes/icon.html diff --git a/doc/user/sass/book.scss b/doc/user/sass/book.scss index 4e5f1729a..d39d71db1 100644 --- a/doc/user/sass/book.scss +++ b/doc/user/sass/book.scss @@ -47,6 +47,16 @@ $sidebar-width: 300px; transform-origin: top left; } } + +.colorbox-inline img { + max-width: 100%; +} + +.icon-image { + display:inline; + max-height: 1.4em; +} + .back-button { background: #ddd; border: 1px solid #bbb; diff --git a/doc/user/static/image.js b/doc/user/static/image.js index f139da139..d97201893 100644 --- a/doc/user/static/image.js +++ b/doc/user/static/image.js @@ -3,14 +3,23 @@ $(document).ready(function() { jQuery('a.thumbnail').colorbox({rel:'gal'}); jQuery('a.gallery_image').colorbox({rel:'gal'}); jQuery(".youtube").colorbox({iframe:true, innerWidth:'75%', innerHeight:'75%'}); - jQuery("a.colorbox-inline").colorbox({inline:true}); if(window.innerWidth >= 1920) { + $("img.scaled-image").each(function(idx, elm){ $(elm).css("margin-bottom", elm.height * -0.333); }).on("load", function(e){ $(e.target).css("margin-bottom", e.target.height * -0.333); }); + $("a.colorbox-inline").each(function(idx, elm){ + let child = $(elm).children("img")[0]; + let w = (child.naturalWidth * 0.666) + 1 + let h = (child.naturalHeight * 0.666) + 1 + $(elm).colorbox({inline: true, innerWidth: w, innerHeight: h, scrolling: false}); + }); + } + else { + jQuery("a.colorbox-inline").colorbox({inline:true}); } $(".back-button") .html("Go Back") diff --git a/doc/user/templates/shortcodes/icon.html b/doc/user/templates/shortcodes/icon.html new file mode 100644 index 000000000..a673243bd --- /dev/null +++ b/doc/user/templates/shortcodes/icon.html @@ -0,0 +1,5 @@ +{{alt}} \ No newline at end of file diff --git a/doc/user/templates/shortcodes/lightbox.html b/doc/user/templates/shortcodes/lightbox.html index c30de785e..68917c434 100644 --- a/doc/user/templates/shortcodes/lightbox.html +++ b/doc/user/templates/shortcodes/lightbox.html @@ -7,7 +7,7 @@