Jdlrobson has uploaded a new change for review.

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


Change subject: Beta: Reinitialise talk overlay after a page refresh
......................................................................

Beta: Reinitialise talk overlay after a page refresh

After an edit ensure the talk button gets re-initialised

Change-Id: Ib8202262717b20042c9b37d6ee43dfb1c3e17dd3
---
M javascripts/modules/talk.js
1 file changed, 12 insertions(+), 4 deletions(-)


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

diff --git a/javascripts/modules/talk.js b/javascripts/modules/talk.js
index cb079ef..7ca3670 100644
--- a/javascripts/modules/talk.js
+++ b/javascripts/modules/talk.js
@@ -102,13 +102,11 @@
                                }
                        }
                } ),
-               talkPage = mw.config.get( 'wgFormattedNamespaces' 
)[mw.config.get( 'wgNamespaceNumber' ) + 1] +
-                       ':' + mw.config.get( 'wgTitle' ),
                Page = M.require( 'page'),
-               $talk = $( '#ca-talk' ),
                req;
 
-       $talk.on( 'click', function( ev ) {
+       function onTalkClick( ev ) {
+               var $talk = $( this ), talkPage = $talk.data( 'title' );
                // FIXME: this currently gives an indication something async is 
happening. We can do better.
                $talk.css( 'opacity', 0.2 );
                ev.preventDefault();
@@ -145,6 +143,16 @@
                } ).error( function() {
                        $talk.css( 'opacity', '' );
                } );
+       }
+
+       function init( title ) {
+               var talkPrefix = mw.config.get( 'wgFormattedNamespaces' ) 
[mw.config.get( 'wgNamespaceNumber' ) + 1 ] + ':';
+               $( '#ca-talk' ).on( 'click', onTalkClick ).data( 'title', 
talkPrefix + title );
+       }
+
+       init( mw.config.get( 'wgTitle' ) );
+       M.on( 'page-loaded', function( page ) {
+               init( page.title );
        } );
 
 }( mw.mobileFrontend, jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8202262717b20042c9b37d6ee43dfb1c3e17dd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to