mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Munstrap various Scripts
This commit is contained in:
parent
fe5af0fb1a
commit
3f9190c083
1 changed files with 31 additions and 0 deletions
31
templates/munstrap/static/js/munstrap.js
Normal file
31
templates/munstrap/static/js/munstrap.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Sanitize all tab links
|
||||||
|
*/
|
||||||
|
$( "ul#tabs>li>a" ).each(function( index ) {
|
||||||
|
var eid = element_clear($( this ).attr('href')).replace(/[^#\w]/gi,'_');
|
||||||
|
$( this ).attr('href', eid);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sanitize all tab ids
|
||||||
|
*/
|
||||||
|
$( "div#munin_nodeview_tab>div" ).each(function( index ) {
|
||||||
|
var eid = element_clear($( this ).attr('id')).replace(/[^\w]/gi,'_');
|
||||||
|
$( this ).attr('id', eid);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the URL with selected tab and active selected tab on page refresh
|
||||||
|
*/
|
||||||
|
$(document).ready(function() {
|
||||||
|
if(location.hash) {
|
||||||
|
$('a[href="' + location.hash + '"]').tab('show');
|
||||||
|
}
|
||||||
|
$(document.body).on("click", "a[data-toggle=tab]", function(event) {
|
||||||
|
location.hash = this.getAttribute("href");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$(window).on('popstate', function() {
|
||||||
|
var anchor = location.hash || $("a[data-toggle=tab]").first().attr("href");
|
||||||
|
$('a[href="' + location.hash + '"]').tab('show');
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue