Robmoen has uploaded a new change for review.

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

Change subject: Init last modified when the module is loaded
......................................................................

Init last modified when the module is loaded

* Sets visibility to .last-modified-bar to hidden while
module is loading
* Remove inline scripts for emitting history-link-loaded
From MinervaTemplate.php
* Results in last modified being restyled without a flash
or a dom reflow.

Bug: T108204
Change-Id: I508ca6a94d5b2d7a134e39637ea2f87f3ddc5430
---
M includes/skins/MinervaTemplate.php
M resources/mobile.head/init.js
M resources/skins.minerva.base.styles/ui.less
3 files changed, 7 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/59/229859/1

diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index e9139ff..04b22c9 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -318,11 +318,6 @@
        protected function renderContentWrapper( $data ) {
                if ( $this->renderHistoryLinkBeforeContent ) {
                        echo $this->getHistoryLinkTopHtml( $data );
-               ?>
-                       <script>
-                               if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-                       </script>
-               <?php
                }
                ?>
                <script>
@@ -333,11 +328,6 @@
                        $this->renderContent( $data );
                        if ( !$this->renderHistoryLinkBeforeContent ) {
                                echo $this->getHistoryLinkTopHtml( $data );
-               ?>
-                               <script>
-                                       if ( window.mw && mw.mobileFrontend ) { 
mw.mobileFrontend.emit( 'history-link-loaded' ); }
-                               </script>
-               <?php
                        }
        }
 
diff --git a/resources/mobile.head/init.js b/resources/mobile.head/init.js
index a4fb107..9c093d1 100644
--- a/resources/mobile.head/init.js
+++ b/resources/mobile.head/init.js
@@ -75,17 +75,16 @@
                } else {
                        // FIXME: remove this when the cache clears.
                        // Make the cached DOM look similar to the new DOM on 
the Main_Page
-                       // It's important that this runs when the DOM is ready, 
otherwise it won't work
-                       // in stable where the 'history-link-loaded' event is 
fired before the DOM is ready.
                        $( function () {
                                $( '#mw-mf-last-modified' ).removeClass( 
'last-modified-bar' );
                        } );
                }
+               // Set the .last-modified-bar element visibility to visible
+               $lastModifiedBar.addClass( 'modified-history-link' );
        }
 
        // bind events
        M.define( 'mainMenu', mainMenu );
-       M.on( 'history-link-loaded', initHistoryLink );
        M.on( 'header-loaded', function () {
                // Now we have a main menu button register it.
                mainMenu.registerClickEvents();
@@ -100,6 +99,7 @@
                if ( !$( '#mw-mf-page-left' ).find( '.menu' ).length ) {
                        mainMenu.appendTo( '#mw-mf-page-left' );
                }
+               initHistoryLink();
        } );
 
 }( mw.mobileFrontend, jQuery ) );
diff --git a/resources/skins.minerva.base.styles/ui.less 
b/resources/skins.minerva.base.styles/ui.less
index a027d34..92f28e6 100644
--- a/resources/skins.minerva.base.styles/ui.less
+++ b/resources/skins.minerva.base.styles/ui.less
@@ -23,6 +23,7 @@
        color: @colorGray6;
        // Make sure last modified link has correct font size (it is outside of 
the content div)
        font-size: .9em;
+       visibility: hidden;
        a,
        a:visited {
                color: @colorGray6;
@@ -39,6 +40,9 @@
                        color: #fff;
                }
        }
+       &.modified-history-link {
+               visibility: visible;
+       }
 }
 
 .header {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I508ca6a94d5b2d7a134e39637ea2f87f3ddc5430
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen <rm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to