Werdna has submitted this change and it was merged.

Change subject: Fix Flash of Unstyled Content issues
......................................................................


Fix Flash of Unstyled Content issues

Change-Id: I9595fc1ace9f0944fadbf1c61db672d3caa33200
---
M includes/ParserHooks.php
M resources/Resources.php
M resources/display.js
A resources/hidecode.css
4 files changed, 19 insertions(+), 8 deletions(-)

Approvals:
  Werdna: Verified; Looks good to me, approved



diff --git a/includes/ParserHooks.php b/includes/ParserHooks.php
index 79d3916..8bf03d9 100755
--- a/includes/ParserHooks.php
+++ b/includes/ParserHooks.php
@@ -73,8 +73,8 @@
         * @return string          HTML to output
         */
        public static function renderDemo( $input, array $args, Parser $parser, 
PPFrame $frame ) {
-               $parser->getOutput()->addModules( array( 'oojs-ui', 
'ext.ooui-playground' ) );
-               $parser->getOutput()->addModuleStyles( array( 'oojs-ui', 
'ext.ooui-playground' ) );
+               $parser->getOutput()->addModules( array( 'oojs-ui', 
'ext.ooui-playground', 'ext.ooui-playground.top' ) );
+               $parser->getOutput()->addModuleStyles( array( 'oojs-ui.styles' 
) );
 
                $classStatus = self::getWidgetFromAttributes( $args );
 
diff --git a/resources/Resources.php b/resources/Resources.php
index 3c6c12c..25b7327 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1,14 +1,21 @@
 <?php
 
-$wgResourceModules['ext.ooui-playground'] = array(
+$oouiPlaygroundResourceTemplate = array(
        'localBasePath' => __DIR__,
        'remoteExtPath' => 'OOUIPlayground/resources',
        'group' => 'ext.ooui-playground',
-       'styles' => 'display.less',
+);
+
+$wgResourceModules['ext.ooui-playground'] = array(
        'scripts' => array( 'display.js', 'defer.js' ),
-       'dependencies' => 'oojs-ui',
+       'dependencies' => array( 'oojs-ui' ),
        'messages' => array(
                "ooui-playground-language-php",
                "ooui-playground-language-javascript",
        ),
-);
+) + $oouiPlaygroundResourceTemplate;
+
+$wgResourceModules['ext.ooui-playground.top'] = array(
+       'styles' => array( 'display.less', 'hidecode.css' ),
+       'position' => 'top',
+) + $oouiPlaygroundResourceTemplate;
diff --git a/resources/display.js b/resources/display.js
index 4eb074a..89b5050 100644
--- a/resources/display.js
+++ b/resources/display.js
@@ -1,4 +1,5 @@
-(function( $, mw ) {
+/* global OO */
+(function( $, mw, OO ) {
 $( function() {
        var $codeGroups = $( '.ooui-playground-code-group' );
        if ( $codeGroups.length ) {
@@ -32,4 +33,4 @@
                selector.selectItem( options[0] );
        }
 } );
-})( jQuery, mediaWiki );
\ No newline at end of file
+})( jQuery, mediaWiki, OO );
diff --git a/resources/hidecode.css b/resources/hidecode.css
new file mode 100644
index 0000000..42d9e7f
--- /dev/null
+++ b/resources/hidecode.css
@@ -0,0 +1,3 @@
+.ooui-playground-code {
+       display: none;
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9595fc1ace9f0944fadbf1c61db672d3caa33200
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OOUIPlayground
Gerrit-Branch: master
Gerrit-Owner: Werdna <agarr...@wikimedia.org>
Gerrit-Reviewer: Werdna <agarr...@wikimedia.org>

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

Reply via email to