Gebruiker:Rots61/Clear.js

Uit Wikikids
Naar navigatie springen Naar zoeken springen

Let op! Nadat je de veranderingen hebt opgeslagen, moet je de cache van je browser nog legen om ze daadwerkelijk te zien.

Mozilla (incl. Firefox) ctrl-shift-r
IE ctrl-f5
Opera f5
Safari cmd-r
Konqueror f5
function fixAbbreviations() {
    var text = document.editform.wpTextbox1.value;
	text = text.replace(/AK(?!\w)/g, '$1Alaska');
	text = text.replace(/AL(?!\w)/g, '$1Alabama');
	text = text.replace(/AR(?!\w)/g, '$1Arkansas');
	text = text.replace(/AZ(?!\w)/g, '$1Arizona');
	text = text.replace(/CA(?!\w)/g, '$1California');
	text = text.replace(/CO(?!\w)/g, '$1Colorado');
	text = text.replace(/CT(?!\w)/g, '$1Connecticut');
	text = text.replace(/DE(?!\w)/g, '$1Delaware');
	text = text.replace(/FL(?!\w)/g, '$1Florida');
	text = text.replace(/GA(?!\w)/g, '$1Georgia');
	text = text.replace(/HI(?!\w)/g, '$1Hawaii');
	text = text.replace(/IA(?!\w)/g, '$1Iowa');
	text = text.replace(/ID(?!\w)/g, '$1Idaho');
	text = text.replace(/IL(?!\w)/g, '$1Illinois');
	text = text.replace(/IN(?!\w)/g, '$1Indiana');
	text = text.replace(/KS(?!\w)/g, '$1Kansas');
	text = text.replace(/KY(?!\w)/g, '$1Kentucky');
	text = text.replace(/LA(?!\w)/g, '$1Louisiana');
	text = text.replace(/MA(?!\w)/g, '$1Massachusetts');
	text = text.replace(/MD(?!\w)/g, '$1Maryland');
	text = text.replace(/ME(?!\w)/g, '$1Maine');
	text = text.replace(/MI(?!\w)/g, '$1Michigan');
	text = text.replace(/MN(?!\w)/g, '$1Minnesota');
	text = text.replace(/MO(?!\w)/g, '$1Missouri');
	text = text.replace(/MS(?!\w)/g, '$1Mississippi');
	text = text.replace(/MT(?!\w)/g, '$1Montana');
	text = text.replace(/NC(?!\w)/g, '$1North Carolina');
	text = text.replace(/ND(?!\w)/g, '$1North Dakota');
	text = text.replace(/NE(?!\w)/g, '$1Nebraska');
	text = text.replace(/NH(?!\w)/g, '$1New Hampshire');
	text = text.replace(/NJ(?!\w)/g, '$1New Jersey');
	text = text.replace(/NM(?!\w)/g, '$1New Mexico');
	text = text.replace(/NV(?!\w)/g, '$1Nevada');
	text = text.replace(/NY(?!\w)/g, '$1New York');
	text = text.replace(/OH(?!\w)/g, '$1Ohio');
	text = text.replace(/OK(?!\w)/g, '$1Oklahoma');
	text = text.replace(/OR(?!\w)/g, '$1Oregon');
	text = text.replace(/PA(?!\w)/g, '$1Pennsylvania');
	text = text.replace(/RI(?!\w)/g, '$1Rhode Island');
	text = text.replace(/SC(?!\w)/g, '$1South Carolina');
	text = text.replace(/SD(?!\w)/g, '$1South Dakota');
	text = text.replace(/TN(?!\w)/g, '$1Tennessee');
	text = text.replace(/TX(?!\w)/g, '$1Texas');
	text = text.replace(/UT(?!\w)/g, '$1Utah');
	text = text.replace(/VA(?!\w)/g, '$1Virginia');
	text = text.replace(/VT(?!\w)/g, '$1Vermont');
	text = text.replace(/WA(?!\w)/g, '$1Washington');
	text = text.replace(/WI(?!\w)/g, '$1Wisconsin');
	text = text.replace(/WV(?!\w)/g, '$1West Virginia');
	text = text.replace(/WY(?!\w)/g, '$1Wyoming');
	text = text.replace(/\./g, '$1....');
	document.editform.wpTextbox1.value = text;
}

mw.loader.using( 'mediawiki.util', function () {

    // Wait for the page to be parsed
    $( document ).ready( function () { 

if (document.editform) {
        var link =     mw.util.addPortletLink("p-tb", "#", "Convert abbreviations", "tb-convertabbreviations", "Convert column of US state abbreviations to full names", "");
        $( link ).click( function ( event ) {
            event.preventDefault();
            fixAbbreviations();

        } );
        }
    } );
} );
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:Rots61/Clear.js&oldid=747196"