Merge "Added increase editcount upon page move"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 20 May 2017 14:55:34 +0000 (14:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 20 May 2017 14:55:34 +0000 (14:55 +0000)
includes/api/i18n/en.json
languages/i18n/en.json
languages/i18n/tyv.json
resources/src/jquery/jquery.makeCollapsible.js
tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js

index 5f52a1e..db31552 100644 (file)
        "apihelp-query+search-param-limit": "How many total pages to return.",
        "apihelp-query+search-param-interwiki": "Include interwiki results in the search, if available.",
        "apihelp-query+search-param-backend": "Which search backend to use, if not the default.",
-       "apihelp-query+search-param-enablerewrites": "Enable internal query rewriting. Some search backends can rewrite the query into one its thinks gives better results, such as correcting spelling errors.",
+       "apihelp-query+search-param-enablerewrites": "Enable internal query rewriting. Some search backends can rewrite the query into another which is thought to provide better results, for instance by correcting spelling errors.",
        "apihelp-query+search-example-simple": "Search for <kbd>meaning</kbd>.",
        "apihelp-query+search-example-text": "Search texts for <kbd>meaning</kbd>.",
        "apihelp-query+search-example-generator": "Get page info about the pages returned for a search for <kbd>meaning</kbd>.",
        "apihelp-query+tags-example-simple": "List available tags.",
 
        "apihelp-query+templates-description": "Returns all pages transcluded on the given pages.",
-       "apihelp-query+templates-param-namespace": "Show templates in this namespaces only.",
+       "apihelp-query+templates-param-namespace": "Show templates in these namespaces only.",
        "apihelp-query+templates-param-limit": "How many templates to return.",
        "apihelp-query+templates-param-templates": "Only list these templates. Useful for checking whether a certain page uses a certain template.",
        "apihelp-query+templates-param-dir": "The direction in which to list.",
index fcdbfdc..cc60432 100644 (file)
        "pageid": "page ID $1",
        "rawhtml-notallowed": "&lt;html&gt; tags cannot be used outside of normal pages.",
        "gotointerwiki": "Leaving {{SITENAME}}",
-       "gotointerwiki-invalid": "The specified title was invalid.",
-       "gotointerwiki-external": "You are about to leave {{SITENAME}} to visit [[$2]] which is a separate website.\n\n[$1 Click here to continue on to $1].",
+       "gotointerwiki-invalid": "The specified title is invalid.",
+       "gotointerwiki-external": "You are about to leave {{SITENAME}} to visit [[$2]], which is a separate website.\n\n'''[$1 Continue to $1]'''",
        "undelete-cantedit": "You cannot undelete this page as you are not allowed to edit this page.",
        "undelete-cantcreate": "You cannot undelete this page as there is no existing page with this name and you are not allowed to create this page."
 }
index 9b9a469..fd51e98 100644 (file)
        "prefs-signature": "Хол үжүү",
        "prefs-diffs": "Ылгалдар",
        "editusergroup": "Ажыглакчының бөлгүмнерни өскертири",
-       "editinguser": "Changing user rights of user '''[[User:$1|$1]]''' ([[User talk:$1|{{int:talkpagelinktext}}]]{{int:pipe-separator}}[[Special:Contributions/$1|{{int:contribslink}}]])",
        "userrights-editusergroup": "Ажыглакчының бөлгүмнерни өскертири",
        "saveusergroups": "{{GENDER:$1|Ажыглакчының|Ажыглакчының}} бөлгүмнерин шыгжаар",
        "userrights-reason": "Чылдагаан:",
index 7296811..9d3df8c 100644 (file)
                if ( $defaultToggle === undefined ) {
                        $defaultToggle = null;
                }
