From 62e48f517791cc7c0df7cb15aef308aa3bd450b0 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 22:49:34 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/dos/ext/vis/docs/js/main.js | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 js/dos/ext/vis/docs/js/main.js diff --git a/js/dos/ext/vis/docs/js/main.js b/js/dos/ext/vis/docs/js/main.js new file mode 100644 index 0000000..0cc33e0 --- /dev/null +++ b/js/dos/ext/vis/docs/js/main.js @@ -0,0 +1,46 @@ +$(document).ready(function() { + + vis.createBreadcrumbs($(".container.full").first()); + +}); + +// namespace +var vis = {}; + +/** + * Adds a breadcrumb as first child to the specified container. + * + * @author felixhayashi + */ +vis.createBreadcrumbs = function(container) { + + // use the url to infer the path + var crumbs = location.pathname.split('/'); + + // number of ancestor directories + var stepbackIndex = crumbs.length-1; + var breadcrumbs = $.map(crumbs, function(crumb, i) { + + // first and last element of the split + if(!crumb) return; + + stepbackIndex--; + + if(/\.html$/.test(crumb)) { + + // strip the .html to make it look prettier + return "" + crumb.replace(/\.html$/, "") + ""; + + } else { + + // calculate the relative url + for(var ref=crumb+"/", j=0; j" + crumb + ""; + } + }).join("") || "Home"; + + // insert into the container at the beginning. + $(container).prepend("
" + breadcrumbs + "
"); + +}; \ No newline at end of file