-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (66 loc) · 2.59 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Tab-based Auto-Completion with JQuery and PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="author" content="Roger Dudler">
<meta http-equiv="content-language" content="en">
<link href="static/css/style.css" media="screen,projection" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<style type="text/css">
body { margin: 0; padding: 30px; }
body, input { font-family: sans-serif; font-size: 12px; }
h1 { margin: 0 0 20px 0; font-size: 24px; }
.info { margin-bottom: 10px; color: #444; font-size: 16px; }
.help { margin-top: 10px; margin-bottom: 40px; color: #444; font-size: 16px; line-height: 150%; }
.help span { font-size: 12px; color: #666; }
a { color: #4d8fc6; }
</style>
</head>
<body>
<h1>Tab-based Auto-Completion with JQuery and PHP</h1>
<div class="info">Usage: Type in "s" and then press TAB</div>
<input id="query" type="text" />
<div class="help">Available commands are <i>select, create, delete, insert, help</i><br /><span>by Roger Dudler \ visit my <a href="http://www.rogerdudler.com">blog</a> or follow me on <a href="http://www.twitter.com/rogerdudler">Twitter</a></span></div>
<!-- Codes -->
<script src="https://gist.github.com/886661.js?file=gistfile1.html"></script>
<script src="https://gist.github.com/886663.js?file=gistfile1.js"></script>
<script src="https://gist.github.com/886666.js?file=gistfile1.php"></script>
<script type="text/javascript">
<!--
function suggest(element) {
var query = element.val();
$.ajax({
url: "api/suggest.php",
dataType: "json",
data: "q=" + query,
success: function(data) {
element.val(data.suggestion);
}
});
}
$(document).ready(function() {
$('#query').focus();
$('#query').live('keydown', function(e){
var keyCode = e.keyCode || e.which;
if (keyCode == 9) {
e.preventDefault();
suggest($('#query'));
}
});
});
//-->
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-652147-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
</body>
</html>