Skip to content

Commit 5631b1d

Browse files
Merge pull request #121 from coding-for-reproducible-research/remove-live-code-buttons
Added javascript files to remove the html elements of the launch butt…
2 parents a147e06 + 483f703 commit 5631b1d

File tree

6 files changed

+69
-86
lines changed

6 files changed

+69
-86
lines changed

_config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ repository:
2424
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
2525
html:
2626
use_repository_button: true
27+
use_edit_page_button: true
2728
use_issues_button: true
2829
use_navigation_shortcuts: false
2930
extra_css:
30-
- _static/style.css
31-
- style.css
31+
- _static/remove_prev_next_bottom_buttons.css
3232

3333
launch_buttons:
3434
thebe : true
3535
binderhub_url: "https://mybinder.org" # The URL for your BinderHub (e.g., https://mybinder.org)
36-
37-
36+
3837
# Files not to be ran when building the jupyter book
3938
exclude_patterns:
4039
- README.md
4140
- individual_modules/python_for_data_analysis/data-analysis-task-solutions.ipynb
4241

42+
4343
# Execute all notebooks by default.
4444
# The R notebooks are excluded from running during the building of the book due to the formatting issues. When ran wen building the output for each of the cells will create a new code block for each space due to the R magic command.
4545
execute:

_static/hide_thebe_button.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
(function() {
2+
// List of filenames for which the Thebe button should be hidden
3+
const filenamesToHideButton = [
4+
'additional_exercises.html',
5+
'analysis_task_1.html',
6+
'analysis_task_2.html',
7+
'analysis_task_3html',
8+
'analysis_task_intro.html',
9+
'control_flow.html',
10+
'dictionaries.html',
11+
'functions.html',
12+
'fundamentals.html',
13+
'imports.html',
14+
'lists.html',
15+
'loops.html',
16+
'motivation.html',
17+
'recap.html',
18+
'basic_commands.html',
19+
'control_flow.html',
20+
'data_types.html',
21+
'gettingstarted.html',
22+
'good_practise.html',
23+
'load_data.html',
24+
'manipulating_data.html',
25+
'plots.html',
26+
'stats.html',
27+
];
28+
29+
// Function to get the current page's filename
30+
function getCurrentFilename() {
31+
const url = window.location.pathname;
32+
const filename = url.substring(url.lastIndexOf('/') + 1);
33+
return filename;
34+
}
35+
36+
// Function to add the custom CSS to the document
37+
function addCustomCSS() {
38+
const css = `
39+
.dropdown.dropdown-launch-buttons {
40+
display: none !important;
41+
}
42+
`;
43+
const style = document.createElement('style');
44+
style.type = 'text/css';
45+
style.appendChild(document.createTextNode(css));
46+
document.head.appendChild(style);
47+
}
48+
49+
// Main function to check the filename and apply CSS if needed
50+
function applyCSSIfNeeded() {
51+
const currentFilename = getCurrentFilename();
52+
if (filenamesToHideButton.includes(currentFilename)) {
53+
addCustomCSS();
54+
}
55+
}
56+
57+
// Run the main function when the page loads
58+
window.onload = applyCSSIfNeeded;
59+
})();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.prev-next-area {
22
display: none;
33
}
4+

_templates/layouts/page.html

Lines changed: 0 additions & 80 deletions
This file was deleted.

individual_modules/introduction_to_python/additional_exercises.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"name": "python",
218218
"nbconvert_exporter": "python",
219219
"pygments_lexer": "ipython3",
220-
"version": "3.12.2"
220+
"version": "3.9.19"
221221
}
222222
},
223223
"nbformat": 4,

individual_modules/introduction_to_python/lists.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "5469da1d-b44c-4dc0-8d83-03bfd1818903",
5+
"id": "ae0d6949-e256-4ab8-ad3e-856076e06002",
66
"metadata": {
77
"editable": true,
88
"slideshow": {
@@ -2173,6 +2173,9 @@
21732173
}
21742174
],
21752175
"metadata": {
2176+
"header_includes": [
2177+
"<link rel=\"stylesheet\" href=\"_static/remove_live_code_button.css\">"
2178+
],
21762179
"kernelspec": {
21772180
"display_name": "Python 3 (ipykernel)",
21782181
"language": "python",

0 commit comments

Comments
 (0)