Skip to content

Commit 3d33801

Browse files
committed
Port scripts and stylesheets to modern theme
1 parent 598432c commit 3d33801

6 files changed

Lines changed: 82 additions & 182 deletions

File tree

docfx.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
"fileMetadataFiles": [],
8484
"template": [
8585
"default",
86-
"templates/html"
86+
"modern",
87+
"template"
8788
],
8889
"postProcessors": [ "ExtractSearchIndex" ],
8990
"markdownEngineName": "markdig",
@@ -97,7 +98,6 @@
9798
"keepFileLink": false,
9899
"cleanupCacheHistory": false,
99100
"disableGitFeatures": false,
100-
"xrefService": [ "https://learn.microsoft.com/api/xref/query?uid={uid}" ],
101101
"xref": [
102102
"https://bonsai-rx.org/docs/xrefmap.yml",
103103
"https://horizongir.github.io/opencv.net/xrefmap.yml",

template/public/main.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.workflow {
2+
border: 1px solid #e3e3e3;
3+
padding: 1px;
4+
}
5+
6+
.workflow > p > img {
7+
padding-top: 12px;
8+
padding-left: 12px;
9+
padding-right: 12px;
10+
}
11+
12+
.codeHeader {
13+
box-sizing: content-box;
14+
background-color: #f2f2f2;
15+
color: #171717;
16+
display: flex;
17+
flex-direction: row;
18+
border: 1px solid #e3e3e3;
19+
border-bottom: 0;
20+
margin-top: 16px;
21+
min-height: 30px;
22+
}
23+
24+
.codeHeader > .language {
25+
padding: 2px 16px;
26+
flex-grow: 1;
27+
line-height: 26px;
28+
}

template/public/main.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
var WorkflowContainer = {
2+
createCodeHeader: function(text) {
3+
const div = document.createElement("div");
4+
div.className = "codeHeader";
5+
div.innerHTML =
6+
'<span class="language">'+ text +'</span>'+
7+
'<a class="btn border-0 code-action" href="#" title="Copy">'+
8+
' <i class="bi bi-clipboard"></i>'+
9+
'</a>';
10+
return div;
11+
},
12+
setCopyAlert: function(element) {
13+
const copyIcon = element.querySelector("i");
14+
element.classList.add("link-success");
15+
copyIcon.classList.add("bi-check-lg");
16+
copyIcon.classList.remove("bi-clipboard");
17+
setTimeout(function() {
18+
copyIcon.classList.remove("bi-check-lg");
19+
copyIcon.classList.add("bi-clipboard");
20+
element.classList.remove("link-success");
21+
}, 1000);
22+
},
23+
renderElement: function(element) {
24+
const img = element.querySelector("img");
25+
const workflowPath = img.src;
26+
img.src = workflowPath.replace(/\.[^.]+$/, ".svg");
27+
28+
const codeHeader = WorkflowContainer.createCodeHeader("Workflow");
29+
const button = codeHeader.querySelector("a");
30+
button.addEventListener("click", (e) => {
31+
e.preventDefault();
32+
fetch(workflowPath).then(req => req.text()).then(contents => {
33+
navigator.clipboard.writeText(contents);
34+
WorkflowContainer.setCopyAlert(button);
35+
});
36+
});
37+
38+
const wrap = document.createElement("p");
39+
const parent = element.parentElement
40+
parent.insertBefore(wrap, element);
41+
wrap.appendChild(codeHeader);
42+
wrap.appendChild(element);
43+
},
44+
init: async function() {
45+
for (const element of document.getElementsByClassName("workflow")) {
46+
WorkflowContainer.renderElement(element)
47+
}
48+
}
49+
}
50+
51+
export default { }
52+
WorkflowContainer.init();

templates/html/partials/scripts.tmpl.partial

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

templates/html/styles/main.css

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

templates/html/styles/main.js

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

0 commit comments

Comments
 (0)