mobile-responsive[1].js

$.noConflict();
var uspsabout = uspsabout || {};

uspsabout.setheight = function($) {
$(‘#ls-gen3-ls-fxr, #main’).height(function(){
var sheight = $(‘#slidernav’).height();
var cheight = Math.max($(‘#ls-row-2-area-2’).height(), $(‘#main-repeat’).height());
if ($(‘#ls-row-2-area-3’).css(‘float’) === ‘none’) {
cheight += $(‘#ls-row-2-area-3’).height();
}
return (sheight > cheight) ? sheight : ‘auto’;
});
}

uspsabout.customizeLeftNav = function($) {
// see if there is a second-level menu in the left nav
var subnav = $(‘#sub-nav-menu .content-wrapper ul.selected’), subparent = ”, submatch = ”, subhref = ”;
if (subnav.length === 1) {
subparent = $(subnav).parents(‘.content-wrapper’).prevAll(‘h2’).eq(0).find(‘a’);
// clone the submenu into the slider
$(‘#slidernav li a[href=”‘ + $(subparent).attr(‘href’) + ‘”]’).after(subnav.clone());
// add class so slider is expanded to show submenu
$(‘#slidernav ul.selected’).parents(‘ul’).eq(0).addClass(‘expanded’);
}
// see if there is a top level left nav entry highlighted
subnav = $(‘#sub-nav-menu h2.selected’);
if (subnav.length === 1) {
subhref = $(subnav).find(‘a’).attr(‘href’).replace(/\?$/,”);
submatch = $(‘#slidernav li a[href^=”‘ + subhref + ‘”]’);
if (submatch.length) {
submatch.eq(0)
.addClass(‘selected’)
.parents(‘ul’).eq(0)
.addClass(‘expanded’);
}
} else {
// no match, try to default to overview link
submatch = location.pathname;
if (submatch.charAt(submatch.length – 1) === ‘/’) {
// add default page name if missing
submatch += ‘welcome.htm’;
}
submatch = $(‘#slidernav li a[href=”‘ + submatch + ‘”]’).last();
if (submatch.length) {
submatch.eq(0)
.addClass(‘selected’)
.parents(‘ul’).eq(0)
.addClass(‘expanded’);
}
}

// Somewhere in the older libraries is code specific to
// Firefox and IE >= 9 that does invalid highlighting
// Remove the classes to resolve the problem
// Has no effect on other browsers
$(‘#sub-nav-sidebar .open’).each(function(){
$(this).removeClass(‘open’).find(‘.selected’).removeClass(‘selected’);
})
}

jQuery(document).ready(function($) {
var hasMain = $(‘#main’).length;
var hasIng = $(‘#page-centering .lefting’).length;

// add missing meta elements
$(‘head’).append(‘‘);
$(‘head’).append(‘‘);

// add identifier if page has three columns
if ($(‘#ls-row-2-area-3’).length) {
$(‘#ls-row-2’).addClass(‘has3cols’);
} else if ($(‘#nest2-top’).length) {
$(‘#my_row_1’).addClass(‘has3cols’);
} else if ($(‘#ls-row-2-area-2’).length === 0) {
// rare case, page with only one column for content, no left nav
$(‘#ls-row-2’).addClass(‘has1col’);
}

// create a sliding left nav for small displays based on top nav for desktop
var slidenav = $(‘

    ‘), slideitem = ”;
    $(‘#navigation-list>li’).each(function(){
    slideitem=$(‘

  • ‘);
    $(this).find(‘h3 a’).clone(true).appendTo(slideitem);
    $(this).find(‘.list-wrapper>ul’).clone().appendTo(slideitem);
    slideitem.appendTo(slidenav);
    });
    slidenav.find(‘>li>a’).each(function(){
    var $this = $(this);
    $this
    .siblings(‘ul:first’)
    .find(‘li:first’)
    .before($(‘
  • Overview
  • ‘));
    $this.click(function(e){
    e.preventDefault();
    $(this).siblings(‘ul:first’).toggleClass(‘expanded’);
    uspsabout.setheight(jQuery);
    });
    });
    if (hasMain) {
    $(‘#main-repeat’).before(slidenav);
    } else if (hasIng) {
    $(‘#page-centering .lefting’).before(slidenav);
    } else {
    $(‘#ls-row-2-area-1’).before(slidenav);
    }

    // add button in top nav area to show/hide sliding menu
    $(‘#navigation-list’)
    .before($(‘

    ‘));
    if (hasMain) {
    $(‘#expando a’).click(function(e){
    e.preventDefault();
    $(‘#expando, #main’).toggleClass(‘active’);
    if ($(‘#main’).hasClass(‘active’)) {
    uspsabout.setheight(jQuery);
    } else {
    $(‘#main’).height(‘auto’);
    }
    });
    } else if (hasIng) {
    $(‘#expando a’).click(function(e){
    e.preventDefault();
    $(‘#expando, #page-centering’).toggleClass(‘active’);
    if ($(‘#page-centering’).hasClass(‘active’)) {
    uspsabout.setheight(jQuery);
    } else {
    $(‘#page-centering’).height(‘auto’);
    }
    });
    } else {
    $(‘#expando a’).click(function(e){
    e.preventDefault();
    $(‘#expando, #ls-gen3-ls-fxr’).toggleClass(‘active’);
    if ($(‘#ls-gen3-ls-fxr’).hasClass(‘active’)) {
    uspsabout.setheight(jQuery);
    } else {
    $(‘#ls-gen3-ls-fxr’).height(‘auto’);
    }
    });
    }
    });

    jQuery(window).load(function(e) {
    // Give Dojo code 1 second to complete adding any left subnav
    window.setTimeout(function() {uspsabout.customizeLeftNav(jQuery)},1000);
    });