-
Notifications
You must be signed in to change notification settings - Fork 6
/
english_to_tamil.html
119 lines (111 loc) · 3.88 KB
/
english_to_tamil.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>English-Tamil Dictionary | ஆங்கிலம் - தமிழ் அகராதி</title>
<style>
.ui-autocomplete {
max-height: 300px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 300px;
}
</style>
<link rel="stylesheet" href="engines/bootstrap-3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="engines/jquery-ui.min.css">
<script src="engines/jquery.min.js"></script>
<script src="engines/jquery-ui.min.js"></script>
<script src="engines/bootstrap-3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">English-Tamil Dictionary</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
</ul>
</div>
</nav>
<!-- Navbar END -->
<div class="container" style="margin-top:70px;">
<div class="row">
<div class="col-md-12">
<div class="col-md-4 col-md-offset-4">
<div class="input-group">
<input type="text" id="search" placeholder="ஆங்கில வார்த்தையை உள்ளிடவும்..." name="search" class="form-control" required>
<span class="input-group-btn">
<button class="btn btn-primary" type="button" id="findbtn">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div><!-- /.input-group -->
</div><!-- /.col-md-4 col-md-offset-4 -->
</div><!-- ./col-md-12 -->
</div><!-- /.row -->
<!-- Result Area -->
<div class="row">
<div class="col-md-12">
<p style="font-size:20px;" id="result"></p>
</div><!-- /.col-md-12 -->
</div><!-- /.row -->
<script>
$(document).ready(function(){
var x = [];
var search_word;
var word_list = new Array();
search_word = $("#search").val();
// Get the JSON file using AJAX
$.ajax({
url: "dictionary.json",
dataType: "json",
async:false,
success: function(data) {
x = data;
$.each(x, function(key, value) {
if ('word_list' in value) {
word_list = value.word_list;
}
});
}
});
// Autocomplete the word when user typing
$("#search").autocomplete({
source:word_list,
minLength: 1,
select: function(event, ui) {
$("input#search").val(ui.item.value);
$("#findbtn").click();
}
});
// Trigger the word searching using button click
$('#findbtn').click(function() {
search_word = $("#search").val();
var start = new Date().getTime();
$.each(x, function(key, value) {
if (value['eng'] == search_word) {
$("#result").text(value['eng'] + '-' +value['tamil']);
console.log(key);
return false;
}
else {
$("#result").text('Not found');
}
});
console.log('Execution Time is:'+(new Date().getTime() - start)/1000.0 + ' seconds');
});
// Trigger end
});
</script>
</div><!-- /.container -->
</body>
</html>