Commits

Gora Khargosh committed c711276

Cleans up toolbar button handling code.

  • Participants
  • Parent commits 0145c91

Comments (0)

Files changed (1)

File coverage/htmlfiles/coverage_html.js

     coverage.assign_shortkeys();
     coverage.wire_up_help_panel();
 
-    // Toolbar buttons
-    var elements = {
-        button_stats_run: $('#button-stats-run'),
-        button_stats_missing: $('#button-stats-missing'),
-        button_stats_excluded: $('#button-stats-excluded'),
-        button_stats_par: $('#button-stats-par'),
-        source_run: $('#source .run'),
-        source_missing: $('#source .mis'),
-        source_excluded: $('#source .exc'),
-        source_par: $('#source .par')
-    };
+    // Toolbar buttons and behavior.
     var map_button_to_context = {
         "button-stats-run": {
-            source_code: elements.source_run,
+            source_code: $('#source .run'),
             hide_class_name: 'hide_run'
         },
         "button-stats-missing": {
-            source_code: elements.source_missing,
+            source_code: $('#source .mis'),
             hide_class_name: 'hide_mis'
         },
         "button-stats-excluded": {
-            source_code: elements.source_excluded,
+            source_code: $('#source .exc'),
             hide_class_name: 'hide_exc'
         },
         "button-stats-par": {
-            source_code: elements.source_par,
+            source_code: $('#source .par'),
             hide_class_name: 'hide_par'
         }
     };
-    // Handle toolbar events.
     var when_button_stats_clicked = function(event){
         var elem = $(this),
             context = map_button_to_context[elem.attr('id')];
         coverage.toggle_lines(elem, context);
     };
-    elements.button_stats_run.click(when_button_stats_clicked);
-    elements.button_stats_missing.click(when_button_stats_clicked);
-    elements.button_stats_excluded.click(when_button_stats_clicked);
-    elements.button_stats_par.click(when_button_stats_clicked);
-
-    // TODO: Show missing parts by default using JavaScript.
-    //elements.button_stats_missing.click();
+    $('#button-stats-run').click(when_button_stats_clicked);
+    $('#button-stats-missing').click(when_button_stats_clicked);
+    $('#button-stats-excluded').click(when_button_stats_clicked);
+    $('#button-stats-par').click(when_button_stats_clicked);
 };
 
 coverage.toggle_lines = function (btn, context) {