Skip to content

Commit

Permalink
updates for reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
wookay committed Apr 20, 2017
1 parent 1f7f090 commit 6ac7b95
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 68 deletions.
114 changes: 57 additions & 57 deletions assets/html/documenter.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ nav.toc li.current > .toctext {
background-color: white;
}

div.topbar {
div#topbar {
display: none;
}

Expand Down Expand Up @@ -434,96 +434,96 @@ article section.docstring a.source-link {
}

@media only screen and (max-width: 768px) {
div.topbar {
div#topbar {
display: block; /* is mobile */
position: fixed;
top: 0px;
left: 0px;
right: 0px;
height: 2.5em;
overflow: hidden;
width: 100%;
height: 2.7em;
background-color: white;
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),
0 1px 5px 0 rgba(0,0,0,.12),
0 3px 1px -2px rgba(0,0,0,.2);
z-index: 1;
}

div.topbar div.container {
height: 100%;
width: 100vw;
}

div.topbar ul {
font-weight: bold;
line-height: 2.5em;
list-style: none;
}

div.topbar ul.float-left {
float: left;
font-size: smaller;
width: 60%;
padding-left: 1em;
margin-top: 0.3em;
box-shadow: 0 1px 3px rgba(0,0,0,.26);
z-index: 2;
top: 0em;
-webkit-transition-property: top; /* Safari */
-webkit-transition-duration: 0.3s; /* Safari */
transition-property: top;
transition-duration: 0.3s;
}

div.topbar ul.float-left li {
white-space: nowrap;
display: inline-block;
div#topbar span {
position: fixed;
width: 80%;
height: 1.8em;
overflow: hidden;
margin-top: 0.6em;
margin-left: 1em;
}

div.topbar ul.float-right {
div#topbar a.fa-bars {
float: right;
padding: 0 0 0 0;
margin-top: 0.1em;
padding: 0.4em 0.5em 0.2em 1em; /* top right bottom left */
font-size: x-large;
}

div.topbar ul.float-right i.fa-bars {
width: 1em;
padding-left: 0.5em;
padding-right: 0.5em;
text-align: right;
font-size: x-large;
background-color: white;
div#topbar a.fa-bars:visited {
color: #3091d1;
}

div.main div.container {
margin-top: 1em;
div#topbar.headroom--unpinned.headroom--not-top.headroom--not-bottom {
top: -3em;
-webkit-transition-property: top; /* Safari */
-webkit-transition-duration: 0.7s; /* Safari */
transition-property: top;
transition-duration: 0.7s;
}

nav.toc {
position: fixed;
overflow-y: scroll;
z-index: 2;
width: 80%;
width: 16em;
left: -16em;
-webkit-overflow-scrolling: touch;
-webkit-transition-property: left; /* Safari */
-webkit-transition-duration: 0.3s; /* Safari */
transition-property: left;
transition-duration: 0.3s;
left: -768px;
-webkit-transition-timing-function: ease-in; /* Safari */
transition-timing-function: ease-in;
-webkit-transition-timing-function: ease-out; /* Safari */
transition-timing-function: ease-out;
z-index: 3;
}

nav.toc.show {
left: 0rem;
-webkit-transition-timing-function: ease-out; /* Safari */
transition-timing-function: ease-out;
left: 0em;
}

article {
padding-top: -3em;
margin-left: 0em;
padding-left: 0.9em;
padding-right: 0.9em;
margin-left: 0;
overflow-wrap: break-word;
z-index: 1;
}

article table {
table-layout: fixed;
width: 99%;
}

article div.MathJax_Display {
overflow: scroll;
}

article span.MathJax {
overflow: hidden;
}

article > header {
display: none;
}

article [id]:before {
display: inline-block;
content: "";
padding-top: 5em;
margin-top: -5em;
padding-top: 3.5em;
margin-top: -3.5em;
}
}
21 changes: 16 additions & 5 deletions assets/html/documenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ requirejs.config({
paths: {
'jquery': 'https://code.jquery.com/jquery-3.1.0.js?',
'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min',
'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.3/headroom.min',
'mathjax': 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML',
'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min',
'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/julia.min',
Expand Down Expand Up @@ -96,19 +97,29 @@ require(['jquery'], function($) {
})

// mobile
require(['jquery'], function($) {
require(['jquery', 'headroom'], function($, Headroom) {
$(document).ready(function() {
var navtoc = $("nav.toc");
var navtoc_current_top = $('nav.toc li.current').offset().top;
$("nav.toc li.current a.toctext").click(function(ev) {
$("nav.toc li.current a.toctext").click(function() {
navtoc.toggleClass('show');
});
$("div.topbar ul.float-right a.btn").click(function() {
$("div#topbar a.btn").click(function(ev) {
navtoc.toggleClass('show');
if (navtoc.hasClass('show')) {
navtoc.animate({scrollTop: navtoc_current_top}, 0);
var title = $("div#topbar span").text();
$("nav.toc ul li a:contains('" + title + "')").focus();
}
ev.preventDefault();
});
$("article#docs").bind('click', function() {
if (navtoc.hasClass('show')) {
navtoc.toggleClass('show');
}
});
if ($("div#topbar").css('display') == 'block') {
var headroom = new Headroom(document.querySelector("div#topbar"), {"tolerance": {"down": 10}});
headroom.init();
}
})

})
10 changes: 4 additions & 6 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ end
Constructs and writes the page referred to by the `navnode` to `.build`.
"""
function render_page(ctx, navnode)
@tags html body div
@tags html body

page = getpage(ctx, navnode)

Expand All @@ -172,7 +172,7 @@ function render_page(ctx, navnode)
htmldoc = DOM.HTMLDocument(
html[:lang=>"en"](
head,
body(topbar, div[".main"](div[".container"](navmenu, article)))
body(topbar, navmenu, article)
)
)
open(Formats.extension(:html, page.build), "w") do io
Expand Down Expand Up @@ -281,12 +281,10 @@ end
# ------------------------------------------------------------------------------

function render_topbar(ctx, navnode)
@tags div ul li span a i
@tags div span a

page_title = string(mdflatten(pagetitle(ctx, navnode)))
topbarleft = ul[".float-left"](li(span(page_title)))
topbarright = ul[".float-right"](li(a[".btn", :href => "#"](i[".fa .fa-bars", Symbol("aria-hidden") => "true"])))
div[".topbar"](div[".container"](topbarleft, topbarright))
div["#topbar"](span(page_title), a[".btn .fa .fa-bars", :href => "#"])
end


Expand Down

0 comments on commit 6ac7b95

Please sign in to comment.