-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (104 loc) · 4.18 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>EBK Scraper</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<link href="/public/css/todc-bootstrap.min.css" rel="stylesheet">
<style type="text/css">
.centered {
position: fixed;
top: 30%;
left: 50%;
}
</style>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">EBK Scraper</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Offers</a></li>
<li><a href="/pref.html">Settings</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>
<div class="container">
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h2>Please read before usage:</h2>
<p>Keep in mind that this server runs as a free service which has quota limits. When these limits are reached, the service will not work anymore.</p>
<p>This service is not public, but at least three people use it. <b>Please load this page not more often than necessary!</b></p>
</div>
<div id="content-placeholder">
<img class="centered" src="/public/images/spinner.gif">
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.4/handlebars.runtime.min.js"></script>
<script src="/public/js/datatables.js"></script>
<script src="/public/js/table.template.js"></script>
<script>
Handlebars.registerHelper('unixtime', function (unixtime) {
var date = new Date(unixtime * 1000);
return date.toISOString();
});
Handlebars.registerHelper('replace', function (string) {
return string.replace(/\n/g, "<br>").replace(/\\n/g, "<br>");
});
var state = 0;
function reload(scope) {
state = scope;
$.ajax({
url: "/listSaved",
data: {
"scope": scope
}
}).done(function (data) {
// console.log(data);
var template_data = {
offers: data,
offset: 0
};
template = Handlebars.templates['table.template']; // your template minus the .js
html = template(template_data);
$("#content-placeholder").html(html);
$('.datatable').dataTable({
"sPaginationType": "bs_full"
});
$('.datatable').each(function () {
var datatable = $(this);
var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
search_input.attr('placeholder', 'Search');
search_input.addClass('form-control input-sm');
var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
length_sel.addClass('form-control input-sm');
});
});
}
reload(1);
function action(url, ID, valid) {
console.log(ID);
$.ajax({
"url": "/" + url,
data: {
"ID": ID,
"valid": valid
}
}).done(function (data) {
reload(state)
});
}
</script>
</body>
</html>