We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit be35247f authored by Camil Staps's avatar Camil Staps 🚀

Make everything collapsable

parent f1c58211
Pipeline #14534 failed with stage
in 56 seconds
body, html {
font-family: sans-serif;
margin: 0;
padding: 0;
}
/* Main boxes */
#container {
position: relative;
}
......@@ -43,3 +45,68 @@ body, html {
right: 0;
top: 0;
}
/* Icons */
.icon {
display: inline-block;
font-size: 120%;
font-weight: bold;
text-align: center;
vertical-align: baseline;
width: 20px;
}
.icon-class:before {
color: #59c28a;
content: '\2b15'; /* hexagon */
}
.icon-function:before {
color: #5998c2;
content: '\2192'; /* -> */
}
.icon-typedef:before {
color: #e3890b;
content: '\2e2a'; /* :: */
}
/* Collapsable */
.collapsable {
border-radius: 2px;
box-shadow: 0 0 2px 2px #cccccc;
margin-bottom: 1em;
}
.collapsable-head {
background: #eeeeee;
border-color: black;
border-radius: 2px;
border-style: solid;
border-width: 0 0 0 2px;
cursor: pointer;
font-family: monospace;
padding: .5em;
}
.collapsable.uncollapsed > .collapsable-head {
border-radius: 2px 2px 0 0;
}
.collapsable-head-class {
border-color: #59c28a;
}
.collapsable-head-function {
border-color: #5998c2;
}
.collapsable-head-typedef {
border-color: #e3890b;
}
.collapsable-body {
border-radius: 2px;
display: none;
padding: .5em;
}
.collapsable.uncollapsed > .collapsable-body {
display: block;
}
(function(){
/* Highlight Clean code */
var codes = document.getElementsByClassName('clean-code');
for (var i = 0; i < codes.length; i++) {
let codes = document.getElementsByClassName('clean-code');
for (let i = 0; i < codes.length; i++) {
codes[i].innerHTML = highlightClean(codes[i].innerText);
}
/* Resizable sidebar */
var sidebar = document.getElementById('sidebar');
let sidebar = document.getElementById('sidebar');
sidebar.onmouseup = function () { /* not every browser supports onresize on div */
console.log(this);
var content = document.getElementById('content');
let content = document.getElementById('content');
content.style.left = this.offsetWidth + 'px';
};
sidebar.onmouseup();
/* Collapsable */
let collapsables = document.getElementsByClassName('collapsable');
for (let i = 0; i < collapsables.length; i++) {
let elem = collapsables[i];
let head = elem.querySelector('.collapsable-head');
head.onclick = function () {
elem.classList.toggle('uncollapsed');
};
}
/* Open collapsable of hashtag in url */
if (window.location.hash.substring(0,1) == '#') {
let id = window.location.hash.substring(1);
let elem = document.getElementById(id);
if (elem.classList.contains('collapsable')) {
let head = elem.querySelector('.collapsable-head');
head.onclick();
}
}
})();
Subproject commit f2282f689b4654f68beaf078f8a3badaf1830ee0
Subproject commit 7a18f6a3295537ebfb0c7bec2f66b31d13baca2a
......@@ -78,9 +78,8 @@ where
: map html (sort m.elem.mod_type_defs)
]
where
html dtd = DivTag [IdAttr ("td-" +++ dtd.name)] $ catMaybes
[ Just $ H2Tag [] [Text dtd.name]
, DivTag [] <$> pure <$> Text <$> (docDescription =<< dtd.doc)
html dtd = collapsable "typedef" ("td-" +++ dtd.name) dtd.name $ catMaybes
[ DivTag [] <$> pure <$> Text <$> (docDescription =<< dtd.doc)
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust dtd.repr)]
]
......@@ -89,9 +88,8 @@ where
: map html (sort m.elem.mod_classes)
]
where
html dc = DivTag [IdAttr ("class-" +++ dc.name)] $ catMaybes
[ Just $ H2Tag [] [Text dc.name]
, DivTag [] <$> pure <$> Text <$> (docDescription =<< dc.doc)
html dc = collapsable "class" ("class-" +++ dc.name) dc.name $ catMaybes
[ DivTag [] <$> pure <$> Text <$> (docDescription =<< dc.doc)
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust dc.repr)]
]
......@@ -102,12 +100,23 @@ where
: map html (sort m.elem.mod_functions)
]
where
html df = DivTag [IdAttr ("fun-" +++ df.name)] $ catMaybes
[ Just $ H2Tag [] [Text df.name]
, DivTag [] <$> pure <$> Text <$> (docDescription =<< df.doc)
html df = collapsable "function" ("fun-" +++ df.name) df.name $ catMaybes
[ DivTag [] <$> pure <$> Text <$> (docDescription =<< df.doc)
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust df.repr)]
]
collapsable :: !String !String !String !a -> HtmlTag | html a
collapsable icon id title body = DivTag
[ ClassAttr "collapsable"
, IdAttr id
]
[ DivTag [ClassAttr ("collapsable-head collapsable-head-" +++ icon)]
[ SpanTag [ClassAttr ("icon icon-" +++ icon)] []
, Text title
]
, DivTag [ClassAttr "collapsable-body"] [html body]
]
writeHTMLSite :: !FilePath !HTMLSite !*World -> *(![String], !*World)
writeHTMLSite root site w
# (assets,w) = findAssetsDirectory w
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment