Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 210 → Rev 227

/trunk/application/layouts/index/multi-display.phtml
1,4 → 1,5
<div id="LCARS">
 
<div id="LCARS">
<?php /*
<div id="button-grid" style="position: absolute; opacity: 0.3">
<a class="button" style="display: block; clear: left; float: left"><span class="text">Button 1</span></a>
52,90 → 53,108
</div>
*/ ?>
<div id="bow">
<div id="bow-top">
<div class="separator-left">&nbsp;</div>
<div class="text"><span>PointedEars’ Website</span></div>
</div>
<div id="bow-top-left">
<div class="concave">&nbsp;</div>
<div style="position: absolute; top: 3.2em; left: 0; background-color: black">
<div class="bow" style="margin-top: 0.2em; width: 8em; height: 1em">&nbsp;</div>
</div>
</div>
<div id="bottom">
<div id="bow-bottom">
<div class="concave">&nbsp;</div>
<div class="spacer">&nbsp;</div>
</div>
</div>
<div id="bow-top">
<div class="separator-left">&nbsp;</div>
<div class="text">
<span>PointedEars’ Website</span>
</div>
</div>
<div id="bow-top-left">
<div class="concave">&nbsp;</div>
<div
style="position: absolute; top: 3.2em; left: 0; background-color: black"
>
<div class="bow"
style="margin-top: 0.2em; width: 8em; height: 1em"
>&nbsp;</div>
</div>
</div>
<div id="bottom">
<div id="bow-bottom">
<div class="concave">&nbsp;</div>
<div class="spacer">&nbsp;</div>
</div>
</div>
 
