User:Lightmouse/monobook.js/script.js

This is an old revision of this page, as edited by Lightmouse (talk | contribs) at 19:09, 29 December 2007. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
//Create 'winc' function:

function winc(s) {
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
//'winc' function allows buttons to be added toolbar
winc('User:Omegatron/monobook.js/addlink.js');

winc('User:Lightmouse/monobook.js/dates.js');
winc('User:Lightmouse/monobook.js/units.js');

function run_dates() {
    var txt = document.editform.wpTextbox1;
    dates();

// Add a tag to the summary box
    var txt = document.editform.wpSummary;
    var summary = "[[User:Lightmouse/monobook.js/script.js|Script]] assisted. Units/dates/other";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}

// Press the diff button to check it
    document.editform.wpDiff.click()
}
addOnloadHook(function () {
    if(document.forms.editform) {
        addLink('p-cactions', 'javascript:run_dates()', 'dates', 'ca-unitfixer', 'Fixes some unit formatting', '', '');
    }
});

function run_formatgeneral() {
    var txt = document.editform.wpTextbox1;
    formatgeneral();

// Add a tag to the summary box
    var txt = document.editform.wpSummary;
    var summary = "[[User:Lightmouse/monobook.js/script.js|Script]] assisted. Units/dates/other";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}

// Press the diff button to check it
    document.editform.wpDiff.click()
}
addOnloadHook(function () {
    if(document.forms.editform) {
        addLink('p-cactions', 'javascript:run_formatgeneral()', 'general', 'ca-unitfixer', 'Fixes some unit formatting', '', '');
    }
});

function combined() {
    var txt = document.editform.wpTextbox1;
    formatgeneral();
    dates();

// Add a tag to the summary box
    var txt = document.editform.wpSummary;
    var summary = "[[User:Lightmouse/monobook.js/script.js|Script]] assisted. Units/dates/other";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}

// Press the diff button to check it
    document.editform.wpDiff.click()
}

addOnloadHook(function () {
    if(document.forms.editform) {
        addLink('p-cactions', 'javascript:combined()', 'combined', 'ca-unitfixer', 'Fixes some unit formatting', '', '');
    }
});