Jump to content

User:Pemaksa/Api.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.
// Install with:
// <code><nowiki>		{{subst:Iusc|User:Pemaksa/Api.js}}																		</nowiki></code>
// or with
// <code><nowiki>		importScript( 'User:Pemaksa/Api.js' ); // Backlink: [[User:Pemaksa/Api.js]] 							</nowiki></code> 
//
// If forking this script, please note my contributions / give me credit
//<nowiki>
$(function (){
var Api_log_config = {
	name: '[[User:Pemaksa/View api log|View api log.js]]',
	version: 1.0,
	debug: false
};

mw.loader.using( 'mediawiki.util', function () {
    $(document).ready( function () { 
    	var page = mw.config.get('wgCanonicalSpecialPageName');
    	if (page && page == "Log") {
    		var target = document.getElementById("ooui-php-3").value;
    		if (Api_log_config.debug) console.log ( target );
    		mw.util.addPortletLink ( 'p-cactions', '//api.wikimedia.org/wiki/Special:Log?page=' + target + '@enwiki', 'View api log', 'ca-api-link', 'View logs on api');
    	}
    } );
} );
});
//</nowiki>