Export allowed tags from Sanitizer to mediawiki.jqueryMsg
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.jqueryMsg.js
index b5c2dba..98148d5 100644 (file)
                        magic: {
                                'SITENAME': mw.config.get( 'wgSiteName' )
                        },
-                       // This is a whitelist based on, but simpler than, Sanitizer.php.
+                       // This is a whitelist like Sanitizer.php.
                        // Self-closing tags are not currently supported.
+                       // The simplified default here is overridden below by data supplied
+                       // by the mediawiki.jqueryMsg.data module.
                        allowedHtmlElements: [
                                'b',
                                'i'
                };
        }
 
+       // Use data from mediawiki.jqueryMsg.data to override defaults, if
+       // available
+       if ( mw.jqueryMsg && mw.jqueryMsg.data ) {
+               if ( mw.jqueryMsg.data.allowedHtmlElements ) {
+                       parserDefaults.allowedHtmlElements = mw.jqueryMsg.data.allowedHtmlElements;
+               }
+       }
+
        mw.jqueryMsg = {};
 
        /**
         * Returns a function suitable for use as a global, to construct strings from the message key (and optional replacements).
         * e.g.
         *
-        *       window.gM = mediaWiki.parser.getMessageFunction( options );
+        *       window.gM = mediaWiki.jqueryMsg.getMessageFunction( options );
         *       $( 'p#headline' ).html( gM( 'hello-user', username ) );
         *
         * Like the old gM() function this returns only strings, so it destroys any bindings. If you want to preserve bindings use the
         * the current selector. Bindings to passed-in jquery elements are preserved. Functions become click handlers for [$1 linktext] links.
         * e.g.
         *
-        *        $.fn.msg = mediaWiki.parser.getJqueryPlugin( options );
+        *        $.fn.msg = mediaWiki.jqueryMsg.getPlugin( options );
         *        var userlink = $( '<a>' ).click( function () { alert( "hello!!" ) } );
         *        $( 'p#headline' ).msg( 'hello-user', userlink );
         *