User:Nikolaos~enwikisource/common.js

/* Replacement de certains caractères spéciaux lors de l'édition Uniquement sous firefox. Auteur: ThomasV Adapted by Nikolaos for transcription of Adler's grammar.

function keycheck { tb = document.getElementById("wpTextbox1") if( tb && wgNamespaceNumber!=8 ) {

tb.onkeyup=function(e) { var key = (window.event) ? event.keyCode : e.keyCode;

startPos = tb.selectionStart; endPos = tb.selectionEnd; if( endPos==startPos && ( (key>=65 && key<=90) || key==222 || key==190) ) {

m = tb.value.substring(startPos-2, startPos); m3 = tb.value.substring(startPos-3, startPos);

f = tb.value.substring(startPos); todo=true; i=2; switch(m) { case "~A" : m = "Ā"; break; case "~a" : m = "ā"; break; case "~E" : m = "Ē"; break; case "~e" : m = "ē"; break; case "~I" : m = "Ī"; break; case "~i" : m = "ī"; break; case "~O" : m = "Ō"; break; case "~o" : m = "ō"; break; case "~U" : m = "Ū"; break; case "~u" : m = "ū"; break; case "~Y" : m = "Ȳ"; break; case "~y" : m = "ȳ"; break; case "*a" : m = "*"; break; case "*d" : m = "&mdash;"; break; default : todo = false; }          if(!todo) { m=m3; todo=true; i=3; switch(m) { case "^oe" : m="œ"; break; case "^ae" : m = "æ"; break; case "^OE" : m = "Œ"; break; case "^AE" : m = "Æ"; break; case "..." : m = "…"; break; default : todo = false; }}

if(todo) { var textScroll = tb.scrollTop; h = tb.value.substring(0, startPos-i); tb.value = h+m+f; tb.selectionStart = startPos-i + m.length; tb.selectionEnd = tb.selectionStart; tb.scrollTop = textScroll; }      }     } } } $(keycheck);