From b9b8a6f4f4bb79076007aa7e84d8f2ffead99c6d Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Wed, 13 Feb 2019 13:11:14 -0500 Subject: [PATCH] Resize images and fix dissapearing image issue --- doc/user/sass/_content.scss | 2 +- doc/user/sass/book.scss | 5 ++ doc/user/static/base.js | 93 ----------------------------------- doc/user/static/image.js | 8 +++ doc/user/templates/index.html | 5 ++ externals | 2 +- 6 files changed, 20 insertions(+), 95 deletions(-) delete mode 100644 doc/user/static/base.js create mode 100644 doc/user/static/image.js diff --git a/doc/user/sass/_content.scss b/doc/user/sass/_content.scss index 2c830efc3..4ca69b84b 100644 --- a/doc/user/sass/_content.scss +++ b/doc/user/sass/_content.scss @@ -20,7 +20,7 @@ } img { - max-width: 100%; + } &__content { diff --git a/doc/user/sass/book.scss b/doc/user/sass/book.scss index ea87c19d1..18829a890 100644 --- a/doc/user/sass/book.scss +++ b/doc/user/sass/book.scss @@ -39,3 +39,8 @@ $sidebar-width: 300px; @import "navigation"; @import "content"; @import "header"; + +img { + transform: scale(0.666); + transform-origin: top left; +} diff --git a/doc/user/static/base.js b/doc/user/static/base.js deleted file mode 100644 index a6e48e7c2..000000000 --- a/doc/user/static/base.js +++ /dev/null @@ -1,93 +0,0 @@ -function getSearchTerm() -{ - var sPageURL = window.location.search.substring(1); - var sURLVariables = sPageURL.split('&'); - for (var i = 0; i < sURLVariables.length; i++) - { - var sParameterName = sURLVariables[i].split('='); - if (sParameterName[0] == 'q') - { - return sParameterName[1]; - } - } -} - -$(document).ready(function() { - - $("img").each(function (idx, elm) { - var x = elm.width, y = elm.height; - elm.width = x * 0.666; - elm.height = y * 0.666; - }); - - var search_term = getSearchTerm(), - $search_modal = $('#mkdocs_search_modal'), - $keyboard_modal = $('#mkdocs_keyboard_modal'); - - if(search_term){ - $search_modal.modal(); - } - - // make sure search input gets autofocus everytime modal opens. - $search_modal.on('shown.bs.modal', function () { - $search_modal.find('#mkdocs-search-query').focus(); - }); - - // Keyboard navigation - document.addEventListener("keydown", function(e) { - if ($(e.target).is(':input')) return true; - var key = e.which || e.keyCode || window.event && window.event.keyCode; - var page; - switch (key) { - case 39: // right arrow - page = $('[role="navigation"] a:contains(Next):first').prop('href'); - break; - case 37: // left arrow - page = $('[role="navigation"] a:contains(Previous):first').prop('href'); - break; - case 83: // s - e.preventDefault(); - $keyboard_modal.modal('hide'); - $search_modal.modal('show'); - $search_modal.find('#mkdocs-search-query').focus(); - break; - case 191: // ? - $keyboard_modal.modal('show'); - break; - default: break; - } - if (page) { - $keyboard_modal.modal('hide'); - window.location.href = page; - } - }); - - // Highlight.js - hljs.initHighlightingOnLoad(); - $('table').addClass('table table-striped table-hover'); - - // Improve the scrollspy behaviour when users click on a TOC item. - $(".bs-sidenav a").on("click", function() { - var clicked = this; - setTimeout(function() { - var active = $('.nav li.active a'); - active = active[active.length - 1]; - if (clicked !== active) { - $(active).parent().removeClass("active"); - $(clicked).parent().addClass("active"); - } - }, 50); - }); - -}); - - -$('body').scrollspy({ - target: '.bs-sidebar', - offset: 100 -}); - -/* Prevent disabled links from causing a page reload */ -$("li.disabled a").click(function() { - event.preventDefault(); -}); diff --git a/doc/user/static/image.js b/doc/user/static/image.js new file mode 100644 index 000000000..c6ae1ce70 --- /dev/null +++ b/doc/user/static/image.js @@ -0,0 +1,8 @@ + +$(document).ready(function() { + $("img").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); + }); +}); diff --git a/doc/user/templates/index.html b/doc/user/templates/index.html index a535bfc76..11469290f 100644 --- a/doc/user/templates/index.html +++ b/doc/user/templates/index.html @@ -9,6 +9,11 @@ {% block title %}{{ config.title }}{% endblock title %} {% block js %} + + {% endblock js %} diff --git a/externals b/externals index c0941c565..f2144c46c 160000 --- a/externals +++ b/externals @@ -1 +1 @@ -Subproject commit c0941c5650a2a136cb036960d009fb8a16fb1165 +Subproject commit f2144c46c63fe0210c125e47baee57085ec2549f