OutputPage: Move hardcoded default modules to Skin::getDefaultModules
[lhc/web/wiklou.git] / includes / skins / Skin.php
index 99658f2..2cd28b4 100644 (file)
@@ -158,8 +158,17 @@ abstract class Skin extends ContextSource {
                global $wgUseAjax, $wgEnableAPI, $wgEnableWriteAPI;
 
                $out = $this->getOutput();
+               $config = $this->getConfig();
                $user = $out->getUser();
                $modules = [
+                       // modules not specific to any specific skin or page
+                       'core' => [
+                               // Enforce various default modules for all pages and all skins
+                               // Keep this list as small as possible
+                               'site',
+                               'mediawiki.page.startup',
+                               'mediawiki.user',
+                       ],
                        // modules that enhance the page content in some way
                        'content' => [
                                'mediawiki.page.ready',
@@ -172,6 +181,11 @@ abstract class Skin extends ContextSource {
                        'user' => [],
                ];
 
+               // Support for high-density display images if enabled
+               if ( $config->get( 'ResponsiveImages' ) ) {
+                       $modules['core'][] = 'mediawiki.hidpi';
+               }
+
                // Preload jquery.tablesorter for mediawiki.page.ready
                if ( strpos( $out->getHTML(), 'sortable' ) !== false ) {
                        $modules['content'][] = 'jquery.tablesorter';
@@ -444,6 +458,15 @@ abstract class Skin extends ContextSource {
                return $wgLogo;
        }
 
+       /**
+        * Whether the logo should be preloaded with an HTTP link header or not
+        * @since 1.29
+        * @return bool
+        */
+       public function shouldPreloadLogo() {
+               return false;
+       }
+
        /**
         * @return string HTML
         */