@@ -242,15 +242,15 @@ var dom = new function() {
242
242
243
243
for (var theme in application.themes) {
244
244
if (!application.themes.hasOwnProperty(theme) || !theme) continue;
245
- this.objects.themesContainer.innerHTML += "<input id=\"terminal-color-theme-" + theme + "\" " +
245
+ this.objects.themesContainer.innerHTML += "<label>< input id=\"terminal-color-theme-" + theme + "\" " +
246
246
"type=\"radio\" name=\"terminal-color-scheme\" value=\"" + theme + "\">" + theme[0].toUpperCase() +
247
- theme.substr(1);
247
+ theme.substr(1) + " </label>" ;
248
248
}
249
249
250
250
for (var l in lang.availableLanguages) {
251
251
if (!lang.availableLanguages.hasOwnProperty(l) || !l) continue;
252
- this.objects.languagesContainer.innerHTML += "<input id=\"terminal-language-unit-" + l + "\" " +
253
- "type=\"radio\" name=\"terminal-language-unit\" value=\"" + l + "\">" + l.toUpperCase();
252
+ this.objects.languagesContainer.innerHTML += "<label>< input id=\"terminal-language-unit-" + l + "\" " +
253
+ "type=\"radio\" name=\"terminal-language-unit\" value=\"" + l + "\">" + l.toUpperCase() + " </label>" ;
254
254
}
255
255
256
256
return this.objectsReady();
@@ -281,6 +281,7 @@ var settings = new function() {
281
281
restoreSession = 0,
282
282
parseOutput = 0,
283
283
cleanStartup = 0,
284
+ fontAntialiasing = 0,
284
285
language = "en";
285
286
286
287
this.get_restoreSession = function() { return restoreSession == 1 };
@@ -299,7 +300,8 @@ var settings = new function() {
299
300
restoreSession: restoreSession,
300
301
cleanStartup: cleanStartup,
301
302
parseOutput: parseOutput,
302
- language: language
303
+ language: language,
304
+ fontAntialiasing: fontAntialiasing
303
305
};
304
306
};
305
307
@@ -308,7 +310,7 @@ var settings = new function() {
308
310
settingImportObject.hasOwnProperty("animations") && settingImportObject.hasOwnProperty("highlighting") &&
309
311
settingImportObject.hasOwnProperty("colorTheme") && settingImportObject.hasOwnProperty("restoreSession") &&
310
312
settingImportObject.hasOwnProperty("cleanStartup") && settingImportObject.hasOwnProperty("parseOutput") &&
311
- settingImportObject.hasOwnProperty("language"))) {
313
+ settingImportObject.hasOwnProperty("language") && settingImportObject.hasOwnProperty("fontAntialiasing") )) {
312
314
log.write("Wrong settings object to import. Use /reset to restore settings.");
313
315
return;
314
316
}
@@ -319,6 +321,7 @@ var settings = new function() {
319
321
restoreSession = (settingImportObject["restoreSession"] == 1)?1:0;
320
322
cleanStartup = settingImportObject["cleanStartup"];
321
323
language = settingImportObject["language"];
324
+ fontAntialiasing = settingImportObject["fontAntialiasing"];
322
325
this.update();
323
326
};
324
327
@@ -329,9 +332,40 @@ var settings = new function() {
329
332
restoreSession = 0;
330
333
parseOutput = 0;
331
334
cleanStartup = 0;
335
+ fontAntialiasing = 0;
332
336
language = "en";
333
337
this.update();
334
338
};
339
+
340
+ var applyDomSettings = function() {
341
+
342
+ dom.objects.themeCSS.href = "css/theme-" + colorTheme + ".css";
343
+ if (!animations) {
344
+ dom.removeClass(dom.objects.body,"noAnimations");
345
+ dom.addClass(dom.objects.body,"noAnimations");
346
+ } else dom.removeClass(dom.objects.body,"noAnimations");
347
+
348
+ var p = ["-webkit-font-smoothing", "font-smoothing", "-moz-osx-font-smoothing"];
349
+
350
+ switch (parseInt(fontAntialiasing)) {
351
+ case 0: {
352
+ document.body.style[p[0]] = "none";
353
+ document.body.style[p[1]] = "none";
354
+ document.body.style[p[2]] = "none";
355
+ } break;
356
+ case 1: {
357
+ document.body.style[p[0]] = "antialiased";
358
+ document.body.style[p[1]] = "antialiased";
359
+ document.body.style[p[2]] = "grayscale";
360
+ } break;
361
+ case 2: {
362
+ document.body.style[p[0]] = "subpixel-antialiased";
363
+ document.body.style[p[1]] = "subpixel-antialiased";
364
+ document.body.style[p[2]] = "auto";
365
+ } break;
366
+ }
367
+
368
+ }
335
369
336
370
/**
337
371
* Updates terminal settings according to dom checked boxes.
@@ -359,13 +393,18 @@ var settings = new function() {
359
393
if (!obj2) continue;
360
394
if (obj2.checked) language = l;
361
395
}
396
+
397
+ fontAntialiasing = 0;
398
+ var els = document.getElementsByName("settings-fontSmoothing");
399
+ for (var ee in els) {
400
+ if (!els.hasOwnProperty(ee)) continue;
401
+ if (els[ee].checked) {
402
+ fontAntialiasing = parseInt(els[ee].value);
403
+ }
404
+ }
362
405
363
- dom.objects.themeCSS.href = "css/theme-" + colorTheme + ".css";
364
- if (!animations) {
365
- dom.removeClass(dom.objects.body,"noAnimations");
366
- dom.addClass(dom.objects.body,"noAnimations");
367
- } else dom.removeClass(dom.objects.body,"noAnimations");
368
-
406
+ applyDomSettings();
407
+
369
408
storage.set("settings", settings.export());
370
409
371
410
};
@@ -402,18 +441,26 @@ var settings = new function() {
402
441
dom.objects.settingsParseOutput.checked = parseOutput;
403
442
dom.objects.settingsAutoSaving.checked = restoreSession == 1;
404
443
dom.objects.settingsCleanStartup.checked = cleanStartup == 1;
444
+
405
445
for (var theme in application.themes) {
406
446
if (!application.themes.hasOwnProperty(theme)) continue;
407
447
var obj = dom.objects.getThemeSelectorObject(theme);
408
448
if (!obj) continue;
409
449
obj.checked = colorTheme === theme;
410
450
}
451
+
411
452
for (var l in lang.availableLanguages) {
412
453
if (!lang.availableLanguages.hasOwnProperty(l)) continue;
413
454
var obj2 = dom.objects.getLanguageSelectorObject(l);
414
455
if (!obj2) continue;
415
456
obj2.checked = language === l;
416
457
}
458
+
459
+ var els = document.getElementsByName("settings-fontSmoothing");
460
+ for (var ee in els) {
461
+ if (!els.hasOwnProperty(ee)) continue;
462
+ els[ee].checked = (parseInt(els[ee].value) == fontAntialiasing)?true:false;
463
+ }
417
464
};
418
465
419
466
this.update = function() {
@@ -425,11 +472,15 @@ var settings = new function() {
425
472
* Applies language to the document.
426
473
*/
427
474
function translateDocument() {
428
- var i = 0, e;
429
- while (e = dom.element("lang-field-" + i)) {
475
+ var e, l;
476
+ for (var i = 0; i < lang.getLanguagesNumber(); i++) {
477
+ e = dom.element("lang-field-" + i);
478
+ if (e && (l = lang.get(i))) { e.innerHTML = l; }
479
+ }
480
+ /*while (e = dom.element("lang-field-" + i)) {
430
481
e.innerHTML = lang.get(62 + i);
431
482
i++;
432
- }
483
+ }*/
433
484
}
434
485
435
486
/**
0 commit comments