Content deleted Content added
Technical 13 (talk | contribs) m Trying to fix backwards compatibility. |
Technical 13 (talk | contribs) Strip out unneeded backwards compat and format to be easier to read. |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
/*
(function($){
var ids = [], target = 'https://bugzilla.wikimedia.org/jsonrpc.cgi';
// // Do not query if no ids were found
if ( !ids.length ) {
return;
}
// Make jsonp request
$.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.bugs ) {
for( var b in data.result.bugs ) {
// //find the right bug to update
var $item = $( '.mw-trackedTemplate' ).find( 'a[title^="bugzilla:' + data.result.bugs[b].id + '"]' );
var title = $( '.trakbug-' +
if( title ) {
title.text( data.result.bugs[b].summary );
}
if( $item ) {
// // Find child, if it 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 />' ).append(
$( '<span />' ).css( statusProps )
.text( 'Status' )
)
);
}
$item
.parent()
.next( 'p' )
.children( 'span' )
.css( 'color', color[data.result.bugs[b].status] || '#333333' )
.text( data.result.bugs[b].status );
$status = null;
}
}
}
}// End of success:
});
})(jQuery);
|