-
Notifications
You must be signed in to change notification settings - Fork 0
/
toggle-font.js
32 lines (32 loc) · 1.02 KB
/
toggle-font.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Font.
function toggleFont() {
var pixelFont = SiteStorage.SiteStorage.get('pixel_font', 'false');
var font = document.getElementById('font');
var set = function () {
var style = pixelFont == 'false' ? 'font: 16px Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace, sans-serif;' : '';
var content = document.getElementById('container');
if (content)
content.style = style;
content = document.getElementById('article-content');
if (content)
content.style = style;
for (var i = 0; i < 999; ++i) {
var comment = document.getElementById('article-comment-' + i.toString());
if (!comment)
break;
comment.style = style;
}
var codes = document.getElementsByTagName('code');
for (var i in codes)
codes[i].style = style;
};
set();
font.onclick = function () {
if (pixelFont == 'true')
pixelFont = 'false';
else
pixelFont='true';
set();
SiteStorage.SiteStorage.set('pixel_font', pixelFont);
};
}