User:Technical 13/SandBox/Gadget-BugStatusUpdate.js/sandbox.js: Difference between revisions

Content deleted Content added
Technical 13 (talk | contribs)
m misplaced );
Technical 13 (talk | contribs)
Let's put the creation of the function up top, and then call it at the bottom.
Line 11:
(function($){
// // Create function to retrieve bug statuses
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 request
function bugStatus(){
$.ajax({
Line 91 ⟶ 75:
});
}
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 request
bugStatus();
})(jQuery);