Skip to content

Commit fb42d59

Browse files
committed
WIP javadoc changes
Signed-off-by: Grace Grimwood <ggrimwoo@redhat.com>
1 parent d8e1250 commit fb42d59

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

_layouts/javadoc-wrapper.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: default
3+
---
4+
<div class="container-fluid p-0">
5+
<iframe id="javadoc-frame"
6+
src="{{ page.raw_path | relative_url }}"
7+
style="width: 100%; height: calc(100vh - 60px); border: none;"
8+
title="Javadoc Content">
9+
</iframe>
10+
</div>
11+
12+
<script>
13+
// This script forces links clicked inside the iframe to
14+
// navigate the PARENT window to the correct Jekyll URI.
15+
const iframe = document.getElementById('javadoc-frame');
16+
17+
iframe.onload = function() {
18+
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
19+
const links = iframeDoc.getElementsByTagName('a');
20+
21+
for (let link of links) {
22+
// Only intercept internal relative links
23+
if (link.href && link.getAttribute('href').indexOf('http') !== 0) {
24+
link.onclick = function(e) {
25+
e.preventDefault();
26+
const href = link.getAttribute('href');
27+
28+
// Construct the new URL by removing the '.raw' part of the path
29+
const currentUrl = new URL(window.location.href);
30+
const newUrl = new URL(href, iframe.src);
31+
window.top.location.href = newUrl.href.replace('/{{ RAW_SUBDIR }}/', '/');
32+
};
33+
}
34+
}
35+
};
36+
</script>

_layouts/javadoc.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
---
3+
{{ content }}

0 commit comments

Comments
 (0)