mediawiki.util: Add mw.log.deprecate to #jsMessage
authorFomafix <fomafix@googlemail.com>
Sat, 26 Apr 2014 13:49:47 +0000 (13:49 +0000)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 28 Apr 2014 22:39:09 +0000 (22:39 +0000)
Duplicate code to wikibits.js to prevent deprecate message on loading.

Change-Id: Ib41d52456825526c5217743302e80a2de2bbe8d8

resources/src/mediawiki/mediawiki.util.js
skins/common/wikibits.js

index 15b075c..eb20d22 100644 (file)
 
                },
 
-               /**
-                * 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
         */
        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 ) );
index a7ff2da..8d80ccb 100644 (file)
@@ -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