From f856a480b9dc99e62bdeb33df5abe213ac9e0f4f Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sat, 26 Apr 2014 13:49:47 +0000 Subject: [PATCH] mediawiki.util: Add mw.log.deprecate to #jsMessage Duplicate code to wikibits.js to prevent deprecate message on loading. Change-Id: Ib41d52456825526c5217743302e80a2de2bbe8d8 --- resources/src/mediawiki/mediawiki.util.js | 41 ++++++++++++----------- skins/common/wikibits.js | 11 +++++- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/resources/src/mediawiki/mediawiki.util.js b/resources/src/mediawiki/mediawiki.util.js index 15b075c2b3..eb20d22d38 100644 --- a/resources/src/mediawiki/mediawiki.util.js +++ b/resources/src/mediawiki/mediawiki.util.js @@ -331,26 +331,6 @@ }, - /** - * Add a little box at the top of the screen to inform the user of - * something, replacing any previous message. - * Calling with no arguments, with an empty string or null will hide the message - * - * @param {Mixed} message The DOM-element, jQuery object or HTML-string to be put inside the message box. - * to allow CSS/JS to hide different boxes. null = no class used. - * @deprecated since 1.20 Use mw#notify - */ - jsMessage: function ( message ) { - if ( !arguments.length || message === '' || message === null ) { - return true; - } - if ( typeof message !== 'object' ) { - message = $.parseHTML( message ); - } - mw.notify( message, { autoHide: true, tag: 'legacy' } ); - return true; - }, - /** * Validate a string as representing a valid e-mail address * according to HTML5 specification. Please note the specification @@ -510,6 +490,27 @@ */ mw.log.deprecate( util, 'tooltipAccessKeyRegexp', /\[(ctrl-)?(option-)?(alt-)?(shift-)?(esc-)?(.)\]$/, 'Use jquery.accessKeyLabel instead.' ); + /** + * @method jsMessage + * Add a little box at the top of the screen to inform the user of + * something, replacing any previous message. + * Calling with no arguments, with an empty string or null will hide the message + * + * @param {Mixed} message The DOM-element, jQuery object or HTML-string to be put inside the message box. + * to allow CSS/JS to hide different boxes. null = no class used. + * @deprecated since 1.20 Use mw#notify + */ + mw.log.deprecate( util, 'jsMessage', function ( message ) { + if ( !arguments.length || message === '' || message === null ) { + return true; + } + if ( typeof message !== 'object' ) { + message = $.parseHTML( message ); + } + mw.notify( message, { autoHide: true, tag: 'legacy' } ); + return true; + }, 'Use mw.notify instead.' ); + mw.util = util; }( mediaWiki, jQuery ) ); diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index a7ff2da370..8d80ccb04d 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -153,7 +153,16 @@ mw.log.deprecate( win, 'escapeQuotesHTML', $.noop, 'Use mw.html instead.' ); * @deprecated since 1.17 Use mediawiki.notify instead * @param {string|HTMLElement} message To be put inside the message box */ -mw.log.deprecate( win, 'jsMsg', mw.util.jsMessage, 'Use mediawiki.notify instead.' ); +mw.log.deprecate( win, 'jsMsg', function ( message ) { + if ( !arguments.length || message === '' || message === null ) { + return true; + } + if ( typeof message !== 'object' ) { + message = $.parseHTML( message ); + } + mw.notify( message, { autoHide: true, tag: 'legacy' } ); + return true; +}, 'Use mediawiki.notify instead.' ); /** * Misc. utilities -- 2.20.1