-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
45 lines (42 loc) · 1.62 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="nodeconf, node.js, nodejs, node, javascript, conference" />
<meta name="description" content="NodeConf. A conference for node.js" />
<title>Remote Finder</title>
<link href="layout.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script language="javascript" type="text/javascript" src="site.js"></script>
</head>
<body>
<h3>Search</h3>
<input type="text" id="search"></input>
<script>
var current = '';
var prev;
$("input#search").keyup(function () {
if (prev) prev.abort();
var search = $(this).val();
if (search === current) return;
if (search === '') return;
current = search;
prev = request({url:'/', type:'POST', data:{search:search}}, function (e, results) {
if (current !== search) return;
$('div#results').html('');
results.forEach(function (r) {
$('div#results').append('<div>'+r+'<span class="openfile">open</span></div>');
})
$('span.openfile').click(function () {
var filename = $(this).parent().text();
filename = filename.slice(0, filename.length - 4);
request({url:'/open', type:'POST', data:{filename:filename}}, function (e, resp) {
if (e) console.log(e);
})
})
})
})
</script>
<div id="results"></div>
</body>
</html>