-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
137 lines (117 loc) · 3.82 KB
/
index.php
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html lang="en">
<?php
$PAGETITLE='mayumi';
include 'client/template/head.php';
?>
<body><?php include 'client/template/menu.php'; ?>
<div class="container">
<div class="row visible-lg">
<div class="col-lg-12" style="height:100px">
</div>
</div>
<div class="row">
<div class="col-lg-8 col-lg-offset-2"><h2>
<div id="inputText" contenteditable="true" class="panel panel-default panel-body">
<b>The car drove to the mall.</b>
</div>
<!-- <b>Hello!</b><br>
This is grammar processing.<br><br>
Try me!
</div>
-->
</h2></div>
</div>
<!-- ------------------------------ MAIN BOT ----------------------------------------- -->
<div class="row">
<div class="col-lg-2">
<div class="visible-lg person" style="right:0">
<img src="client/img/pinkgirl.png" width="90px">
</div>
</div>
<div class="col-lg-8">
<div id="outputText" class="panel panel-default panel-body">
</div>
<div class="speechBubble visible-lg"></div>
</div>
</div>
<!-- ------------------------------ DIVIDER ----------------------------------------- -->
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<hr></hr>
</div>
</div>
<!-- ------------------------------ BOT 1 ----------------------------------------- -->
<div class="row">
<div class="col-sm-12 hidden-lg">bot 1</div>
<div class="col-lg-8 col-lg-offset-2">
<div id="bot1Output" class="panel panel-default panel-body">
Thinking...
</div>
<div class="rightSpeechBubble visible-lg"></div>
</div>
<div class="col-lg-2">
<div class="visible-lg person" style="left:0">
<img src="client/img/coolguy.png" width="100px">
</div>
</div>
</div>
<div class="row visible-lg" style="margin-bottom:20px"></div>
<!-- ------------------------------ BOT 2 ----------------------------------------- -->
<div class="row">
<div class="col-sm-12 hidden-lg">bot 2</div>
<div class="col-lg-2">
<div class="visible-lg person" style="right:50px">
<img src="client/img/ponytail.png" width="110px">
</div>
</div>
<div class="col-lg-8">
<div id="bot2Output" class="panel panel-default panel-body">
Thinking...
</div>
<div class="speechBubble visible-lg"></div>
</div>
</div>
<div class="row visible-lg" style="margin-bottom:20px"></div>
<!-- ------------------------------ BOT 3 ----------------------------------------- -->
<div class="row">
<div class="col-sm-12 hidden-lg">bot 3</div>
<div class="col-lg-2 col-lg-offset-10">
<div class="visible-lg person" style="left:-30px">
<img src="client/img/girl.png" width="80px">
</div>
</div>
<div class="col-lg-8 col-lg-offset-2">
<div id="bot3Output" class="panel panel-default panel-body">
Thinking...
</div>
<div class="rightSpeechBubble visible-lg"></div>
</div>
</div>
<div class="row visible-lg" style="margin-bottom:20px"></div>
</div>
<?php include 'client/template/javascriptSource.php'; ?>
<script>
$('document').ready(function(e){
$('#inputText').get(0).focus();
textUpdate();
startFunBackground();
$('#inputText').on('keyup', textUpdate);
});
var lastChanged=0;
function textUpdate(){
//start timer. only submit after the user stops making changes.
lastChanged=(new Date()).getTime();
setTimeout(function(){
if(lastChanged+800 < (new Date()).getTime()){
//do the change. prevent future timeouts from doing this one.
lastChanged=(new Date()).getTime();
$('#outputText').html($('#inputText').html());
heuristicEngine($('#inputText').html(), '#bot1Output');
dictionaryEngine($('#inputText').html(), '#bot3Output');
}
}, 1000);
}
</script>
</body>
</html