<div class="menu-container">
<nav class="menu">
<ul>
<div class="menu-container">
<nav class="menu">
<ul>
<?php foreach ($languages as $key => $name): ?>
<li><a href="index.<?php echo language_key_short($key); ?>?ani=0"
lang="<?php echo $key; ?>" hreflang="<?php echo $key; ?>"
class="button<?php if ($language === $key) { ?> selected<?php } ?>"
tabindex="2"><span class="text"><?php echo language_name($key); ?></span></a></li>
<li><a
href="index.<?php echo language_key_short($key); ?>?ani=0"
lang="<?php echo $key; ?>" hreflang="<?php echo $key; ?>"
class="button<?php if ($language === $key) { ?> selected<?php } ?>"
tabindex="2"
><span class="text"><?php echo language_name($key); ?></span></a></li>
<?php endforeach; ?>
</ul>
<div class="bow" style="margin-bottom: 0.4em; height: 0.4em">&nbsp;</div>
<ul style="margin-bottom: 1.2em">
<li><a href="<?php echo $menu['scripts']['path']; ?>" target="_top" class="button"
lang="<?php echo $language; ?>"
><span class="text"><?php echo $menu['scripts']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['es-matrix']['path']; ?>" target="_top" class="button"
title="<?php echo $menu['es-matrix']['title']; ?>"
><span class="text"><?php echo $menu['es-matrix']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['devel']['path']; ?>" target="_top" class="button"
lang="<?php echo $language; ?>"
><span class="text"><?php echo $menu['devel']['text']; ?></span></a></li>
</ul>
<ul style="margin-bottom: 0.2em">
<li><a href="psf/" target="_top"
class="button ancillary"
><abbr title="<?php echo tr("PointedEars' Standard Frases"); ?>"
class="text">psf</abbr></a></li>
<li><a href="<?php echo $menu['series']['path']; ?>" target="_top" class="button ancillary"
title="<?php echo tr('List of recommended TV shows and episodes, with logos in CSS'); ?>"
><span class="text"><?php echo $menu['series']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['ufpdb']['path']; ?>" target="_top" class="button database"
><abbr title="<?php echo $menu['ufpdb']['title']; ?>"
class="text"><?php echo $menu['ufpdb']['text']; ?></abbr></a></li>
</ul>
<div style="position: relative; margin-bottom: 1.2em">
<div class="bow" style="height: 0.8em">&nbsp;</div>
</div>
<ul>
<li><a href="http://climateapps2.oerc.ox.ac.uk/cpdnboinc/show_user.php?userid=648544"
target="_top" class="button secondary"
title="<?php echo tr("The world’s largest climate forecasting experiment for the 21st century"); ?>"
><span class="text">climateprediction.net</span></a></li>
<li><a href="http://fah-web2.stanford.edu/cgi-bin/main.py?qtype=userpage&username=Thomas_Lahn"
target="_top" class="button secondary"
title="<?php echo tr("Distributed computing to understand protein folding, protein aggregation, and related diseases"); ?>"
><span class="text">Folding at home</span></a></li>
<li><a href="http://lhcathomeclassic.cern.ch/sixtrack/show_user.php?userid=221181"
target="_top" class="button secondary"
title="<?php echo tr("Particle physics research with the Large Hadron Collider at CERN"); ?>"
><span class="text">LHC at home</span></a></li>
<li><a href="http://setiathome.berkeley.edu/show_user.php?userid=378921"
target="_top" class="button secondary"
title="<?php echo tr("The Search for Extra-Terrestrial Intelligence at HOME"); ?>"
><span class="text">SETI at home</span></a></li>
<li><a href="http://stackoverflow.com/users/855543/pointedears"
target="_top" class="button secondary"
title="<?php echo tr("Me on Stack Overflow"); ?>"
><span class="text">Stack Overflow</span></a></li>
<li><a href="https://twitter.com/PointedEars2"
target="_top" class="button secondary"
title="<?php echo tr("Me on Twitter"); ?>"
><span class="text">Twitter</span></a></li>
<li><a href="<?php echo tr("http://en.wikipedia.org/wiki/Special:Contributions/PointedEars"); ?>"
target="_top" class="button secondary"
title="<?php echo tr("My contributions to Wikipedia"); ?>"
><span class="text"><?php echo tr('Wikipedia'); ?></span></a></li>
</ul>
<div class="bow" style="margin-bottom: 0.4em; height: 0.4em">&nbsp;</div>
<ul style="margin-bottom: 1.2em">
<li><a href="<?php echo $menu['scripts']['path']; ?>"
target="_top" class="button" lang="<?php echo $language; ?>"
><span class="text"><?php echo $menu['scripts']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['es-matrix']['path']; ?>"
target="_top" class="button"
title="<?php echo $menu['es-matrix']['title']; ?>"
><span class="text"><?php echo $menu['es-matrix']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['devel']['path']; ?>"
target="_top" class="button" lang="<?php echo $language; ?>"
><span class="text"><?php echo $menu['devel']['text']; ?></span></a></li>
</ul>
<ul style="margin-bottom: 0.2em">
<li><a href="psf/" target="_top" class="button ancillary"><abbr
title="<?php echo tr("PointedEars' Standard Frases"); ?>"
class="text"
>psf</abbr></a></li>
<li><a href="<?php echo $menu['series']['path']; ?>"
target="_top" class="button ancillary"
title="<?php echo tr('List of recommended TV shows and episodes, with logos in CSS'); ?>"
><span class="text"><?php echo $menu['series']['text']; ?></span></a></li>
<li><a href="<?php echo $menu['ufpdb']['path']; ?>"
target="_top" class="button database"
><abbr title="<?php echo $menu['ufpdb']['title']; ?>"
class="text"
><?php echo $menu['ufpdb']['text']; ?></abbr></a></li>
</ul>
<div style="position: relative; margin-bottom: 1.2em">
<div class="bow" style="height: 0.8em">&nbsp;</div>
</div>
<ul>
<li><a
href="http://climateapps2.oerc.ox.ac.uk/cpdnboinc/show_user.php?userid=648544"
target="_top" class="button secondary"
title="<?php echo tr("The world’s largest climate forecasting experiment for the 21st century"); ?>"
><span class="text">climateprediction.net</span></a></li>
<li><a
href="http://fah-web2.stanford.edu/cgi-bin/main.py?qtype=userpage&username=Thomas_Lahn"
target="_top" class="button secondary"
title="<?php echo tr("Distributed computing to understand protein folding, protein aggregation, and related diseases"); ?>"
><span class="text">Folding at home</span></a></li>
<li><a
href="http://lhcathomeclassic.cern.ch/sixtrack/show_user.php?userid=221181"
target="_top" class="button secondary"
title="<?php echo tr("Particle physics research with the Large Hadron Collider at CERN"); ?>"
><span class="text">LHC at home</span></a></li>
<li><a
href="http://setiathome.berkeley.edu/show_user.php?userid=378921"
target="_top" class="button secondary"
title="<?php echo tr("The Search for Extra-Terrestrial Intelligence at HOME"); ?>"
><span class="text">SETI at home</span></a></li>
<li><a
href="http://stackoverflow.com/users/855543/pointedears"
target="_top" class="button secondary"
title="<?php echo tr("Me on Stack Overflow"); ?>"
><span class="text">Stack Overflow</span></a></li>
<li><a href="https://twitter.com/PointedEars2" target="_top"
class="button secondary"
title="<?php echo tr("Me on Twitter"); ?>"
><span class="text">Twitter</span></a></li>
<li><a
href="<?php echo tr("http://en.wikipedia.org/wiki/Special:Contributions/PointedEars"); ?>"
target="_top" class="button secondary"
title="<?php echo tr("My contributions to Wikipedia"); ?>"
><span class="text"><?php echo tr('Wikipedia'); ?></span></a></li>
</ul>
<?php /*
<script type="text/javascript">
var sURL = location.href;
166,24 → 185,28
</script>
*/ ?>
</nav>
</div>
</div>
<div id="connectors">
<div class="bow top left">&nbsp;</div>
<div class="bow top right">&nbsp;</div>
 
