Révision 3f9190c0
Munstrap various Scripts
| templates/munstrap/static/js/munstrap.js | ||
|---|---|---|
| 1 |
/* |
|
| 2 |
* Sanitize all tab links |
|
| 3 |
*/ |
|
| 4 |
$( "ul#tabs>li>a" ).each(function( index ) {
|
|
| 5 |
var eid = element_clear($( this ).attr('href')).replace(/[^#\w]/gi,'_');
|
|
| 6 |
$( this ).attr('href', eid);
|
|
| 7 |
}); |
|
| 8 |
|
|
| 9 |
/* |
|
| 10 |
* Sanitize all tab ids |
|
| 11 |
*/ |
|
| 12 |
$( "div#munin_nodeview_tab>div" ).each(function( index ) {
|
|
| 13 |
var eid = element_clear($( this ).attr('id')).replace(/[^\w]/gi,'_');
|
|
| 14 |
$( this ).attr('id', eid);
|
|
| 15 |
}); |
|
| 16 |
|
|
| 17 |
/* |
|
| 18 |
* Update the URL with selected tab and active selected tab on page refresh |
|
| 19 |
*/ |
|
| 20 |
$(document).ready(function() {
|
|
| 21 |
if(location.hash) {
|
|
| 22 |
$('a[href="' + location.hash + '"]').tab('show');
|
|
| 23 |
} |
|
| 24 |
$(document.body).on("click", "a[data-toggle=tab]", function(event) {
|
|
| 25 |
location.hash = this.getAttribute("href");
|
|
| 26 |
}); |
|
| 27 |
}); |
|
| 28 |
$(window).on('popstate', function() {
|
|
| 29 |
var anchor = location.hash || $("a[data-toggle=tab]").first().attr("href");
|
|
| 30 |
$('a[href="' + location.hash + '"]').tab('show');
|
|
| 31 |
}); |
|
Formats disponibles : Unified diff