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

Change subject: Improvements to TUX shortcuts
......................................................................


Improvements to TUX shortcuts

Indicators for insertables were only partially visible,
possibly due to CSS change in core that reduced margin.

* Amend the message to mention the trigger
* Position properly in RTL
* Made the indicators more visible
* Added indicators for up/down arrows
* Removed special case for insertables
* Update indicators after using a shortcut

Change-Id: I16f12ea39ad16a5dfb3d4cf2fd1aeb72bee3343b
---
M i18n/core/en.json
M resources/css/ext.translate.editor.css
M resources/js/ext.translate.editor.js
M resources/js/ext.translate.editor.shortcuts.js
4 files changed, 49 insertions(+), 18 deletions(-)

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



diff --git a/i18n/core/en.json b/i18n/core/en.json
index a352845..4d48f64 100644
--- a/i18n/core/en.json
+++ b/i18n/core/en.json
@@ -327,7 +327,7 @@
     "tux-editor-skip-button-label": "Skip to next",
     "tux-editor-cancel-button-label": "Cancel",
     "tux-editor-confirm-button-label": "Confirm translation",
-    "tux-editor-shortcut-info": "Press \"$1\" to save or \"$2\" to skip to 
next message",
+    "tux-editor-shortcut-info": "Press \"$1\" to save or \"$2\" to skip to 
next message or \"$3\" for other shortcuts.",
     "tux-editor-edit-desc": "Edit documentation",
     "tux-editor-add-desc": "Add documentation",
     "tux-editor-suggestions-title": "Suggestions",
@@ -389,4 +389,4 @@
     "translate-statsbar-tooltip": "$1% translated, $2% reviewed",
     "translate-statsbar-tooltip-with-fuzzy": "$1% translated, $2% reviewed, 
$3% outdated",
     "translate-search-more-groups-info": "$1 more {{PLURAL:$1|group|groups}}"
-}
\ No newline at end of file
+}
diff --git a/resources/css/ext.translate.editor.css 
b/resources/css/ext.translate.editor.css
index 40a878e..c47798f 100644
--- a/resources/css/ext.translate.editor.css
+++ b/resources/css/ext.translate.editor.css
@@ -398,11 +398,19 @@
 }
 
 .shortcut-popup {
-       position: absolute;
-       width: 16px;
+       /* Firefox likes to add "relative" inline for elements with offset */
+       position: absolute !important;
+       width: 17px;
        height: 17px;
        line-height: 17px;
        overflow: hidden;
-       font-size: 11px;
+       font-size: 13px;
        text-align: center;
+       border: gray 1px dashed;
+       border-radius: 100%;
+       z-index: 110;
+       background-color: white;
+       margin-top: -10px;
+       /* @noflip */
+       margin-left: -10px;
 }
diff --git a/resources/js/ext.translate.editor.js 
b/resources/js/ext.translate.editor.js
index 5f46bfa..71fd27d 100644
--- a/resources/js/ext.translate.editor.js
+++ b/resources/js/ext.translate.editor.js
@@ -539,6 +539,8 @@
                                        e.preventDefault();
                                        e.stopPropagation();
                                        translateEditor.$editor.find( 
'.shortcut-activated:visible' ).eq( index ).trigger( 'click' );
+                                       // Update numbers and locations after 
trigger should be completed
+                                       window.setTimeout( function() { 
translateEditor.showShortcuts(); }, 100 );
                                }
 
                                if ( e.which === 18 && e.type === 'keyup' ) {
@@ -725,7 +727,8 @@
                                        .addClass( 'row shortcutinfo' )
                                        .text( mw.msg( 
'tux-editor-shortcut-info',
                                                ( 
mw.util.tooltipAccessKeyPrefix + 's' ).toUpperCase(),
-                                               ( 
mw.util.tooltipAccessKeyPrefix + 'd' ).toUpperCase() )
+                                               ( 
mw.util.tooltipAccessKeyPrefix + 'd' ).toUpperCase(),
+                                               'ALT' )
                                        )
                                );
                        }
diff --git a/resources/js/ext.translate.editor.shortcuts.js 
b/resources/js/ext.translate.editor.shortcuts.js
index c2e53f4..e68b6e3 100644
--- a/resources/js/ext.translate.editor.shortcuts.js
+++ b/resources/js/ext.translate.editor.shortcuts.js
@@ -6,34 +6,54 @@
 
        var translateEditorShortcuts = {
                showShortcuts: function () {
-                       var editorOffset, minTop, maxTop;
+                       var editorOffset, minTop, maxTop, maxLeft, middle, rtl;
+
+                       // Any better way?
+                       rtl = $( 'body' ).is( '.rtl' );
 
                        editorOffset = this.$editor.offset();
                        minTop = editorOffset.top;
-                       maxTop = minTop + this.$editor.height();
+                       maxTop = minTop + this.$editor.outerHeight();
+                       middle = minTop + ( maxTop - minTop ) / 2;
+
+                       maxLeft = editorOffset.left;
+                       if ( !rtl ) {
+                                maxLeft += this.$editor.outerWidth();
+                       }
 
                        this.hideShortcuts();
+
+                       // For scrolling up and down
+                       $( '<div>' )
+                               .text( '↑' )
+                               .offset( { top: middle - 10, left: maxLeft } )
+                               .addClass( 'shortcut-popup' )
+                               .appendTo( 'body' );
+
+                       $( '<div>' )
+                               .text( '↓' )
+                               .offset( { top: middle + 10, left: maxLeft } )
+                               .addClass( 'shortcut-popup' )
+                               .appendTo( 'body' );
+
                        this.$editor.find( '.shortcut-activated:visible' 
).each( function ( index ) {
-                               var popup,
-                                       $this = $( this ),
+                               var $this = $( this ),
                                        offset = $this.offset();
 
+                               if ( rtl ) {
+                                       offset.left += $this.outerWidth();
+                               }
+
                                // Let's not have numbers appear outside the 
editor over other content
-                               if ( offset.top + 15 > maxTop || offset.top < 
minTop ) {
+                               if ( offset.top > maxTop || offset.top < minTop 
) {
                                        return;
                                }
 
-                               popup = $( '<div>' )
+                               $( '<div>' )
                                        .text( index + 1 )
                                        .offset( offset )
                                        .addClass( 'shortcut-popup' )
-                                       .css( 'position', 'absolute' )
                                        .appendTo( 'body' );
-
-                               // Insertables need special positioning
-                               if ( $this.is( '.insertable' ) ) {
-                                       popup.css( 'margin-top', '30px' );
-                               }
                        } );
                },
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I16f12ea39ad16a5dfb3d4cf2fd1aeb72bee3343b
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to