Merge "Migrate redirectToFragment() from wikibits.js to own module"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 7 Jan 2014 21:16:14 +0000 (21:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 7 Jan 2014 21:16:14 +0000 (21:16 +0000)
1  2 
includes/Article.php
resources/Resources.php

diff --combined includes/Article.php
@@@ -989,9 -989,8 +989,8 @@@ class Article implements Page 
  
                                // Set the fragment if one was specified in the redirect
                                if ( strval( $this->getTitle()->getFragment() ) != '' ) {
-                                       $outputPage->addInlineScript( Xml::encodeJsCall(
-                                               'redirectToFragment', array( $this->getTitle()->getFragmentForURL() )
-                                       ) );
+                                       $outputPage->addJsConfigVars( 'wgRedirectToFragment', $this->getTitle()->getFragmentForURL() );
+                                       $outputPage->addModules( 'mediawiki.action.view.redirectToFragment' );
                                }
  
                                // Add a <link rel="canonical"> tag
  
                if ( $appendSubtitle ) {
                        $out = $this->getContext()->getOutput();
 -                      $out->addSubtitle( wfMessage( 'redirectpagesub' )->escaped() );
 +                      $out->addSubtitle( wfMessage( 'redirectpagesub' )->parse() );
                }
  
                // the loop prepends the arrow image before the link, so the first case needs to be outside
                $outputPage->setPageTitle( wfMessage( 'delete-confirm', $this->getTitle()->getPrefixedText() ) );
                $outputPage->addBacklinkSubtitle( $this->getTitle() );
                $outputPage->setRobotPolicy( 'noindex,nofollow' );
 +              if ( $this->getTitle()->getBacklinkCache()->hasLinks( 'pagelinks' ) ) {
 +                      $outputPage->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
 +                              'deleting-backlinks-warning' );
 +              }
                $outputPage->addWikiMsg( 'confirmdeletetext' );
  
                wfRunHooks( 'ArticleConfirmDelete', array( $this, $outputPage, &$reason ) );
