Subversion Repositories LCARS

Rev

Rev 234 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 234 Rev 235
Line 11... Line 11...
11
  "I": "\uF8D7",
11
  "I": "\uF8D7",
12
  "j": "\uF8D8",
12
  "j": "\uF8D8",
13
  "l": "\uF8D9",
13
  "l": "\uF8D9",
14
  "m": "\uF8DA",
14
  "m": "\uF8DA",
15
  "n": "\uF8DB",
15
  "n": "\uF8DB",
-
 
16
-
 
17
  /* prevents mistranscription of "n-gh" as "ng-h" (trailing garbage) */
-
 
18
  "ngh": "\uF8DB\uF8D5",
-
 
19
16
  "ng": "\uF8DC",
20
  "ng": "\uF8DC",
17
  "o": "\uF8DD",
21
  "o": "\uF8DD",
18
  "p": "\uF8DE",
22
  "p": "\uF8DE",
19
  "q": "\uF8DF",
23
  "q": "\uF8DF",
20
  "Q": "\uF8E0",
24
  "Q": "\uF8E0",
Line 49... Line 53...
49
rxKlingon = new RegExp(
53
rxKlingon = new RegExp(
50
  rxKlingon.filter(function (e) { return e.length > 1; }).join("|")
54
  rxKlingon.filter(function (e) { return e.length > 1; }).join("|")
51
    + "|[" + rxKlingon.filter(function (e) { return e.length === 1; }). join("") + "]",
55
    + "|[" + rxKlingon.filter(function (e) { return e.length === 1; }). join("") + "]",
52
  "ig");
56
  "ig");
53
57
54
//jsx.object.flip = function (obj) {
-
 
55
//  var flipped = jsx.object.inheritFrom(obj);
-
 
56
//  var keys = jsx.object.getKeys(obj);
-
 
57
//
-
 
58
//  for (var i = 0, len = keys.length; i < len; ++i)
-
 
59
//  {
-
 
60
//    var key = keys[i];
-
 
61
//    var value = obj[key];
-
 
62
//    if (typeof value != "function")
-
 
63
//    {
-
 
64
//      flipped[value] = key;
-
 
65
//    }
-
 
66
//  }
-
 
67
//
-
 
68
//  return flipped;
-
 
69
//};
-
 
70
-
 
71
function pIqaDize (s)
58
function pIqaDize (s)
72
{
59
{
73
  return s.replace(
60
  return s.replace(
74
    rxKlingon,
61
    rxKlingon,
75
    function (s) {
62
    function (s) {
Line 89... Line 76...
89
  if (!klingon_texts)
76
  if (!klingon_texts)
90
  {
77
  {
91
    return;
78
    return;
92
  }
79
  }
93
80
-
 
81
  if (document.documentElement.lang == LANG_KLINGON)
-
 
82
  {
-
 
83
    var title = document.getElementsByTagName("title")[0];
-
 
84
    title.setAttribute("data-text", document.title);
-
 
85
    document.title = pIqaDize(document.title);
-
 
86
  }
-
 
87
94
  for (var i = 0, len = klingon_texts.length; i < len; ++i)
88
  for (var i = 0, len = klingon_texts.length; i < len; ++i)
95
  {
89
  {
96
    var text = klingon_texts[i];
90
    var text = klingon_texts[i];
97
91
98
    if (!text.hasAttribute("data-html"))
92
    if (!text.hasAttribute("data-html"))
Line 118... Line 112...
118
112
119
    if (text.lang == LANG_KLINGON)
113
    if (text.lang == LANG_KLINGON)
120
    {
114
    {
121
      text.lang = LANG_KLINGON_PIQAD;
115
      text.lang = LANG_KLINGON_PIQAD;
122
    }
116
    }
123
    else if (text.parentNode.lang == LANG_KLINGON)
117
    else if (text.parentNode && text.parentNode.lang == LANG_KLINGON)
124
    {
118
    {
125
      text.parentNode.lang = LANG_KLINGON_PIQAD;
119
      text.parentNode.lang = LANG_KLINGON_PIQAD;
126
    }
120
    }
127
  }
121
  }
128
122
Line 130... Line 124...
130
  {
124
  {
131
    button.firstChild.lang = LANG_KLINGON;
125
    button.firstChild.lang = LANG_KLINGON;
132
  }
126
  }
133
127
134
  var html = document.documentElement;
128
  var html = document.documentElement;
-
 
129
  if (html.lang == LANG_KLINGON)
-
 
130
  {
135
  html.setAttribute("data-lang", html.lang);
131
    html.setAttribute("data-lang", html.lang);
136
  html.lang = LANG_KLINGON_PIQAD;
132
    html.lang = LANG_KLINGON_PIQAD;
-
 
133
  }
137
}
134
}
138
135
139
function klingonLatinScript (button)
136
function klingonLatinScript (button)
140
{
137
{
-
 
138
  var title = document.getElementsByTagName("title")[0];
-
 
139
  if (document.documentElement.lang == LANG_KLINGON_PIQAD)
-
 
140
  {
-
 
141
    document.title = title.getAttribute("data-text");
-
 
142
    title.removeAttribute("data-text")
-
 
143
  }
-
 
144
141
  for (var i = 0, len = klingon_texts.length; i < len; ++i)
145
  for (var i = 0, len = klingon_texts.length; i < len; ++i)
142
  {
146
  {
143
    var text = klingon_texts[i];
147
    var text = klingon_texts[i];
144
148
145
    text.innerHTML = text.getAttribute('data-html');
149
    text.innerHTML = text.getAttribute('data-html');
Line 147... Line 151...
147
151
148
    if (text.lang == LANG_KLINGON_PIQAD)
152
    if (text.lang == LANG_KLINGON_PIQAD)
149
    {
153
    {
150
      text.lang = LANG_KLINGON;
154
      text.lang = LANG_KLINGON;
151
    }
155
    }
152
    else if (text.parentNode.lang == LANG_KLINGON_PIQAD)
156
    else if (text.parentNode && text.parentNode.lang == LANG_KLINGON_PIQAD)
153
    {
157
    {
154
      text.parentNode.lang = LANG_KLINGON;
158
      text.parentNode.lang = LANG_KLINGON;
155
    }
159
    }
156
  }
160
  }
157
161
Line 159... Line 163...
159
  {
163
  {
160
    button.firstChild.lang = LANG_KLINGON_PIQAD;
164
    button.firstChild.lang = LANG_KLINGON_PIQAD;
161
  }
165
  }
162
166
163
  var html = document.documentElement;
167
  var html = document.documentElement;
-
 
168
  if (html.lang == LANG_KLINGON_PIQAD)
-
 
169
  {
164
  html.lang = html.getAttribute("data-lang");
170
    html.lang = html.getAttribute("data-lang");
165
  html.removeAttribute("data-lang");
171
    html.removeAttribute("data-lang");
-
 
172
  }
166
}
173
}