Rev 228 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 228 | Rev 235 | ||
|---|---|---|---|
| Line 13... | Line 13... | ||
| 13 | E: "σ", |
13 | E: "σ", |
| 14 | V: "³", |
14 | V: "³", |
| 15 | U: "¶", |
15 | U: "¶", |
| 16 | H: "ξ", |
16 | H: "ξ", |
| 17 | G: "^", |
17 | G: "^", |
| 18 | Ch: ")", |
18 | CH: ")", |
| 19 | I: "ƒ", |
19 | I: "ƒ", |
| 20 | N: "(", |
20 | N: "(", |
| 21 | Z: "ε", |
21 | Z: "ε", |
| 22 | M: "δ", |
22 | M: "δ", |
| 23 | Y: "ς", |
23 | Y: "ς", |
| Line 28... | Line 28... | ||
| 28 | TH: "λ", |
28 | TH: "λ", |
| 29 | KH: "Φ", |
29 | KH: "Φ", |
| 30 | ZH: "ω", |
30 | ZH: "ω", |
| 31 | TS: "θ", |
31 | TS: "θ", |
| 32 | DZH: "C", |
32 | DZH: "C", |
| 33 | J: "C", |
- | |
| 34 | KS: "φ", |
33 | KS: "φ", |
| 35 | X: "φ", |
- | |
| 36 | LL: "μ", |
34 | // LL: "μ",
|
| 37 | M: "&", |
35 | // M: "&",
|
| 38 | NG: "ρ", |
36 | // NG: "ρ",
|
| 39 | NN: "þ", |
37 | // NN: "þ",
|
| 40 | SS: "β", |
38 | // SS: "β",
|
| 41 | TCH: "M" |
39 | // TCH: "M"
|
| 42 | }; |
40 | }; |
| 43 | 41 | ||
| 44 | var rxVulcan = jsx.object.getKeys(media_map); |
42 | var rxVulcan = jsx.object.getKeys(media_map); |
| 45 | rxVulcan.sort(function (a, b) { return b.length - a.length; }); |
43 | rxVulcan.sort(function (a, b) { return b.length - a.length; }); |
| 46 | rxVulcan = new RegExp( |
44 | rxVulcan = new RegExp( |
| 47 | rxVulcan.filter(function (e) { return e.length > 1; }).join("|") |
45 | rxVulcan.filter(function (e) { return e.length > 1; }).join("|") |
| 48 | + "|[" + rxVulcan.filter(function (e) { return e.length === 1; }). join("") + "]", |
46 | + "|[" + rxVulcan.filter(function (e) { return e.length === 1; }). join("") + "]", |
| 49 | "ig"); |
47 | "ig"); |
| 50 | 48 | ||
| 51 | //jsx.object.flip = function (obj) {
|
49 | function mediaTranscribe (s) |
| 52 | // var flipped = jsx.object.inheritFrom(obj);
|
- | |
| 53 | // var keys = jsx.object.getKeys(obj);
|
- | |
| 54 | //
|
50 | {
|
| 55 | // for (var i = 0, len = keys.length; i < len; ++i)
|
51 | return s.toUpperCase().replace( |
| 56 | // {
|
52 | rxVulcan,
|
| 57 | // var key = keys[i];
|
53 | function (s) { |
| 58 | // var value = obj[key];
|
- | |
| 59 | // if (typeof value != "function")
|
54 | return jsx.object.getProperty(media_map, s.replace(/\s+/g, " "), s); |
| 60 | // {
|
- | |
| 61 | // flipped[value] = key;
|
- | |
| 62 | // }
|
55 | }); |
| 63 | // }
|
- | |
| 64 | //
|
56 | }
|
| 65 | // return flipped;
|
- | |
| 66 | //};
|
- | |
| 67 | 57 | ||
| 68 | var media_script_used = false; |
58 | var LANG_VULCAN_MEDIA = "vuh-Media-Gol-modern"; |
| 69 | 59 | ||
| 70 | function mediaScript (button) |
60 | function mediaScript (button) |
| 71 | {
|
61 | {
|
| 72 | vulcan_texts = jsx.dom.xpath.evaluate( |
62 | vulcan_texts = jsx.dom.xpath.evaluate( |
| 73 | './/*[@class = "text" and (@lang = "' + LANG_VULCAN |
63 | './/*[@class = "text" and (@lang = "' + LANG_VULCAN |
| Line 77... | Line 67... | ||
| 77 | if (!vulcan_texts) |
67 | if (!vulcan_texts) |
| 78 | {
|
68 | {
|
| 79 | return; |
69 | return; |
| 80 | }
|
70 | }
|
| 81 | 71 | ||
| - | 72 | if (document.documentElement.lang == LANG_VULCAN) |
|
| - | 73 | {
|
|
| - | 74 | var title = document.getElementsByTagName("title")[0]; |
|
| - | 75 | title.setAttribute("data-text", document.title); |
|
| - | 76 | document.title = mediaTranscribe(document.title); |
|
| - | 77 | }
|
|
| - | 78 | ||
| 82 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
79 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
| 83 | {
|
80 | {
|
| 84 | var text = vulcan_texts[i]; |
81 | var text = vulcan_texts[i]; |
| 85 | 82 | ||
| 86 | text.style.textTransform = "none"; |
83 | text.style.textTransform = "none"; |
| Line 90... | Line 87... | ||
| 90 | 87 | ||
| 91 | if (!text.title) |
88 | if (!text.title) |
| 92 | {
|
89 | {
|
| 93 | text.title = text.textContent; |
90 | text.title = text.textContent; |
| 94 | }
|
91 | }
|
| - | 92 | else
|
|
| - | 93 | {
|
|
| - | 94 | text.setAttribute("data-title", text.title); |
|
| - | 95 | text.title = mediaTranscribe(text.title); |
|
| - | 96 | }
|
|
| 95 | }
|
97 | }
|
| 96 | 98 | ||
| 97 | var text_nodes = jsx.dom.xpath.evaluate( |
99 | var text_nodes = jsx.dom.xpath.evaluate( |
| 98 | './/text()[parent::*[not(@lang) or (@lang = "' + LANG_VULCAN + '")]]', |
100 | './/text()[parent::*[not(@lang) or (@lang = "' + LANG_VULCAN + '")]]', |
| 99 | text); |
101 | text); |
| 100 | 102 | ||
| 101 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
103 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
| 102 | {
|
104 | {
|
| 103 | var text_node = text_nodes[j]; |
105 | var text_node = text_nodes[j]; |
| 104 | 106 | ||
| 105 | text_node.nodeValue = text_node.nodeValue.replace( |
107 | text_node.nodeValue = mediaTranscribe(text_node.nodeValue); |
| 106 | rxVulcan,
|
- | |
| 107 | function (s) { |
- | |
| 108 | return jsx.object.getProperty(media_map, s.replace(/\s+/g, " ").toUpperCase(), s); |
- | |
| 109 | }); |
- | |
| 110 | }
|
108 | }
|
| 111 | 109 | ||
| - | 110 | if (text.lang == LANG_VULCAN) |
|
| - | 111 | {
|
|
| - | 112 | text.lang = LANG_VULCAN_MEDIA; |
|
| - | 113 | }
|
|
| - | 114 | else if (text.parentNode.lang == LANG_VULCAN) |
|
| - | 115 | {
|
|
| 112 | text.parentNode.lang = "vuh-Media-Gol-modern"; |
116 | text.parentNode.lang = LANG_VULCAN_MEDIA; |
| - | 117 | }
|
|
| 113 | }
|
118 | }
|
| 114 | 119 | ||
| 115 | if (button && lcars.language == LANG_VULCAN) |
120 | if (button) |
| 116 | {
|
121 | {
|
| 117 | button.setAttribute("data-caption", button.firstChild.textContent); |
- | |
| 118 | button.firstChild.textContent = "Latin-Zukitan"; |
122 | button.firstChild.lang = LANG_VULCAN; |
| 119 | }
|
123 | }
|
| 120 | 124 | ||
| - | 125 | var html = document.documentElement; |
|
| - | 126 | if (html.lang == LANG_VULCAN) |
|
| - | 127 | {
|
|
| 121 | media_script_used = true; |
128 | html.lang = LANG_VULCAN_MEDIA; |
| - | 129 | }
|
|
| 122 | }
|
130 | }
|
| 123 | 131 | ||
| 124 | function latinScript (button) |
132 | function latinScript (button) |
| 125 | {
|
133 | {
|
| - | 134 | var title = document.getElementsByTagName("title")[0]; |
|
| - | 135 | if (document.documentElement.lang == LANG_VULCAN_MEDIA) |
|
| - | 136 | {
|
|
| - | 137 | document.title = title.getAttribute("data-text"); |
|
| - | 138 | title.removeAttribute("data-text") |
|
| - | 139 | }
|
|
| - | 140 | ||
| 126 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
141 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
| 127 | {
|
142 | {
|
| 128 | var text = vulcan_texts[i]; |
143 | var text = vulcan_texts[i]; |
| 129 | 144 | ||
| 130 | text.style.textTransform = ""; |
145 | text.style.textTransform = ""; |
| 131 | text.innerHTML = text.getAttribute('data-html'); |
146 | text.innerHTML = text.getAttribute('data-html') || ""; |
| - | 147 | text.title = text.getAttribute("data-title") || ""; |
|
| - | 148 | ||
| - | 149 | if (text.lang == LANG_VULCAN_MEDIA) |
|
| - | 150 | {
|
|
| - | 151 | text.lang = LANG_VULCAN; |
|
| - | 152 | }
|
|
| - | 153 | else if (text.parentNode.lang == LANG_VULCAN_MEDIA) |
|
| - | 154 | {
|
|
| 132 | text.parentNode.lang = "vuh-Latn-Gol-modern"; |
155 | text.parentNode.lang = LANG_VULCAN; |
| - | 156 | }
|
|
| 133 | }
|
157 | }
|
| 134 | 158 | ||
| 135 | if (lcars.language == LANG_VULCAN) |
159 | if (button) |
| 136 | {
|
160 | {
|
| 137 | button.firstChild.textContent = button.getAttribute("data-caption"); |
161 | button.firstChild.lang = LANG_VULCAN_MEDIA; |
| 138 | }
|
162 | }
|
| 139 | 163 | ||
| - | 164 | var html = document.documentElement; |
|
| - | 165 | if (html.lang == LANG_VULCAN_MEDIA) |
|
| - | 166 | {
|
|
| 140 | media_script_used = false; |
167 | html.lang = LANG_VULCAN; |
| - | 168 | }
|
|
| 141 | }
|
169 | }
|