Jump to content

User:Isaac (WMF)/wp testing.js

From Wikipedia, the free encyclopedia
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.
function getPagesToTranslate() {
		var params = {
			s: 'en',
			t: 'es',
			article: mw.config.get('wgPageName'),
			n: 10,
		};
		$.get( 'https://api.wikimedia.org/service/lw/recommendation/v1/api', params ).done( results => console.log(results) );
}

$(document).ready(function() {
	// article on enwiki but not Main Page
    if (mw.config.get("wgDBname") == "enwiki" && mw.config.get('wgNamespaceNumber') == 0 && mw.config.get('wgWikibaseItemId') != 'Q5296') {
	    getPagesToTranslate();
    }
});