2016-12-07 05:46:27 +01:00
|
|
|
/*
|
|
|
|
* Sanitize all tab links
|
|
|
|
*/
|
2016-12-07 06:23:25 +01:00
|
|
|
$("ul#tabs>li>a").each(function (index) {
|
|
|
|
var eid = $(this).attr('href').replace(/[^#\w]/gi, '_');
|
|
|
|
$(this).attr('href', eid);
|
2016-12-07 05:46:27 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanitize all tab ids
|
|
|
|
*/
|
2016-12-07 06:23:25 +01:00
|
|
|
$("div#munin_nodeview_tab>div").each(function (index) {
|
|
|
|
var eid = $(this).attr('id').replace(/[^\w]/gi, '_');
|
|
|
|
$(this).attr('id', eid);
|
2016-12-07 05:46:27 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the URL with selected tab and active selected tab on page refresh
|
|
|
|
*/
|
2016-12-07 06:23:25 +01:00
|
|
|
$(document).ready(function () {
|
|
|
|
if (location.hash) {
|
2016-12-07 05:46:27 +01:00
|
|
|
$('a[href="' + location.hash + '"]').tab('show');
|
|
|
|
}
|
2016-12-07 06:23:25 +01:00
|
|
|
$(document.body).on("click", "a[data-toggle=tab]", function (event) {
|
2016-12-07 05:46:27 +01:00
|
|
|
location.hash = this.getAttribute("href");
|
|
|
|
});
|
|
|
|
});
|
2016-12-07 06:23:25 +01:00
|
|
|
$(window).on('popstate', function () {
|
2016-12-07 05:46:27 +01:00
|
|
|
var anchor = location.hash || $("a[data-toggle=tab]").first().attr("href");
|
2016-12-07 05:59:38 +01:00
|
|
|
$('a[href="' + anchor + '"]').tab('show');
|
2016-12-07 05:46:27 +01:00
|
|
|
});
|