summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/res/smw/util/ext.smw.personal.js
blob: d5e6f955b8b25ac197039bcce09a9ff1b88cf026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * @license GNU GPL v2+
 * @since 3.0
 *
 * @author mwjames
 */

/*global jQuery, mediaWiki, mw */
( function ( $, mw ) {

	'use strict';

	$( document ).ready( function() {

		$( '.smw-personal-jobqueue-watchlist' ).removeClass( 'is-disabled' );

		// Iterate over available nav links onClick
		$( '.smw-personal-jobqueue-watchlist' ).each( function() {

			var watchlist = mw.config.get( 'smwgJobQueueWatchlist' );
			var text = '';

			for ( var prop in watchlist ) {
				if ( watchlist.hasOwnProperty( prop ) ) {
					text = text + '<tr><td>' + prop + '</td><td>&nbsp;</td><td><span class="item-count active">' + watchlist[prop] + '</span></td></tr>';
				}
			}

			if ( text !== '' ) {
				text = '<table class="smw-personal-table"><tbody>' + text + '</tbody></table>';

				var tooltip = smw.Factory.newTooltip();
				tooltip.show ( {
					context: $( this ),
					title: mw.msg( 'smw-personal-jobqueue-watchlist' ),
					type: 'inline',
					content: text
				} );
			};
		} );

	} );

}( jQuery, mediaWiki ) );