<div class="bow mid left">&nbsp;</div>
<div class="bow mid right">&nbsp;</div>
</div>
<div class="multi-display">
<div class="upper">
<div class="content">
<div class="title" id="title" lang="<?php echo $language; ?>">
<span class="text"><?php echo tr('Home'); ?></span>
</div>
</div>
<div id="connectors">
<div class="bow top left">&nbsp;</div>
<div class="bow top right">&nbsp;</div>
 
<div class="bow mid left">&nbsp;</div>
<div class="bow mid right">&nbsp;</div>
</div>
<div class="multi-display">
<div class="upper">
<div class="content">
<div class="title" id="title" lang="<?php echo $language; ?>"><span class="text"><?php echo tr('Home'); ?></span></div>
<div class="analysis" id="analysis">
<table>
<tr>
<th lang="<?php echo $language; ?>"><span class="text"><?php echo tr('Display'); ?>:</span></th>
<td lang="<?php echo $language; ?>"><script type="text/javascript">
<div class="analysis" id="analysis">
<table>
<tr>
<th lang="<?php echo $language; ?>"><span class="text"><?php echo tr('Display'); ?>:</span></th>
<td lang="<?php echo $language; ?>"><script
type="text/javascript"
>
var _addEventListener = jsx.dom.addEventListener;
var _runAsync = jsx.dom.timeout.runAsync;
var ID_SCREEN_DIM = 'screenDim';
258,16 → 281,20
tColor = null;
});
}());
</script><noscript><?php echo tr('N/A'); ?></noscript></td>
</tr>
<tr>
<th><?php echo tr('User Agent'); ?>:</th>
<td><script type="text/javascript" src="application/scripts/ua.js"></script><noscript><?php
</script>
<noscript><?php echo tr('N/A'); ?></noscript></td>
</tr>
<tr>
<th lang="<?php echo $language; ?>"><span class="text"><?php echo tr('User Agent'); ?>:</span></th>
<td><script type="text/javascript"
src="application/scripts/ua.js"
></script>
<noscript><?php
echo tr('N/A'); ?></noscript></td>
</tr>
<tr>
<th><?php echo tr('Features'); ?>:</th>
<td><script type="text/javascript">
</tr>
<tr>
<th lang="<?php echo $language; ?>"><span class="text"><?php echo tr('Features'); ?>:</span></th>
<td><script type="text/javascript">
var fullscreen = jsx.dom.window.fullscreen;
 
