jenkins-bot has submitted this change and it was merged.

Change subject: Modifies Play button and layover because the previous layover 
was hiding the static graph
......................................................................


Modifies Play button and layover because the previous layover was hiding the 
static graph

Bug: T120146
Change-Id: I3ab1deb9b491bf51ed161ec21094c3d3792690f5
---
M i18n/en.json
M i18n/qqq.json
M includes/Graph.body.php
A includes/ajax-loader.gif
M modules/graph-loader.js
M styles/common.less
6 files changed, 61 insertions(+), 49 deletions(-)

Approvals:
  Yurik: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 70c9085..26531d8 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -46,9 +46,5 @@
        "graph-ve-dialog-edit-unknown-graph-type-warning": "The type of this 
graph is unsupported, and any modifications made to it may break its display. 
Please edit the graph through the raw data specification on the 
\"{{int:graph-ve-dialog-edit-page-raw}}\" tab.",
        "graph-ve-no-spec": "No graph specification found",
        "graph-ve-vega-error": "Vega has encountered an error rendering this 
graph",
-       "graph-ve-vega-error-no-render": "Vega was unable to render this graph",
-       "graph-interactive-title": "Interactive",
-       "graph-switch-button": "Play",
-       "graph-loading": "Loading...",
-       "graph-loading-done": "Done!"
+       "graph-ve-vega-error-no-render": "Vega was unable to render this graph"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f63546c..a8222fb 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -48,9 +48,5 @@
        "graph-ve-dialog-edit-unknown-graph-type-warning": "Warning label about 
unsupported graph types",
        "graph-ve-no-spec": "Label to display on a graph node when no spec is 
found",
        "graph-ve-vega-error": "Label to display on a graph node when Vega 
encounters an unknown error",
-       "graph-ve-vega-error-no-render": "Label to display on a graph node when 
Vega is unable to render",
-       "graph-interactive-title": "Label to display on the layover to indicate 
interactive graph",
-       "graph-switch-button": "Button to turn the static graph image into an 
interactive graph\n{{Identical|Play}}",
-       "graph-loading": "Label to indicate when the interactive graph is 
loading\n{{Identical|Loading}}",
-       "graph-loading-done": "Label to indicate when the interactive graph has 
loaded\n{{Identical|Done}}"
+       "graph-ve-vega-error-no-render": "Label to display on a graph node when 
Vega is unable to render"
 }
diff --git a/includes/Graph.body.php b/includes/Graph.body.php
index 6cf80c6..0c06206 100644
--- a/includes/Graph.body.php
+++ b/includes/Graph.body.php
@@ -204,7 +204,9 @@
                        $url = sprintf( $wgGraphImgServiceUrl, $server, $title, 
$revid, $hash );
                        $html = Html::rawElement( 'img', array(
                                        'class' => 'mw-graph-img',
-                                       'src' => $url
+                                       'src' => $url,
+                                       'alt' => $graphTitle,
+                                       'title' => $graphTitle,
                        ) );
 
                        if ( $isInteractive ) {
@@ -213,21 +215,19 @@
                                $attribs = self::buildDivAttributes( 
'interactable', $data, $hash );
 
                                // Add a "make interactive" button
-                               $buttonSpan = Html::rawElement( 'span', null, 
wfMessage( 'graph-switch-button' )->inContentLanguage()->text() );
                                $buttonIcon = Html::rawElement( 'i', array( 
'class' => 'icon-play' ), '►' );
 
                                $button = Html::rawElement( 'div', array(
                                        'class' => 'mw-graph-switch',
-                               ), $buttonIcon . $buttonSpan );
+                               ), $buttonIcon );
 
