Fix typos
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoader.php
index aa632c3..151b271 100644 (file)
@@ -1095,7 +1095,7 @@ MESSAGE;
                                                break;
                                        case 'styles':
                                                $styles = $content['styles'];
-                                               // We no longer seperate into media, they are all combined now with
+                                               // We no longer separate into media, they are all combined now with
                                                // custom media type groups into @media .. {} sections as part of the css string.
                                                // Module returns either an empty array or a numerical array with css strings.
                                                $strContent = isset( $styles['css'] ) ? implode( '', $styles['css'] ) : '';
@@ -1484,16 +1484,33 @@ MESSAGE;
        }
 
        /**
-        * Wraps JavaScript code to run after startup and base modules.
+        * Wraps JavaScript code to run after the startup module.
         *
         * @param string $script JavaScript code
         * @return string JavaScript code
         */
        public static function makeLoaderConditionalScript( $script ) {
+               // Adds a function to lazy-created RLQ
                return '(window.RLQ=window.RLQ||[]).push(function(){' .
                        trim( $script ) . '});';
        }
 
+       /**
+        * Wraps JavaScript code to run after a required module.
+        *
+        * @since 1.32
+        * @param string|string[] $modules Module name(s)
+        * @param string $script JavaScript code
+        * @return string JavaScript code
+        */
+       public static function makeInlineCodeWithModule( $modules, $script ) {
+               // Adds an array to lazy-created RLQ
+               return '(window.RLQ=window.RLQ||[]).push(['
+                       . json_encode( $modules ) . ','
+                       . 'function(){' . trim( $script ) . '}'
+                       . ']);';
+       }
+
        /**
         * Returns an HTML script tag that runs given JS code after startup and base modules.
         *