Jump to content

User:Xaradnam/monobook.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Xaradnam (talk | contribs)
m function printValue
Xaradnam (talk | contribs)
m .
Line 50: Line 50:
}
}


printValue("ot1", document.getElementById('mw-diff-otitle1'))
printValue("ot1", document.getElementById('mw-diff-otitle1').title)
printValue("nt1", document.getElementById('mw-diff-ntitle1'))
printValue("nt1", document.getElementById('mw-diff-ntitle1').title)
printValue("CurPg", CurPg)
printValue("CurPg", CurPg)

Revision as of 00:57, 20 October 2021

importScript('User:Shubinator/DYKcheck.js');


// Section subscribe
CurNSnum=mw.config.get('wgNamespaceNumber');
if (CurNSnum%2==1||CurNSnum==4)
	{mw.util.addPortletLink(
		'p-tb',
		mw.config.get('wgScript')+'?title='+mw.config.get('wgPageName')+'&dtenable=1',
		'Section subscribe'
		);}

// Add unredirected link next to redirects; from [[User:BrandonXLF/NoRedirect.js]]
$(function() {
	$('#mw-content-text .mw-redirect').after(function() {
		return this.href.indexOf('redirect=no') !== -1 || this.href.indexOf('action=') !== -1  || this.href.indexOf('diff=') !== -1 ? ''
			: '<a href="' +
			this.href +
			(this.href.includes('?') ? '&' : '?') +
			'redirect=no" title="' +
			(this.title || this.href) +
			' (redirect pg)"><span style="color:#534e8a"><sup> Я</sup></span></a>';
	});
});


CurPg=mw.config.get('wgPageName'); // Current page name


// ======== ADD DIFF INFO TO BOTTOM OF PAGE WHEN APPLICABLE =========
$.when( $.ready, mw.loader.using(["mediawiki.util"]) ).then( function () {
    var suffix = mw.config.get("wgDiffNewId");
    if (suffix) {
        if (document.getElementsByClassName("diff-multi").length ||
            CurPg === "Special:ComparePages") {
            suffix = mw.config.get("wgDiffOldId") + "/" + suffix;
        }
        $('body').append("<center><h4><tt>[[Special:Diff/" + suffix + "&#124;diff]]</tt></h4></center>");
    } else {
        var oldidMatch = mw.util.getParamValue("oldid");
        if(oldidMatch) {
            $('body').append("<center><h4><tt>[[Special:Permalink/" + oldidMatch + "&#124;permalink]]</tt></h4></center>");
        }
    }
} );


function printValue(txt, val) {
 $('body').append("<center><h4><tt>" + txt + ": " + val + " </tt></h4></center>");
}

printValue("ot1", document.getElementById('mw-diff-otitle1').title)
printValue("nt1", document.getElementById('mw-diff-ntitle1').title)
printValue("CurPg", CurPg)