Rev 210 | Rev 228 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 210 | Rev 227 | ||
---|---|---|---|
Line 36... | Line 36... | ||
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 | ", ": " - ", |
- | |
43 | ":": " – ", |
- | |
44 | " – ": " – ", |
- | |
45 | " — ": " – ", |
- | |
46 | "…": "—", |
- | |
47 | "~": "=", |
- | |
48 | "!": "..", |
- | |
49 | "!!!": "...", |
- | |
50 | "(": "|", |
- | |
51 | ")": "|", |
- | |
52 | "[": "||", |
- | |
53 | "]": "||", |
- | |
54 | "&": "•", |
- | |
55 | "°": "¯" |
- | |
56 | }; |
42 | }; |
57 | 43 | ||
- | 44 | var rxVulcan = jsx.object.getKeys(media_map); |
|
- | 45 | rxVulcan.sort(function (a, b) { return b.length - a.length; }); |
|
- | 46 | rxVulcan = new RegExp( |
|
- | 47 | rxVulcan.filter(function (e) { return e.length > 1; }).join("|") |
|
- | 48 | + "|[" + rxVulcan.filter(function (e) { return e.length === 1; }). join("") + "]", |
|
- | 49 | "ig"); |
|
- | 50 | ||
58 | //jsx.object.flip = function (obj) {
|
51 | //jsx.object.flip = function (obj) {
|
59 | // var flipped = jsx.object.inheritFrom(obj);
|
52 | // var flipped = jsx.object.inheritFrom(obj);
|
60 | // var keys = jsx.object.getKeys(obj);
|
53 | // var keys = jsx.object.getKeys(obj);
|
61 | //
|
54 | //
|
62 | // for (var i = 0, len = keys.length; i < len; ++i)
|
55 | // for (var i = 0, len = keys.length; i < len; ++i)
|
Line 72... | Line 65... | ||
72 | // return flipped;
|
65 | // return flipped;
|
73 | //};
|
66 | //};
|
74 | 67 | ||
75 | var media_caption; |
68 | var media_caption; |
76 | 69 | ||
- | 70 | var media_script_used = false; |
|
- | 71 | ||
77 | function mediaScript (button) |
72 | function mediaScript (button) |
78 | {
|
73 | {
|
79 | vulcan_texts = jsx.dom.xpath.evaluate( |
74 | vulcan_texts = jsx.dom.xpath.evaluate( |
80 | './/*[@lang = "' + LANG_VULCAN + '"]//*[(not(@lang) or (@lang = "' + LANG_VULCAN + '")) and (@class = "text")]', |
75 | './/*[@lang = "' + LANG_VULCAN + '"]//*[(not(@lang) or (@lang = "' + LANG_VULCAN + '")) and (@class = "text")]', |
81 | document.body); |
76 | document.body); |
Line 111... | Line 106... | ||
111 | var text_node = text_nodes[j]; |
106 | var text_node = text_nodes[j]; |
112 | 107 | ||
113 | if (text_node.parentNode.lang != LANG_VULCAN) |
108 | if (text_node.parentNode.lang != LANG_VULCAN) |
114 | {
|
109 | {
|
115 | text_node.nodeValue = text_node.nodeValue.replace( |
110 | text_node.nodeValue = text_node.nodeValue.replace( |
116 | /Tch|Ch|Sh|Th|Kh|Zh|Ts|Dzh|Ks|Ll|Ng|Nn|Ss| [–—] |, |!!!|[!STPKRLADOEVUHGINZMYFWBJX:()[\]&°…~]/gi, |
111 | rxVulcan,
|
117 | function (s) { |
112 | function (s) { |
118 | return jsx.object.getProperty(media_map, s.toUpperCase(), s); |
113 | return jsx.object.getProperty(media_map, s.replace(/\s+/g, " ").toUpperCase(), s); |
119 | }); |
114 | }); |
120 | }
|
115 | }
|
121 | }
|
116 | }
|
122 | 117 | ||
123 | text.parentNode.lang = "vuh-Media-Gol-modern"; |
118 | text.parentNode.lang = "vuh-Media-Gol-modern"; |
Line 125... | Line 120... | ||
125 | 120 | ||
126 | if (button) |
121 | if (button) |
127 | {
|
122 | {
|
128 | media_caption = button.firstChild.textContent; |
123 | media_caption = button.firstChild.textContent; |
129 | button.firstChild.textContent = "Latin-Zukitan"; |
124 | button.firstChild.textContent = "Latin-Zukitan"; |
130 | button.onclick = function () { |
- | |
131 | latinScript(this); |
- | |
132 | }; |
- | |
133 | }
|
125 | }
|
- | 126 | ||
- | 127 | media_script_used = true; |
|
134 | }
|
128 | }
|
135 | 129 | ||
136 | function latinScript (button) |
130 | function latinScript (button) |
137 | {
|
131 | {
|
138 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
132 | for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
Line 143... | Line 137... | ||
143 | text.innerHTML = text.getAttribute('data-html'); |
137 | text.innerHTML = text.getAttribute('data-html'); |
144 | text.parentNode.lang = "vuh-Latn-Gol-modern"; |
138 | text.parentNode.lang = "vuh-Latn-Gol-modern"; |
145 | }
|
139 | }
|
146 | 140 | ||
147 | button.firstChild.textContent = media_caption; |
141 | button.firstChild.textContent = media_caption; |
148 | button.onclick = function () { |
- | |
- | 142 | ||
149 | mediaScript(this); |
143 | media_script_used = false; |
150 | }; |
- | |
151 | }
|
144 | }
|