forked from scriptythekid/lazystudent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_template.mako
128 lines (96 loc) · 2.54 KB
/
index_template.mako
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
## -*- coding: utf-8 -*-
<html>
<head>
<title>lazystudent - study and fail</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../css/lazystudent.css" type="text/css" />
<style type='text/css'>
span {
color:#FFFFFF;
}
</style>
<!--
<style type='text/css'>
th, td {
padding: 3px !important;
}
/* Sortable tables */
table.sortable thead {
background-color:#333;
color:#666666;
font-weight: bold;
cursor: default;
}
th {
font-size: 100%;
}
</style>
-->
<script src="../../js/sorttable.js"></script>
</head>
<body>
<script type="text/javascript">
function highlight(container,what,spanClass) {
var content = container.innerHTML,
pattern = new RegExp('(>[^<.]*)(' + what + ')([^<.]*)','g'),
replaceWith = '$1<span ' + ( spanClass ? 'class="' + spanClass + '"' : '' ) + '">$2</span>$3',
highlighted = content.replace(pattern,replaceWith);
return (container.innerHTML = highlighted) !== content;
}
function filter2(phrase, _id){
var words = phrase.value.toLowerCase().split(" ");
var table = document.getElementById(_id);
var ele;
for (var r = 1; r < table.rows.length; r++){
ele = table.rows[r].innerHTML.replace(/<[^>]+>/g,"");
var displayStyle = 'none';
for (var i = 0; i < words.length; i++) {
if (ele.toLowerCase().indexOf(words[i])>=0) {
displayStyle = '';
//highlight(ele,words[i],'myspan');
} else {
displayStyle = 'none';
break;
}
}
table.rows[r].style.display = displayStyle;
}
}
/*
var $rows = $('#table tr');
$('#filt').keyup(function() {
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
$rows.show().filter(function() {
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
return !~text.indexOf(val);
}).hide();
});
*/
</script>
<input id='filt' name='filt' onkeyup="filter2(this, 'table')" value="Search..."></br>
<logos><img src="../../css/lazystudent.png" width="1039" height="229" alt="lazy"></logos>
<table id='table' class='sortable CSSTableGenerator'>
<caption>lazystudent</caption>
% for row in data:
% if loop.index is 0:
${makehead(row)}
%endif
${makerow(row)}
% endfor
</table>
<%def name="makehead(row)">
<tr>
% for name,val in row.items():
<th>${name}</th>
% endfor
</tr>
</%def>
<%def name="makerow(row)">
<tr>
% for name,val in row.items():
<td class='${name}'> ${val}</td>
% endfor
</tr>
</%def>
</body>
</html>