diff --combined resources/Resources.php
@@@ -50,59 -50,6 +50,59 @@@ return array
        // Scripts for the dynamic language specific data, like grammar forms.
        'mediawiki.language.data' => array( 'class' => 'ResourceLoaderLanguageDataModule' ),
  
 +      /**
 +       * Common skin styles, grouped into three graded levels.
 +       *
 +       * Level 1 "elements":
 +       *     The base level that only contains the most basic of common skin styles.
 +       *     Only styles for single elements are included, no styling for complex structures like the TOC
 +       *     is present. This level is for skins that want to implement the entire style of even content area
 +       *     structures like the TOC themselves.
 +       *
 +       * Level 2 "content":
 +       *     The most commonly used level for skins implemented from scratch. This level includes all the single
 +       *     element styles from "elements" as well as styles for complex structures such as the TOC that are output
 +       *     in the content area by MediaWiki rather than the skin. Essentially this is the common level that lets
 +       *     skins leave the style of the content area as it is normally styled, while leaving the rest of the skin
 +       *     up to the skin implementation.
 +       *
 +       * Level 3 "interface":
 +       *     The highest level, this stylesheet contains extra common styles for classes like .firstHeading, #contentSub,
 +       *     et cetera which are not outputted by MediaWiki but are common to skins like MonoBook, Vector, etc...
 +       *     Essentially this level is for styles that are common to MonoBook clones. And since practically every skin
 +       *     that currently exists within core is a MonoBook clone, all our core skins currently use this level.
 +       *
 +       * These modules are typically loaded by addModuleStyles which has absolutely no concept of dependency
 +       * management. As a result the skins.common.* modules contain duplicate stylesheet references instead of
 +       * setting 'dependencies' to the lower level the module is based on. For this reason avoid including multiple
 +       * skins.common.* modules into your skin as this will result in duplicate css.
 +       */
 +      'skins.common.elements' => array(
 +              'styles' => array(
 +                      'common/commonElements.css' => array( 'media' => 'screen' ),
 +              ),
 +              'remoteBasePath' => $GLOBALS['wgStylePath'],
 +              'localBasePath' => $GLOBALS['wgStyleDirectory'],
 +      ),
 +      'skins.common.content' => array(
 +              'styles' => array(
 +                      'common/commonElements.css' => array( 'media' => 'screen' ),
 +                      'common/commonContent.css' => array( 'media' => 'screen' ),
 +              ),
 +              'remoteBasePath' => $GLOBALS['wgStylePath'],
 +              'localBasePath' => $GLOBALS['wgStyleDirectory'],
 +      ),
 +      'skins.common.interface' => array(
 +              // Used in the web installer. Test it after modifying this definition!
 +              'styles' => array(
 +                      'common/commonElements.css' => array( 'media' => 'screen' ),
 +                      'common/commonContent.css' => array( 'media' => 'screen' ),
 +                      'common/commonInterface.css' => array( 'media' => 'screen' ),
 +              ),
 +              'remoteBasePath' => $GLOBALS['wgStylePath'],
 +              'localBasePath' => $GLOBALS['wgStyleDirectory'],
 +      ),
 +
        /**
         * Skins
         * Be careful not to add 'scripts' to these modules,
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
        ),
 +      // FIXME: Remove in favour of skins.monobook.styles when cache expires
        'skins.monobook' => array(
                'styles' => array(
                        'common/commonElements.css' => array( 'media' => 'screen' ),
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
        ),
 +      // FIXME: Remove in favour of skins.vector.styles when cache expires
        'skins.vector' => array(
 -              // Used in the web installer. Test it after modifying this definition!
                'styles' => array(
                        'common/commonElements.css' => array( 'media' => 'screen' ),
                        'common/commonContent.css' => array( 'media' => 'screen' ),
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
        ),
 -      'skins.vector.beta' => array(
 -              // Keep in sync with skins.vector
 +      'skins.vector.styles' => array(
 +              // Used in the web installer. Test it after modifying this definition!
                'styles' => array(
 -                      'common/commonElements.css' => array( 'media' => 'screen' ),
 -                      'common/commonContent.css' => array( 'media' => 'screen' ),
 -                      'common/commonInterface.css' => array( 'media' => 'screen' ),
 -                      'vector/styles-beta.less',
 +                      'vector/styles.less',
 +              ),
 +              'remoteBasePath' => $GLOBALS['wgStylePath'],
 +              'localBasePath' => $GLOBALS['wgStyleDirectory'],
 +      ),
 +      'skins.monobook.styles' => array(
 +              'styles' => array(
 +                      'monobook/main.css' => array( 'media' => 'screen' ),
                ),
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
                'messages' => array( 'htmlform-chosen-placeholder' ),
        ),
        'mediawiki.icon' => array(
 -              'styles' => 'resources/mediawiki/mediawiki.icon.css',
 +              'styles' => 'resources/mediawiki/mediawiki.icon.less',
        ),
        'mediawiki.inspect' => array(
                'scripts' => 'resources/mediawiki/mediawiki.inspect.js',
                'styles' => 'resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css',
                'dependencies' => array(
                        'jquery.makeCollapsible',
 +                      'jquery.cookie',
                        'mediawiki.icon',
                ),
        ),
                        'postedit-confirmation',
                ),
        ),
+       'mediawiki.action.view.redirectToFragment' => array(
+               'scripts' => 'resources/mediawiki.action/mediawiki.action.view.redirectToFragment.js',
+               'dependencies' => array(
+                       'jquery.client',
+               ),
+               'position' => 'top',
+       ),
        'mediawiki.action.view.rightClickEdit' => array(
                'scripts' => 'resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js',
        ),
        ),
        'mediawiki.special.block' => array(
                'scripts' => 'resources/mediawiki.special/mediawiki.special.block.js',
 +              'styles' => 'resources/mediawiki.special/mediawiki.special.block.css',
                'dependencies' => array(
                        'mediawiki.util',
                ),
        'mediawiki.special.changeslist' => array(
                'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.css',
        ),
 +      'mediawiki.special.changeslist.js' => array(
 +              'scripts' => 'resources/mediawiki.special/mediawiki.special.changeslist.js',
 +              'dependencies' => array(
 +                      'jquery.makeCollapsible',
 +                      'jquery.cookie',
 +              ),
 +      ),
        'mediawiki.special.changeslist.enhanced' => array(
                'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.enhanced.css',
        ),
                        'mediawiki.util',
                ),
        ),
 -      'mediawiki.special.userlogin' => array(
 +      'mediawiki.special.userlogin.common.styles' => array(
                'styles' => array(
 -                      'resources/mediawiki.special/mediawiki.special.vforms.css',
 -                      'resources/mediawiki.special/mediawiki.special.userLogin.css',
 +                      'resources/mediawiki.special/mediawiki.special.userlogin.common.css',
                ),
                'position' => 'top',
        ),
 -      'mediawiki.special.createaccount' => array(
 +      'mediawiki.special.userlogin.signup.styles' => array(
                'styles' => array(
 -                      'resources/mediawiki.special/mediawiki.special.vforms.css',
 -                      'resources/mediawiki.special/mediawiki.special.createAccount.css',
 +                      'resources/mediawiki.special/mediawiki.special.userlogin.signup.css',
                ),
 +              'position' => 'top',
        ),
 -      'mediawiki.special.createaccount.js' => array(
 -              'scripts' => 'resources/mediawiki.special/mediawiki.special.createAccount.js',
 +      'mediawiki.special.userlogin.login.styles' => array(
 +              'styles' => array(
 +                      'resources/mediawiki.special/mediawiki.special.userlogin.login.css',
 +              ),
 +              'position' => 'top',
 +      ),
 +      'mediawiki.special.userlogin.common.js' => array(
 +              'scripts' => array(
 +                      'resources/mediawiki.special/mediawiki.special.userlogin.common.js',
 +              ),
                'messages' => array(
                        'createacct-captcha',
 +                      'createacct-imgcaptcha-ph',
 +              ),
 +      ),
 +      'mediawiki.special.userlogin.signup.js' => array(
 +              'scripts' => 'resources/mediawiki.special/mediawiki.special.userlogin.signup.js',
 +              'messages' => array(
                        'createacct-emailrequired',
 -                      'createacct-imgcaptcha-ph'
                ),
                'dependencies' => 'mediawiki.jqueryMsg',
 -              'position' => 'top',
        ),
        'mediawiki.special.javaScriptTest' => array(
                'scripts' => 'resources/mediawiki.special/mediawiki.special.javaScriptTest.js',
                'position' => 'top',
                'targets' => array( 'desktop', 'mobile' ),
        ),
 +      'mediawiki.special.version' => array(
 +              'styles' => 'resources/mediawiki.special/mediawiki.special.version.css',
 +      ),
  
        /* MediaWiki Tests */
  
                        'vector' => 'resources/mediawiki.ui/vector.less',
                ),
                'position' => 'top',
 +              'targets' => array( 'desktop', 'mobile' ),
 +      ),
 +      // Lightweight module for button styles
 +      'mediawiki.ui.button' => array(
 +              'skinStyles' => array(
 +                      'default' => 'resources/mediawiki.ui/components/default/buttons.less',
 +                      'vector' => 'resources/mediawiki.ui/components/vector/buttons.less',
 +              ),
 +              'position' => 'top',
 +              'targets' => array( 'desktop', 'mobile' ),
        ),
  
        /* OOJS */
                ),
                'targets' => array( 'desktop', 'mobile' ),
        ),
 -
  );