-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
117 lines (111 loc) · 4.44 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!------------------------------------------------------------------------
File: JScript.js
Description: JAVIER Browser HTML version
Author: Edgar Medrano Pérez
edgarmedrano at gmail dot com
Created: 2007.03.26
Company: JAVIER project
http://javier.sourceforge.net
Notes:
------------------------------------------------------------------------>
<html>
<head>
<title>JAVIER: JAvascript Voicexml InterpretER</title>
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width">
<link rel="icon" href="/img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
</head>
<body onload="loadVoices()">
<script language="Javascript" src="lib/handlers.js"></script>
<script language="Javascript" src="lib/javier.js"></script>
<script language="Javascript"><!--
var interpreter = new VXMLInterpreter
(new JSInHandler()
,new JSOutHandler()
,new NetHandler()
,new LogHandler()
,new ErrHandler()
);
function jsSource() {
var viewSource = window.open("",'_blank').document;
var lines = "<script>\nfunction document() {\n"
+ interpreter.js.replace(/<\/script/g,"< / script")
+ "\n}\n</script>";
viewSource.writeln(lines);
lines = lines.replace(/</g,"<").replace(/>/g,">").split("\n");
for(var i = 0; i < lines.length; i++) {
lines[i] = (i + 1) + "\t" + lines[i];
}
viewSource.writeln("<pre>")
viewSource.writeln(lines.join("\n"));
viewSource.writeln("</pre>")
viewSource.close();
}
function xmlSource() {
var viewSource = window.open("",'_blank').document;
viewSource.writeln("<pre>")
viewSource.writeln(interpreter.text.replace(/</g,"<").replace(/>/g,">"));
viewSource.writeln("</pre>")
viewSource.close();
}
function loadVoices() {
if(TTSHandler) {
if(document.getElementById) {
var TTSVoices = TTSHandler.GetVoices();
var htmlCode = "<br>Voice: <select onchange='setVoice(this.options[this.selectedIndex].text)'>";
for(var i=0; i < TTSVoices.Count; i++) {
htmlCode += "<option>" + TTSVoices.Item(i).GetDescription() + "</option>";
}
htmlCode += "</select>";
document.getElementById("combo").innerHTML = htmlCode;
}
} else {
if ("ActiveXObject" in window) {
alert("To enable Text to Speech, add the page address to a secure zone " +
"in the 'Security' tab of 'Internet options' dialog " +
"and set 'Initialize and script ActiveX controls not marked as safe'" +
" to 'Prompt'");
}
}
}
if ("speechSynthesis" in window) {
window.speechSynthesis.onvoiceschanged = function (e) {
loadVoices();
};
}
//--></script>
<SCRIPT FOR="window" EVENT="OnQuit()" LANGUAGE="JavaScript">
// Clean up voice object
delete TTSHandler;
</SCRIPT>
<form onsubmit="return false;">
Address: <input name="txtURL" value="default.xml" size="70">
<input value="Go" type="submit" onclick="interpreter.run(this.form.txtURL.value);"><br>
<input value="Home" type="submit" onclick="this.form.txtURL.value = this.form.txtURL.defaultValue; interpreter.run(this.form.txtURL.value);">
Bookmarks:
<select onchange="this.form.txtURL.value = this.options[this.selectedIndex].value; interpreter.run(this.form.txtURL.value);">
<option value=""></option>
<option value="samples/hw.xml">Hello World!</option>
<option value="samples/hw2.xml">Hello World! 2</option>
<option value="samples/hw3.xml">Hello World! 3</option>
<option value="samples/hw4.xml">Hello World! 4</option>
<option value="samples/hw5.xml">Hello World! 5</option>
<option value="samples/credit.xml">Credit card</option>
</select>
<input value="VXML" type="submit" onclick="xmlSource(this.form)">
<input value="JS" type="submit" onclick="jsSource(this.form)">
<input value="autoEval" type="checkbox" onclick="interpreter.autoEval = this.checked;" checked="true"> Auto-run
<div id="combo"></div>
</form>
<br>
<form name="frmOut" onsubmit="return false;">
<textarea cols="80" rows="10" name="txtOut" onfocus="this.select()" style="font-family: Courier New"></textarea><br>
</form>
<form name="frmLog" onsubmit="return false;">
<textarea cols="80" rows="10" wrap="off" name="txtLog" onfocus="this.select()" style="font-family: Courier New"></textarea><br>
<input value="Clear" type="submit" onclick="this.form.txtLog.value='';">
</form>
</body>
</html>