Jump to content

User:Btilm/replace.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.
function replace1() {
var txt = document.editform.wpTextbox1;
var replacetext='/1/ is located in /2/.  It was added to the /3/ on /4/.'
txt.value=txt.value.replace('The infobox is NOT enough for a standalone article.  You need to enter some more information about where the property is located, its history, and why this property is notable.  In other words, don\'t use this infobox generator to create one-sentence stubs.',replacetext)
var holdthree = txt.value.replace(/(\n|.)*name = (.*)(\n|.)*/gim, "\'\'\'$2\'\'\'");
txt.value = txt.value.replace(/\/1\//gim, holdthree);
var holdone=txt.value.replace(/(\n|.)*(location|nearest\_city).?=.*\[\[(.*)\]\](\n|.)*/gim, '[[$3]]');
txt.value = txt.value.replace(/\/2\//gim, holdone);
txt.value = txt.value.replace(/\/3\//gim, "[[National Register of Historic Places]]");
var holdtwo=txt.value.replace(/(\n|.)*added = (.*)\n(\n|.)*/gim, '$2');
txt.value = txt.value.replace(/\/4\//gim, holdtwo);
document.editform.wpSummary.value = 'new article';
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}

addOnloadHook(
function(){
mw.util.addPortletLink("p-cactions", "javascript:replace1()", "r", "ca-rept", "replace", "")
})