MediaWiki:Gadget-MonacoRecentChanges.js

/* _____________________________________________________________________________ * |                                                                             | * |                    === WARNING: GLOBAL GADGET FILE ===                      | * |                 Changes to this page affect many users. | * |          Please discuss changes on the talk page before editing. | * |_____________________________________________________________________________| * * Gadget definition for Monaco Sidebar Recent Changes Widget */ (function ($, mw) { $(function  { var monacoWidget = mw.libs.monacoWidget; var ns = mw.config.get('wgNamespaceNumber'); if(!monacoWidget || !monacoWidget.IsMonaco || monacoWidget.Exists('RCWidget')) return; if(ns < 0 || ns > 1) // on mainspace and talk articles only. return; new monacoWidget('RCWidget', 'Recent changes', false, null, true, 1500, 'Loading...', 'progress',     // content callback      function (widget) { widget.addStdListContentElement(false); },      // click callback      function (widget) {        if(!widget.state || widget.state == 2) {          widget.state = 1; // loading          monacoWidget.DoAPIQuery( widget, monacoWidget.GetRecentChangesQuery, // query callback function (widget, data) { widget.state = 2; // loaded widget.makeRefreshPic; widget.emptyStdListContentElement; var rclist = $('#RCWidget_stdlist'); data.query.recentchanges.forEach(function (result) {               rclist.append( '' + monacoWidget.ArticleLink(result.title, result) + ' - ' + monacoWidget.UserLink(result.user) + ' (' + monacoWidget.PrettyDate(result.timestamp) + ')' + '' ); // end append             }); // end forEach } // end of DoAPIQuery callback ); // end DoAPIQuery       } // end if      } // end click callback    ); // end new monacoWidget }); // end $ })(jQuery, mediaWiki);