-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
executable file
·82 lines (72 loc) · 2.27 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<title>Testing Natural Language Searches</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="phraseForm.js"></script>
<style>
body {
font-family: garamond;
font-size: 1.5em;
background-color: #1D1810;
color: #716D4D;
}
form {
display : block;
margin : 100px auto;
padding : 30px;
width : 950px;
height : 400px;
background-color: #252117;
border : 3px double #716D4D;
}
form input {
border: 0;
background-color: #2C281C;
color: #716D4D;
text-align: center;
font-family: garamond;
font-weight: bold;
font-size: 1.5em;
width: 200px;
}
a {
display: block;
position: absolute;
right: 50px;
top: 50px;
background-color: #4B7996;
color: #143C55;
text-decoration: none;
}
</style>
</head>
<body>
<form id="searchForm" action="#" method="POST">
<input type="text" id="item" name="search[item]" />
<input type="text" id="color" name="search[color]" />
<input type="text" id="size" name="search[size]" />
<input type="text" id="alternative" name="search[alternative]" />
<a href="#" id="queryBuilder">Get the next portion</a>
<br />
</form>
<script type="text/javascript">
var iterators = [];
var currentIterator = 0;
$('#searchForm input').each(function(){
iterators.push($(this).attr('id'));
});
var search = new PhraseForm($('#searchForm'));
search.build.contexts({
'item' : 'I am looking for a %input, can you tell me how to find one?',
'color' : 'I would like for it to be a shade of %input.',
'size' : 'I would also prefer if it were %input.',
'alternative' : 'Of course, if you don\'t know where to find one, I could always just get a %input.'
});
$('#queryBuilder').bind('click.phraseForm', function(){
search.act.add(iterators[currentIterator]);
currentIterator = (currentIterator + 1) % iterators.length;
});
</script>
</body>
</html>