Select Git revision
_01-foot.mustache
-
jan.hamal.dvorak authored
Signed-off-by:
Jan Hamal Dvořák <mordae@anilinux.org>
jan.hamal.dvorak authoredSigned-off-by:
Jan Hamal Dvořák <mordae@anilinux.org>
_01-foot.mustache 1.04 KiB
<!--DO NOT REMOVE-->
{{{ patternLabFoot }}}
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.js"></script>
<script src="../../js/main.bundle.js?{{ cacheBuster }}"></script>
<script>
/*
* By default, {{ link.[pattern] }} starts with /, which breaks when app
* isn't served from the root like in case of versioned styleguide.
* This fixes that in most cases by detecting the current prefix from
* location.pathname and makes it work the same way the main pattern lab nav.
* IMPORTANT: hrefs need to be marked with data-href instead of real href
*/
var idx = location.pathname.indexOf("/patterns");
var prefix = location.pathname.substring(0, idx);
var anchors = document.querySelectorAll('a[data-href]');
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
if (prefix != "") {
anchor.setAttribute('href', prefix + anchor.dataset.href);
} else {
anchor.setAttribute('href', anchor.dataset.href);
}
}
</script>
</body>
</html>