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

Commit 63a7b85

Browse files
committed
New: message on how to disable ads
1 parent eea97b2 commit 63a7b85

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

runestone/common/js/bookfuncs.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ async function handlePageSetup() {
213213
bw.innerHTML =
214214
"<p class='navbar_message'>Saving and Logging are Disabled</p>";
215215
}
216+
let aw = document.getElementById("ad_warning");
217+
if (aw) {
218+
aw.innerHTML =
219+
"<p class='navbar_message'>🚫 Log-in to Remove <a href='/runestone/default/ads'>Ads!</a> 🚫 &nbsp;</p>";
220+
}
216221
}
217222
$(".loggedinuser").html(mess);
218223

@@ -298,15 +303,14 @@ window.addEventListener("load", function () {
298303
e.stopPropagation();
299304
});
300305
});
301-
306+
302307
// re-write some urls
303308
// This is tricker than it looks and you have to obey the rules for # anchors
304309
// The #anchors must come after the query string as the server basically ignores any part
305310
// of a url that comes after # - like a comment...
306311
if (location.href.includes("mode=browsing")) {
307312
let queryString = "?mode=browsing";
308313
document.querySelectorAll("a").forEach((link) => {
309-
console.log(`Starting: ${link.href}`)
310314
let anchorText = "";
311315
if (link.href.includes("books/published") && ! link.href.includes("?mode=browsing")) {
312316
if (link.href.includes("#")) {
@@ -318,7 +322,6 @@ window.addEventListener("load", function () {
318322
? link.href + queryString.replace("?", "&") + anchorText
319323
: link.href + queryString + anchorText;
320324
}
321-
console.log(`Ending: ${link.href}`)
322325
});
323326
}
324327
});

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<ul class="nav navbar-nav navbar-right" >
6767

6868
<li class="divider-vertical"></li>
69+
<li><span id="ad_warning"></span></li>
6970
<li><span id="browsing_warning"></span></li>
7071

7172
<!-- social media dropdown -->
@@ -149,8 +150,8 @@
149150
<li class="divider"></li>
150151
<li><a href='/{{appname}}/assignments/chooseAssignment.html'>Assignments</a></li>
151152
<li><a href='/{{appname}}/assignments/practice'>Practice</a></li>
152-
<li id="inst_peer_link"><a href='/{{appname}}/peer/instructor.html'>Peer Instruction (Instructor)</a></li>
153-
<li><a href='/{{appname}}/peer/student.html'>Peer Instruction (Student)</a></li>
153+
<li id="inst_peer_link"><a href='/{{appname}}/peer/instructor.html'>Peer Instruction (Instructor)</a></li>
154+
<li><a href='/{{appname}}/peer/student.html'>Peer Instruction (Student)</a></li>
154155
<li class="divider"></li>
155156
{% if minimal_outside_links != 'True' %}
156157
<li><a href='/{{appname}}/default/courses'>Change Course</a></li>

0 commit comments

Comments
 (0)