2012-07-20 23:59:59 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor initialization Target class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic platform.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
* @constructor
|
|
|
|
* @param {String} pageName Name of target page
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.init.Platform = function () {
|
2012-07-20 23:59:59 +00:00
|
|
|
// Inheritance
|
|
|
|
ve.EventEmitter.call( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a regular expression that matches allowed external link URLs.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @abstract
|
|
|
|
* @returns {RegExp} Regular expression object
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.init.Platform.prototype.getExternalLinkUrlProtocolsRegExp = function () {
|
2012-08-08 17:48:53 +00:00
|
|
|
throw new Error( 've.init.Platform.getExternalLinkUrlProtocolsRegExp must be overridden in subclass' );
|
2012-07-20 23:59:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a remotely accessible URL to the modules directory.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @abstract
|
|
|
|
* @returns {String} Remote modules URL
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.init.Platform.prototype.getModulesUrl = function () {
|
2012-08-08 17:48:53 +00:00
|
|
|
throw new Error( 've.init.Platform.getModulesUrl must be overridden in subclass' );
|
2012-07-20 23:59:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds multiple messages to the localization system.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @abstract
|
|
|
|
* @param {Object} messages Map of message-key/message-string pairs
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.init.Platform.prototype.addMessages = function ( messages ) {
|
2012-08-08 17:48:53 +00:00
|
|
|
throw new Error( 've.init.Platform.addMessages must be overridden in subclass' );
|
2012-07-20 23:59:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a message from the localization system.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @abstract
|
|
|
|
* @param {String} key Message key
|
|
|
|
* @param {Mixed} [...] List of arguments which will be injected at $1, $2, etc. in the messaage
|
|
|
|
* @returns {String} Localized message
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.init.Platform.prototype.getMessage = function ( key ) {
|
2012-08-08 17:48:53 +00:00
|
|
|
throw new Error( 've.init.Platform.getMessage must be overridden in subclass' );
|
2012-07-20 23:59:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.init.Platform, ve.EventEmitter );
|