MediaWiki:Gadget-NamespaceNotice.js: Difference between revisions

From Wikimedia Foundation Governance Wiki
Content deleted Content added
MZMcBride (talk | contribs)
once more...
MZMcBride (talk | contribs)
hmm
Line 2: Line 2:
if ( ( mw.config.get( 'wgNamespaceNumber' ) == 1 ) &&
if ( ( mw.config.get( 'wgNamespaceNumber' ) == 1 ) &&
( mw.config.get( 'wgAction') == 'view' ) &&
( mw.config.get( 'wgAction') == 'view' ) &&
( mw.config.get( 'wgUserName' ) != 'null' ) ) {
( mw.config.get( 'wgUserName' ) == null ) ) {
var text = $.getJSON(
var text = $.getJSON(
wgScriptPath + '/api.php?',
wgScriptPath + '/api.php?',

Revision as of 01:52, 16 July 2012

/* Show a notice inside <div id="contentSub"></div> on pages in the Talk namespace */
if ( ( mw.config.get( 'wgNamespaceNumber' ) == 1 ) &&
     ( mw.config.get( 'wgAction') == 'view' ) &&
     ( mw.config.get( 'wgUserName' ) == null ) ) {
  var text = $.getJSON(
        wgScriptPath + '/api.php?',
        {
            action: 'parse',
            prop: 'text',
            page: 'Template:Contribute',
            format: 'json'
        },
        function( data ) {
            if ( data ) {
                var text = data.parse.text['*'];
                $('#contentSub').html(text).css({'margin':'1em 0', 'color':'#000'});
            }
        }
  )
}