Search Unity

I made arrow key navigation for the manual, for FF

Discussion in 'Documentation' started by feiting, Dec 25, 2014.

  1. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    I found myself spoiled by other websites that do this, so I went into the jqueries and added a few.

    Find the staticFilesManual directory and you'll see the css and javascript directories. In either, or both Core.js, add this function for fireFox:
    Code (JavaScript):
    1. /****************************************
    2.   ==== 8. USER ADDED FUNCTIONS
    3. ****************************************/ // Allow arrow keys to navigate
    4.   $(document).keypress( function(e) {
    5.     switch(e.keyCode)
    6.     {
    7.       case 37:
    8.      $(".prev")[0].firstElementChild.click();
    9.       break;
    10.       case 38: //up
    11.           var listElem = $("div[class='breadcrumbs clear']")[0].firstElementChild;
    12.           if( listElem.children.length >= 2)
    13.           {
    14.               listElem.children[listElem.children.length-2].firstElementChild.click();
    15.          }
    16.       break;
    17.      case 39:
    18.      $(".next")[0].firstElementChild.click();
    19.      }
    20.       } );
    If I had time I'd map all the hierarchies, group functions by what they do, and erase all inherited properties.

    Thought this might help somebody, or at least spark a document mod
     
  2. Rasmus Selsmark

    Rasmus Selsmark

    Joined:
    Mar 13, 2013
    Posts:
    120
    Cool, thanks. I like the idea of being able to navigate documentation using keyboard (although not sure about using up key, as it conflicts with normal up/down arrows for scrolling the page). Seems that changing keypress() to keydown() in the code above, also makes it work on Chrome.

    Thanks a lot, we'll look into if we can get this into the docs (and in that case how to credit you ofc).

    Btw. which sites were you inspired by?

    Rasmus
     
  3. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    Mostly comics. I am having issues remembering other sites that do this, but I remember going through various manuals like this. Scrolling, I guess I don't normally go "up" since I read linearly.

    Didn't expect a Unity Tech to be responding so quick near holidays, enjoy your vacation!


    Take a look at iOS for the functional categorical organization, and previous Unity docs used hierarchies. Inherited methods are somewhat repetitive, esp, since they are all lumped into one spot. I can't tell if the method comes from 1 or more levels up the tree.

    Not saying it hinders me completely, I wrote a card game, just have to size it for different devices and find a decent HTML rendering thingy.

    edit: I remember, it's Kindle. Amazon kindle lets you do this, and most book-reader programs