-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
122 lines (105 loc) · 2.47 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<html>
<head>
<title>Sol COllector</title>
<style>
*{
margin:0;
padding:0;
}
body {
text-align:center;
}
#suggestions ul {
list-style :none;
}
#wrapper {
width:960px;
margin:auto;
text-align:left;
}
#suggestions ul li {
display:block;
background-color:#434343;
float:left;
padding:7px;
margin-right:10px;
margin-bottom:10px;
color:#fff;
border-radius:7px;
cursor:pointer;
}
#suggestions ul li.selected {
background-color:#999;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-table; }
/* Hides from IE-mac \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* End hide from IE-mac */
form {
margin-bottom:10px;
text-align:center;
margin-top:10px;
}
</style>
<script src="js/jquery-1.7.min.js"></script>
<script src="js/suggest.js"></script>
<script>
$(document).ready(function() {
$("#btn_get_words").click(function(){
$("#suggestions").empty();
var suggestedWords = solCollector.getWords($("#rootWord").val());
$("#suggestions").html(convertToList(suggestedWords));
$("#suggestions").append("<input type='button' id='save' value='save' style='clear:both'/>");
$("#suggestions li").click(onWordClicked);
$("#save").click(function(){
var suffixRules = "";
$("li.selected").each(function() {
suffixRules += $(this).attr('id');
});
alert($('#rootWord').val()+"/"+suffixRules);
});
});
});
function onWordClicked(evt) {
var thisObj = $(this);
if(thisObj.hasClass('selected')){
thisObj.removeClass('selected');
}else {
thisObj.addClass('selected');
}
}
function convertToList(wordsArray) {
if(wordsArray && wordsArray.length>0) {
var opt = "<ul class='clearfix'>";
for(var i=0;i<wordsArray.length;i++){
opt+="<li id='"+wordsArray[i].rule+"'>"+wordsArray[i].word+"</li>";
}
opt+="</ul>";
return opt;
}
}
</script>
</head>
<body>
<div id="wrapper">
<form action="">
<input type="text" id="rootWord"/>
<input type="button" id="btn_get_words" value="Suggest"/>
</form>
<div style="margin:10px 0;">
Please select the correct words by clicking it
</div>
<div id="suggestions" class="clearfix">
</div>
</div>
</body>
</html>