Followup If21705c2, Shorten remaining urls to the whatwg HTML spec.
[lhc/web/wiklou.git] / includes / OutputPage.php
index b63e658..978fddc 100644 (file)
@@ -1986,7 +1986,8 @@ class OutputPage extends ContextSource {
         * the object, let's actually output it:
         */
        public function output() {
-               global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP;
+               global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
+                       $wgUseAjax, $wgResponsiveImages;
 
                if ( $this->mDoNothing ) {
                        return;
@@ -2051,9 +2052,32 @@ class OutputPage extends ContextSource {
                if ( $this->mArticleBodyOnly ) {
                        echo $this->mBodytext;
                } else {
-                       $this->addDefaultModules();
 
                        $sk = $this->getSkin();
+                       // add skin specific modules
+                       $modules = $sk->getDefaultModules();
+
+                       // enforce various default modules for all skins
+                       $coreModules = array(
+                               // keep this list as small as possible
+                               'mediawiki.page.startup',
+                               'mediawiki.user',
+                       );
+
+                       // Support for high-density display images if enabled
+                       if ( $wgResponsiveImages ) {
+                               $coreModules[] = 'mediawiki.hidpi';
+                       }
+
+                       $this->addModules( $coreModules );
+                       foreach ( $modules as $group ) {
+                               $this->addModules( $group );
+                       }
+                       MWDebug::addModules( $this );
+                       if ( $wgUseAjax ) {
+                               // FIXME: deprecate? - not clear why this is useful
+                               wfRunHooks( 'AjaxAddScript', array( &$this ) );
+                       }
 
                        // Hook that allows last minute changes to the output page, e.g.
                        // adding of CSS or Javascript by extensions.
@@ -2504,8 +2528,8 @@ $templates
                        // The spec recommends defining XHTML5's charset using the XML declaration
                        // instead of meta.
                        // Our XML declaration is output by Html::htmlHeader.
-                       // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#attr-meta-http-equiv-content-type
-                       // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset
+                       // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
+                       // http://www.whatwg.org/html/semantics.html#charset
                        $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
                }
 
@@ -2553,59 +2577,6 @@ $templates
                return $ret;
        }
 
-       /**
-        * Add the default ResourceLoader modules to this object
-        */
-       private function addDefaultModules() {
-               global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
-                       $wgAjaxWatch, $wgResponsiveImages;
-
-               // Add base resources
-               $this->addModules( array(
-                       'mediawiki.user',
-                       'mediawiki.page.startup',
-                       'mediawiki.page.ready',
-               ) );
-               if ( $wgIncludeLegacyJavaScript ) {
-                       $this->addModules( 'mediawiki.legacy.wikibits' );
-               }
-
-               if ( $wgPreloadJavaScriptMwUtil ) {
-                       $this->addModules( 'mediawiki.util' );
-               }
-
-               MWDebug::addModules( $this );
-
-               // Add various resources if required
-               if ( $wgUseAjax ) {
-                       $this->addModules( 'mediawiki.legacy.ajax' );
-
-                       wfRunHooks( 'AjaxAddScript', array( &$this ) );
-
-                       if ( $wgAjaxWatch && $this->getUser()->isLoggedIn() ) {
-                               $this->addModules( 'mediawiki.page.watch.ajax' );
-                       }
-
-                       if ( !$this->getUser()->getOption( 'disablesuggest', false ) ) {
-                               $this->addModules( 'mediawiki.searchSuggest' );
-                       }
-               }
-
-               if ( $this->getUser()->getBoolOption( 'editsectiononrightclick' ) ) {
-                       $this->addModules( 'mediawiki.action.view.rightClickEdit' );
-               }
-
-               # Crazy edit-on-double-click stuff
-               if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
-                       $this->addModules( 'mediawiki.action.view.dblClickEdit' );
-               }
-
-               // Support for high-density display images
-               if ( $wgResponsiveImages ) {
-                       $this->addModules( 'mediawiki.hidpi' );
-               }
-       }
-
        /**
         * Get a ResourceLoader object associated with this OutputPage
         *
@@ -3595,7 +3566,7 @@ $templates
         * this stylesheet
         */
        public static function transformCssMedia( $media ) {
-               global $wgRequest, $wgHandheldForIPhone;
+               global $wgRequest;
 
                // http://www.w3.org/TR/css3-mediaqueries/#syntax
                $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
@@ -3627,18 +3598,6 @@ $templates
                        }
                }
 
-               // Expand longer media queries as iPhone doesn't grok 'handheld'
-               if ( $wgHandheldForIPhone ) {
-                       $mediaAliases = array(
-                               'screen' => 'screen and (min-device-width: 481px)',
-                               'handheld' => 'handheld, only screen and (max-device-width: 480px)',
-                       );
-
-                       if ( isset( $mediaAliases[$media] ) ) {
-                               $media = $mediaAliases[$media];
-                       }
-               }
-
                return $media;
        }