Remove duplicate comments from platform code

Inherited methods don't need to repeat documentation.

Change-Id: I05c4efe8e4a394411922add5f11259d47d44e3bb
This commit is contained in:
Ed Sanders 2013-08-20 20:35:01 +01:00
parent e38bb7714f
commit cbe35632f1
3 changed files with 17 additions and 103 deletions

View file

@ -36,59 +36,35 @@ ve.inheritClass( ve.init.mw.Platform, ve.init.Platform );
/* Methods */
/**
* Get a regular expression that matches allowed external link URLs.
*
* Uses the mw.config wgUrlProtocols variable.
*
* @method
* @returns {RegExp} Regular expression object
* @inheritdoc
*/
ve.init.mw.Platform.prototype.getExternalLinkUrlProtocolsRegExp = function () {
return this.externalLinkUrlProtocolsRegExp;
};
/**
* Get a remotely accessible URL to the modules directory.
*
* Uses MediaWiki's {wgExtensionAssetsPath} variable.
*
* @method
* @returns {string} Remote modules URL
* @inheritdoc
*/
ve.init.mw.Platform.prototype.getModulesUrl = function () {
return this.modulesUrl;
};
/**
* Add multiple messages to the localization system.
*
* Wrapper for mw.msg system.
*
* @method
* @param {Object} messages Map of message-key/message-string pairs
* @inheritdoc
*/
ve.init.mw.Platform.prototype.addMessages = function ( messages ) {
return mw.messages.set( messages );
};
/**
* Get a message from the localization system.
*
* Wrapper for mw.msg system.
*
* @method
* @param {string} key Message key
* @param {Mixed...} [args] List of arguments which will be injected at $1, $2, etc. in the messaage
* @returns {string} Localized message (plain, unescaped)
*/
ve.init.mw.Platform.prototype.getMessage = ve.bind( mw.msg, mw );
/**
* Add multiple parsed messages to the localization system.
*
* @method
* @param {Object} messages Map of message-key/html pairs
*/
/** */
ve.init.mw.Platform.prototype.addParsedMessages = function ( messages ) {
for ( var key in messages ) {
this.parsedMessages[key] = messages[key];
@ -96,14 +72,8 @@ ve.init.mw.Platform.prototype.addParsedMessages = function ( messages ) {
};
/**
* Get a parsed message as HTML string.
*
* Falls back to mw.messsage with .escaped().
* Does not support $# replacements.
*
* @method
* @param {string} key Message key
* @returns {string} Parsed localized message as HTML string
* @inheritdoc
*/
ve.init.mw.Platform.prototype.getParsedMessage = function ( key ) {
if ( key in this.parsedMessages ) {
@ -114,22 +84,12 @@ ve.init.mw.Platform.prototype.getParsedMessage = function ( key ) {
return mw.message( key ).escaped();
};
/**
* Gets client platform string from browser.
*
* @method
* @returns {string} Client platform string
*/
/** */
ve.init.mw.Platform.prototype.getSystemPlatform = function () {
return $.client.profile().platform;
};
/**
* Gets the user language from the browser.
*
* @method
* @returns {string} User language string
*/
/** */
ve.init.mw.Platform.prototype.getUserLanguage = function () {
return mw.config.get( 'wgUserLanguage' );
};

View file

@ -30,12 +30,7 @@ ve.inheritClass( ve.init.sa.Platform, ve.init.Platform );
/* Methods */
/**
* Get a regular expression that matches allowed external link URLs.
*
* @method
* @returns {RegExp} Regular expression object
*/
/** */
ve.init.sa.Platform.prototype.getExternalLinkUrlProtocolsRegExp = function () {
return this.externalLinkUrlProtocolsRegExp;
};
@ -50,36 +45,19 @@ ve.init.sa.Platform.prototype.setModulesUrl = function ( url ) {
this.modulesUrl = url;
};
/**
* Get a remotely accessible URL to the modules directory.
*
* @method
* @returns {string} Remote modules URL
*/
/** */
ve.init.sa.Platform.prototype.getModulesUrl = function () {
return this.modulesUrl;
};
/**
* Add multiple messages to the localization system.
*
* @method
* @param {Object} messages Map of message-key/message-string pairs
*/
/** */
ve.init.sa.Platform.prototype.addMessages = function ( messages ) {
for ( var key in messages ) {
this.messages[key] = messages[key];
}
};
/**
* Get a message from the localization system.
*
* @method
* @param {string} key Message key
* @param {Mixed...} [args] List of arguments which will be injected at $1, $2, etc. in the messaage
* @returns {string} Localized message
*/
/** */
ve.init.sa.Platform.prototype.getMessage = function ( key ) {
if ( key in this.messages ) {
// Simple message parser, does $N replacement and nothing else.
@ -92,28 +70,14 @@ ve.init.sa.Platform.prototype.getMessage = function ( key ) {
return '<' + key + '>';
};
/**
* Add multiple parsed messages to the localization system.
*
* @method
* @param {Object} messages Map of message-key/html pairs
*/
/** */
ve.init.sa.Platform.prototype.addParsedMessages = function ( messages ) {
for ( var key in messages ) {
this.parsedMessages[key] = messages[key];
}
};
/**
* Get a parsed message as HTML string.
*
* Falls back to mw.messsage with .escaped().
* Does not support $# replacements.
*
* @method
* @param {string} key Message key
* @returns {string} Parsed localized message as HTML string
*/
/** */
ve.init.sa.Platform.prototype.getParsedMessage = function ( key ) {
if ( key in this.parsedMessages ) {
// Prefer parsed results from VisualEditorMessagesModule.php if available.
@ -136,12 +100,7 @@ ve.init.sa.Platform.prototype.getParsedMessage = function ( key ) {
} );
};
/**
* Gets client platform string from browser.
*
* @method
* @returns {string} Client platform string
*/
/** */
ve.init.sa.Platform.prototype.getSystemPlatform = function () {
var platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone'],
match = new RegExp( '(' + platforms.join( '|' ) + ')' ).exec( window.navigator.platform.toLowerCase() );
@ -150,12 +109,7 @@ ve.init.sa.Platform.prototype.getSystemPlatform = function () {
}
};
/**
* Gets the user language from the browser.
*
* @method
* @returns {string} User language string
*/
/** */
ve.init.sa.Platform.prototype.getUserLanguage = function () {
// IE or Firefox Safari Opera
var lang = window.navigator.userLanguage || window.navigator.language;

View file

@ -75,7 +75,7 @@ ve.init.Platform.prototype.getMessage = function () {
*
* @method
* @abstract
* @param {Object} messages Containing parsed html strings
* @param {Object} messages Map of message-key/html pairs
*/
ve.init.Platform.prototype.addParsedMessages = function () {
throw new Error( 've.init.Platform.addParsedMessages must be overridden in subclass' );
@ -106,7 +106,7 @@ ve.init.Platform.prototype.getSystemPlatform = function () {
};
/**
* Gets the user language from the browser.
* Gets the user language.
*
* @method
* @abstract