-
Notifications
You must be signed in to change notification settings - Fork 20
/
mobile.html
90 lines (67 loc) · 2.66 KB
/
mobile.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Universal Viewer Examples</title>
<link rel="icon" href="uv/favicon.ico">
<script type="text/javascript" src="https://unpkg.com/jquery@1.11.2/dist/jquery.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@edsilv/utils@0.2.6/dist/Utils.js"></script>
<style>
body {
margin: 0px;
padding: 20px;
}
#options {
padding: 20px 0 0 0;
}
</style>
</head>
<body>
<div id="options">
<select id="manifestSelect"></select>
<input id="manifest" type="text" value="" />
<a id="setManifestButton" class="button" href="#">Set</a>
</div>
<script type="text/javascript">
var manifest;
// load manifests
$.getJSON('manifests.json', function(manifests) {
var $manifestSelect = $('#manifestSelect');
for (var i = 0; i < manifests.collections.length; i++) {
var collection = manifests.collections[i];
if (collection.visible === false) {
continue;
}
$manifestSelect.append('<optgroup label="' + collection.label + '">');
for (var j = 0; j < collection.manifests.length; j++) {
var manifest = collection.manifests[j];
if (manifest.visible !== false) {
$manifestSelect.append('<option value="' + manifest['@id'] + '">' + manifest.label + '</option>');
}
}
$manifestSelect.append('</optgroup>');
}
setSelectedManifest();
});
function setSelectedManifest() {
manifest = Utils.Urls.getHashParameter('manifest');
if (manifest) {
$('#manifestSelect').val(manifest);
} else {
var options = $('#manifestSelect option');
if (options.length) {
manifest = options[0].value;
}
}
$('#manifest').val(manifest);
}
$('#manifestSelect').on('change', function() {
$('#manifest').val($('#manifestSelect option:selected').val());
});
$('#setManifestButton').on('click', function() {
manifest = $('#manifest').val();
document.location.href = 'uv/uv.html#?manifest=' + manifest + '&locales=en-GB';
});
</script>
</body>
</html>