(function () {
315,9 → 342,10
 
if (jsx.dom.geolocation.isAvailable())
{
features.push('<a href="#" title="<?php echo tr('Get location'); ?>"'
+ ' onclick="return lcars.multiDisplay.geolocate(\'<?php echo tr('Geolocation'); ?>\', \'<?php echo $language; ?>\')"'
+ '><?php echo tr('Geolocation'); ?><\/a>');
features.push('<a href="#" title="<?php echo htmlspecialchars(tr('Get location'), ENT_QUOTES); ?>"'
+ ' lang="<?php echo $language; ?>"'
+ ' onclick=\'return lcars.multiDisplay.geolocate("<?php echo htmlspecialchars(tr('Geolocation'), ENT_QUOTES); ?>", "<?php echo $language; ?>")\''
+ '><span class="text"><?php echo htmlspecialchars(tr('Geolocation'), ENT_QUOTES); ?><\/span><\/a>');
}
 
if (typeof navigator.javaEnabled != "undefined" && navigator.javaEnabled())
407,36 → 435,35
});
 
var windowText = "<?php echo tr("Window"); ?>";
</script><noscript><?php echo tr('N/A'); ?></noscript></td>
</tr>
</table>
</div>
<ul class="commands">
<li id="cmd1"><a href="index.php"
title="Language selection"
tabindex="1"
class="button left right"
onmouseover="return setStatus(this.title + ': ' + this.href)"
onmouseout="return resetStatus()"
onfocus="return this.onmouseover()"
onblur="return this.onmouseout()"
><abbr class="text" title="Language selection">Language</abbr></a></li>
<li id="cmd2"><a href="index.<?php echo $language; ?>?printable=1"
title="<?php echo tr('Printable version'); ?>"
tabindex="1"
class="button left right"
onmouseover="return setStatus(this.title + ': ' + this.href)"
onmouseout="return resetStatus()"
onfocus="return this.onmouseover()"
onblur="return this.onmouseout()"
lang="<?php echo $language; ?>"
><span class="text"><?php echo tr("Printable"); ?></span></a></li>
<li id="cmd3"><div class="button left right"
style="cursor: not-allowed !important"
onclick="fullscreen.requestOn(document.documentElement, this)"
onkeyup="if (event.keyCode == 13) { this.onclick(); }"
lang="<?php echo $language; ?>"
><span class="text"><script type="text/javascript">
</script>
<noscript><?php echo tr('N/A'); ?></noscript></td>
</tr>
</table>
</div>
<ul class="commands">
<li id="cmd1"><a href="index.php" title="Language selection"
tabindex="1" class="button left right"
onmouseover="return setStatus(this.title + ': ' + this.href)"
onmouseout="return resetStatus()"
onfocus="return this.onmouseover()"
onblur="return this.onmouseout()"
><abbr class="text" title="Language selection">Language</abbr></a></li>
<li id="cmd2"><a
href="index.<?php echo $language; ?>?printable=1"
title="<?php echo tr('Printable version'); ?>" tabindex="1"
class="button left right"
onmouseover="return setStatus(this.title + ': ' + this.href)"
onmouseout="return resetStatus()"
onfocus="return this.onmouseover()"
onblur="return this.onmouseout()"
lang="<?php echo $language; ?>"
><span class="text"><?php echo tr("Printable"); ?></span></a></li>
<li id="cmd3"><div class="button left right"
style="cursor: not-allowed !important"
onclick="fullscreen.requestOn(document.documentElement, this)"
onkeyup="if (event.keyCode == 13) { this.onclick(); }"
lang="<?php echo $language; ?>"
><span class="text"><script type="text/javascript">
var cmd3;
if (fullscreen.isSupportedBy(document.documentElement))
{
488,6 → 515,7
var textTarget = target.firstChild;
if (nowIsFullscreen)
{
/* FIXME: Do not override event listeners, use the state instead */
oldHandler = target.onclick;
target.onclick = function () {
fullscreen.cancel();
504,48 → 532,65
}
}
});
</script></span></div></li>
<li id="cmd4"><script type="text/javascript">
</script></span>
</div></li>
<li id="cmd4"><script type="text/javascript">
var LANG_KLINGON = "<?php echo $klingon; ?>";
var LANG_VULCAN = "<?php echo $vulcan; ?>";
</script><script type="text/javascript" src="application/scripts/vulcan-media-script.js"></script><div
class="button left right"<?php
if ($language == $vulcan)
{
?> tabindex="1" onclick="mediaScript(this)"<?php
}
else
{
?> style="cursor: not-allowed !important"<?php
}
?>><span class="text"><?php
echo $language == $vulcan ? 'Hitra-Zukitan' : '&nbsp;';
?></span></div></li>
</ul>
</div>
<div class="elbo-button">
<span class="text" title="<?php echo tr("Date of last modification"); ?>"
><?php echo gmdate('Ym.d', $modi); ?></span>
</div>
<div class="elbo" lang="<?php echo $language; ?>">
<span class="text"><abbr title="<?php echo tr('Library Computer Access and Retrieval System'); ?>"><?php echo tr('LCARS'); ?></abbr> PE-22A</span>
<div class="concave">&nbsp;</div>
</div>
<div class="border">
<div class="left">&nbsp;</div>
<div class="right">&nbsp;</div>
</div>
</script>
<script type="text/javascript"
src="application/scripts/klingon.js"
<script type="text/javascript"
src="application/scripts/vulcan-media-script.js"
></script>
<div class="button left right"<?php
if (in_array($language, array($klingon, $vulcan)))
{
?> tabindex="1" onclick="<?php
switch ($language)
{
case $klingon: echo 'pIqaD(this)'; break;
case $vulcan: echo 'if (media_script_used) { latinScript(this); } else { mediaScript(this); }'; break;
}
?>"<?php
}
else
{
?> style="cursor: not-allowed !important"<?php
}
?>><span class="text"><?php
echo $language == $vulcan ? 'Hitra-Zukitan' : '&nbsp;';
?></span>
</div></li>
</ul>
</div>
<div class="elbo-button">
<span class="text"
title="<?php echo tr("Date of last modification"); ?>"
><?php echo gmdate('Ym.d', $modi); ?></span>
</div>
<div class="elbo" lang="<?php echo $language; ?>">
<span class="text"><abbr
title="<?php echo tr('Library Computer Access and Retrieval System'); ?>"
><?php echo tr('LCARS'); ?></abbr> PE-22A</span>
<div class="concave">&nbsp;</div>
</div>
<div class="border">
<div class="left">&nbsp;</div>
<div class="right">&nbsp;</div>
</div>
</div>
<div class="lower">
<div class="elbo">
<div class="concave">&nbsp;</div>
</div>
<div class="bg">&nbsp;</div>
<div class="border-container">
<div class="border">
<div class="left">&nbsp;</div>
<div class="right">&nbsp;</div>
</div>
<div class="lower">
<div class="elbo">
<div class="concave">&nbsp;</div>
</div>
<div class="bg">&nbsp;</div>
<div class="border-container">
<div class="border">
<div class="left">&nbsp;</div>
<div class="right">&nbsp;</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
/trunk/application/layouts/index/footer.phtml
16,11 → 16,17
. " and <a href='%s'"
. " title='LCARS 47 Development Blog&nbsp;-- LCARS&nbsp;101: A Designer's Handbook'"
. ">Eleanor&nbsp;C.&nbsp;Davenport</a>.")
. ($app == 'Language' || $language === $klingon
? "<br> "
. tr("Translation into Klingon supported by the"
. " <a href='http://kli.org/'>Klingon Language Institute</a>,"
. " Qo'onoS.")
: '')
. ($app == 'Language' || $language === $vulcan
? "<br>"
? "<br> "
. tr("Translation into Modern Golic Vulcan supported by the"
. " <a href='http://wayback.archive.org/web/20130927210751/http://www.stogeek.com/wiki/Category:Vulcan_Language_Institute'>Vulcan Language Institute</a>,"
. " Shi'Kahr, a'Shav, T'Khasi.")
. " <a href='http://home.comcast.net/~markg61/vlif.htm'>Vulcan Language Institute</a>,"
. " Shi'Kahr, T'Khasi.")
: ''),
'https://twitter.com/MikeOkuda',
tr('Michael Okuda on Twitter'),
/trunk/application/layouts/index/index.phtml
87,7 → 87,7
-->
</style>
 
