User:DannyS712/Meta.js

Source: 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:DannyS712/Meta.js}}																		</nowiki></code>
// or with
// <code><nowiki>		importScript( 'User:DannyS712/Meta.js' ); // Backlink: [[User:DannyS712/Meta.js]] 							</nowiki></code> 
//
// If forking this script, please note my contributions / give me credit
//<nowiki>
$(function (){
const MetaLog = {};
MetaLog.config = {
	name: '[[User:DannyS712/View meta log|View meta log.js]]',
	version: 1.1,
	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 (MetaLog.config.debug) {
    			console.log( target );
    		}
    		mw.util.addPortletLink(
    			'p-cactions',
    			'//meta.wikimedia.org/wiki/Special:Log?page=' + target + '@' + mw.config.get( 'wgDBname'),
    			'View meta log',
    			'ca-meta-link',
    			'View logs on meta'
    		);
    	}
    } );
} );
});
//</nowiki>