Sha256: a76cee7e41edc214aba4a6a50e6f954cf8caa80dedcb910d4af086fe8b96d5c7

Contents?: true

Size: 1.48 KB

Versions: 101

Compression:

Stored size: 1.48 KB

Contents

function onlyShow(className) {
    $("ul.build-scratch").hide();
    $("ul.build-new").hide();
    $("ul.build-existing").hide();
    if (className) {
        $("ul." + className).show();
    }
}

$( document ).ready(function() {
    // onlyShow(); // hides all level 2 links

    var currentPath = $(location).attr('pathname');

    // add active class to the subnav link based on the current page
    var activeLink = $(".content-nav a").filter(function(i, link) {
      return(link.pathname == currentPath);
    });
    activeLink.addClass("active");

    // hide level 2 list items unless currently under that area
    // if (~currentPath.indexOf("/docs/scratch")) {
    //     console.log("scratch");
    //     onlyShow("build-scratch");
    // } else if (~currentPath.indexOf("/docs/new")) {
    //     console.log("new");
    //     onlyShow("build-new");
    // } else if (~currentPath.indexOf("/docs/existing")) {
    //     console.log("existing");
    //     onlyShow("build-existing");
    // }

    var keymap = {};

    // LEFT
    keymap[ 37 ] = "#prev";
    // RIGHT
    keymap[ 39 ] = "#next";

    $( document ).on( "keyup", function(event) {
        var href,
            selector = keymap[ event.which ];
        // if the key pressed was in our map, check for the href
        if ( selector ) {
            href = $( selector ).attr( "href" );
            if ( href ) {
                // navigate where the link points
                window.location = href;
            }
        }
    });

});

Version data entries

101 entries across 101 versions & 2 rubygems

Version Path
ufo-5.0.7 docs/js/nav.js
ufo-5.0.6 docs/js/nav.js
sonic-screwdriver-2.2.7 docs/js/nav.js
sonic-screwdriver-2.2.6 docs/js/nav.js
sonic-screwdriver-2.2.5 docs/js/nav.js
sonic-screwdriver-2.2.4 docs/js/nav.js
sonic-screwdriver-2.2.3 docs/js/nav.js
sonic-screwdriver-2.2.2 docs/js/nav.js
sonic-screwdriver-2.2.1 docs/js/nav.js
ufo-5.0.5 docs/js/nav.js
ufo-5.0.4 docs/js/nav.js
ufo-5.0.3 docs/js/nav.js
ufo-5.0.2 docs/js/nav.js
ufo-5.0.1 docs/js/nav.js
ufo-5.0.0 docs/js/nav.js
sonic-screwdriver-2.2.0 docs/js/nav.js
ufo-4.6.3 docs/js/nav.js
ufo-4.6.2 docs/js/nav.js
ufo-4.6.1 docs/js/nav.js
ufo-4.6.0 docs/js/nav.js