リビジョン | 7e551c698deead4dbc5f9393ff2c18fbbb03ca92 (tree) |
---|---|
日時 | 2020-02-16 17:51:57 |
作者 | ![]() |
コミッター | mshio |
update html
add SIL Open Font License
@@ -101,9 +101,24 @@ def parse_args(): | ||
101 | 101 | ps.add_argument("source") |
102 | 102 | ps.add_argument("-o", dest="out_path", default="out.html") |
103 | 103 | ps.add_argument("-t", dest="template_path", default="template.html") |
104 | + ps.add_argument("-r", dest="for_rootdir", default=False) | |
104 | 105 | |
105 | 106 | return ps.parse_args() |
106 | 107 | |
108 | +def rewrite_resource_path(template): | |
109 | + def to_be_rewritten(path: str) -> bool: | |
110 | + return not re.match(r"^(https?:)?//.*", path) | |
111 | + | |
112 | + for l in template.xpath("//link[@rel='stylesheet']"): | |
113 | + path = l.attrib.get("href") | |
114 | + if to_be_rewritten(path): | |
115 | + l.attrib["href"] = f"../{path}" | |
116 | + | |
117 | + for s in template.xpath("//script|//img"): | |
118 | + path = s.attrib.get("src") | |
119 | + if to_be_rewritten(path): | |
120 | + s.attrib["src"] = f"../{path}" | |
121 | + | |
107 | 122 | if __name__ == "__main__": |
108 | 123 | args = parse_args() |
109 | 124 |
@@ -113,7 +128,7 @@ if __name__ == "__main__": | ||
113 | 128 | |
114 | 129 | temp = html.parse(args.template_path) |
115 | 130 | temp.getroot().attrib['lang'] = doc.property['lang'] |
116 | - temp.xpath('//title')[0].text = doc.property['title'] | |
131 | + temp.xpath('/html/head/title')[0].text = doc.property['title'] | |
117 | 132 | img = temp.xpath('//div[contains(@class, "logo")]/img')[0] |
118 | 133 | img.attrib['alt'] = doc.property['title'] |
119 | 134 | langname = temp.xpath('//div[contains(@id, "current-lang")]/span')[0] |
@@ -126,5 +141,8 @@ if __name__ == "__main__": | ||
126 | 141 | |
127 | 142 | for a in temp.xpath('//a'): a.attrib['target'] = '_blank' |
128 | 143 | |
144 | + if not args.for_rootdir: | |
145 | + rewrite_resource_path(temp) | |
146 | + | |
129 | 147 | with open(args.out_path, 'w') as f: |
130 | 148 | f.write(html.tostring(temp, encoding='utf-8').decode()) |
@@ -290,7 +290,7 @@ $ -> | ||
290 | 290 | 'mincho' |
291 | 291 | ] |
292 | 292 | |
293 | - $container = $('#docs-header .buttons-container .inner-container') | |
293 | + $container = $('header .buttons-container .inner-container') | |
294 | 294 | buttons = [] |
295 | 295 | for name, n in drawPage.mapping |
296 | 296 | b = document.createElement('div') |
@@ -52,13 +52,9 @@ class LangMenu | ||
52 | 52 | return |
53 | 53 | |
54 | 54 | onclickItem: (event)-> |
55 | - console.log(@) | |
56 | - | |
57 | 55 | return if $(@).attr("id") == "current-lang" |
58 | 56 | key = $(@).attr("data-key") + '/' |
59 | - key = '' if key is 'ja/' | |
60 | 57 | root = '../' |
61 | - root = './' if $("div#current-lang").attr("data-key") is "ja" | |
62 | 58 | window.location = root + key |
63 | 59 | return |
64 | 60 |
@@ -25,7 +25,7 @@ nav .container div#navbar div#lang div.container { | ||
25 | 25 | } |
26 | 26 | nav .container div#navbar div#lang div.item { |
27 | 27 | padding: 26px 1em 0 1em; |
28 | - width: 85px; | |
28 | + width: 90px; | |
29 | 29 | height: 40px; |
30 | 30 | cursor: pointer; |
31 | 31 | background-color: #fff; |
@@ -22,21 +22,23 @@ daily use, such as standard kanji, for being under developing now. | ||
22 | 22 | % license |
23 | 23 | ## License |
24 | 24 | |
25 | -The license of Sawarabi Fonts is Creative Commons Attribution 3.0. You can see | |
26 | -the content of this license on the following site: | |
25 | +Sawarabi Gothic and Mincho are dual-licensed under either the terms of | |
26 | +the Creative Commons Attribution 3.0 or under the terms of the SIL Open | |
27 | +Font License 1.1. | |
27 | 28 | |
28 | 29 | - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/) |
30 | +- [SIL Open Font License 1.1](https://scripts.sil.org/OFL) | |
29 | 31 | |
30 | 32 | % samples |
31 | 33 | ## Samples |
32 | 34 | |
33 | 35 | Sawarabi Gothic (ver.20161015). |
34 | 36 | |
35 | -<img src="/img/sample-gothic.png" alt="Sample (Gothic)" /><br /> | |
37 | +<img src="img/sample-gothic.png" alt="Sample (Gothic)" /><br /> | |
36 | 38 | |
37 | -Sawarabi Mincho (ver.20140815). | |
39 | +Sawarabi Mincho (ver.20200215). | |
38 | 40 | |
39 | -<img src="../img/sample-mincho.png" alt="Sample (Mincho)" /><br /> | |
41 | +<img src="img/sample-mincho-20200215.png" alt="Sample (Mincho)" /><br /> | |
40 | 42 | |
41 | 43 | % download |
42 | 44 | ## Download |
@@ -17,21 +17,21 @@ | ||
17 | 17 | % license |
18 | 18 | ## ライセンス |
19 | 19 | |
20 | - さわらびフォントのライセンスは、Creative Commons Attribution 3.0 です。 | |
21 | -このライセンスの内容は、以下のリンクからご覧いただけます。 | |
20 | + さわらびフォントは、Creative Commons Attribution 3.0 と SIL Open Font License 1.1 のデュアルライセンスで配布されています。ライセンスの内容は、以下のリンクからご覧いただけます。 | |
22 | 21 | |
23 | 22 | - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/deed.ja) |
23 | +- [SIL Open Font License 1.1](https://scripts.sil.org/OFL) | |
24 | 24 | |
25 | 25 | % samples |
26 | 26 | ## 書体見本 |
27 | 27 | |
28 | 28 | さわらびゴシック(ver.20161015)の書体見本です。 |
29 | 29 | |
30 | -<img src="/img/sample-gothic.png" alt="書体見本(ゴシック)" /><br /> | |
30 | +<img src="img/sample-gothic.png" alt="書体見本(ゴシック)" /><br /> | |
31 | 31 | |
32 | - さわらび明朝(ver.20140815)の書体見本です。 | |
32 | + さわらび明朝(ver.20200215)の書体見本です。 | |
33 | 33 | |
34 | -<img src="/img/sample-mincho.png" alt="書体見本(明朝)" /><br /> | |
34 | +<img src="img/sample-mincho-20200215.png" alt="書体見本(明朝)" /><br /> | |
35 | 35 | |
36 | 36 | % download |
37 | 37 | ## ダウンロード |
@@ -1,8 +1,8 @@ | ||
1 | -// Generated by CoffeeScript 1.4.0 | |
1 | +// Generated by CoffeeScript 1.12.7 | |
2 | 2 | (function() { |
3 | 3 | var AbstractRectangle, Canvas, GradientRectangle, GraphBar, KanjiInfo, Label, Line, Screen, makeGraphPage, merge, screenPosition, |
4 | - __hasProp = {}.hasOwnProperty, | |
5 | - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | |
5 | + hasProp = {}.hasOwnProperty; | |
6 | 6 | |
7 | 7 | Canvas = { |
8 | 8 | el: "canvas#header-canvas", |
@@ -19,7 +19,6 @@ | ||
19 | 19 | }; |
20 | 20 | |
21 | 21 | Screen = (function() { |
22 | - | |
23 | 22 | function Screen(attr) { |
24 | 23 | if (attr == null) { |
25 | 24 | attr = {}; |
@@ -42,13 +41,13 @@ | ||
42 | 41 | }; |
43 | 42 | |
44 | 43 | Screen.prototype.draw = function(obj) { |
45 | - var x, _i, _len, _ref; | |
44 | + var i, len, ref, x; | |
46 | 45 | if (obj) { |
47 | 46 | obj.draw(); |
48 | 47 | } else { |
49 | - _ref = this.objects; | |
50 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
51 | - x = _ref[_i]; | |
48 | + ref = this.objects; | |
49 | + for (i = 0, len = ref.length; i < len; i++) { | |
50 | + x = ref[i]; | |
52 | 51 | x.draw(); |
53 | 52 | } |
54 | 53 | } |
@@ -56,40 +55,41 @@ | ||
56 | 55 | }; |
57 | 56 | |
58 | 57 | Screen.prototype.animate = function() { |
59 | - var _this = this; | |
60 | 58 | this.locking = true; |
61 | - return setTimeout(function() { | |
62 | - var animating, x, _i, _len, _ref; | |
63 | - animating = false; | |
64 | - _ref = _this.objects; | |
65 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
66 | - x = _ref[_i]; | |
67 | - if (!((x.isAnimating != null) && x.isAnimating())) { | |
68 | - continue; | |
59 | + return setTimeout((function(_this) { | |
60 | + return function() { | |
61 | + var animating, i, len, ref, x; | |
62 | + animating = false; | |
63 | + ref = _this.objects; | |
64 | + for (i = 0, len = ref.length; i < len; i++) { | |
65 | + x = ref[i]; | |
66 | + if (!((x.isAnimating != null) && x.isAnimating())) { | |
67 | + continue; | |
68 | + } | |
69 | + x.draw(); | |
70 | + animating = true; | |
69 | 71 | } |
70 | - x.draw(); | |
71 | - animating = true; | |
72 | - } | |
73 | - if (animating) { | |
74 | - return _this.animate(); | |
75 | - } else { | |
76 | - return _this.afterAnimation(); | |
77 | - } | |
78 | - }, 25); | |
72 | + if (animating) { | |
73 | + return _this.animate(); | |
74 | + } else { | |
75 | + return _this.afterAnimation(); | |
76 | + } | |
77 | + }; | |
78 | + })(this), 25); | |
79 | 79 | }; |
80 | 80 | |
81 | 81 | Screen.prototype.afterAnimation = function() { |
82 | - var x, _i, _len, _ref, _results; | |
82 | + var i, len, ref, results, x; | |
83 | 83 | this.locking = false; |
84 | - _ref = this.objects; | |
85 | - _results = []; | |
86 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
87 | - x = _ref[_i]; | |
84 | + ref = this.objects; | |
85 | + results = []; | |
86 | + for (i = 0, len = ref.length; i < len; i++) { | |
87 | + x = ref[i]; | |
88 | 88 | if (x.afterAnimation != null) { |
89 | - _results.push(x.afterAnimation(this)); | |
89 | + results.push(x.afterAnimation(this)); | |
90 | 90 | } |
91 | 91 | } |
92 | - return _results; | |
92 | + return results; | |
93 | 93 | }; |
94 | 94 | |
95 | 95 | return Screen; |
@@ -97,24 +97,22 @@ | ||
97 | 97 | })(); |
98 | 98 | |
99 | 99 | Label = (function() { |
100 | - | |
101 | 100 | function Label(text, attr) { |
102 | - var _ref, _ref1, _ref2, _ref3; | |
103 | 101 | if (attr == null) { |
104 | 102 | attr = {}; |
105 | 103 | } |
106 | 104 | this.text = text; |
107 | 105 | merge(this, attr); |
108 | - if ((_ref = this.font) == null) { | |
106 | + if (this.font == null) { | |
109 | 107 | this.font = '10px sans'; |
110 | 108 | } |
111 | - if ((_ref1 = this.color) == null) { | |
109 | + if (this.color == null) { | |
112 | 110 | this.color = 'white'; |
113 | 111 | } |
114 | - if ((_ref2 = this.x) == null) { | |
112 | + if (this.x == null) { | |
115 | 113 | this.x = 0; |
116 | 114 | } |
117 | - if ((_ref3 = this.y) == null) { | |
115 | + if (this.y == null) { | |
118 | 116 | this.y = 0; |
119 | 117 | } |
120 | 118 | } |
@@ -143,7 +141,6 @@ | ||
143 | 141 | })(); |
144 | 142 | |
145 | 143 | Line = (function() { |
146 | - | |
147 | 144 | function Line(attr) { |
148 | 145 | if (attr == null) { |
149 | 146 | attr = {}; |
@@ -178,23 +175,21 @@ | ||
178 | 175 | })(); |
179 | 176 | |
180 | 177 | AbstractRectangle = (function() { |
181 | - | |
182 | 178 | function AbstractRectangle(attr) { |
183 | - var _ref, _ref1, _ref2, _ref3; | |
184 | 179 | if (attr == null) { |
185 | 180 | attr = {}; |
186 | 181 | } |
187 | 182 | merge(this, attr); |
188 | - if ((_ref = this.x0) == null) { | |
183 | + if (this.x0 == null) { | |
189 | 184 | this.x0 = 0; |
190 | 185 | } |
191 | - if ((_ref1 = this.y0) == null) { | |
186 | + if (this.y0 == null) { | |
192 | 187 | this.y0 = 0; |
193 | 188 | } |
194 | - if ((_ref2 = this.x1) == null) { | |
189 | + if (this.x1 == null) { | |
195 | 190 | this.x1 = 0; |
196 | 191 | } |
197 | - if ((_ref3 = this.y1) == null) { | |
192 | + if (this.y1 == null) { | |
198 | 193 | this.y1 = 0; |
199 | 194 | } |
200 | 195 | } |
@@ -216,26 +211,24 @@ | ||
216 | 211 | |
217 | 212 | })(); |
218 | 213 | |
219 | - GradientRectangle = (function(_super) { | |
220 | - | |
221 | - __extends(GradientRectangle, _super); | |
214 | + GradientRectangle = (function(superClass) { | |
215 | + extend(GradientRectangle, superClass); | |
222 | 216 | |
223 | 217 | function GradientRectangle(attr) { |
224 | - var _ref, _ref1; | |
225 | 218 | if (attr == null) { |
226 | 219 | attr = {}; |
227 | 220 | } |
228 | 221 | GradientRectangle.__super__.constructor.call(this, attr); |
229 | - if ((_ref = this.colors) == null) { | |
222 | + if (this.colors == null) { | |
230 | 223 | this.colors = ['#fff', '#fff']; |
231 | 224 | } |
232 | - if ((_ref1 = this.direction) == null) { | |
225 | + if (this.direction == null) { | |
233 | 226 | this.direction = 'horizontal'; |
234 | 227 | } |
235 | 228 | } |
236 | 229 | |
237 | 230 | GradientRectangle.prototype.draw = function(offsetX, offsetY) { |
238 | - var c, d, g, p, v, _i, _len, _ref; | |
231 | + var c, d, g, i, len, p, ref, v; | |
239 | 232 | if (offsetX == null) { |
240 | 233 | offsetX = 0; |
241 | 234 | } |
@@ -251,9 +244,9 @@ | ||
251 | 244 | g = c.createLinearGradient(p.x0, p.y0, p.x1, p.y0); |
252 | 245 | } |
253 | 246 | d = 0.0; |
254 | - _ref = this.colors; | |
255 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
256 | - v = _ref[_i]; | |
247 | + ref = this.colors; | |
248 | + for (i = 0, len = ref.length; i < len; i++) { | |
249 | + v = ref[i]; | |
257 | 250 | g.addColorStop(d, v); |
258 | 251 | d += 1 / (this.colors.length - 1); |
259 | 252 | } |
@@ -267,23 +260,21 @@ | ||
267 | 260 | })(AbstractRectangle); |
268 | 261 | |
269 | 262 | GraphBar = (function() { |
270 | - | |
271 | 263 | function GraphBar(attr) { |
272 | - var _ref, _ref1, _ref2, _ref3; | |
273 | 264 | if (attr == null) { |
274 | 265 | attr = {}; |
275 | 266 | } |
276 | 267 | merge(this, attr); |
277 | - if ((_ref = this.x) == null) { | |
268 | + if (this.x == null) { | |
278 | 269 | this.x = 0; |
279 | 270 | } |
280 | - if ((_ref1 = this.y) == null) { | |
271 | + if (this.y == null) { | |
281 | 272 | this.y = 0; |
282 | 273 | } |
283 | - if ((_ref2 = this.width) == null) { | |
274 | + if (this.width == null) { | |
284 | 275 | this.width = 1; |
285 | 276 | } |
286 | - if ((_ref3 = this.height) == null) { | |
277 | + if (this.height == null) { | |
287 | 278 | this.height = 24; |
288 | 279 | } |
289 | 280 | this.performance = attr.performance || 0; |
@@ -331,7 +322,7 @@ | ||
331 | 322 | if (parseInt(val) * 1.0 === Number(val)) { |
332 | 323 | val = parseInt(val); |
333 | 324 | } |
334 | - label = new Label("" + val + "%", { | |
325 | + label = new Label(val + "%", { | |
335 | 326 | font: '12px sans' |
336 | 327 | }); |
337 | 328 | width = 1.0 * this.width / this.max * this.performance; |
@@ -349,27 +340,27 @@ | ||
349 | 340 | })(); |
350 | 341 | |
351 | 342 | merge = function(dist, src) { |
352 | - var k, v, _results; | |
353 | - _results = []; | |
343 | + var k, results, v; | |
344 | + results = []; | |
354 | 345 | for (k in src) { |
355 | 346 | v = src[k]; |
356 | 347 | if (src.hasOwnProperty(k)) { |
357 | - _results.push(dist[k] = v); | |
348 | + results.push(dist[k] = v); | |
358 | 349 | } |
359 | 350 | } |
360 | - return _results; | |
351 | + return results; | |
361 | 352 | }; |
362 | 353 | |
363 | 354 | screenPosition = function(obj, offsetX, offsetY) { |
364 | - var m, offset, pos, _i, _len, _ref; | |
355 | + var i, len, m, offset, pos, ref; | |
365 | 356 | pos = {}; |
366 | 357 | offset = { |
367 | 358 | x: offsetX, |
368 | 359 | y: offsetY |
369 | 360 | }; |
370 | - _ref = screenPosition.fields; | |
371 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
372 | - m = _ref[_i]; | |
361 | + ref = screenPosition.fields; | |
362 | + for (i = 0, len = ref.length; i < len; i++) { | |
363 | + m = ref[i]; | |
373 | 364 | if (obj.hasOwnProperty(m)) { |
374 | 365 | pos[m] = obj[m] + offset[m[0]]; |
375 | 366 | } |
@@ -433,7 +424,7 @@ | ||
433 | 424 | return screen.add(bottomLine); |
434 | 425 | })(); |
435 | 426 | (function() { |
436 | - var d, graphArea, x, _, _i, _len, _ref, _results; | |
427 | + var _, d, graphArea, i, len, ref, results, x; | |
437 | 428 | graphArea = new GradientRectangle({ |
438 | 429 | x0: 146, |
439 | 430 | y0: 75, |
@@ -443,31 +434,31 @@ | ||
443 | 434 | }); |
444 | 435 | screen.add(graphArea); |
445 | 436 | d = [650 - 146] / 4; |
446 | - _ref = new Array(5); | |
447 | - _results = []; | |
448 | - for (x = _i = 0, _len = _ref.length; _i < _len; x = ++_i) { | |
449 | - _ = _ref[x]; | |
450 | - _results.push(screen.add(new Line({ | |
437 | + ref = new Array(5); | |
438 | + results = []; | |
439 | + for (x = i = 0, len = ref.length; i < len; x = ++i) { | |
440 | + _ = ref[x]; | |
441 | + results.push(screen.add(new Line({ | |
451 | 442 | x: 146 + d * (x + 1), |
452 | 443 | y0: 75, |
453 | 444 | y1: 268, |
454 | 445 | color: "rgb(178, 255, 178)" |
455 | 446 | }))); |
456 | 447 | } |
457 | - return _results; | |
448 | + return results; | |
458 | 449 | })(); |
459 | 450 | (function() { |
460 | - var field, fields, n, _i, _len, _results; | |
451 | + var field, fields, i, len, n, results; | |
461 | 452 | fields = ['kyoikuKanji', 'level1st', 'level2nd', 'level3rd', 'level4th']; |
462 | - _results = []; | |
463 | - for (n = _i = 0, _len = fields.length; _i < _len; n = ++_i) { | |
453 | + results = []; | |
454 | + for (n = i = 0, len = fields.length; i < len; n = ++i) { | |
464 | 455 | field = fields[n]; |
465 | 456 | screen.add(new Label(window.dictionary[field], { |
466 | 457 | x: 30, |
467 | 458 | y: 103 + (37 * n), |
468 | 459 | font: '14px sans' |
469 | 460 | })); |
470 | - _results.push(screen.add(new GraphBar({ | |
461 | + results.push(screen.add(new GraphBar({ | |
471 | 462 | x: 146, |
472 | 463 | y: 87 + (37 * n), |
473 | 464 | width: 504, |
@@ -475,7 +466,7 @@ | ||
475 | 466 | performance: KanjiInfo[pageName][field] |
476 | 467 | }))); |
477 | 468 | } |
478 | - return _results; | |
469 | + return results; | |
479 | 470 | })(); |
480 | 471 | screen.add(new Line({ |
481 | 472 | x: 146, |
@@ -493,18 +484,18 @@ | ||
493 | 484 | return; |
494 | 485 | } |
495 | 486 | screenScale = (function() { |
496 | - var m, scale, _i, _len, _ref; | |
487 | + var i, len, m, ref, scale; | |
497 | 488 | scale = {}; |
498 | - _ref = ['width', 'height']; | |
499 | - for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
500 | - m = _ref[_i]; | |
489 | + ref = ['width', 'height']; | |
490 | + for (i = 0, len = ref.length; i < len; i++) { | |
491 | + m = ref[i]; | |
501 | 492 | scale[m] = parseInt(Canvas.$el.css(m)); |
502 | 493 | } |
503 | 494 | return scale; |
504 | 495 | })(); |
505 | 496 | screen = new Screen(screenScale); |
506 | 497 | return KanjiInfo.update(function() { |
507 | - var $container, b, buttons, drawPage, n, name, _i, _len, _ref; | |
498 | + var $container, b, buttons, drawPage, i, len, n, name, ref; | |
508 | 499 | drawPage = function(pageIndex) { |
509 | 500 | var pageName; |
510 | 501 | pageName = drawPage.mapping[pageIndex]; |
@@ -513,11 +504,11 @@ | ||
513 | 504 | } |
514 | 505 | }; |
515 | 506 | drawPage.mapping = ['gothic', 'mincho']; |
516 | - $container = $('#docs-header .buttons-container .inner-container'); | |
507 | + $container = $('header .buttons-container .inner-container'); | |
517 | 508 | buttons = []; |
518 | - _ref = drawPage.mapping; | |
519 | - for (n = _i = 0, _len = _ref.length; _i < _len; n = ++_i) { | |
520 | - name = _ref[n]; | |
509 | + ref = drawPage.mapping; | |
510 | + for (n = i = 0, len = ref.length; i < len; n = ++i) { | |
511 | + name = ref[n]; | |
521 | 512 | b = document.createElement('div'); |
522 | 513 | $(b).addClass('button').text(n + 1).click(function() { |
523 | 514 | var index; |
@@ -1,4 +1,4 @@ | ||
1 | -// Generated by CoffeeScript 1.4.0 | |
1 | +// Generated by CoffeeScript 1.12.7 | |
2 | 2 | (function() { |
3 | 3 | var CurrentLangLabel, LangMenu, LangMenuItem, availableLanguages, main; |
4 | 4 |
@@ -17,18 +17,18 @@ | ||
17 | 17 | }; |
18 | 18 | |
19 | 19 | CurrentLangLabel = (function() { |
20 | - | |
21 | 20 | function CurrentLangLabel(menu) { |
22 | - var _this = this; | |
23 | 21 | this.el = "#current-lang"; |
24 | 22 | this.$el = $(this.el); |
25 | 23 | this.menu = menu; |
26 | - this.$el.click(function(event) { | |
27 | - event.stopPropagation(); | |
28 | - return $(_this.menu.$el).css({ | |
29 | - "z-index": 99 | |
30 | - }).toggle(); | |
31 | - }); | |
24 | + this.$el.click((function(_this) { | |
25 | + return function(event) { | |
26 | + event.stopPropagation(); | |
27 | + return $(_this.menu.$el).css({ | |
28 | + "z-index": 99 | |
29 | + }).toggle(); | |
30 | + }; | |
31 | + })(this)); | |
32 | 32 | } |
33 | 33 | |
34 | 34 | CurrentLangLabel.prototype.text = function() { |
@@ -40,7 +40,6 @@ | ||
40 | 40 | })(); |
41 | 41 | |
42 | 42 | LangMenuItem = (function() { |
43 | - | |
44 | 43 | function LangMenuItem(langSymbol, langText) { |
45 | 44 | this.$el = $(document.createElement("div")); |
46 | 45 | this.$el.attr({ |
@@ -56,15 +55,13 @@ | ||
56 | 55 | })(); |
57 | 56 | |
58 | 57 | LangMenu = (function() { |
59 | - | |
60 | 58 | function LangMenu() { |
61 | 59 | this.el = "#lang-menu-container"; |
62 | 60 | this.$el = $(this.el); |
63 | 61 | } |
64 | 62 | |
65 | 63 | LangMenu.prototype.buildItems = function(currentLangText) { |
66 | - var k, v, | |
67 | - _this = this; | |
64 | + var k, v; | |
68 | 65 | for (k in availableLanguages) { |
69 | 66 | v = availableLanguages[k]; |
70 | 67 | if (v === currentLangText) { |
@@ -74,25 +71,20 @@ | ||
74 | 71 | } |
75 | 72 | } |
76 | 73 | $('.item', this.$el).click(this.onclickItem); |
77 | - $('body').click(function() { | |
78 | - return _this.$el.hide(); | |
79 | - }); | |
74 | + $('body').click((function(_this) { | |
75 | + return function() { | |
76 | + return _this.$el.hide(); | |
77 | + }; | |
78 | + })(this)); | |
80 | 79 | }; |
81 | 80 | |
82 | 81 | LangMenu.prototype.onclickItem = function(event) { |
83 | 82 | var key, root; |
84 | - console.log(this); | |
85 | 83 | if ($(this).attr("id") === "current-lang") { |
86 | 84 | return; |
87 | 85 | } |
88 | 86 | key = $(this).attr("data-key") + '/'; |
89 | - if (key === 'ja/') { | |
90 | - key = ''; | |
91 | - } | |
92 | 87 | root = '../'; |
93 | - if ($("div#current-lang").attr("data-key") === "ja") { | |
94 | - root = './'; | |
95 | - } | |
96 | 88 | window.location = root + key; |
97 | 89 | }; |
98 | 90 |
@@ -0,0 +1,3 @@ | ||
1 | +lxml==4.5.0 | |
2 | +Markdown==3.2.1 | |
3 | +pkg-resources==0.0.0 |