-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathFavicon.coffee
84 lines (77 loc) · 2.88 KB
/
Favicon.coffee
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Favicon =
init: ->
$.asap (-> d.head and Favicon.el = $ 'link[rel="shortcut icon"]', d.head), Favicon.initAsap
initAsap: ->
Favicon.el.type = 'image/x-icon'
{href} = Favicon.el
Favicon.SFW = /ws\.ico$/.test href
Favicon.default = href
Favicon.switch()
switch: ->
items = {
ferongr: [
'<%= readBase64('ferongr.unreadDead.png') %>'
'<%= readBase64('ferongr.unreadDeadY.png') %>'
'<%= readBase64('ferongr.unreadSFW.png') %>'
'<%= readBase64('ferongr.unreadSFWY.png') %>'
'<%= readBase64('ferongr.unreadNSFW.png') %>'
'<%= readBase64('ferongr.unreadNSFWY.png') %>'
]
'xat-': [
'<%= readBase64('xat-.unreadDead.png') %>'
'<%= readBase64('xat-.unreadDeadY.png') %>'
'<%= readBase64('xat-.unreadSFW.png') %>'
'<%= readBase64('xat-.unreadSFWY.png') %>'
'<%= readBase64('xat-.unreadNSFW.png') %>'
'<%= readBase64('xat-.unreadNSFWY.png') %>'
]
Mayhem: [
'<%= readBase64('Mayhem.unreadDead.png') %>'
'<%= readBase64('Mayhem.unreadDeadY.png') %>'
'<%= readBase64('Mayhem.unreadSFW.png') %>'
'<%= readBase64('Mayhem.unreadSFWY.png') %>'
'<%= readBase64('Mayhem.unreadNSFW.png') %>'
'<%= readBase64('Mayhem.unreadNSFWY.png') %>'
]
'4chanJS': [
'<%= readBase64('4chanJS.unreadDead.png') %>'
'<%= readBase64('4chanJS.unreadDeadY.png') %>'
'<%= readBase64('4chanJS.unreadSFW.png') %>'
'<%= readBase64('4chanJS.unreadSFWY.png') %>'
'<%= readBase64('4chanJS.unreadNSFW.png') %>'
'<%= readBase64('4chanJS.unreadNSFWY.png') %>'
]
Original: [
'<%= readBase64('Original.unreadDead.png') %>'
'<%= readBase64('Original.unreadDeadY.png') %>'
'<%= readBase64('Original.unreadSFW.png') %>'
'<%= readBase64('Original.unreadSFWY.png') %>'
'<%= readBase64('Original.unreadNSFW.png') %>'
'<%= readBase64('Original.unreadNSFWY.png') %>'
]
'Metro': [
'<%= readBase64('Metro.unreadDead.png') %>'
'<%= readBase64('Metro.unreadDeadY.png') %>'
'<%= readBase64('Metro.unreadSFW.png') %>'
'<%= readBase64('Metro.unreadSFWY.png') %>'
'<%= readBase64('Metro.unreadNSFW.png') %>'
'<%= readBase64('Metro.unreadNSFWY.png') %>'
]
}[Conf['favicon']]
f = Favicon
t = 'data:image/png;base64,'
i = 0
while items[i]
items[i] = t + items[i++]
[f.unreadDead, f.unreadDeadY, f.unreadSFW, f.unreadSFWY, f.unreadNSFW, f.unreadNSFWY] = items
f.update()
update: ->
if @SFW
@unread = @unreadSFW
@unreadY = @unreadSFWY
else
@unread = @unreadNSFW
@unreadY = @unreadNSFWY
dead: 'data:image/gif;base64,<%= readBase64('dead.gif') %>'
logo: 'data:image/png;base64,<%= readBase64('/src/meta/icon128.png') %>'
return Favicon