Prtksxna has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/151852

Change subject: Add tooltips for countries with an extra comment
......................................................................

Add tooltips for countries with an extra comment

Change-Id: I913971767c3ea5f427dd712812fb4df5329eb91d
---
M source/data/dmca_requests.csv
M source/data/where_from.csv
M source/javascripts/content.js
M source/stylesheets/graph.css.scss
4 files changed, 34 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/TransparencyReport 
refs/changes/52/151852/1

diff --git a/source/data/dmca_requests.csv b/source/data/dmca_requests.csv
index 3d397e0..b852768 100644
--- a/source/data/dmca_requests.csv
+++ b/source/data/dmca_requests.csv
@@ -1,4 +1,4 @@
-key,requests,complied,duration,comment
+key,requests,complied,duration,tooltip
 USA,13,9,jul12jun13,yes
 United Kingdom,3,0,jul12jun13,yes
 France,2,0,jul12jun13,yes
diff --git a/source/data/where_from.csv b/source/data/where_from.csv
index 5972b6b..a958997 100644
--- a/source/data/where_from.csv
+++ b/source/data/where_from.csv
@@ -1,16 +1,16 @@
 key,value,duration,tooltip
-USA,54,jul12jun13,yes
+USA,54,jul12jun13,One case was American-Brazilian
 Germany,21,jul12jun13
-United Kingdom,17,jul12jun13,yes
-France,13,jul12jun13,yes
+United Kingdom,17,jul12jun13,One case was British-Swiss
+France,13,jul12jun13,One case was French-Saudi Arabian
 Italy,12,jul12jun13
-Spain,2,jul12jun13,yes
+Spain,2,jul12jun13,One case was Spanish-Italian
 Canada,4,jul12jun13
 Australia,2,jul12jun13
 India,1,jul12jun13
 Netherlands,2,jul12jun13
 New Zealand,1,jul12jun13
-Russia,2,jul12jun13,yes
+Russia,2,jul12jun13,One case was Russian-British
 Austria,1,jul12jun13
 Belgium,1,jul12jun13
 Chile,1,jul12jun13
@@ -21,7 +21,7 @@
 Malaysia,1,jul12jun13
 Poland,1,jul12jun13
 Senegal,1,jul12jun13
-Serbia,1,jul12jun13,yes
+Serbia,1,jul12jun13,One case was Serbo-Croat
 Singapore,1,jul12jun13
 Switzerland,1,jul12jun13
 Unknown,4,jul12jun13
diff --git a/source/javascripts/content.js b/source/javascripts/content.js
index 083db37..acf67d4 100644
--- a/source/javascripts/content.js
+++ b/source/javascripts/content.js
@@ -149,7 +149,11 @@
 
                        labels
                                .html( function ( d ) {
-                                       return d.key;
+                                       var tooltip = "";
+                                       if ( typeof d.tooltip !== 'undefined' ) 
{
+                                               tooltip = "<a 
class='where_from_tooltip' title='" + d.tooltip + "'>*</a>";
+                                       }
+                                       return d.key + tooltip;
                                } )
                                .on( 'mouseover', function ( d ) {
                                        var
@@ -176,6 +180,19 @@
 
                        labels.exit().remove();
 
+
+                       // Tooltips for labels
+                       $( '.where_from_tooltip').mouseover( function( e ) {
+                               var text = $( this ).attr( 'title' );
+
+                               tooltip
+                                       .html( text )
+                                       .style( 'top', ( e.pageY - 7 )+ 'px' )
+                                       .style( 'left', ( e.pageX + 15 ) + 'px' 
)
+                                       .style( 'display', 'block' );
+                               return false;
+                       } );
+
                        // Flags
                        var flags = graph.selectAll( 'image.flags' ).data( 
data, function ( d ) {
                                return d.key.split( '*' )[0];
diff --git a/source/stylesheets/graph.css.scss 
b/source/stylesheets/graph.css.scss
index 14f4734..f3f3afa 100644
--- a/source/stylesheets/graph.css.scss
+++ b/source/stylesheets/graph.css.scss
@@ -137,6 +137,15 @@
                cursor: pointer;
                fill: $blue;
        }
+
+       text a {
+               fill: $blue;
+               cursor: pointer;
+
+               &:hover {
+                       text-decoration: none;
+               }
+       }
 }
 
 .bubble_graph {

-- 
To view, visit https://gerrit.wikimedia.org/r/151852
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I913971767c3ea5f427dd712812fb4df5329eb91d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/TransparencyReport
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to