forked from BrightcoveOS/App-Cloud-Emulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
157 lines (117 loc) · 4.66 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html>
<head>
<title>AppCloud Emulator</title>
<link rel="stylesheet" href="emu.css" />
<link type="text/css" href="smoothness/jquery-ui-1.8.14.custom.css" rel="stylesheet" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>
<script type="text/javascript">
function frameChanged() {
var contentWindow = bc = $("#phone iframe").get(0).contentWindow;
bc = contentWindow.bc;
$$ = contentWindow.$; // save off the other jquery so we can use it
}
function changeView(uri) {
var frame = document.getElementsByTagName("iframe")[0];
if (uri) {
frame.setAttribute("src", "../" + uri);
}
else {
frame.contentDocument.location.reload(true);
}
}
$(function() {
var triggerSwipe, updateDisplay;
$.get("../manifest.json", function(data) {
var ul = $("#views ul");
ul.html("");
var views = data.views;
for (var i in views) {
var uri = views[i].uri;
var label = views[i].navigationTitle;
var icon = views[i].navigationIcon;
ul.append('<li><a href="#" onclick="changeView(\'' + uri + '\'); return false;">' + (icon ? '<img src="../'+icon+'" title="'+label+'" />' : '<span>'+label+'</span>') + '</a></li>');
}
$("#views").show();
changeView(views[0].uri);
});
$(".button").button();
$(".radioset").buttonset();
$("#selectView").button({ icons: {secondary:"ui-icon-triangle-1-s"} });
// event handlers
$("#phone .actions .back").click(function() {
bc.ui.backPage();
});
// triggers display updates (such as orientation after display changes)
updateDisplay = function() {
// if you don't change the orientation you have to trigger the event yourself
// we'll force the orientation to be changed
if (typeof bc != "undefined") bc.context.viewOrientation = null;
$( $("#phone iframe").get(0).contentWindow ).trigger("resize");
};
$("#orientation input").change(function() {
var portrait = $("#portrait").get(0).checked;
$("#phone").removeClass(portrait ? "landscape" : "portrait")
.addClass(portrait ? "portrait" : "landscape");
updateDisplay();
});
$("#device input").change(function() {
var iphone = $("#iphone").get(0).checked;
$("#phone").removeClass(iphone ? "android" : "iphone")
.addClass(iphone ? "iphone" : "android");
updateDisplay();
changeView();
});
// defaults
$("#portrait").get(0).checked = true;
$("#portrait").trigger("change");
$("#iphone").get(0).checked = true;
$("#iphone").trigger("change");
triggerSwipe = function(direction) {
var current = bc.ui.currentPage;
if (!current) return;
$$(current).trigger("swipe", direction);
};
$("#swipeLeft").click(function() { triggerSwipe("swipeLeft"); });
$("#swipeRight").click(function() { triggerSwipe("swipeRight"); });
});
</script>
</head>
<body>
<div id="content">
<div id="controls">
<div id="orientation" class="radioset">
<input type="radio" id="portrait" name="orientation" /><label for="portrait"><img src="images/iphone-portait.png" /></label>
<input type="radio" id="landscape" name="orientation" /><label for="landscape"><img src="images/iphone-portait.png" class="rotate-90-left" /></label>
</div>
<div id="device" class="radioset">
<input type="radio" id="iphone" name="device" /><label for="iphone"><img src="images/iphone-icon.png" /></label>
<input type="radio" id="android" name="device" /><label for="android"><img src="images/android-icon.png" /></label>
</div>
<div id="miniControls">
<div id="views" style="display: none;">
<button id="selectView">Views</button>
<ul>
</ul>
</div>
<div id="swipes">
<button id="swipeLeft" class="button ui-icon ui-icon-arrowreturnthick-1-w" title="Swipe Left" />
<button id="swipeRight" class="button ui-icon ui-icon-arrowreturnthick-1-e" title="Swipe Right" />
</div>
</div>
</div>
<div id="phoneWrapper">
<div id="phone">
<iframe src="" frameborder="0" onload="frameChanged();"></iframe>
<div class="actions">
<a class="back" onclick="return false;" href="#"><span></span></a>
</div>
</div>
</div>
<div id="attribution">
© 2011 Created by <a href="http://cantina.co" target="_blank"><span>Cantina Consulting</span> <img src="images/cantina-logo.png" /></a>
</div>
</div>
</body>
</html>