Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 233 → Rev 234

/trunk/application/scripts/klingon.js
1,31 → 1,31
var klingon_texts = null;
 
var klingon_map = {
"A": "\uF8D0",
"B": "\uF8D1",
"CH": "\uF8D2",
"a": "\uF8D0",
"b": "\uF8D1",
"ch": "\uF8D2",
"D": "\uF8D3",
"E": "\uF8D4",
"GH": "\uF8D5",
"e": "\uF8D4",
"gh": "\uF8D5",
"H": "\uF8D6",
"I": "\uF8D7",
"J": "\uF8D8",
"L": "\uF8D9",
"M": "\uF8DA",
"N": "\uF8DB",
"NG": "\uF8DC",
"O": "\uF8DD",
"P": "\uF8DE",
"Q": "\uF8DF",
"QH": "\uF8E0",
"R": "\uF8E1",
"j": "\uF8D8",
"l": "\uF8D9",
"m": "\uF8DA",
"n": "\uF8DB",
"ng": "\uF8DC",
"o": "\uF8DD",
"p": "\uF8DE",
"q": "\uF8DF",
"Q": "\uF8E0",
"r": "\uF8E1",
"S": "\uF8E2",
"T": "\uF8E3",
"TLH": "\uF8E4",
"U": "\uF8E5",
"V": "\uF8E6",
"W": "\uF8E7",
"Y": "\uF8E8",
"t": "\uF8E3",
"tlh": "\uF8E4",
"u": "\uF8E5",
"v": "\uF8E6",
"w": "\uF8E7",
"y": "\uF8E8",
"'": "\uF8E9",
"0": "\uF8F0",
"1": "\uF8F1",
68,8 → 68,17
// return flipped;
//};
 
var media_caption;
function pIqaDize (s)
{
return s.replace(
rxKlingon,
function (s) {
return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s);
});
}
 
var LANG_KLINGON_PIQAD = "tlh-pIqaD";
 
function pIqaD (button)
{
klingon_texts = jsx.dom.xpath.evaluate(
82,15 → 91,10
return;
}
 
var previous_parent = null;
 
for (var i = 0, len = klingon_texts.length; i < len; ++i)
{
var text = klingon_texts[i];
 
text.style.fontFamily = "pIqaD, Constructium, Code2000, serif";
text.style.fontSize = "90%";
 
if (!text.hasAttribute("data-html"))
{
text.setAttribute("data-html", text.innerHTML);
109,23 → 113,27
{
var text_node = text_nodes[j];
 
text_node.nodeValue = text_node.nodeValue.toUpperCase().replace(
rxKlingon,
function (s) {
return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s);
});
text_node.nodeValue = pIqaDize(text_node.nodeValue);
}
 
text.parentNode.lang = "tlh-pIqaD";
if (text.lang == LANG_KLINGON)
{
text.lang = LANG_KLINGON_PIQAD;
}
else if (text.parentNode.lang == LANG_KLINGON)
{
text.parentNode.lang = LANG_KLINGON_PIQAD;
}
}
 
if (button && lcars.language == LANG_KLINGON)
if (button)
{
button.setAttribute("data-caption", button.firstChild.textContent);
button.firstChild.textContent = "Latin";
button.firstChild.style.fontFamily = "";
button.firstChild.style.fontSize = "";
button.firstChild.lang = LANG_KLINGON;
}
 
var html = document.documentElement;
html.setAttribute("data-lang", html.lang);
html.lang = LANG_KLINGON_PIQAD;
}
 
function klingonLatinScript (button)
134,14 → 142,25
{
var text = klingon_texts[i];
 
text.style.fontFamily = "";
text.style.fontSize = "";
text.innerHTML = text.getAttribute('data-html');
text.parentNode.lang = "tlh-Latn";
text.removeAttribute("data-html");
 
if (text.lang == LANG_KLINGON_PIQAD)
{
text.lang = LANG_KLINGON;
}
else if (text.parentNode.lang == LANG_KLINGON_PIQAD)
{
text.parentNode.lang = LANG_KLINGON;
}
}
 
if (lcars.language == LANG_KLINGON)
if (button)
{
button.firstChild.textContent = button.getAttribute("data-caption");
button.firstChild.lang = LANG_KLINGON_PIQAD;
}
 
var html = document.documentElement;
html.lang = html.getAttribute("data-lang");
html.removeAttribute("data-lang");
}