Ori.livneh has uploaded a new change for review.

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


Change subject: Housecleaning.
......................................................................

Housecleaning.

More to be done.

Change-Id: Id49bbf565fd4ff59cbeeb9e16d3a7b0d10055cc2
---
M Experiments.hooks.php
M Experiments.php
2 files changed, 12 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/E3Experiments 
refs/changes/39/51339/1

diff --git a/Experiments.hooks.php b/Experiments.hooks.php
index f4cb45a..7650bb5 100644
--- a/Experiments.hooks.php
+++ b/Experiments.hooks.php
@@ -11,25 +11,6 @@
        public static $isWelcomeCreation = false;
 
        /**
-        * globRelative
-        *
-        * Searches for files matching pattern relative to the path of the 
extension
-        *
-        * @param $pattern string glob pattern
-        * @return array
-        */
-       public static function globRelative( $pattern ) {
-               // Trim the slash after the directory as well.
-               $dirlen = strlen( __DIR__ ) + 1;
-               $matches = glob( __DIR__ . $pattern );
-               foreach ( $matches as &$match ) {
-                               $match = substr( $match, $dirlen );
-               }
-               unset( $match );
-               return $matches;
-       }
-
-       /**
         * BeforePageDisplay hook
         *
         * Adds the modules to the page
@@ -39,9 +20,7 @@
         * @return bool
         */
        public static function onBeforePageDisplay( $out, $skin ) {
-               $out->addModules( array (
-                       'ext.Experiments.experiments'
-               ) );
+               $out->addModules( 'ext.Experiments.openTask' );
                return true;
        }
 
@@ -54,10 +33,10 @@
         * @return bool
         */
        public static function onMakeGlobalVariablesScript( &$vars, $out ) {
-               global $wgUser;
-               if ( $wgUser->isLoggedIn() ) {
-                       $vars[ 'wgEditCount' ] = $wgUser->getEditCount();
-                       $vars[ 'wgUserId' ] = $wgUser->getId();
+               $user = $out->getUser();
+               if ( $user->isLoggedIn() ) {
+                       $vars[ 'wgEditCount' ] = $user->getEditCount();
+                       $vars[ 'wgUserId' ] = $user->getId();
                }
                if ( self::$isWelcomeCreation ) {
                        $vars[ 'wgIsWelcomeCreation' ] = true;
@@ -67,7 +46,7 @@
 
        /**
         * ResourceLoaderGetConfigVars hook
-        * Sends down _static_ config vars to JavaScript
+        * Sends down static config vars to JavaScript
         *
         * @param $vars array
         * @return bool
@@ -88,10 +67,8 @@
         * @return bool
         */
        public static function onUserCreateForm( &$template ) {
-               global $wgOut;
-               $wgOut->addModules( array (
-                       'ext.Experiments.acux'
-               ) );
+               $out = $this->getOutput();
+               $out->addModules( 'ext.Experiments.acux' );
                return true;
        }
 
@@ -102,8 +79,6 @@
         */
        public static function onBeforeWelcomeCreation( &$welcomeCreationMsg, 
&$injected_html ) {
                self::$isWelcomeCreation = true;
-
                return true;
        }
-
 }
diff --git a/Experiments.php b/Experiments.php
index 5d9df78..f42c274 100644
--- a/Experiments.php
+++ b/Experiments.php
@@ -41,20 +41,19 @@
 );
 
 $wgResourceModules[ 'ext.Experiments.lib' ] = array(
-       'scripts'       => ExperimentsHooks::globRelative( '/lib/*.js' ),
+       'scripts'       => array( 'lib/jquery.stall.js', 'lib/e3.js' ),
        'localBasePath' => __DIR__,
        'dependencies'  => array(
                'jquery.cookie',
-               'jquery.json',  // openTask.js uses $.toJSON
+               'jquery.json',
                'mediawiki.user',
                'ext.UserBuckets',
         ),
        'remoteExtPath' => 'E3Experiments'
 );
 
-$wgResourceModules[ 'ext.Experiments.experiments' ] = array(
-       'scripts'       => ExperimentsHooks::globRelative( '/experiments/*.js' 
),
-       'styles'        => ExperimentsHooks::globRelative( '/css/*.css' ),
+$wgResourceModules[ 'ext.Experiments.openTask' ] = array(
+       'scripts'       => 'experiments/openTask.js',
        'localBasePath' => __DIR__,
        'remoteExtPath' => 'E3Experiments',
        'dependencies'  => array(
@@ -68,8 +67,6 @@
        )
 );
 
-// Account Creation UX is only needed on UserCreateForm, hence
-// it's a separate module.
 $wgResourceModules[ 'ext.Experiments.acux' ] = array(
        'scripts'       => 'experiments/acux/accountCreationUX.js',
        'styles'        => 'css/acux/acux.css',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id49bbf565fd4ff59cbeeb9e16d3a7b0d10055cc2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/E3Experiments
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to