-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
179 lines (161 loc) · 6 KB
/
index.html
File metadata and controls
179 lines (161 loc) · 6 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Reading List</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var classcode = Widget.preferences.getItem('idnumber');
function getAjaxUrl(type){
if(typeof type == 'undefined') {
type ='readinglist'
};
var url = 'http://classes.myplace.strath.ac.uk/blocks/liblinks/ajax.php?classcode=' + classcode + '&type=' + type ;
if(Widget && typeof Widget.proxify === 'function'){
url = Widget.proxify(url);
};
return url;
}
$(document).ready(function(){
if (typeof classcode != 'undefined') {
$('#searchform').hide();
} else {
$('#links').hide();
}
$('#searchform').submit(function(e) {
e.preventDefault();
classcode = $('#classcode').val();
$('#links').show();
});
$('#block_liblinks_reading_list_link').click(function(){
if($('#block_liblinks_reading_list_content').length == 0) {
$.getJSON(getAjaxUrl('readinglist'), block_liblinks_fn.getReadingList);
$('#block_liblinks_reading_list').append('<div id="loading-image-container"><img class="loading-image" style="display: none;" src="images/ajax-loader.gif" /></div>')
.find('.loading-image').delay(500).fadeIn();
}
$('#block_liblinks_reading_list').toggle();
return false;
});
$('#block_liblinks_exam_papers_link').click(function(){
if($('#block_liblinks_exam_papers_content').length == 0) {
$.getJSON(getAjaxUrl('exampapers'), block_liblinks_fn.getExamPapers);
$('#block_liblinks_exam_papers').append('<div id="loading-image-container"><img class="loading-image" style="display: none;" src="images/ajax-loader.gif" /></div>')
.find('.loading-image').delay(500).fadeIn();
}
$('#block_liblinks_exam_papers').toggle();
return false;
});
$('#block_liblinks_scans_link').click(function(){
if($('#block_liblinks_scans_content').length == 0) {
$.getJSON(getAjaxUrl('scans'), block_liblinks_fn.getScans);
$('#block_liblinks_scans').append('<div id="loading-image-container"><img class="loading-image" style="display: none;" src="images/ajax-loader.gif" /></div>')
.find('.loading-image').delay(500).fadeIn();
}
$('#block_liblinks_scans').toggle();
return false;
});
});
block_liblinks_fn = {
"getReadingList": function(data) {
var html = '<ul>';
if(data.errors){
html += '<li><a href="#" target="_blank">See library catalogue</a></li>';
} else if(data.readingList.length == 0) {
html += '<li><i>No books found</i></li>';
}
for(var i=0; i<data.readingList.length; i++) {
var item = data.readingList[i];
if(item.link) {
html += "<li><a href=\"" + item.link + "\" target=\"_blank\">" + item.title + "</a></li>";
} else {
html += "<li>" + item.title + "</li>";
}
}
html += '</ul>';
$('#block_liblinks_reading_list').append("<div id='block_liblinks_reading_list_content'>" +
html + "</div>");
$('#block_liblinks_reading_list #loading-image-container').remove();
},
"getExamPapers": function(data) {
var html = '<ul>';
if(data.examPapers.length == 0) {
html += '<li><i>No exam papers found</i></li>';
}
for(var i=0; i<data.examPapers.length; i++) {
var item = data.examPapers[i];
if(item.link) {
html += "<li><a href=\"" + item.link + "\" target=\"_blank\">" + item.title + "</a></li>";
} else {
html += "<li>" + item.title + "</li>";
}
}
html += '</ul>';
$('#block_liblinks_exam_papers').append("<div id='block_liblinks_exam_papers_content'>" +
html + "</div>");
$('#block_liblinks_exam_papers #loading-image-container').remove();
},
"getScans": function(data) {
var html = '<ul>';
if(data.scans.length == 0) {
html += '<li><i>No scanned items found</i></li>';
}
for(var i=0; i<data.scans.length; i++) {
var item = data.scans[i];
if(item.link) {
html += "<li><a href=\"" + item.link + "\" target=\"_blank\">" + item.title + "</a></li>";
} else {
html += "<li>" + item.title + "</li>";
}
}
html += '</ul>';
$('#block_liblinks_scans').append("<div id='block_liblinks_scans_content'>" +
html + "</div>");
$('#block_liblinks_scans #loading-image-container').remove();
}
};
</script>
<style type="text/css">
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h1 {
font-weight: normal;
font-size: 1.3em;
}
#block_liblinks_reading_list { display: none }
#block_liblinks_exam_papers { display: none }
#block_liblinks_scans { display:none }
#block_liblinks_reading_list ul,
#block_liblinks_exam_papers ul,
#block_liblinks_scans ul {
padding-left: 15px;
margin-left: 0;
}
#block_liblinks_reading_list li,
#block_liblinks_exam_papers li,
#block_liblinks_scans li {
list-style-image: url('images/bullet.gif');
padding-left: 0px;
margin-left: 0;
margin-bottom: 0.5em;
}
</style>
</head>
<body>
<!--<h1>Reading Lists</h1>
--><div id="searchform">
<form>
<label for="classcode">Class Code</label>
<input id="classcode" type="text" name="classcode" size="5" />
</form>
</div>
<div id="links">
<p><a id="block_liblinks_reading_list_link" href="#">Reading List</a></p>
<div id="block_liblinks_reading_list" ></div>
<p><a id="block_liblinks_exam_papers_link" href="#">Exam Papers</a></p>
<div id="block_liblinks_exam_papers" ></div>
<p><a id="block_liblinks_scans_link" href="#">Scanned Items</a></p>
<div id="block_liblinks_scans"></div>
</div>
</body>
</html>