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