Gilles has uploaded a new change for review.

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

Change subject: Explicitly define module position
......................................................................

Explicitly define module position

Style modules currently added through addModuleStyles default
to being in the head ("top" position). This is an unhealthy default,
since only critical styles that are needed at pageload should be
in the head. In order to be able to switch the default to "bottom",
existing module positions have to be defined explicitly.

Bug: T97410
Change-Id: I90f6d31c9b478d34ddfc04d8ac0d5c34e7bad36f
---
M ResourceLoaderCodeReviewModule.php
M extension.json
2 files changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeReview 
refs/changes/83/214683/1

diff --git a/ResourceLoaderCodeReviewModule.php 
b/ResourceLoaderCodeReviewModule.php
index bfef606..59b1fec 100644
--- a/ResourceLoaderCodeReviewModule.php
+++ b/ResourceLoaderCodeReviewModule.php
@@ -7,6 +7,20 @@
  * @file
  */
 class ResourceLoaderCodeReviewModule extends ResourceLoaderWikiModule {
+       /** @var string Position on the page to load this module at */
+       protected $position = 'bottom';
+
+       public function __construct( $options ) {
+               foreach ( $options as $member => $option ) {
+                       switch ( $member ) {
+                               case 'position':
+                                       $this->isPositionDefined = true;
+                                       $this->{$member} = (string)$option;
+                                       break;
+                       }
+               }
+       }
+
        /**
         * @param $context ResourceLoaderContext
         * @return array
@@ -16,4 +30,8 @@
                        'MediaWiki:CodeReview.css' => array( 'type' => 'style' 
),
                );
        }
+
+       public function getPosition() {
+               return $this->position;
+       }
 }
diff --git a/extension.json b/extension.json
index b585cb5..5135a5b 100644
--- a/extension.json
+++ b/extension.json
@@ -93,6 +93,7 @@
                        "dependencies": "jquery.suggestions"
                },
                "ext.codereview.styles": {
+                       "position": "top",
                        "styles": "ext.codereview.styles.css"
                },
                "ext.codereview.loaddiff": {
@@ -112,6 +113,7 @@
                        ]
                },
                "ext.codereview.local": {
+                       "position": "top",
                        "class": "ResourceLoaderCodeReviewModule"
                }
        },

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I90f6d31c9b478d34ddfc04d8ac0d5c34e7bad36f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeReview
Gerrit-Branch: master
Gerrit-Owner: Gilles <gdu...@wikimedia.org>

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

Reply via email to