From: Fomafix Date: Sat, 10 Feb 2018 21:16:00 +0000 (+0100) Subject: mediawiki.Title: Reorder function declaration X-Git-Tag: 1.31.0-rc.0~633^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=85531b7b020a78d05813083c00007bfb4d32192c;p=lhc%2Fweb%2Fwiklou.git mediawiki.Title: Reorder function declaration This avoids the eslint rule exceptions: * no-use-before-define * vars-on-top Change-Id: Ie9c9145052fe8629b1aa50ac3e2ac62d6a10ec0f --- diff --git a/resources/src/mediawiki/mediawiki.Title.js b/resources/src/mediawiki/mediawiki.Title.js index 9db2771d30..851f06c2d1 100644 --- a/resources/src/mediawiki/mediawiki.Title.js +++ b/resources/src/mediawiki/mediawiki.Title.js @@ -1,11 +1,9 @@ /*! * @author Neil Kandalgaonkar, 2010 - * @author Timo Tijhof, 2011-2013 + * @author Timo Tijhof * @since 1.18 */ -/* eslint-disable no-use-before-define */ - ( function ( mw, $ ) { /** * Parse titles into an object structure. Note that when using the constructor @@ -29,27 +27,10 @@ * mw.Title.makeTitle( NS_TEMPLATE, 'Template:Foo' ).getPrefixedText(); // => 'Template:Template:Foo' * * @class mw.Title - * @constructor - * @param {string} title Title of the page. If no second argument given, - * this will be searched for a namespace - * @param {number} [namespace=NS_MAIN] If given, will used as default namespace for the given title - * @throws {Error} When the title is invalid */ - function Title( title, namespace ) { - var parsed = parse( title, namespace ); - if ( !parsed ) { - throw new Error( 'Unable to parse title' ); - } - - this.namespace = parsed.namespace; - this.title = parsed.title; - this.ext = parsed.ext; - this.fragment = parsed.fragment; - } /* Private members */ - // eslint-disable-next-line vars-on-top var namespaceIds = mw.config.get( 'wgNamespaceIds' ), @@ -458,6 +439,25 @@ return trimToByteLength( name, FILENAME_MAX_BYTES - extension.length - 1 ) + '.' + extension; }; + /** + * @method constructor + * @param {string} title Title of the page. If no second argument given, + * this will be searched for a namespace + * @param {number} [namespace=NS_MAIN] If given, will used as default namespace for the given title + * @throws {Error} When the title is invalid + */ + function Title( title, namespace ) { + var parsed = parse( title, namespace ); + if ( !parsed ) { + throw new Error( 'Unable to parse title' ); + } + + this.namespace = parsed.namespace; + this.title = parsed.title; + this.ext = parsed.ext; + this.fragment = parsed.fragment; + } + /* Static members */ /**