User:Btilm/replace.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Btilm/replace. |
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", "")
})