-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresources.go
117 lines (104 loc) · 2.51 KB
/
resources.go
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package main
const CSS = `
body {
width: 95%;
margin: auto;
padding-top: 20px;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
font: normal 100% sans-serif;
}
div.row {
overflow: auto;
margin-top: 0.875em;
margin-bottom: 0.875em;
}
a { text-decoration: none; }
a:visited{ color: #6600CC; }
a:link{ color: #33CC33; }
div.name {
float: left;
width: 160px;
background-color: #eee;
border: 1px solid #aaa;
border-right: 1px solid #eee;
padding: 0.4em;
}
div.comic {
margin-left: 170px;
border-top: 1px solid #aaa;
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
background-color: #eee;
padding: 0.4em;
}
div.descr {
font-weight: bold;
font-size: 0.75em;
background-color: #e3e2cf;
border-right: 1px solid #aaa;
border-left: 1px solid #aaa;
border-bottom: 1px solid #aaa;
padding-top: 0.875em;
margin-left: 170px;
padding: 10px;
text-align: center;
}
img.comic {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 100%;
}
`
const MAIN_TEMPLATE = `
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<link title="Default Comics" media="screen" href="comics.css" type="text/css" rel="stylesheet">
<title>{{.Date.Year}}_{{.Date.Month}}_{{.Date.Day}}</title>
</head>
<body text="#000000" link="#ff00ff" bgcolor="#ffffff">
<div><a href="log.txt" target="_blank">Logi błędów</a></div>
{{range .Comics}}
{{.HTML}}
{{end}}
<script>
(function(){
for (node of document.getElementsByClassName("js-toggle-image")){
node.addEventListener("click", function(ev){
var imgNode = document.getElementById(this.dataset["for"]);
if (imgNode.style.display === "none"){ imgNode.style.display = "block"; }
else { imgNode.style.display = "none"; }
})
}
})()
</script>
</body>
</html>
`
const SEGMENT_TEMPLATE = `
<div class="row">
<div class="name">
<h1>
<a href="{{.Comic.Url}}">{{.Comic.Name}}</a>
</h1>
</div>
{{ if .ErrorMsg }}
<div class="descr">{{.ErrorMsg}}</div>
{{ else }}
<div class="comic">
<img id="comic-{{ .Comic.Name }}" src="{{.ImgSrc}}" class="comic{{ if .Comic.Nsfw }} nsfw" style="display:none{{ end }}">
{{ if .Comic.Nsfw }}
<a class="js-toggle-image" data-for="comic-{{ .Comic.Name }}">Pokaż / Ukryj</a>
{{ end }}
</div>
{{ if .Title }}
<div class="descr">{{.Title}}</div>
{{ end }}
{{ end }}
</div>
`