Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 226 → Rev 227

/trunk/application/scripts/vulcan-media-script.js
38,23 → 38,16
NG: "ρ",
NN: "þ",
SS: "β",
TCH: "M",
", ": " - ",
":": " – ",
" – ": " – ",
" — ": " – ",
"…": "—",
"~": "=",
"!": "..",
"!!!": "...",
"(": "|",
")": "|",
"[": "||",
"]": "||",
"&": "•",
"°": "¯"
TCH: "M"
};
 
var rxVulcan = jsx.object.getKeys(media_map);
rxVulcan.sort(function (a, b) { return b.length - a.length; });
rxVulcan = new RegExp(
rxVulcan.filter(function (e) { return e.length > 1; }).join("|")
+ "|[" + rxVulcan.filter(function (e) { return e.length === 1; }). join("") + "]",
"ig");
 
//jsx.object.flip = function (obj) {
// var flipped = jsx.object.inheritFrom(obj);
// var keys = jsx.object.getKeys(obj);
74,6 → 67,8
 
var media_caption;
 
var media_script_used = false;
 
function mediaScript (button)
{
vulcan_texts = jsx.dom.xpath.evaluate(
113,9 → 108,9
if (text_node.parentNode.lang != LANG_VULCAN)
{
text_node.nodeValue = text_node.nodeValue.replace(
/Tch|Ch|Sh|Th|Kh|Zh|Ts|Dzh|Ks|Ll|Ng|Nn|Ss| [–—] |, |!!!|[!STPKRLADOEVUHGINZMYFWBJX:()[\]&°…~]/gi,
rxVulcan,
function (s) {
return jsx.object.getProperty(media_map, s.toUpperCase(), s);
return jsx.object.getProperty(media_map, s.replace(/\s+/g, " ").toUpperCase(), s);
});
}
}
127,10 → 122,9
{
media_caption = button.firstChild.textContent;
button.firstChild.textContent = "Latin-Zukitan";
button.onclick = function () {
latinScript(this);
};
}
 
media_script_used = true;
}
 
function latinScript (button)
145,7 → 139,6
}
 
button.firstChild.textContent = media_caption;
button.onclick = function () {
mediaScript(this);
};
 
media_script_used = false;
}