-                               $layoverContent =
-                                       Html::rawElement( 'p', null, wfMessage( 
'graph-interactive-title' )->inContentLanguage()->text() ) .
-                                       Html::element( 'p', array( 'class' => 
'mw-graph-title' ), $graphTitle ) .
-                                       Html::rawElement( 'div', null, $button 
);
+                               $hoverTitle = Html::element( 'div', array( 
'class' => 'mw-graph-hover-title' ), $graphTitle );
+
+                               $layoverContent = $hoverTitle . $button;
 
                                $layover = Html::rawElement( 'div', array(
                                        'class' => 'mw-graph-layover',
-                               ), Html::rawElement( 'div', null, 
$layoverContent ) );
+                               ), $layoverContent );
 
                                $html .= $layover;
                        } else {
diff --git a/includes/ajax-loader.gif b/includes/ajax-loader.gif
new file mode 100644
index 0000000..c519155
--- /dev/null
+++ b/includes/ajax-loader.gif
Binary files differ
diff --git a/modules/graph-loader.js b/modules/graph-loader.js
index 49a5506..a9163af 100644
--- a/modules/graph-loader.js
+++ b/modules/graph-loader.js
@@ -12,8 +12,8 @@
 
                        // Add a class to decorate loading
                        $button.hide()
+                               .html( '' )
                                .addClass( 'mw-graph-loading' )
-                               .text( mw.message( 'graph-loading' ).text() )
                                .show();
 
                        // Replace the image with the graph
@@ -39,15 +39,10 @@
                                        hash: $el.data( 'graphId' )
                                } ).done( function ( data ) {
                                        mw.drawVegaGraph( $el[ 0 ], data.graph, 
function ( error ) {
-                                               var $button = $el.find( 
'.mw-graph-switch' ),
-                                                       $layover = $el.find( 
'.mw-graph-layover' );
+                                               var $layover = $el.find( 
'.mw-graph-layover' );
                                                if ( !error ) {
                                                        $el.find( 'img' 
).remove();
-                                                       $button.text( 
mw.message( 'graph-loading-done' ).text() );
-                                                       setTimeout( function () 
{
-                                                               
$layover.remove();
-                                                               
$el.removeClass( 'mw-graph-loading mw-graph-interactable' );
-                                                       }, 800 );
+                                                       $layover.remove();
                                                } else {
                                                        mw.log.warn( error );
                                                }
diff --git a/styles/common.less b/styles/common.less
index 9f319b7..87ee499 100644
--- a/styles/common.less
+++ b/styles/common.less
@@ -2,6 +2,10 @@
 @import "mediawiki.mixins";
 @import "mediawiki.mixins.animation";
 
+@darkColor:  #2B333F;
+@darkColorOpac: rgba(43,51,63,0.7);
+@colorWhiteOpac: rgba(255,255,255,0.7);
+
 .client-js {
 
   .mw-graph {
@@ -20,8 +24,23 @@
     &:hover {
       cursor: pointer;
 
+      .mw-graph-hover-title {
+        display: block;
+      }
+
       .mw-graph-layover {
         display: block;
+        background: @colorWhiteOpac;
+      }
+
+      .mw-graph-switch {
+        &.mw-graph-loading {
+          background-color: @colorWhite;
+        }
+
+        &:hover {
+          background-color: @colorWhite;
+        }
       }
 
     }
@@ -30,34 +49,29 @@
   /* white layover */
   .mw-graph-layover {
     display: block;
-    background: rgba(255,255,255, .7);
     position: absolute;
     top: 0;
     left: 0;
     right: 0;
     bottom: 0;
-    padding: 30px;
     z-index: 1;
 
     /* center the container vertically */
     &> div {
       position: absolute;
-      top: ~"calc(50% - 78px)";
-      left: 0;
-      right: 0;
+      left: 10px;
+      top: 10px;
     }
 
-    p, div {
+    .mw-graph-hover-title {
+      display: none;
+      position: absolute;
+      top: ~"calc(50% - 17px)";
+      left: 1em;
+      right: 1em;
       text-align: center;
-      font-weight: 700;
-    }
-    p:not(.mw-graph-title) {
-      text-transform: uppercase;
-    }
-    p.mw-graph-title {
       font-size: 150%;
-      margin-top: 5px;
-      margin-bottom: 30px;
+      background-color: @colorWhite;
     }
   }
 
@@ -76,16 +90,21 @@
     text-align: center;
     cursor: pointer;
     white-space: nowrap;
-    line-height: 30px;
+    line-height: 1em;
     padding: .5em;
-    width: 100px;
+    width: 60px;
   }
 
   /* Play button style */
   .mw-graph-switch {
-    background-color: @colorProgressive;
-    border-color: @colorProgressive;
-    color: @colorWhite;
+    border-width: 2px;
+    border-style: solid;
+    border-color: #333;
+    border-radius: .3em;
+
+    color: @darkColor;
+    background-color: @colorWhite;
+    background-color: @colorWhiteOpac;
 
     &:hover {
       background: @colorProgressiveHighlight;
@@ -108,10 +127,8 @@
       top: 4px;
       left: 0;
       bottom: 0;
-      margin-right: 10px;
-      font-size: 170%;
+      font-size: 160%;
       font-style: normal;
-      line-height: 25px;
     }
 
   }
@@ -121,10 +138,18 @@
 
     color: @colorGray5;
     background-color: @colorWhite;
+    border-color: @colorProgressiveActive;
 
     &:hover {
-      background: @colorGrayLighter;
+      border-color: #333;
     }
+    .transition(~"background 0s ease");
+    background-position: 50% 50%;
+    background-size: 20px;
+    background-repeat: no-repeat;
+    /* @embed */
+    background-image: url(../includes/ajax-loader.gif);
+    display: block;
   }
 
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ab1deb9b491bf51ed161ec21094c3d3792690f5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: JGirault <[email protected]>
Gerrit-Reviewer: JGirault <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to