-
Notifications
You must be signed in to change notification settings - Fork 3
/
status_template.html
148 lines (145 loc) · 5.99 KB
/
status_template.html
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<html>
<head>
<title>${config['account']['username']} status</title>
<style>
table { border-collapse: collapse; }
th, td {
border: 2px solid black;
padding: 3px;
max-width: 13em;
}
a {
display: inline-block;
z-index: 10;
position: relative;
background: rgba(255,255,255,0.5);
}
a:hover {
background: yellow;
}
#popover, #gfypopover {
position: absolute;
z-index: 5;
}
</style>
</head>
<body>
<p>${config['account']['username']} was last restarted at ${last_restarted.strftime('%I:%M%p PST on %b %d, %Y')}.</p>
<p>It is currently aware of ${num_images} images that are triggered by a total of ${num_keys} phrases, as follows:</p>
<p>
<img id="popover" style="display: none" src=""/>
<div id="gfypopover" style="display: none">
<img/>
</div>
<table id="imagetable">
<thead>
<tr>
<th>Triggers</th>
<th>Images</th>
</tr>
</thead>
<tbody>
% for keys, images in imagelist:
<tr>
<td>${', '.join(keys)}</td>
<td>
% for url in images:
<a class="imagelink" href="${url}">[${loop.index + 1}]</a>
% endfor
</td>
</tr>
% endfor
</tbody>
</table>
</p>
<script type="text/javascript">
var popover = document.getElementById('popover');
var gfypop = document.getElementById('gfypopover');
var lastimg;
document.getElementById('imagetable').addEventListener(
'mouseover',
function(evt) {
if(evt.target.tagName == 'A' && lastimg != evt.target.href) {
//Hide the image, switch the src, position, and reshow
popover.style.display = 'none';
gfypop.style.display = 'none';
lastimg = evt.target.href;
lastpart = lastimg.split('/').pop();
if(lastpart.indexOf('.') == -1) {
gfyelm = document.createElement('img');
gfyelm.setAttribute('data-id',lastpart);
while (gfypop.hasChildNodes()) {
gfypop.removeChild(gfypop.lastChild);
}
gfypop.appendChild(gfyelm);
var gfy = new gfyObject(gfyelm);
gfy.init();
curelm = gfypop;
} else {
popover.src = lastimg;
popover.className = "";
popover.removeAttribute('data-id');
curelm = popover;
}
curpos = evt.target.actualPos();
curelm.style.top = curpos.top;
curelm.style.left = curpos.left + evt.target.clientWidth;
curelm.style.display = 'block';
}
}
);
Element.prototype.actualPos = function() {
var top = this.offsetTop;
var left = this.offsetLeft;
var curp = this;
while(curp = curp.offsetParent) {
top += curp.offsetTop;
left += curp.offsetLeft;
}
return {'top': top, 'left': left}
}
/*
document.getElementById('imagetable').addEventListener(
'mouseout',
function(evt) {
if(evt.target.tagName == 'A' && lastimg != evt.target.href) {
popover.src = '';
popover.style.display = 'none';
}
}
);
*/
</script>
<script>
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'http://assets.gfycat.com/js/gfyajax-0.517d.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-327426-12', 'cincodenada.com');
ga('send', 'pageview');
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://analytics.cincodenada.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 2]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="http://analytics.cincodenada.com/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>