-
Notifications
You must be signed in to change notification settings - Fork 1
/
chatbot.html
executable file
·111 lines (104 loc) · 4.9 KB
/
chatbot.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>convForm - example</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="dist/jquery.convform.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="demo.css">
</head>
<body>
<section id="demo">
<div class="vertical-align">
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-offset-3 col-xs-offset-0">
<div class="card no-border">
<div id="chat" class="conv-form-wrapper">
<form action="data.php" method="POST" class="hidden">
<select data-conv-question="Hello! I'm a DASM Can I Know your NAME?" name="first-question">
<option value="yes">Yes</option>
<option value="sure">Sure!</option>
</select>
<input type="text" name="name1" data-conv-question="Alright! Please, tell me your name first." >
<input type="text" name="age" data-conv-question="Hey, {name1}:0! It's a pleasure to meet you. Please Enter Your Age to Proceed" >
<input type="text" name="res1" data-conv-question="Hey, {name1}:0! How are you today?" >
<select name="talk" data-callback="storeState" data-conv-question="Would you like to talk about it?">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<div data-conv-fork="talk">
<div data-conv-case="yes">
<input type="text" name="res_2" data-conv-question="I would love to hear your more about it.(Please Explain the situation in 5-6l ines.)">
</div>
<div data-conv-case="no">
<select name="thought" data-conv-question="Are you Sure it is always better to talk.">
<option value="yes">Yes</option>
<option value="no">No..</option>
</select>
<div data-conv-case="yes">
<input type="text" name="res_3" data-conv-question="I would love to hear your more about it.(Please Explain the situation in 5-6l ines.)">
</div>
<div data-conv-case="no">
<p name="thought" data-conv-question="Okay,Bye {name1}:0!">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<table>
<script type="text/javascript" src="jquery-1.12.3.min.js"></script>
<script type="text/javascript" src="dist/autosize.min.js"></script>
<script type="text/javascript" src="dist/jquery.convform.js"></script>
<script>
function google(stateWrapper, ready) {
window.open("https://google.com");
ready();
}
function bing(stateWrapper, ready) {
window.open("https://bing.com");
ready();
}
var rollbackTo = false;
var originalState = false;
function storeState(stateWrapper, ready) {
rollbackTo = stateWrapper.current;
console.log("storeState called: ",rollbackTo);
ready();
}
function rollback(stateWrapper, ready) {
console.log("rollback called: ", rollbackTo, originalState);
console.log("answers at the time of user input: ", stateWrapper.answers);
if(rollbackTo!=false) {
if(originalState==false) {
originalState = stateWrapper.current.next;
console.log('stored original state');
}
stateWrapper.current.next = rollbackTo;
console.log('changed current.next to rollbackTo');
}
ready();
}
function restore(stateWrapper, ready) {
if(originalState != false) {
stateWrapper.current.next = originalState;
console.log('changed current.next to originalState');
}
ready();
}
</script>
<script>
jQuery(function($){
convForm = $('#chat').convform();
console.log(convForm);
});
</script>
</body>
</html>