User:MPGuy2824/scripts/getOresScores.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/******************************************************************************
 GetOresScores
--------------
A script to get the ORES scores of the latest revision of the article
******************************************************************************/
$.when(
	// Resource loader modules
	mw.loader.using( [ 'mediawiki.util' ] ),
	// Page ready
	$.ready
).then( function( require ) {
	var getORESAPI = function( revisionId ) {
		return "https://ores.wikimedia.org/v3/scores/enwiki/" + 
			revisionId + "/articlequality";
	};

	// Only for article, draft and user namespaces
	if( [ 0, 2, 118 ].indexOf( mw.config.get( "wgNamespaceNumber" ) ) !== -1 ) {
		mw.util.addPortletLink(
			'p-navigation',
			getORESAPI( mw.config.get( 'wgCurRevisionId' ) ),
			'ORES Scores',
			't-ores',
			'A link for the ORES Scores',
			null,
			null
		);
	}
});