MediaWiki:MarcEditorDynamicLinks.js: mudanças entre as edições

sem sumário de edição
Sem resumo de edição
Sem resumo de edição
 
function rmCarriageReturn() {
const inputstextareas = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-inputtextarea');
inputstextareas.forEach((inputtextarea) => {
const element = inputtextarea;
element.value = element.value.replace('
', '');
});
 
function rmHtmlTags() {
const inputstextareas = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-inputtextarea');
inputstextareas.forEach((inputtextarea) => {
const element = inputtextarea;
element.value = element.value.replace(/<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g, '');
});
}
 
function rmTxtFromHiddenTexareasrmTxtFromHiddenFields() {
const inputsspans = document.body.querySelectorAll('span.hiddenByPF');
inputsspans.forEach((elem) => {
elem.querySelectorAll('.input.oo-ui-inputWidget-input').forEach((input) => {
const normalizedInputelement = input;
element.value = '';
});
elem.querySelectorAll('textarea').forEach((input) => {
const element = input;
element.value = '';
 
function normalizeInput() {
const inputsinstanceMains = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-input');
inputsinstanceMains.forEach((inputinstanceMain) => {
instanceMain.querySelectorAll('.oo-ui-inputWidget-input').forEach((input) => {
const normalizedInput = input;
const normalizedInput.value = normalizedInput.valueinput;
normalizedInput.value = normalizedInput.value
// "$a Bar \n$b Baz" > " $a Bar $b Baz"
.replace(/\s*(\$[a-z0-8])\s*/g, ' $1 ')
// "$a Bar\nFoo" > "$a Bar Foo" ou "$a Bar Foo" > "$a Bar Foo"
.replace(/\n|\s\s+|\t/g, ' ')
// replace "|" by "%7C" (Ex.: http://viaf.org/processed/WKP|Q2484404)
// .replace(' "|'," 'by "%7C'" (Ex.: http://viaf.org/processed/WKP|Q2484404);
.replace('|', '%7C');
});
instanceMain.querySelectorAll('textarea').forEach((textarea) => {
const normalizedInput = textarea;
textarea.value = normalizedInput.value
// "$a Bar \n$b Baz" > " $a Bar $b Baz"
.replace(/\s*(\$[a-z0-8])\s*/g, ' $1 ')
// "$a Bar\nFoo" > "$a Bar Foo" ou "$a Bar Foo" > "$a Bar Foo"
.replace(/\n|\s\s+|\t/g, ' ')
// replace "|" by "%7C" (Ex.: http://viaf.org/processed/WKP|Q2484404)
.replace('|', '%7C');
});
});
}
saveBtn.addEventListener('click', () => {
observer.disconnect();
rmTxtFromHiddenTexareasrmTxtFromHiddenFields();
rmCarriageReturn();
rmHtmlTags();