<script type="text/javascript" src="scripts/builder?src=object,dom,dom/css,dom/storage,dom/events,dom/geolocation,dom/timeout,dom/widgets,dom/window,dom/xpath,http,regexp,lcars,../application/scripts/vulcan-media-script<?php
<script type="text/javascript" src="scripts/builder?src=object,dom,dom/css,dom/storage,dom/events,dom/geolocation,dom/timeout,dom/widgets,dom/window,dom/xpath,http,regexp,lcars,../application/scripts/klingon,../application/scripts/vulcan-media-script<?php
if ($isLocal)
{
?>&amp;verbose=1&amp;debug=1<?php
158,11 → 158,18
content: lcars.content
});
 
/* Enable Vulcan Media Script */
var cmd4 = document.getElementById("cmd4");
if (cmd4 && cmd4.lastChild && typeof cmd4.lastChild.onclick == "function")
{
jsx.dom.timeout.runAsync(function () { cmd4.lastChild.onclick(); }, 1000);
jsx.dom.timeout.runAsync(function () {
var event = document.createEvent("Events");
event.initEvent("click", true, false);
cmd4.lastChild.dispatchEvent(event);
}, 1000);
}
 
lcars.insertSound();
}
</script>
<?php /* <bgsound src="media/interface/sound/beginop.wav" loop="infinite"> */ ?>
/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;
}
/trunk/application/scripts/klingon.js
0,0 → 1,146
var klingon_texts = null;
 
