-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
89 lines (71 loc) · 1.79 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
<!--<meta name="apple-mobile-web-app-capable" content="yes">-->
<script src="http://code.jquery.com/jquery.js" type="text/javascript"></script>
<style>
html, body {
height:100%;
color:black;
font-family: arial;
line-height: 1.6;
font-size:30pt;
color:black;
}
a {
text-decoration: none;
}
.content {
padding:20px;
padding-top:120px;
}
.translation {
height:100px;
position:fixed;
width:100%;
bottom:0px;
left:0;
background-color:white;
border-top:2px solid black;
padding: 20px;
text-align: center;
font-size:40pt;
}
.header {
height:40px;
position:fixed;
width:100%;
top:0px;
left:0;
background-color:white;
border-bottom:2px solid black;
padding: 20px;
text-align: center;
font-size:20pt;
}
</style>
<script src="/socket.io/socket.io.js"></script>
<div class="header">
Touch Translator © 2015 Luke Cleland
</div>
<div class="content">
</div>
<div class="translation">
</div>
<script>
var socket = io();
socket.on('book', function(msg) {
$('.content').append($('<a href="#" class="word">').html(msg+' '));
});
$(document).ready(function() {
setTimeout(function(){
$('.word').click(function(){
var word = $(this).text();
$.ajax({
type: "GET",
url: "/api/translate/"+word
}).done(function(result) {
$('.translation').html(word+' = '+result);
});
return false;
});
}, 500);
});
</script>