-
Notifications
You must be signed in to change notification settings - Fork 0
/
agenda.js
131 lines (110 loc) · 2.8 KB
/
agenda.js
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
var httpObject = null;
var httpObject2 = null;
var link = "";
var timerID = 0;
// Get the HTTP Object
function getHTTPObject()
{
if( window.ActiveXObject )
return new ActiveXObject("Microsoft.XMLHTTP");
else if( window.XMLHttpRequest )
return new XMLHttpRequest();
else
{
alert("Your browser does not support AJAX.");
return null;
}
}
function getAgendaName( item )
{
var agendaitem = eval( '(' + item + ')' );
if( ( agendaitem == "Error" ) || ( agendaitem == "No Results" ) )
return ' ';
else
return agendaitem[0].name;
}
function recvAgendaItem()
{
if( httpObject.readyState == 4 )
{
var response = httpObject.responseText;
var objDiv = document.getElementById("CurrentAgendaItem");
objDiv.innerHTML = getAgendaName( response );
}
}
function getAgendaItem( offset )
{
httpObject = getHTTPObject();
if( httpObject != null )
{
if( isNaN( offset ) )
offset = 0;
var link = dataURL + '?mediaid=' + mediaid + "&cmd=fnd&offset=" + offset;
httpObject.open("POST", link , true);
httpObject.onreadystatechange = recvAgendaItem;
httpObject.send(null);
}
}
function getAgendaList( list )
{
var agenda = eval( '(' + list + ')' );
var index;
var count = agenda.length;
if( ( agenda == "Error" ) || ( agenda == "No Results" ) )
return ' ';
var agendalist_html = agenda_list_head;
for( index = 0; index < count; index++ )
{
var item = agenda[index];
var onclickfunc = "gotoIndex(" + item.offset + ", '" + escape( item.name ) + "');";
var item_html = agenda_list_item + "\n";
item_html = item_html.replace( '%%id%%', item.id );
item_html = item_html.replace( '%%agenda_index%%', 'agenda_index_' + index );
item_html = item_html.replace( '%%click%%', onclickfunc );
item_html = item_html.replace( '%%name%%', item.name );
agendalist_html += item_html;
}
agendalist_html += agenda_list_tail;
return agendalist_html;
}
function recvAllAgendaItem()
{
if( httpObject2.readyState == 4 )
{
var response = httpObject2.responseText;
var objDiv = document.getElementById("AgendaItemList");
objDiv.innerHTML = getAgendaList( response );
}
}
function getAllAgenda()
{
httpObject2 = getHTTPObject();
if( httpObject2 != null )
{
var link = dataURL + '?mediaid=' + mediaid + "&cmd=lst";
httpObject2.open("POST", link , true);
httpObject2.onreadystatechange = recvAllAgendaItem;
httpObject2.send(null);
}
}
function doReload()
{
if( jwplayer != null )
{
var position = Math.floor( jwplayer().getPosition() );
getAgendaItem( position );
}
}
function UpdateTimer()
{
doReload();
timerID = setTimeout("UpdateTimer()", 1000);
}
function gotoIndex( offset, name )
{
if( jwplayer != null )
{
jwplayer().seek( offset );
getAgendaItem( offset );
}
}