User:Rcsprinter123/script.js

// lowercase first letter
function SM_lower(str) {
 if (str != "") {
  var x = str.search( /[a-z]/gi );
  if( x >= 0 ) {
   var let = str.slice(x,x+1);
   str = str.replace(let, let.toLowerCase());
  }
 }
 return str;
}
 
// uppercase first letter
function SM_upper(str) {
 if (str != "") {
  var x = str.search( /[a-z]/gi );
  if( x >= 0 ) {
   var let = str.slice(x,x+1);
   str = str.replace(let, let.toUpperCase());
  }
 }
 return str;
}
 
// Obfuscation using sic template
function SM_obfuscate(str) {
 if (str != "") {
  str = str.replace(/\(/g, '(?:');
  var x = str.search( /[a-z][a-z]/gi );
  if( x >= 0 ) {
   str = '('+ str.slice(0,x+1) +')('+ str.slice(x+1) +')';
  }
 }
 return str;
}
 
// special replace
function SM_sr(str, spair) {
 var r = "";
 var s = new RegExp("", "gm");
 var m = spair.match(/^(.*)\/(.*)$/);
 
 // obfuscate misspellings in file names
 var sfile = new RegExp("(\\[\\[(?:FILE|IMAGE)[^\\]\\|]*[^\\w\\/\\.])" + SM_obfuscate(m[1]) + "([^\\w\\/])", 'gim' );
 str = str.replace(sfile, '$1{{sic|$2|$3|hide=y}}$4');
 
 // obfuscate misspellings in URLs
 sfile = new RegExp("(http:[^ ]*)" + SM_obfuscate(m[1]), 'gim' );
 str = str.replace(sfile, '$1<!--SMSPELL-->$2<!--SMSPELL-->$3');
 // obfuscate misspellings in audio templates
 sfile = new RegExp("({{audio\\|)" + SM_obfuscate(m[1]), 'gim' );
 str = str.replace(sfile, '$1<!--SMSPELL-->$2<!--SMSPELL-->$3');
 
 // case insensitive check
 var sgim = new RegExp("([^\\w\\/\\.])" + m[1] + "([^\\w\\/])","gim");
 if( str.search(sgim) >= 0 ) {
  // lowercase
  s.compile("([^\\w\\/\\.])" + SM_lower(m[1]) + "([^\\w\\/])","gm");
  r = SM_lower(m[2].replace(/\$1/g, '$2'));
  if( r.search( /\$2/g ) >= 0 ) {
   r = "$1" + r + "$3";
  } else {
   r = "$1" + r + "$2";
  }
  str = str.replace(s, r);
  // uppercase
  s.compile("([^\\w\\/\\.])" + SM_upper(m[1]) + "([^\\w\\/])","gm");
  r = SM_upper(r);
  str = str.replace(s, r);
 }
 
 // Remove obfuscation
 str = str.replace(/<!--SMSPELL-->/g, '');
 
 return str;
}
 
// Foreign cite web
function SM_cita(str) {
  str = str.replace(/{{cita web/gi, '{{cite web');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])autor[ ]*=[ ]*/gim, '$1author = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])apellido[ ]*=[ ]*/gim, '$1last = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])nombre[ ]*=[ ]*/gim, '$1first = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])(?:editor|editorial)[ ]*=[ ]*/gim, '$1publisher = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])año[ ]*=[ ]*/gim, '$1year = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])(?:titolo|título)[ ]*=[ ]*/gim, '$1title = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])fecha[ ]*=[ ]*/gim, '$1date = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])formato[ ]*=[ ]*/gim, '$1format = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])obra[ ]*=[ ]*/gim, '$1work = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])idioma[ ]*=[ ]*/gim, '$1language = ');
  str = str.replace(/({{cite web(?:[\r\n]|[^{}])*[^a-z{}])(?:accesso|fechaacceso)[ ]*=[ ]*/gim, '$1accessdate = ');
  return str;
}

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.