-               if ( $defaultToggle !== null && !$defaultToggle.jquery ) {
-                       // is optional (may be undefined), but if defined it must be an instance of jQuery.
-                       // If it's not, abort right away.
-                       // After this $defaultToggle is either null or a valid jQuery instance.
-                       return;
-               }
 
                // Trigger a custom event to allow callers to hook to the collapsing/expanding,
                // allowing the module to be testable, and making it possible to
                if ( e ) {
                        if (
                                e.type === 'click' &&
-                               options.linksPassthru &&
-                               e.target.nodeName.toLowerCase() === 'a' &&
-                               $( e.target ).attr( 'href' ) &&
-                               $( e.target ).attr( 'href' ) !== '#'
+                               e.target.nodeName.toLowerCase() === 'a'
                        ) {
-                               // Don't fire if a link with href !== '#' was clicked, if requested  (for premade togglers by default)
+                               // Don't fire if a link was clicked (for premade togglers)
                                return;
                        } else if ( e.type === 'keypress' && e.which !== 13 && e.which !== 32 ) {
                                // Only handle keypresses on the "Enter" or "Space" keys
                                .toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed );
                }
 
-               // Toggle the text ("Show"/"Hide"), if requested (for default togglers by default)
+               // Toggle the text ("Show"/"Hide") within elements tagged with mw-collapsible-text
                if ( options.toggleText ) {
                        collapseText = options.toggleText.collapseText;
                        expandText = options.toggleText.expandText;
 
-                       $textContainer = $toggle.find( '> a' );
-                       if ( !$textContainer.length ) {
-                               $textContainer = $toggle;
+                       $textContainer = $collapsible.find( '.mw-collapsible-text' );
+                       if ( $textContainer.length ) {
+                               $textContainer.text( wasCollapsed ? collapseText : expandText );
                        }
-                       $textContainer.text( wasCollapsed ? collapseText : expandText );
                }
 
                // And finally toggle the element state itself
 
                this.each( function () {
                        var $collapsible, collapseText, expandText, $caption, $toggle, actionHandler, buildDefaultToggleLink,
-                               premadeToggleHandler, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval;
+                               $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval;
 
                        // Ensure class "mw-collapsible" is present in case .makeCollapsible()
                        // is called on element(s) that don't have it yet.
                                opts = $.extend( defaultOpts, options, opts );
                                togglingHandler( $( this ), $collapsible, e, opts );
                        };
+
                        // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).
                        buildDefaultToggleLink = function () {
-                               return $( '<a>' )
-                                       .attr( {
-                                               role: 'button',
-                                               tabindex: 0
-                                       } )
+                               return $( '<span class="mw-collapsible-text"></span>' )
                                        .text( collapseText )
-                                       .wrap( '<span class="mw-collapsible-toggle"></span>' )
-                                               .parent()
-                                               .prepend( '<span class="mw-collapsible-bracket">[</span>' )
-                                               .append( '<span class="mw-collapsible-bracket">]</span>' )
+                                       .wrap( '<span class="mw-collapsible-toggle"></span>' ).parent()
+                                               .attr( {
+                                                       role: 'button',
+                                                       tabindex: 0
+                                               } )
+                                               .prepend( '<span>[</span>' )
+                                               .append( '<span>]</span>' )
                                                .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
                        };
 
-                       // Default handler for clicking on premade toggles
-                       premadeToggleHandler = function ( e, opts ) {
-                               var defaultOpts = { toggleClasses: true, linksPassthru: true };
-                               opts = $.extend( defaultOpts, options, opts );
-                               togglingHandler( $( this ), $collapsible, e, opts );
-                       };
-
                        // Check if this element has a custom position for the toggle link
                        // (ie. outside the container or deeper inside the tree)
                        if ( options.$customTogglers ) {
                                                if ( !$toggle.length ) {
                                                        $toggleLink = buildDefaultToggleLink().appendTo( $caption );
                                                } else {
-                                                       actionHandler = premadeToggleHandler;
                                                        $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                                                .prop( 'tabIndex', 0 );
                                                }
                                                if ( !$toggle.length ) {
                                                        $toggleLink = buildDefaultToggleLink().prependTo( $firstItem.eq( -1 ) );
                                                } else {
-                                                       actionHandler = premadeToggleHandler;
                                                        $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                                                .prop( 'tabIndex', 0 );
                                                }
                                                $toggleLink = buildDefaultToggleLink();
                                                $toggleLink.wrap( '<li class="mw-collapsible-toggle-li"></li>' ).parent().prependTo( $collapsible );
                                        } else {
-                                               actionHandler = premadeToggleHandler;
                                                $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                                        .prop( 'tabIndex', 0 );
                                        }
                                        if ( !$toggle.length ) {
                                                $toggleLink = buildDefaultToggleLink().prependTo( $collapsible );
                                        } else {
-                                               actionHandler = premadeToggleHandler;
                                                $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                                        .prop( 'tabIndex', 0 );
                                        }
index 4e77d72..44a2305 100644 (file)
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
        } );
 
