Skip to content

Commit 0fcbd2f

Browse files
committed
Added pencil icon and changed the rendering of terminal animations toggle.
1 parent 044b185 commit 0fcbd2f

3 files changed

Lines changed: 31 additions & 16 deletions

File tree

docs/css/access-nri.css

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,29 +1127,35 @@ pre > button:is(:hover,:focus).md-clipboard {
11271127
word-break: normal;
11281128
}
11291129

1130+
.terminal-switch-container {
1131+
position: relative;
1132+
float: right;
1133+
height: 1.2rem;
1134+
margin: 0.4rem 0.2rem;
1135+
}
1136+
11301137
img.terminal-switch {
1138+
height: 100%;
1139+
}
1140+
1141+
img.terminal-switch.inactive {
11311142
position: absolute;
1132-
right: 0;
1133-
top: -0.5em;
1134-
height: 1.5rem;
1135-
margin: 0.5rem 0.2rem;
1143+
left: 0;
1144+
top: 0;
1145+
z-index: 1;
11361146
}
11371147

11381148
img.terminal-switch:hover {
11391149
cursor: pointer;
11401150
}
11411151

1142-
.terminal-switch-container {
1143-
position: relative;
1144-
}
1145-
11461152
.terminal-switch-tooltip {
11471153
position: absolute;
11481154
display: inline-block;
11491155
z-index: 1;
1150-
right: 2em;
1151-
top: 2em;
1152-
max-width: 30vw;
1156+
right: 1.6em;
1157+
top: 1.1em;
1158+
width: clamp(20vw,10rem,30vw);
11531159
font-size: 0.7em;
11541160
background-color: var(--tooltip-background);
11551161
border: solid 1.5px var(--tooltip-border-color);

docs/js/miscellaneous.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function tabFunctionality() {
138138
function makeLinksExternal() {
139139
const externalLinkClass = "external-link";
140140
const currentHost = location.hostname;
141-
const excludedClasses = ['.vertical-card', '.horizontal-card', '.text-card'];
141+
const excludedClasses = ['.vertical-card', '.horizontal-card', '.text-card', '.md-content__button'];
142142
document.querySelectorAll("a[href^='http']")
143143
.forEach(link => {
144144
const url = new URL(link.href);
@@ -235,7 +235,7 @@ function toggleTerminalAnimations() {
235235
terminalAnimationsSwitch.setAttribute('src',SWITCH_IMG);
236236
terminalAnimationsSwitch.classList.add('terminal-switch');
237237
const terminalAnimationsSwitchInactive = document.createElement('img');
238-
terminalAnimationsSwitchInactive.classList.add('terminal-switch');
238+
terminalAnimationsSwitchInactive.classList.add('terminal-switch', 'inactive');
239239
terminalAnimationsSwitchInactive.setAttribute('src',SWITCH_IMG_INACTIVE);
240240
// Create the Animation Switch tooltip
241241
const terminalAnimationsTooltip = document.createElement('div');
@@ -256,8 +256,14 @@ function toggleTerminalAnimations() {
256256
let state = getState();
257257
applyState(terminalAnimationsSwitchContainer, state);
258258
// Place the Animation switch within the document
259-
const h1 = document.querySelector('h1');
260-
h1.parentElement.insertBefore(terminalAnimationsSwitchContainer, h1);
259+
// If pencil icon is present, place the switch next to it, otherwise at the beginning of the 'article' element
260+
const pencilIcon = document.querySelector('.md-content__button[title="Edit this page"]');
261+
if (pencilIcon) {
262+
pencilIcon.parentElement.insertBefore(terminalAnimationsSwitchContainer, pencilIcon.nextSibling);
263+
} else {
264+
const articleElement = document.querySelector('article');
265+
articleElement.insertBefore(terminalAnimationsSwitchContainer, articleElement.firstChild);
266+
}
261267
}
262268
}
263269

mkdocs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ site_url: !ENV READTHEDOCS_CANONICAL_URL
88
repo_url: https://github.com/ACCESS-NRI/ACCESS-Hive-Docs
99
repo_name: ACCESS-Hive-Docs
1010

11+
edit_uri: edit/development/docs/
12+
1113
theme:
1214
name: material
1315
custom_dir: overrides
@@ -39,6 +41,7 @@ theme:
3941
- navigation.tracking # The URL in the address bar is automatically updated with active anchor
4042
- content.code.copy # for displaying copy icon at top right in code snippets
4143
- content.code.annotate
44+
- content.action.edit
4245
- content.tabs.link
4346
- search.suggest
4447
- search.highlight
@@ -231,7 +234,7 @@ extra_css:
231234

232235
extra_javascript:
233236
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js # For pymdownx.arithmatex extension
234-
- https://cdn.jsdelivr.net/gh/atteggiani/animated-terminal@3.0/animated-terminal.min.js # Terminal animations
237+
- https://cdn.jsdelivr.net/gh/atteggiani/animated-terminal@3.1/animated-terminal.min.js # Terminal animations
235238
- js/custom-tags.js
236239
- js/miscellaneous.js
237240

0 commit comments

Comments
 (0)