Rev 227 | Rev 234 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 227 | Rev 228 | ||
|---|---|---|---|
| Line 71... | Line 71... | ||
| 71 | var media_caption; |
71 | var media_caption; |
| 72 | 72 | ||
| 73 | function pIqaD (button) |
73 | function pIqaD (button) |
| 74 | {
|
74 | {
|
| 75 | klingon_texts = jsx.dom.xpath.evaluate( |
75 | klingon_texts = jsx.dom.xpath.evaluate( |
| 76 | './/*[@lang = "' + LANG_KLINGON + '"]' |
76 | './/*[@class = "text" and (@lang = "' + LANG_KLINGON |
| 77 | + '//*[(not(@lang) or (@lang = "' + LANG_KLINGON + '"))' |
77 | + '" or parent::*[@lang = "' + LANG_KLINGON + '"])]', |
| 78 | + ' and (@class = "text")]', |
- | |
| 79 | document.body); |
78 | document.body); |
| 80 | 79 | ||
| 81 | if (!klingon_texts) |
80 | if (!klingon_texts) |
| 82 | {
|
81 | {
|
| 83 | return; |
82 | return; |
| Line 87... | Line 86... | ||
| 87 | 86 | ||
| 88 | for (var i = 0, len = klingon_texts.length; i < len; ++i) |
87 | for (var i = 0, len = klingon_texts.length; i < len; ++i) |
| 89 | {
|
88 | {
|
| 90 | var text = klingon_texts[i]; |
89 | var text = klingon_texts[i]; |
| 91 | 90 | ||
| 92 | text.style.fontFamily = "'pIqaD', 'Constructium', 'Code2000'"; |
91 | text.style.fontFamily = "pIqaD, Constructium, Code2000, serif"; |
| 93 | text.style.fontSize = "90%"; |
92 | text.style.fontSize = "90%"; |
| 94 | 93 | ||
| 95 | if (!text.hasAttribute("data-html")) |
94 | if (!text.hasAttribute("data-html")) |
| 96 | {
|
95 | {
|
| 97 | text.setAttribute("data-html", text.innerHTML); |
96 | text.setAttribute("data-html", text.innerHTML); |
| Line 108... | Line 107... | ||
| 108 | 107 | ||
| 109 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
108 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
| 110 | {
|
109 | {
|
| 111 | var text_node = text_nodes[j]; |
110 | var text_node = text_nodes[j]; |
| 112 | 111 | ||
| 113 | if (text_node.parentNode.lang != LANG_KLINGON) |
- | |
| 114 | {
|
- | |
| 115 | text_node.nodeValue = text_node.nodeValue.toUpperCase().replace( |
112 | text_node.nodeValue = text_node.nodeValue.toUpperCase().replace( |
| 116 | rxKlingon,
|
113 | rxKlingon,
|
| 117 | function (s) { |
114 | function (s) { |
| 118 | return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s); |
115 | return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s); |
| 119 | }); |
116 | }); |
| 120 | }
|
- | |
| 121 | }
|
117 | }
|
| 122 | 118 | ||
| 123 | text.parentNode.lang = "tlh-pIqaD"; |
119 | text.parentNode.lang = "tlh-pIqaD"; |
| 124 | }
|
120 | }
|
| 125 | 121 | ||
| 126 | if (button) |
122 | if (button && lcars.language == LANG_KLINGON) |
| 127 | {
|
123 | {
|
| 128 | media_caption = button.firstChild.textContent; |
124 | button.setAttribute("data-caption", button.firstChild.textContent); |
| 129 | button.firstChild.textContent = "Latin"; |
125 | button.firstChild.textContent = "Latin"; |
| - | 126 | button.firstChild.style.fontFamily = ""; |
|
| - | 127 | button.firstChild.style.fontSize = ""; |
|
| 130 | }
|
128 | }
|
| 131 | }
|
129 | }
|
| 132 | 130 | ||
| 133 | function klingonLatinScript (button) |
131 | function klingonLatinScript (button) |
| 134 | {
|
132 | {
|
| Line 140... | Line 138... | ||
| 140 | text.style.fontSize = ""; |
138 | text.style.fontSize = ""; |
| 141 | text.innerHTML = text.getAttribute('data-html'); |
139 | text.innerHTML = text.getAttribute('data-html'); |
| 142 | text.parentNode.lang = "tlh-Latn"; |
140 | text.parentNode.lang = "tlh-Latn"; |
| 143 | }
|
141 | }
|
| 144 | 142 | ||
| - | 143 | if (lcars.language == LANG_KLINGON) |
|
| - | 144 | {
|
|
| 145 | button.firstChild.textContent = media_caption; |
145 | button.firstChild.textContent = button.getAttribute("data-caption"); |
| - | 146 | }
|
|
| 146 | }
|
147 | }
|