This repository has been archived by the owner on Nov 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
status.html
130 lines (120 loc) · 6 KB
/
status.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
<!DOCTYPE HTML>
<!--
COPYRIGHT (c) Xidian Open Source Community < xdl@xdlinux.info >
Author:
- Shanzi <ant_sz@xdlinux.info>
- Justin Wong <bigeagle@xdlinux.info>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
-->
<html>
<head>
<title>Mirror Status | xdlinux</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="frame">
<div id="filter">
<a href="#" class="checked" id="success">Success</a>
<a href="#" class="checked" id="syncing" >Syncing</a>
<a href="#" class="checked" id="failed">Failed</a>
<select id="sort">
<option value="original-order">Original Order</option>
<option value="name">Name</option>
<option value="time">Last Sync</option>
<option value="random">Random</option>
</select>
</div>
<div id="pannel">
<div id="container">
</div>
</div>
</div>
<script type="text/javascript" charset="utf-8" src="js/jquery.min.js">
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.isotope.min.js">
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
var container=$('#container');
function onDataReceived(ss){
$.each(ss,function(i,t){
var category='Failed';
if( t.status == "0")
{
category="Success";
}
else if ( t.status == "-1" ){
category="Syncing";
}
var ymd=t.lastsync.match(/(\d{4})-(\d{2})-(\d{2})/)
var hms=t.lastsync.match(/(\d{2}):(\d{2}):(\d{2})/)
try{
var d=new Date();
d.setFullYear(parseInt(ymd[1],10))
d.setMonth(parseInt(ymd[2],10))
d.setDate(parseInt(ymd[3],10))
d.setHours(parseInt(hms[1],10))
d.setMinutes(parseInt(hms[2],10))
d.setSeconds(parseInt(hms[3],10))
var ti=d.getTime();
}catch(e)
{
var ti=0;
}
var node=$('<div></div>');
node.addClass(category).addClass('element')
.attr('data-category',category)
.attr('data-name',i.toUpperCase())
.attr('data-time',ti)
.append($('<h2></h2>').text(i))
.append($('<h1></h1>').text(i))
.append(
$('<p></p>').append('<strong>Last Sync:</strong><br/>')
.append(t.lastsync)
)
.append($('<a></a>').text(category).attr('href',t.log));
container.append(node);
});
container.children().eq(0).addClass('large-size')
container.children().eq(1).addClass('large-height')
container.children().eq(3).addClass('large-height')
container.children().eq(6).addClass('large-height')
container.children().eq(13).addClass('large-height')
container.isotope({
'filter':'*',
'itemSelector':'.element',
'masonry':{'columnWidth':180},
'masonryHorizontal':{'rowHeight':180},
'getSortData':{
'name': function(ele){return ele.attr('data-name')},
'time': function(ele){return ele.attr('data-time')}
}
});
}
$('#sort').bind('change',function(){
container.isotope(
{'sortBy':$('#sort').val()}
)
});
$('#syncing,#success,#failed').click(
function(){
$(this).toggleClass('checked');
var filters=new Array();
if($('#syncing').hasClass('checked')) filters.push('.Syncing')
if($('#success').hasClass('checked')) filters.push('.Success')
if($('#failed').hasClass('checked')) filters.push('.Failed')
if(filters.length==0) $('#syncing,#success,#failed').addClass('checked');
container.isotope({'filter':filters.join(',')})
}
)
$.ajax({ url: "/m_status.json",
method: 'GET',
dataType: 'json',
success: onDataReceived
});
});
</script>
</body>
</html>