Difference between revisions 87413 and 87451 on cawikisource/*Barreja de diferents Mediawikis de Wikisource (ThomasV, Pathoschild, et al.)*/ (function (mw) { mw.corregir={}; function Fragment_Tipo(text) { var typo_def = new Array ( "( )", " ", "(— )", "—", "( —)", "—", "(- )", "-", "( -)", "-", "(■)",";", (contracted; show full) for (var i = 0; i < lng; i += 2) { search = new RegExp(typo_def[i + 0], "g"); text = text.replace(search, typo_def[i + 1]); } return text; } //function Tipografia() { mw.corregir.Tipografia= function () {⏎ if (mw.config.get("wgNamespaceNumber") == 102) { var editbox = document.getElementById('wpTextbox1'); if (editbox) { var text = editbox.value; var new_text = ''; var last_match = 0; // Dividir el text en paraules per a no aplicar canvis al propi codi html (contracted; show full) editbox.parentNode.insertBefore(regexform,editbox.parentNode.firstChild); var formform = document.createElement('form'); formform.setAttribute('id','regexformform'); regexform.appendChild(formform); var corregir_button = document.createElement('input'); corregir_button.setAttribute('type',"button"); corregir_button.setAttribute('onclick'," mw.corregir.Tipografia();"); corregir_button.setAttribute('title',"Corregeix"); corregir_button.setAttribute('value',"Corregeix"); formform.appendChild(corregir_button); var prosa_button = document.createElement('input'); prosa_button.setAttribute('type',"button"); prosa_button.setAttribute('onclick',"mw.corregir.Fes_Prosa();"); prosa_button.setAttribute('title',"Prosa"); prosa_button.setAttribute('value',"Prosa"); formform.appendChild(prosa_button); var newinput = document.createElement('input'); newinput.setAttribute('id','formsearch'); var newlabel = document.createElement('label'); newlabel.setAttribute('for','formsearch'); newlabel.appendChild(document.createTextNode("Canvia ")); formform.appendChild(newlabel); formform.appendChild(newinput); var newinput = document.createElement('input'); newinput.setAttribute('id','formreplace'); var newlabel = document.createElement('label'); newlabel.setAttribute('for','formreplace'); newlabel.appendChild(document.createTextNode(' per ')); formform.appendChild(newlabel); formform.appendChild(newinput); var go_button = document.createElement('input'); go_button.setAttribute('type',"button"); go_button.setAttribute('onclick',"mw.corregir.customgo();"); go_button.setAttribute('title',"Vés!"); go_button.setAttribute('value',"Vés!"); formform.appendChild(go_button); } } //function Fes_Prosa() { mw.corregir.Fes_Prosa= function () {⏎ var editbox = document.getElementById('wpTextbox1'); if (editbox) { var text = editbox.value; var new_text = ''; var last_match = 0; // Dividir el text en paraules per a no aplicar canvis al propi codi html splitter = new RegExp("<math>.*</math>|<[a-zA-z0-9 =\"']>|[</[a-zA-z0-9 =\"']+>|style=\".*\"| |—|<!--.*-->|\n:[:]*|\n;[;]*|[[][[].*]]", "gm"); while ((result = splitter.exec(text)) != null) { new_text += Fragment_Prosa(text.slice(last_match, splitter.lastIndex - result[0].length)); new_text += result; last_match = splitter.lastIndex; } new_text += Fragment_Prosa(text.slice(last_match)); editbox.value = new_text; } } //function customgo() { mw.corregir.customgo= function () {⏎ var msearch = document.getElementById('formsearch').value; msearch = msearch.replace(/\\n/g, '\n'); var mreplace = document.getElementById('formreplace').value; mreplace = mreplace.replace(/\\n/g, '\n'); //convertir entrada en expressió regular if(!msearch.match(/^\s*\/[\s\S]*\/[a-z]*\s*$/i)) {//sense delimitadors var search_re = new RegExp(msearch,'g'); } (contracted; show full) } } function add_Corr_button(){ if (mw.config.get("wgNamespaceNumber") == 102) { addButton2("wpRep","Correccions automàtiques","Correcció automàtica", "//upload.wikimedia.org/wikipedia/commons/a/af/Button_Fractur_OCR.png", CreaFormulari); } } $(document).ready(add_Corr_button);⏎ ⏎ })(mediaWiki); All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://ca.wikisource.org/w/index.php?diff=prev&oldid=87451.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|