var klingon_map = {
"A": "\uF8D0",
"B": "\uF8D1",
"CH": "\uF8D2",
"D": "\uF8D3",
"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",
"S": "\uF8E2",
"T": "\uF8E3",
"TLH": "\uF8E4",
"U": "\uF8E5",
"V": "\uF8E6",
"W": "\uF8E7",
"Y": "\uF8E8",
"'": "\uF8E9",
"0": "\uF8F0",
"1": "\uF8F1",
"2": "\uF8F2",
"3": "\uF8F3",
"4": "\uF8F4",
"5": "\uF8F5",
"6": "\uF8F6",
"7": "\uF8F7",
"8": "\uF8F8",
"9": "\uF8F9",
",": "\uF8FD",
".": "\uF8FE",
 
/* mummification glyph, symbol of the empire */
"Δ": "\uF8FF"
};
 
var rxKlingon = jsx.object.getKeys(klingon_map);
rxKlingon.sort(function (a, b) { return b.length - a.length; });
rxKlingon = new RegExp(
rxKlingon.filter(function (e) { return e.length > 1; }).join("|")
+ "|[" + rxKlingon.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);
//
// for (var i = 0, len = keys.length; i < len; ++i)
// {
// var key = keys[i];
// var value = obj[key];
// if (typeof value != "function")
// {
// flipped[value] = key;
// }
// }
//
// return flipped;
//};
 
var media_caption;
 
function pIqaD (button)
{
klingon_texts = jsx.dom.xpath.evaluate(
'.//*[@lang = "' + LANG_KLINGON + '"]'
+ '//*[(not(@lang) or (@lang = "' + LANG_KLINGON + '"))'
+ ' and (@class = "text")]',
document.body);
 
if (!klingon_texts)
{
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'";
text.style.fontSize = "90%";
 
if (!text.hasAttribute("data-html"))
{
text.setAttribute("data-html", text.innerHTML);
 
if (!text.title)
{
text.title = text.textContent;
}
}
 
var text_nodes = jsx.dom.xpath.evaluate(
'.//text()[parent::*[not(@lang) or (@lang = "' + LANG_KLINGON + '")]]',
text);
 
for (var j = 0, len2 = text_nodes.length; j < len2; ++j)
{
var text_node = text_nodes[j];
 
if (text_node.parentNode.lang != LANG_KLINGON)
{
text_node.nodeValue = text_node.nodeValue.toUpperCase().replace(
rxKlingon,
function (s) {
return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s);
});
}
}
 
text.parentNode.lang = "tlh-pIqaD";
}
 
if (button)
{
media_caption = button.firstChild.textContent;
button.firstChild.textContent = "Latin";
}
}
 
function klingonLatinScript (button)
{
for (var i = 0, len = klingon_texts.length; i < len; ++i)
{
var text = klingon_texts[i];
 
text.style.fontFamily = "";
text.style.fontSize = "";
text.innerHTML = text.getAttribute('data-html');
text.parentNode.lang = "tlh-Latn";
}
 
button.firstChild.textContent = media_caption;
}