For faster navigation, this Iframe is preloading the Wikiwand page for मीडियाविकि:Gadget-BugStatusUpdate.js.

मीडियाविकि:Gadget-BugStatusUpdate.js

/* 
 * Bug Status Update Gadget
 * Author: Rob Moen (robm)
 * Description:
 *  Finds and updates bug status templates on a page. 
 *  Makes 1 JSONP request to Bugzilla JSON RPC api.
 * Source: [[mw:User:Robmoen/bugStatusUpdate.js]]
 */
 
( function( $ ){
	var	ids = [],
		target = 'https://bugzilla.wikimedia.org/jsonrpc.cgi';

	// Ugly way to compose the request parameters. though, bugzilla is happy with it
	var getParams = function( ids ) {
		return 'method=Bug.get&id=158&params=[{ "ids": [' + ids.join( ',' ) + '], "include_fields": ["last_change_time", "status", "id", "summary"] }]';
	};
 
	// Get the bug id numbers on the page
	$( '.mw-trackedTemplate' ).each( function() {
		var title = $( this ).find( 'a[title^="bugzilla:"]' ).attr( 'title' );
		ids.push( title.split( ':' )[1] );
	});

        // Do not query if no ids were found
        if ( !ids.length ) {
                return;
        }
 
	// Make jsonp
	$.ajax( {
		url: target,
		dataType: 'jsonp',
		data: getParams( ids ),
		success: function ( data ) {
 
			var		color = {
						"RESOLVED": "green",
						"CRITICAL": "red"
					},
					statusProps = {
						'font-weight': 'bold', 
						'font-size': '1.5em', 
						'text-transform': 'uppercase'
					};
 
			if ( data.result && data.result.bugs ) {
				for( var b in data.result.bugs ) {
					// Find the right bug to update
					$item = $( '.mw-trackedTemplate' )
						.find( 'a[title^="bugzilla:' + data.result.bugs[b].id + '"]');
					title = $( '.trakbug-'+data.result.bugs[b].id )

					if ( title ) {
						title.text( data.result.bugs[b].summary );
					}
                                         
 					if( $item ) {
						// Find child, if exists
						$status = $item
							.parent()
							.next( 'p' )
							.children( 'span' );
						// Create the status element if it does not exist
						if( $status.length === 0 ) {
							$item.parent().parent()
								.append( $( '<p></p>' )
									.append( $( '<span></span>' )
										.css( statusProps )
										.text( 'Status' )
									)
								);
						}
						// Udpate the status element
						$item
							.parent()
							.next( 'p' )
							.children( 'span' )
							.css( 'color', color[data.result.bugs[b].status] || '#333333' )
							.text( data.result.bugs[b].status.replace( /_/g, ' ' ) );
						$status = null;
 
					}
				}
			}
		}
	});
 
})( jQuery );
{{bottomLinkPreText}} {{bottomLinkText}}
मीडियाविकि:Gadget-BugStatusUpdate.js
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?