Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit d7a0691

Browse files
authored
Merge pull request #1232 from ascholerChemeketa/layout_fixes
2 parents deba664 + 19991df commit d7a0691

18 files changed

Lines changed: 113 additions & 128 deletions

File tree

runestone/activecode/js/activecode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class ActiveCode extends RunestoneBase {
132132
);
133133
if (this.autorun) {
134134
// Simulate pressing the run button, since this will also prevent the user from clicking it until the initial run is complete, and also help the user understand why they're waiting.
135-
$(document).ready(this.runButtonHandler.bind(this));
135+
$(this.runButtonHandler.bind(this));
136136
}
137137
this.indicate_component_ready();
138138
}

runestone/animation/chart.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// $("#visualization").gchart({type: 'graphviz', series: [$.gchart.series([20, 50, 30])]});
1919
// label: '<f0> left | <f1> middle | <f2> right'
2020

21-
document.addEventListener('load', (event) => {
21+
window.addEventListener('load', (event) => {
2222
$('#visualization').gchart($.gchart.graphviz(true,
2323
{
2424
struct1: {label: '<f0> left |<f1> middle |<f2> right'},

runestone/animation/jqchart/gChartBasic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
1010
<script src="jquery.gchart.js"></script>
1111
<script>
12-
document.addEventListener('load', (event) => {
12+
window.addEventListener('load', (event) => {
1313
$(function () {
1414
$('#basicGChart').gchart({type: 'line', maxValue: 40,
1515
title: 'Weather for|Brisbane, Australia', titleColor: 'green',

runestone/codelens/js/codelens.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (typeof allVsualizers === "undefined") {
4949
window.allVisualizers = [];
5050
}
5151

52-
$(document).ready(function () {
52+
$(function () {
5353
if (typeof allTraceData !== "undefined") {
5454
for (let divid in allTraceData) {
5555
let cl = document.getElementById(divid);
@@ -69,7 +69,7 @@ $(document).ready(function () {
6969
console.log(err);
7070
}
7171
}
72-
document.addEventListener("codelens:answer", function (evt) {
72+
window.addEventListener("codelens:answer", function (evt) {
7373
let rb = new RunestoneBase();
7474
rb.logBookEvent({
7575
event: "codelens",

runestone/common/css/runestone-custom-sphinx-bootstrap.css

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ a {
194194
/* Remove top padding when top navbar goes collapsed in narrow viewports */
195195
body {
196196
padding-top: 0;
197-
margin: auto auto auto 5px;
198197
}
199198

200199
.navbar-fixed-top {
@@ -204,12 +203,15 @@ a {
204203
}
205204

206205
@media (min-width: 768px) {
207-
208206
/* when navbar is collapsed we don't want any vertical dividers taking up space */
209207
.navbar .divider-vertical {
210208
margin: 0 3px;
211209
border-left: 1px solid #f2f2f2;
212210
}
211+
212+
.navbar-fixed-top .container {
213+
padding: 0;
214+
}
213215
}
214216

215217
div.container {
@@ -222,8 +224,8 @@ div.section {
222224
}
223225

224226
.container {
225-
padding-left: 0;
226-
padding-right: 0;
227+
padding-left: 10px;
228+
padding-right: 10px;
227229
}
228230

229231
.container .section>*:not(.section):not(.ac_section) {
@@ -254,6 +256,11 @@ div.section {
254256
max-width: none;
255257
}
256258

259+
.container-fluid>.navbar-collapse, .container-fluid>.navbar-header, .container>.navbar-collapse, .container>.navbar-header {
260+
margin-left: 0;
261+
margin-right: 0;
262+
}
263+
257264
.navbar>.container .navbar-brand {
258265
margin-left: 0;
259266
}
@@ -262,6 +269,10 @@ div.section {
262269
background-color: var(--navbar);
263270
}
264271

272+
.navbar-toggle {
273+
margin-right: 0px;
274+
}
275+
265276
.footer>.container {
266277
background-color: var(--outerBackground);
267278
}
@@ -273,12 +284,13 @@ div.section {
273284
.brand-logo {
274285
float: left;
275286
display: block;
276-
background-size: 40px 40px !important;
277-
width: 40px;
278-
height: 40px;
279287
margin-top: 4px;
280288
}
281289

290+
.brand-logo img {
291+
height: 40px;
292+
}
293+
282294
.social-menu {
283295
width: 220px;
284296
padding: 10px 10px 15px 20px;
@@ -659,23 +671,51 @@ div.flash {
659671
display: inline;
660672
bottom: 65px;
661673
position: fixed;
674+
opacity: 0.4;
662675
}
663676

664-
#relations-next {
677+
.navLink:hover {
678+
opacity: 1;
679+
}
680+
681+
.navLink a {
682+
display: inline-block;
683+
background-color: white;
684+
border-style:solid;
685+
border-color:lightgrey;
686+
border-width:2px;
687+
width:100px;
688+
height:50px
689+
}
690+
691+
.relations-next {
665692
right: 35px;
666693
}
667694

668-
#relations-prev {
695+
.relations-prev {
669696
left: 35px;
670697
}
671698

699+
.nextprev-list {
700+
margin: 10px;
701+
padding-left: 0;
702+
height: 50px;
703+
}
704+
705+
.nextprev-list-top {
706+
display: none;
707+
}
708+
672709
@media (max-width: 600px) {
673710

674-
/* Styling definitions for chevron function in bookfuncs.js */
711+
.nextprev-list-top {
712+
display: block;
713+
}
714+
675715
.navLink {
676-
z-index: 2;
677-
display: inline;
678-
position: static;
716+
display: inline-block;
717+
bottom: auto;
718+
position: absolute;
679719
}
680720

681721
ul#top-relations-console,
@@ -697,10 +737,6 @@ div.flash {
697737
}
698738
}
699739

700-
.navLink a {
701-
color: #999;
702-
}
703-
704740
#completionButton {
705741
margin-top: 25px;
706742
margin-bottom: 15px;
@@ -920,9 +956,14 @@ textarea#lp-result {
920956

921957

922958
#scprogresscontainer {
923-
width: 50%;
924-
margin-left: auto;
925-
margin-right: auto;
959+
width: 100%;
960+
max-width: 500px;
961+
margin: 10px auto;
962+
}
963+
964+
#subchapterprogress.ui-progressbar .ui-progressbar-value {
965+
margin: 0;
966+
border-radius: 0px;
926967
}
927968

928969
#subchapterprogress>div {
@@ -968,11 +1009,11 @@ body {
9681009
.theme-switch-wrapper {
9691010
display: flex;
9701011
align-items: center;
1012+
}
9711013

972-
em {
973-
margin-left: 10px;
974-
font-size: 1rem;
975-
}
1014+
.theme-switch-wrapper em {
1015+
margin-left: 10px;
1016+
font-size: 1rem;
9761017
}
9771018

9781019
.theme-switch {

runestone/common/js/bookfuncs.js

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,6 @@
2929
3030
*/
3131

32-
//
33-
// Chevron functions - Must correspond with width in runestone-custom-sphinx-bootstrap.css
34-
//
35-
$(function () {
36-
var resizeWindow = false;
37-
var resizeWidth = 600;
38-
$(window)
39-
.on("resize", function (event) {
40-
if ($(window).width() <= resizeWidth && resizeWindow == false) {
41-
resizeWindow = true;
42-
var topPrev = $("#relations-prev")
43-
.clone()
44-
.attr("id", "top-relations-prev");
45-
var topNext = $("#relations-next")
46-
.clone()
47-
.attr("id", "top-relations-next");
48-
$("#relations-prev, #relations-next").hide();
49-
var bottomPrev = topPrev
50-
.clone()
51-
.attr("id", "bottom-relations-prev");
52-
var bottomNext = topNext
53-
.clone()
54-
.attr("id", "bottom-relations-next");
55-
$("div#main-content > div").prepend(topPrev, topNext);
56-
$("#top-relations-prev, #top-relations-next").wrapAll(
57-
'<ul id="top-relations-console"></ul>'
58-
);
59-
$("div#main-content > div").append(bottomPrev, bottomNext);
60-
$("#bottom-relations-prev, #bottom-relations-next").wrapAll(
61-
'<ul id="bottom-relations-console"></ul>'
62-
);
63-
}
64-
if ($(window).width() >= resizeWidth + 1 && resizeWindow == true) {
65-
resizeWindow = false;
66-
$("#top-relations-console, #bottom-relations-console").remove();
67-
$("#relations-prev, #relations-next").show();
68-
}
69-
})
70-
.resize();
71-
});
72-
7332
//
7433
// Page decoration functions
7534
//
@@ -263,7 +222,7 @@ function notifyRunestoneComponents() {
263222
}
264223

265224
// initialize stuff
266-
$(document).ready(function () {
225+
$(function () {
267226
if (eBookConfig) {
268227
handlePageSetup();
269228
} else {
@@ -277,7 +236,7 @@ $(document).ready(function () {
277236

278237
// misc stuff
279238
// todo: This could be further distributed but making a video.js file just for one function seems dumb.
280-
$(document).ready(function () {
239+
window.addEventListener("load", function () {
281240
// add the video play button overlay image
282241
$(".video-play-overlay").each(function () {
283242
$(this).css(

runestone/common/js/presenter_mode.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ function configureCodelens() {
211211
}
212212
}
213213

214-
//$(document).ready(configure);
215214
$(document).bind("runestone:login-complete", function () {
216215
// if user is instructor, enable presenter mode
217216
if (eBookConfig.isInstructor) {

runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/layout.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
</button>
4040

4141
<div>
42+
{% set logo = '_static/' + (logo if logo else 'img/logo_small.png') %}
4243
{% if minimal_outside_links != 'True' %}
43-
<a class="brand-logo" style='background: transparent url("{{pathto('_static/img/logo_small.png', 1)}}") no-repeat 0px 0px;' href="/{{appname}}/default/user/login">&nbsp; </a>
44+
<a class="brand-logo" href="/{{appname}}/default/user/login" aria-label="Login"><img src="{{pathto(logo, 1)}}" alt=""></a>
4445
{% else %}
45-
<a class="brand-logo" style='background: transparent url("{{pathto('_static/img/logo_small.png', 1)}}") no-repeat 0px 0px;'>&nbsp;<span aria-label="logo" class="visuallyhidden">Runestone Logo</span> </a>
46+
<div class="brand-logo"><img src="{{pathto(logo, 1)}}" alt=""></div>
4647
{% endif %}
4748
<a class="navbar-brand" href="{{ pathto(master_doc) }}" aria-label="index-page">
4849
{% if dynamic_pages == 'True' %}
@@ -220,7 +221,10 @@
220221
{% endmacro %}
221222

222223
{%- block extrahead %}
224+
225+
{% if not favicon %}
223226
<link rel="shortcut icon" href="/{{appname}}/static/favicon.ico" type="image/ico" />
227+
{% endif %}
224228

225229
<script>
226230
eBookConfig = {};
@@ -289,6 +293,11 @@
289293
<div class="container" id="continue-reading"></div>
290294

291295
<div class="container" id="main-content" role="main">
296+
297+
{% with place='top' %}
298+
{% include "subchapter.html" %}
299+
{% endwith %}
300+
292301
<!-- Ad Serving for Runestone Campaign -->
293302
{% if dynamic_pages == 'True' %}
294303
{% raw %}
@@ -310,9 +319,9 @@
310319
<div id="scprogresscontainer">
311320
You have attempted <span id="scprogresstotal"></span> of <span id="scprogressposs"></span> activities on this page <div id="subchapterprogress" aria-label="Page progress"></div>
312321
</div>
313-
{% block nextprevious %}
314-
{% include "subchapter.html" %}
315-
{% endblock %}
322+
{% with place='bottom'%}
323+
{% include "subchapter.html" %}
324+
{% endwith %}
316325
</div>
317326
{%- endblock %}
318327

@@ -375,12 +384,14 @@
375384
</script>
376385

377386
<script async src="https://hypothes.is/embed.js"></script>
387+
<!--provide space to prevent hypothes.is sidebar from obscuring content-->
388+
<style>@media screen and (max-width:767px) { body { padding-right: 21px; }}</style>
378389

379390
{% endif %}
380391
{% endif %}
381392

382393
<script>
383-
document.addEventListener('load', (event) => {
394+
window.addEventListener('load', (event) => {
384395
runestoneComponents.getSwitch();
385396
});
386397
</script>

runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/progress.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
document.getElementById("progressBar").style.width = book.curChapterPercent-1 + "%";
6666
}
6767
}
68-
document.addEventListener('DOMContentLoaded', function() {
68+
window.addEventListener('load', function() {
6969
loadProgressBar();
7070
}, false);
7171
</script>

runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/relations.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'delay': { show: 100, hide: 50}
2626
};
2727

28-
document.addEventListener('load', (event) => {
28+
window.addEventListener('load', (event) => {
2929
$('#relations-prev').tooltip(opts);
3030
$('#relations-next').tooltip(opts);
3131
});

0 commit comments

Comments
 (0)