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)
wth...
 
(4 intermediate revisions by the same user not shown)
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 80 ⟶ 64:
}
}
error: function ( foo, data, error ) {
}/* End of success:
error: function(){
/* Using this string with 49741 being a ticket I can't see:
https://bugzilla.wikimedia.org/jsonrpc.cgi?method=Bug.get&id=158&params=[{%20%22ids%22:%20[35810,35909,300,48745,49741,54598],%22include_fields%22:[%22last_change_time%22,%22status%22,%20%22id%22,%20%22summary%22]}]
returns:
{"error":{"message":"You are not authorized to access bug #49741. To see this bug, you must first log in to an account with the appropriate permissions.","code":102},"id":"158","result":null}
*//*
console.error( 'Foo: %o\nRaw data: %o\nError: %o', foo, data, error );
console.error( 'id array: %o', ids );
}*/
}
});
}
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);