Home | History | Annotate | Download | only in resources
      1 $(document).ready(function() {
      2     $('a.navigator-link').click(function() {
      3         // Extract the panel for this link
      4         var panel = getPanelName($(this));
      5 
      6         // Mark this link as currently selected
      7         $('.navigator-link').parent().removeClass('navigator-selected');
      8         $(this).parent().addClass('navigator-selected');
      9 
     10         showPanel(panel);
     11     });
     12 
     13     installMethodHandlers('failed');
     14     installMethodHandlers('skipped');
     15     installMethodHandlers('passed', true); // hide passed methods by default
     16 
     17     $('a.method').click(function() {
     18         showMethod($(this));
     19         return false;
     20     });
     21 
     22     // Hide all the panels and display the first one (do this last
     23     // to make sure the click() will invoke the listeners)
     24     $('.panel').hide();
     25     $('.navigator-link').first().click();
     26 
     27     // Collapse/expand the suites
     28     $('a.collapse-all-link').click(function() {
     29         var contents = $('.navigator-suite-content');
     30         if (contents.css('display') == 'none') {
     31             contents.show();
     32         } else {
     33             contents.hide();
     34         }
     35     });
     36 });
     37 
     38 // The handlers that take care of showing/hiding the methods
     39 function installMethodHandlers(name, hide) {
     40     function getContent(t) {
     41     return $('.method-list-content.' + name + "." + t.attr('panel-name'));
     42     }
     43 
     44     function getHideLink(t, name) {
     45         var s = 'a.hide-methods.' + name + "." + t.attr('panel-name');
     46         return $(s);
     47     }
     48 
     49     function getShowLink(t, name) {
     50         return $('a.show-methods.' + name + "." + t.attr('panel-name'));
     51     }
     52 
     53     function getMethodPanelClassSel(element, name) {
     54         var panelName = getPanelName(element);
     55     var sel = '.' + panelName + "-class-" + name;
     56         return $(sel);
     57     }
     58 
     59     $('a.hide-methods.' + name).click(function() {
     60         var w = getContent($(this));
     61         w.hide();
     62         getHideLink($(this), name).hide();
     63         getShowLink($(this), name).show();
     64     getMethodPanelClassSel($(this), name).hide();
     65     });
     66 
     67     $('a.show-methods.' + name).click(function() {
     68         var w = getContent($(this));
     69         w.show();
     70         getHideLink($(this), name).show();
     71         getShowLink($(this), name).hide();
     72     showPanel(getPanelName($(this)));
     73     getMethodPanelClassSel($(this), name).show();
     74     });
     75 
     76     if (hide) {
     77         $('a.hide-methods.' + name).click();
     78     } else {
     79         $('a.show-methods.' + name).click();
     80     }
     81 }
     82 
     83 function getHashForMethod(element) {
     84     return element.attr('hash-for-method');
     85 }
     86 
     87 function getPanelName(element) {
     88     return element.attr('panel-name');
     89 }
     90 
     91 function showPanel(panelName) {
     92     $('.panel').hide();
     93     var panel = $('.panel[panel-name="' + panelName + '"]');
     94     panel.show();
     95 }
     96 
     97 function showMethod(element) {
     98     var hashTag = getHashForMethod(element);
     99     var panelName = getPanelName(element);
    100     showPanel(panelName);
    101     var current = document.location.href;
    102     var base = current.substring(0, current.indexOf('#'))
    103     document.location.href = base + '#' + hashTag;
    104     var newPosition = $(document).scrollTop() - 65;
    105     $(document).scrollTop(newPosition);
    106 }
    107 
    108 function drawTable() {
    109     for (var i = 0; i < suiteTableInitFunctions.length; i++) {
    110         window[suiteTableInitFunctions[i]]();
    111     }
    112 
    113     for (var k in window.suiteTableData) {
    114         var v = window.suiteTableData[k];
    115         var div = v.tableDiv;
    116         var data = v.tableData
    117         var table = new google.visualization.Table(document.getElementById(div));
    118         table.draw(data, {
    119             showRowNumber : false
    120         });
    121     }
    122 }
    123