Go to Vaniquotes | Go to Vanipedia | Go to Vanimedia


Vanisource - the complete essence of Vedic knowledge


MediaWiki

MediaWiki:Unify.js

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// Unify - formats Balaram fonts to Unicode
 
function Unify() {
  obj = document.editform.wpTextbox1.value;
  obj_array = obj.split('\n');
  re = /[äéüåèìïöòëçàùÿûÄÉÜÅÈÌÑÏÖÒËÇÀÙß]/g; 
 
  for ($i = 0; $i < obj_array.length; $i++) {
 
    if (re.test (obj_array[$i])) { 
 
      obj_array[$i] = obj_array[$i].replace (/ä/g, "ā"); // long a
      obj_array[$i] = obj_array[$i].replace (/é/g, "ī"); // long i
      obj_array[$i] = obj_array[$i].replace (/ü/g, "ū"); // long u
      obj_array[$i] = obj_array[$i].replace (/å/g, "ṛ"); // r cedilla
      obj_array[$i] = obj_array[$i].replace (/è/g, "ṟ"); // long r cedilla
      obj_array[$i] = obj_array[$i].replace (/ì/g, "ṅ"); // n dot over
 
      obj_array[$i] = obj_array[$i].replace (/ñ/g, "ṣ"); // s cedilla
      obj_array[$i] = obj_array[$i].replace (/ï/g, "ñ"); // n tilde
 
      obj_array[$i] = obj_array[$i].replace (/ö/g, "ṭ"); // t cedilla
      obj_array[$i] = obj_array[$i].replace (/ò/g, "ḍ"); // d cedilla
      obj_array[$i] = obj_array[$i].replace (/ë/g, "ṇ"); // n cedilla
      obj_array[$i] = obj_array[$i].replace (/ç/g, "ś"); // s accent
 
      obj_array[$i] = obj_array[$i].replace (/à/g, "ṁ"); // m dot over (anusvara)
      obj_array[$i] = obj_array[$i].replace (/ù/g, "ḥ"); // h cedilla (visarga)
      obj_array[$i] = obj_array[$i].replace (/ÿ/g, "ḷ"); // l cedilla
      obj_array[$i] = obj_array[$i].replace (/û/g, "ḻ"); // long l cedilla
 
      obj_array[$i] = obj_array[$i].replace (/Ä/g, "Ā"); // long a
      obj_array[$i] = obj_array[$i].replace (/É/g, "Ī"); // long i
      obj_array[$i] = obj_array[$i].replace (/Ü/g, "Ū"); // long u
      obj_array[$i] = obj_array[$i].replace (/Å/g, "Ṛ"); // r cedilla
      obj_array[$i] = obj_array[$i].replace (/È/g, "Ṟ"); // long r cedilla
      obj_array[$i] = obj_array[$i].replace (/Ì/g, "&#7748;"); // n dot over
 
      obj_array[$i] = obj_array[$i].replace (/Ñ/g, "Ṣ"); // s cedilla
      obj_array[$i] = obj_array[$i].replace (/Ï/g, "Ñ"); // n tilde
 
      obj_array[$i] = obj_array[$i].replace (/Ö/g, "Ṭ"); // t cedilla
      obj_array[$i] = obj_array[$i].replace (/Ò/g, "Ḍ"); // d cedilla
      obj_array[$i] = obj_array[$i].replace (/Ë/g, "Ṇ"); // n cedilla
      obj_array[$i] = obj_array[$i].replace (/Ç/g, "Ś"); // s accent
 
      obj_array[$i] = obj_array[$i].replace (/À/g, "Ṁ"); // m dot over (anusvara)
      obj_array[$i] = obj_array[$i].replace (/Ù/g, "Ḥ"); // h cedilla (visarga)
      obj_array[$i] = obj_array[$i].replace (/ß/g, "Ḷ"); // l cedilla 
 
    }
 
  }
 
  obj = obj_array.join('\n');
 
  // keep the changed text selected, needed to remove the formatting with a second click
  //obj.changed.keepSel = true;
  document.editform.wpTextbox1.value = obj;
  return;
}
 
// end Unify