-       QUnit.test( 'clicks on links inside toggler pass through (options.linksPassthru)', function ( assert ) {
+       QUnit.test( 'clicks on links inside toggler pass through', function ( assert ) {
                var $collapsible = prepareCollapsible(
                                '<div class="mw-collapsible">' +
                                        '<div class="mw-collapsible-toggle">' +
-                                               'Toggle <a href="#top">toggle</a> toggle <b>toggle</b>' +
+                                               'Toggle <a href="#">toggle</a> toggle <b>toggle</b>' +
                                        '</div>' +
                                        '<div class="mw-collapsible-content">' + loremIpsum + '</div>' +
                                '</div>',
                                        loremIpsum +
                                '</div>'
                        ),
-                       $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+                       $toggleText = $collapsible.find( '.mw-collapsible-text' );
 
-               assert.equal( $toggleLink.text(), 'Collapse me!', 'data-collapsetext is respected' );
+               assert.equal( $toggleText.text(), 'Collapse me!', 'data-collapsetext is respected' );
 
                $collapsible.on( 'afterCollapse.mw-collapsible', function () {
-                       assert.equal( $toggleLink.text(), 'Expand me!', 'data-expandtext is respected' );
+                       assert.equal( $toggleText.text(), 'Expand me!', 'data-expandtext is respected' );
                } );
 
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
                                '<div class="mw-collapsible">' + loremIpsum + '</div>',
                                { collapseText: 'Collapse me!', expandText: 'Expand me!' }
                        ),
-                       $toggleLink = $collapsible.find( '.mw-collapsible-toggle a' );
+                       $toggleText = $collapsible.find( '.mw-collapsible-text' );
 
-               assert.equal( $toggleLink.text(), 'Collapse me!', 'options.collapseText is respected' );
+               assert.equal( $toggleText.text(), 'Collapse me!', 'options.collapseText is respected' );
 
                $collapsible.on( 'afterCollapse.mw-collapsible', function () {
-                       assert.equal( $toggleLink.text(), 'Expand me!', 'options.expandText is respected' );
+                       assert.equal( $toggleText.text(), 'Expand me!', 'options.expandText is respected' );
+               } );
+
+               $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
+       } );
+
+       QUnit.test( 'predefined toggle button and text (.mw-collapsible-toggle/.mw-collapsible-text)', function ( assert ) {
+               var $collapsible = prepareCollapsible(
+                               '<div class="mw-collapsible">' +
+                                       '<div class="mw-collapsible-toggle">' +
+                                               '<span>[</span><span class="mw-collapsible-text">Toggle</span><span>]</span>' +
+                                       '</div>' +
+                                       '<div class="mw-collapsible-content">' + loremIpsum + '</div>' +
+                               '</div>',
+                               { collapseText: 'Hide', expandText: 'Show' }
+                       ),
+                       $toggleText = $collapsible.find( '.mw-collapsible-text' );
+
+               assert.equal( $toggleText.text(), 'Toggle', 'predefined text remains' );
+
+               $collapsible.on( 'afterCollapse.mw-collapsible', function () {
+                       assert.equal( $toggleText.text(), 'Show', 'predefined text is toggled' );
+
+                       $collapsible.on( 'afterExpand.mw-collapsible', function () {
+                               assert.equal( $toggleText.text(), 'Hide', 'predefined text is toggled back' );
+                       } );
+
+                       $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );
                } );
 
                $collapsible.find( '.mw-collapsible-toggle' ).trigger( 'click' );