[perf-web] Cleanup: refactor common code



commit b2d24f372a16e3b23b60f85385c0abcd43b95b1c
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jul 23 19:39:57 2014 -0400

    Cleanup: refactor common code

 static/main.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/static/main.js b/static/main.js
index 8f9f652..f6071bc 100644
--- a/static/main.js
+++ b/static/main.js
@@ -1087,9 +1087,16 @@ PerfDisplay.prototype._loadRange = function(group, start, end) {
              }});
 }
 
-PerfDisplay.prototype.onWindowLoaded = function() {
+PerfDisplay.prototype.updateElementsForRange = function() {
+    var rangeType = this.rangeType;
+
     $( "#aboveMainLeft a" ).removeClass('range-active');
-    $( "#" + this.rangeType + "Link" ).addClass('range-active');
+    $( "#" + rangeType + "Link" ).addClass('range-active');
+}
+
+
+PerfDisplay.prototype.onWindowLoaded = function() {
+    this.updateElementsForRange();
 
     if (this.windowLoaded)
         return;
@@ -1131,10 +1138,9 @@ PerfDisplay.prototype.onWindowLoaded = function() {
 
 function setRange(e, a, rangeType) {
     e.preventDefault();
-    $( "#aboveMainLeft a" ).removeClass('range-active');
-    $( a ).addClass('range-active');
 
     theDisplay.setPositionAndRange(theDisplay.centerTime, rangeType, false);
+    theDisplay.updateElementsForRange();
 }
 
 function getQueryParams() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]