User:AzaToth/monobook.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.
importScript('Wikipedia:AutoEd/complete.js');
$( function() {
if( mw.config.get('wgCanonicalSpecialPageName') == 'Log' ) {
	var form = document.forms[0];
	var labels = form.getElementsByTagName( 'label' );

	// Save the given text from the beginning, first one is the "user" field, and the nect one is the "page" field;
	var old = {};
	old.user = labels[0].textContent;
	old.page = labels[1].textContent;
	var logLabelCallback = function logLabelCallback( event ) {
		var form = event.target;
		var value = form.type.value;
		labels = form.getElementsByTagName( 'label' );

		switch( value ) {
		case 'block':
			labels[0].textContent = 'Blocker:';
			labels[1].textContent = 'Blockee:';
			break;
		default:
			labels[0].textContent = old.user;
			labels[1].textContent = old.page;
			break;
		}
	}

	// We add an event listener to the callback in the form element
	form.addEventListener( 'change', logLabelCallback, false );

	// to make it "pop up" on load, we initiate an change event
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	form.dispatchEvent( evt );
}
});
if(!document.all) {
$(function() {var s=document.evaluate('//div[span/a/@class="image" and starts-with(span/a/@title,"Replace this image") and contains(span/a/@title,".svg")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);for(var i=0;i<s.snapshotLength;++i){var c=s.snapshotItem(i);c.parentNode.removeChild(c);}});

//importScript('User:Voice_of_All/Addtabs/monobook.js');
//importScript('User:Voice of All/History/monobook.js');
//importScript('User:Animum/derhexer.js');
//importScript('User:CWii/JB2script.js');
/*
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinkleprotect.js');
importScript('User:AzaToth/twinkleprod.js');
importScript('User:AzaToth/twinklexfd.js');
importScript('User:AzaToth/twinkleimage.js');
importScript('User:AzaToth/twinkleunlink.js');
importScript('User:AzaToth/twinkledelimages.js');
importScript('User:AzaToth/twinkledeprod.js');
importScript('User:AzaToth/twinklebatchdelete.js');
importScript('User:AzaToth/twinklebatchprotect.js');
importScript('User:AzaToth/twinklebatchundelete.js');
importScript('User:AzaToth/twinkleclose.js');
importScript('User:AzaToth/twinkleundelete.js');
importScript('User:AzaToth/twinkleimagetraverse.js');
importScript('User:AzaToth/whackaspammer.js');
*/
//importScript('User:AzaToth/tests/friendlytag.js');
importScript('User:AzaToth/morebits.js');
importScript('User:CBM/ratemath.js');
/*
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'window',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " using [[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
        protectionSummaryAd             :       " using [[WP:TWINKLE|TW]]",
        watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [],
        watchRevertedPages              :       [ 'agf', 'norm', 'vand', 'torev' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        watchWarnings                   :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       true,
        offerReasonOnNormalRevert       :       true
};
*/
}
//importScript('User:AzaToth/VoA.js');
//importScript('User:AzaToth/liveclock.js');
//importScript('User:Interiot/Tool2/code.js');
//importScript('User:GeorgeMoney/UserScripts/RemExternalLinks');

// [[User:Outriggr/metadatatest.js]]      
//importScript('User:Outriggr/metadatatest.js'); 
//defaultProject = "WPBiography";

//importScript('User:Voice_of_All/Deletion/monobook.js');
//importScript('User:Lupin/recent2.js');

// Lousy hack ↓
function getParamValue(paramName, h) {
	if (typeof h == 'undefined' ) { h = document.location.href; }
	var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
	var m=cmdRe.exec(h);
	if (m) {
		try {
			return decodeURI(m[1]);
		} catch (someError) {}
	}
	return null;
}
$(function () {
var summary=getParamValue('autosummary');

if (document.editform && summary) { document.editform.wpSummary.value=summary; }
});