Rev 210 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 210 | Rev 211 | ||
---|---|---|---|
1 | var vulcan_texts = null; |
1 | var vulcan_texts = null; |
2 | 2 | ||
3 | var media_map = { |
3 | var media_map = { |
4 | S: "?", |
4 | S: "?", |
5 | T: "Y", |
5 | T: "Y", |
6 | P: "]", |
6 | P: "]", |
7 | K: "ß", |
7 | K: "ß", |
8 | R: "²", |
8 | R: "²", |
9 | L: "ζ", |
9 | L: "ζ", |
10 | A: "Ŧ", |
10 | A: "Ŧ", |
11 | D: "S", |
11 | D: "S", |
12 | O: "Ŋ", |
12 | O: "Ŋ", |
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: "ς", |
24 | F: "[", |
24 | F: "[", |
25 | W: "¬", |
25 | W: "¬", |
26 | B: "Ξ", |
26 | B: "Ξ", |
27 | SH: "§", |
27 | SH: "§", |
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", |
33 | J: "C", |
34 | KS: "φ", |
34 | KS: "φ", |
35 | X: "φ", |
35 | X: "φ", |
36 | LL: "μ", |
36 | LL: "μ", |
37 | M: "&", |
37 | M: "&", |
38 | NG: "ρ", |
38 | NG: "ρ", |
39 | NN: "þ", |
39 | NN: "þ", |
40 | SS: "β", |
40 | SS: "β", |
41 | TCH: "M", |
41 | TCH: "M", |
42 | ", ": " - ", |
42 | ", ": " - ", |
43 | ":": " – ", |
43 | ":": " – ", |
44 | " – ": " – ", |
44 | " – ": " – ", |
45 | " — ": " – ", |
45 | " — ": " – ", |
46 | "…": "—", |
46 | "…": "—", |
47 | "~": "=", |
47 | "~": "=", |
48 | "!": "..", |
48 | "!": "..", |
49 | "!!!": "...", |
49 | "!!!": "...", |
50 | "(": "|", |
50 | "(": "|", |
51 | ")": "|", |
51 | ")": "|", |
52 | "[": "||", |
52 | "[": "||", |
53 | "]": "||", |
53 | "]": "||", |
54 | "&": "•", |
54 | "&": "•", |
55 | "°": "¯" |
55 | "°": "¯" |
56 | }; |
56 | }; |
57 | 57 | ||
58 | //jsx.object.flip = function (obj) {
|
58 | //jsx.object.flip = function (obj) {
|
59 | // var flipped = jsx.object.inheritFrom(obj);
|
59 | // var flipped = jsx.object.inheritFrom(obj);
|
60 | // var keys = jsx.object.getKeys(obj);
|
60 | // var keys = jsx.object.getKeys(obj);
|
61 | //
|
61 | //
|
62 | // for (var i = 0, len = keys.length; i < len; ++i)
|
62 | // for (var i = 0, len = keys.length; i < len; ++i)
|
63 | // {
|
63 | // {
|
64 | // var key = keys[i];
|
64 | // var key = keys[i];
|
65 | // var value = obj[key];
|
65 | // var value = obj[key];
|
66 | // if (typeof value != "function")
|
66 | // if (typeof value != "function")
|
67 | // {
|
67 | // {
|
68 | // flipped[value] = key;
|
68 | // flipped[value] = key;
|
69 | // }
|
69 | // }
|
70 | // }
|
70 | // }
|
71 | //
|
71 | //
|
72 | // return flipped;
|
72 | // return flipped;
|
73 | //};
|
73 | //};
|
74 | 74 | ||
75 | var media_caption; |
75 | var media_caption; |
76 | 76 | ||
77 | function mediaScript (button) |
77 | function mediaScript (button) |
78 | {
|
78 | {
|
79 | vulcan_texts = jsx.dom.xpath.evaluate( |
79 | vulcan_texts = jsx.dom.xpath.evaluate( |
80 | './/*[@lang = "' + LANG_VULCAN + '"]//*[(not(@lang) or (@lang = "' + LANG_VULCAN + '")) and (@class = "text")]', |
80 | './/*[@lang = "' + LANG_VULCAN + '"]//*[(not(@lang) or (@lang = "' + LANG_VULCAN + '")) and (@class = "text")]', |
81 | document.body); |
81 | document.body); |
82 | 82 | ||
83 | if (!vulcan_texts) |
83 | if (!vulcan_texts) |
84 | {
|
84 | {
|
85 | return; |
85 | return; |
86 | }
|
86 | }
|
87 | 87 | ||
88 | var previous_parent = null; |
88 | var previous_parent = null; |
89 | 89 | ||
90 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
90 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
91 | {
|
91 | {
|
92 | var text = vulcan_texts[i]; |
92 | var text = vulcan_texts[i]; |
93 | 93 | ||
94 | text.style.textTransform = "none"; |
94 | text.style.textTransform = "none"; |
95 | if (!text.hasAttribute("data-html")) |
95 | if (!text.hasAttribute("data-html")) |
96 | {
|
96 | {
|
97 | text.setAttribute("data-html", text.innerHTML); |
97 | text.setAttribute("data-html", text.innerHTML); |
98 | 98 | ||
99 | if (!text.title) |
99 | if (!text.title) |
100 | {
|
100 | {
|
101 | text.title = text.textContent; |
101 | text.title = text.textContent; |
102 | }
|
102 | }
|
103 | }
|
103 | }
|
104 | 104 | ||
105 | var text_nodes = jsx.dom.xpath.evaluate( |
105 | var text_nodes = jsx.dom.xpath.evaluate( |
106 | './/text()[parent::*[not(@lang) or (@lang = "' + LANG_VULCAN + '")]]', |
106 | './/text()[parent::*[not(@lang) or (@lang = "' + LANG_VULCAN + '")]]', |
107 | text); |
107 | text); |
108 | 108 | ||
109 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
109 | for (var j = 0, len2 = text_nodes.length; j < len2; ++j) |
110 | {
|
110 | {
|
111 | var text_node = text_nodes[j]; |
111 | var text_node = text_nodes[j]; |
112 | 112 | ||
113 | if (text_node.parentNode.lang != LANG_VULCAN) |
113 | if (text_node.parentNode.lang != LANG_VULCAN) |
114 | {
|
114 | {
|
115 | text_node.nodeValue = text_node.nodeValue.replace( |
115 | text_node.nodeValue = text_node.nodeValue.replace( |
116 | /Tch|Ch|Sh|Th|Kh|Zh|Ts|Dzh|Ks|Ll|Ng|Nn|Ss| [–—] |, |!!!|[!STPKRLADOEVUHGINZMYFWBJX:()[\]&°…~]/gi, |
116 | /Tch|Ch|Sh|Th|Kh|Zh|Ts|Dzh|Ks|Ll|Ng|Nn|Ss| [–—] |, |!!!|[!STPKRLADOEVUHGINZMYFWBJX:()[\]&°…~]/gi, |
117 | function (s) { |
117 | function (s) { |
118 | return jsx.object.getProperty(media_map, s.toUpperCase(), s); |
118 | return jsx.object.getProperty(media_map, s.toUpperCase(), s); |
119 | }); |
119 | }); |
120 | }
|
120 | }
|
121 | }
|
121 | }
|
122 | 122 | ||
123 | text.parentNode.lang = "vuh-Media-Gol-modern"; |
123 | text.parentNode.lang = "vuh-Media-Gol-modern"; |
124 | }
|
124 | }
|
125 | 125 | ||
126 | if (button) |
126 | if (button) |
127 | {
|
127 | {
|
128 | media_caption = button.firstChild.textContent; |
128 | media_caption = button.firstChild.textContent; |
129 | button.firstChild.textContent = "Latin-Zukitan"; |
129 | button.firstChild.textContent = "Latin-Zukitan"; |
130 | button.onclick = function () { |
130 | button.onclick = function () { |
131 | latinScript(this); |
131 | latinScript(this); |
132 | }; |
132 | }; |
133 | }
|
133 | }
|
134 | }
|
134 | }
|
135 | 135 | ||
136 | function latinScript (button) |
136 | function latinScript (button) |
137 | {
|
137 | {
|
138 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
138 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
139 | {
|
139 | {
|
140 | var text = vulcan_texts[i]; |
140 | var text = vulcan_texts[i]; |
141 | 141 | ||
142 | text.style.textTransform = ""; |
142 | text.style.textTransform = ""; |
143 | text.innerHTML = text.getAttribute('data-html'); |
143 | text.innerHTML = text.getAttribute('data-html'); |
144 | text.parentNode.lang = "vuh-Latn-Gol-modern"; |
144 | text.parentNode.lang = "vuh-Latn-Gol-modern"; |
145 | }
|
145 | }
|
146 | 146 | ||
147 | button.firstChild.textContent = media_caption; |
147 | button.firstChild.textContent = media_caption; |
148 | button.onclick = function () { |
148 | button.onclick = function () { |
149 | mediaScript(this); |
149 | mediaScript(this); |
150 | }; |
150 | }; |
151 | }
|
151 | }
|
152 | 152 |