-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
134 lines (120 loc) · 4.04 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<div id="whole">
<head id="head">
<!--<link rel="stylesheet" type="text/css" href="css/widgets.css">-->
<!--<link rel="stylesheet" type="text/css" href="css/general.css">-->
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/simplegrid.css">
<meta name="author" content="Matt Kubilus" />
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Empty Orchestra</title>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/json2.js"></script>
<script type="text/javascript" src="/js/ajax_stuff.js"></script>
<script type="text/javascript">
InstallFunction(server, 'do_local_query');
InstallFunction(server, 'do_web_query');
InstallFunction(server, 'do_save_song');
$(document).ready(function() {
var inurl = document.URL;
var m = inurl.match(/\bindex.html\?(.*?)='(.*?)'/);
//alert(m[0]);
if(m[1] == 'say_stuff'){
say_stuff(m[2]);
}
});
function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1)
{
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1)
{
c_value = null;
}
else
{
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1)
{
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function checkCookie()
{
var username=getCookie("username");
if (username!=null && username!="")
{
//alert("Welcome again " + username);
//document.getElementById('user_data').innerHTML = "Hello ";
document.getElementById('user_data').innerHTML = "Hello " + username + "! Please choose a song.";
}
else
{
username=prompt("Please enter your username:","");
if (username!=null && username!="")
{
setCookie("username",username,365);
}
}
}
function say_stuff(stuff){
alert(stuff);
}
function onLoad(data) {
checkCookie();
//alert($(data));
// alert("Load");
}
function query() {
var search_term = document.getElementById('search_query').value;
//alert("From was submitted:" + search_term);
server.do_local_query(search_term, onLocalReturn);
server.do_web_query(search_term, onWebReturn);
}
function save_song(artist, title, path, archive) {
//alert(artist+title+path);
var username=getCookie("username");
server.do_save_song(username, artist, title, path, archive);
document.getElementById('user_data').innerHTML = username + ", you chose to do " + unescape(artist) + " " + unescape(title) + " next!"}
function onLocalReturn(response) {
document.getElementById('data_loc').innerHTML = response;
}
function onWebReturn(response) {
document.getElementById('data_web').innerHTML = response;
}
</script>
<meta name="viewport" content="width=device-width" />
</head>
<body onload="onLoad()">
<div class="header">
<div id="user_data"> </div>
<form action="javascript:query()">
<input type=text name=query id=search_query>
<input type=submit>
</form>
</div>
Local Results:
<div class="data" id="data_loc"> </div>
Web Results:
<div class="data" id="data_web"> </div>
</body>
</div>
</html>