jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Move DOM handling out of postRender
......................................................................
Hygiene: Move DOM handling out of postRender
postRender in theory can be run multiple times. We only want to add
this to the DOM once.
Change-Id: I6096960578846f1c264dc8bcc65ca65f2002e028
---
M javascripts/modules/wikigrok/WikiGrokDialog.js
M javascripts/modules/wikigrok/wikigrokeval.js
2 files changed, 11 insertions(+), 11 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/wikigrok/WikiGrokDialog.js
b/javascripts/modules/wikigrok/WikiGrokDialog.js
index 727d1ca..9a5aff3 100644
--- a/javascripts/modules/wikigrok/WikiGrokDialog.js
+++ b/javascripts/modules/wikigrok/WikiGrokDialog.js
@@ -123,16 +123,6 @@
postRender: function( options ) {
var self = this;
- // Insert the dialog into the page
- $( function() {
- // If there is a table of contents, insert
before it.
- if ( $( '.toc-mobile' ).length ) {
- self.insertBefore( '.toc-mobile' );
- } else {
- self.appendTo( M.getLeadSection() );
- }
- } );
-
// Initialize all the buttons and links
// ...for final 'Thanks' step
if ( options.thankUser ) {
diff --git a/javascripts/modules/wikigrok/wikigrokeval.js
b/javascripts/modules/wikigrok/wikigrokeval.js
index c2979bb..c4c1341 100644
--- a/javascripts/modules/wikigrok/wikigrokeval.js
+++ b/javascripts/modules/wikigrok/wikigrokeval.js
@@ -11,6 +11,7 @@
api.getClaims().done(
function( data ) {
var instanceClaims,
+ dialog,
loadWikiGrokDialog = false;
// See if the page has any 'instance of' claims.
@@ -28,7 +29,16 @@
}
} );
if ( loadWikiGrokDialog ) {
- new WikiGrokDialog( { itemId:
wikidataID } );
+ dialog = new WikiGrokDialog( {
itemId: wikidataID } );
+ // Insert the dialog into the
page
+ $( function() {
+ // If there is a table
of contents, insert before it.
+ if ( $( '.toc-mobile'
).length ) {
+
dialog.insertBefore( '.toc-mobile' );
+ } else {
+
dialog.appendTo( M.getLeadSection() );
+ }
+ } );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/162134
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6096960578846f1c264dc8bcc65ca65f2002e028
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits