[tor-commits] [atlas/master] Simplify the code enabling the tooltips

irl at torproject.org irl at torproject.org
Wed Mar 1 17:01:13 UTC 2017


commit 68b35f406a887c2783519b7ccc012c2233961699
Author: cypherpunks <cypherpunks at torproject.org>
Date:   Tue Feb 7 18:01:22 2017 +0000

    Simplify the code enabling the tooltips
    
    The simplification enables tooltips only on elements within the "tip"
    class and sample points in the graphs.
---
 js/views/about/main.js        | 10 ----------
 js/views/details/main.js      | 10 ----------
 js/views/search/do.js         |  4 +---
 templates/details/router.html |  2 +-
 templates/search/do.html      |  6 +++---
 5 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/js/views/about/main.js b/js/views/about/main.js
index 2aae5da..4d6aad1 100644
--- a/js/views/about/main.js
+++ b/js/views/about/main.js
@@ -18,16 +18,6 @@ define([
             var compiledTemplate = _.template(aboutTemplate, data);
             this.el.html(compiledTemplate);
             //$("#loading").hide();
-            //$(".flag .tooltip").hide();
-            //$(".tip").tooltip();
-            $(".flag").hover(function(){
-                $(this).children(".tooltip").show();
-
-            }, function(e){
-
-                $(this).children(".tooltip").hide();
-
-            });
         }
     });
     return new aboutView;
diff --git a/js/views/details/main.js b/js/views/details/main.js
index 4becdf9..ce4f87b 100644
--- a/js/views/details/main.js
+++ b/js/views/details/main.js
@@ -240,17 +240,7 @@ define([
             }
 
             $("#loading").hide();
-            $(".flags").tooltip();
-            $(".flag .tooltip").hide();
             $(".tip").tooltip();
-            $(".flag").hover(function(){
-                $(this).children(".tooltip").show();
-
-            }, function(e){
-
-                $(this).children(".tooltip").hide();
-
-            });
         },
         error: function() {
             var compiledTemplate = _.template(errorDetailsTemplate, {relay: null});
diff --git a/js/views/search/do.js b/js/views/search/do.js
index 4226dd8..1899e85 100644
--- a/js/views/search/do.js
+++ b/js/views/search/do.js
@@ -160,9 +160,7 @@ define([
 				"aaSorting": [],
                 "fnDrawCallback": function( oSettings ) {
                     // Make the tooltips
-                    $(".flags").tooltip();
-                    $(".country").tooltip();
-                    $(".uptime").tooltip();
+                    $(".tip").tooltip();
                 }
 			});
             // Type ahead for country codes
diff --git a/templates/details/router.html b/templates/details/router.html
index d3f80ed..0b20237 100644
--- a/templates/details/router.html
+++ b/templates/details/router.html
@@ -76,7 +76,7 @@
 
     <dt><span class="tip" title="Flags that the directory authorities assigned to this relay." data-original-title="Relay flags">Flags</span></dt>
     <dd><% _.each(relay.get('flags'), function(flag) { %>
-        <span class="flags" title="<%= flag[0] %><br /><%= flag[2] %>">
+        <span class="tip flags" title="<%= flag[0] %><br /><%= flag[2] %>">
             <img class="inline" alt="" src="img/flags/<%= flag[1] %>.png"/>
             <span class="inline"><%= flag[0] %></span>
         </span>
diff --git a/templates/search/do.html b/templates/search/do.html
index c534f7a..cd07a61 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -81,19 +81,19 @@
             </td>
 			<td><span data-filter="<%= relay.get('bandwidth') %>"><%= relay.get('bandwidth_hr') %></td>
 			<td>
-            <span data-hidden="<%= relay.get('last_restarted') %>" title="<%= relay.get('uptime_hrfull') %>" data-filter="<%= relay.get('uptime') %>" class="uptime">
+            <span data-hidden="<%= relay.get('last_restarted') %>" title="<%= relay.get('uptime_hrfull') %>" data-filter="<%= relay.get('uptime') %>" class="tip uptime">
             <% if (relay.get('running') === false) { %><s><% } %><%= relay.get('uptime_hr') %><% if (relay.get('running') === false) { %></s><% } %>
             </span>
             </td>
 			<td>
             <% if ( relay.get('country')) { %>
-            <img class="inline country" title="<%= relay.get('countryname') %>" alt="<%= relay.get('countryname') %>" src="img/cc/<%= relay.get('country') %>.png"/>
+            <img class="tip inline country" title="<%= relay.get('countryname') %>" alt="<%= relay.get('countryname') %>" src="img/cc/<%= relay.get('country') %>.png"/>
             <% } %>
             </td>
 			<td><%= relay.get('or_address') %></td>
 			<td>
             <% _.each(relay.get('flags'), function(flag) { %>
-            <img class="inline flags" rel="tooltip" src="img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/>
+            <img class="tip inline flags" src="img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/>
             <% }); %>
             </td>
 			<td><%= relay.get('or_port') %></td>





More information about the tor-commits mailing list