Польꙃєватєл҄ь:Некто участник/common.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
мѣтъка: Reverted
глава 1:
/**
/*********************************************************
* Old EnglishChurch Slavic Wikipedia transliterator *
Early Cyrillic to Glagolitic convertion
* Deals with the following orthographies: gw, ȝƿ, runes *
Based on Old English Wikipedia transliterator by PiRSquared17
* Created by PiRSquared17 *
(https://ang.wikipedia.org/wiki/User:PiRSquared17/spellingstyle.js GFDL / CC-BY-SA 3.0)
* Please report bugs on talk page or village pump *
**/
* Currently supports: "gw", "ȝƿ", and "runes" *
*********************************************************/
 
/**
Line 174 ⟶ 173:
* @returns converted version of inputhtml
*/
function convertStyle(inputhtml, inputstyle, outputstyle) {
var temp = inputhtml;
if (inputstyle == outputstyle) return inputhtml;
if (inputstyle != "runes" && outputstyle != "runes") {
if (outputstyle == "yoghwynn") {
temp = myReplace(temp, /[Ᵹ]/g, 'Ȝ');
temp = myReplace(temp, /[gᵹ]/g, 'ȝ');
temp = myReplace(temp, /W/g, 'Ƿ');
temp = myReplace(temp, /w/g, 'ƿ');
} else if (outputstyle == "gw") {
temp = myReplace(temp, /[ȜꝽ]/g, "G");
temp = myReplace(temp, /[ȝᵹ]/g, "g");
temp = myReplace(temp, /Ƿ/g, "W");
temp = myReplace(temp, /ƿ/g, "w");
} else if (outputstyle == "insularwynn") {
temp = myReplace(temp, /[Ȝ]/g, "Ᵹ");
temp = myReplace(temp, /[gȝ]/g, "ᵹ");
temp = myReplace(temp, /W/g, "Ƿ");
temp = myReplace(temp, /w/g, "ƿ");
}
} else if (inputstyle == "runes") {
for (var rune in runes) {
temp = myReplace(temp, rune, runes[rune]);
}
return convertStyle(temp, "gw", outputstyle);
} else if (outputstyle == "runes") {
temp = convertStyle(myReplace(temp,"","",1), inputstyle, "gw");
for (var i = 0; i < rune2_exceptions.length; i++) {
temp = myReplace(temp,rune2_exceptions[i][0],rune2_exceptions[i][1]);
}
for (var latin in runes2) {
temp = myReplace(temp, latin, runes2[latin]);
}
}
 
return temp;
}
 
/**
* Remove some accents, in an Anglo-Saxon-centric manner
*
* @param r the string
* @returns normalized version (same case, e.g., É -> E, é -> e)
*/
function normalizeString(r){
// from http://stackoverflow.com/questions/8186302/javascript-removing-accents , modified
// same code is found in another S.O. post
r = myReplace(r, /ċ/g , "c");
r = myReplace(r, /Ċ/g , "C");
r = myReplace(r, "Ġ" , "G");
r = myReplace(r, "ġ" , "g");
r = myReplace(r, /[àáâãäåā]/g, "a");
r = myReplace(r, /[ÀÁÂÃÄÅĀ]/g, "A");
r = myReplace(r, /ç/g , "s");
r = myReplace(r, /Ç/g , "S");
r = myReplace(r, /[èéêëē]/g , "e");
r = myReplace(r, /[ÈÉÊËĒ]/g , "E");
r = myReplace(r, /[ìíîïī]/g , "i");
r = myReplace(r, /[ÌÍÎÏĪ]/g , "I");
r = myReplace(r, /ñ/g , "n");
r = myReplace(r, /Ñ/g , "n");
r = myReplace(r, /[òóôõöō]/g , "o");
r = myReplace(r, /[ÒÓÔÕÖŌ]/g , "O");
r = myReplace(r, /[ùúûüū]/g , "u");
r = myReplace(r, /[ÙÚÛÜŪ]/g , "U");
r = myReplace(r, /[ýÿȳ]/g , "y");
r = myReplace(r, /[ŸȲ]/g , "Y");
r = myReplace(r, /ǣ/g , "æ");
r = myReplace(r, /Ǣ/g , "Æ");
r = myReplace(r, /Ḡ/g , "G");
r = myReplace(r, /ḡ/g , "g");
return r;
}
 
/*