blob: f7d96d398102c6efbc1fe1129b1ce06093453f78 [file] [log] [blame]
function detectOS() {
var os="windows";
if (navigator.appVersion.indexOf("Mac")!=-1) os="mac";
if (navigator.appVersion.indexOf("X11")!=-1) os="linux";
if (navigator.appVersion.indexOf("Linux")!=-1) os="linux";
return os;
}
function activeOSInstruction() {
var os = detectOS();
$(".cw-tab-link").removeClass("active");
$(".cw-tab-pane").removeClass("active");
$('.cw-tab-link[data-os="'+os+'"]').addClass('active');
$('.cw-tab-pane[data-os="'+os+'"]').addClass('active');
}
$( document ).ready(function() {
var location = window.location;
var pathname = location.pathname.substring(location.pathname.lastIndexOf('/') + 1);
// Syncs the sidebar to the current page
$('#sidebar-container a').each(function( i ) {
if ($(this)[0].hasAttribute("data-url")){
if($(this).attr('data-url') === pathname){
// Add the class to highlight the selected item in the sidebar
$(this).addClass("cw-current-page");
// Our sidebar supports three levels, so need to iterate up to open up
// the menus so the selected item can be shown
var parentID = $(this).attr("data-parent");
if (parentID && parentID != ""){
$(parentID).collapse();
var grandparentID = "[id=\"" + parentID + "\"]";
if (grandparentID && grandparentID != ""){
var grandparent = $(grandparentID).attr("data-parent");
$(grandparent).collapse();
}
}
// Stop the .each as we found the required URL
return false;
}
}
});
activeOSInstruction();
});