-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobile.php
206 lines (177 loc) · 6.32 KB
/
mobile.php
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php /*
Copyright 2011 Juho Rutila
This file is part of Jamendo HTML5 Player
Jamendo HTML5 Player is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Jamendo HTML5 Player is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Jamendo Html5 Player</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
<style>
#nowplaying #cover
{
width: 100%;
max-width: 600px;
display: block;
margin-left: auto;
margin-right: auto;
}
.play
{
font-size: smaller;
padding: 5px;
padding-left: 7px;
padding-right: 7px;
margin-right: 3px;
}
li span.playtext
{
display: none;
}
li.playing span.playtext
{
display: inline;
margin-left: 20px;
color: gray;
}
.version
{
font-size: 8pt;
float: left;
}
</style>
<script type="text/javascript">
API = "http://api.jamendo.com/get2";
function initApplication()
{
return 'abba';
}
function ajaxError(jqXHR, textStatus, errorThrown) {
alert(textStatus + ": " + errorThrown);
}
</script>
<script type="text/javascript" src="js/jamendo5.mobile.js"></script>
<script type="text/javascript" src="js/jamendo5.player.js"></script>
<script type="text/javascript" src="js/jamendo5.radio.js"></script>
<script type="text/javascript" src="js/jamendo5.browse.js"></script>
</head>
<body>
<div data-role="page" id="main">
<?php
$titles = array( 'radio' => 'Radio', 'album' => 'Album', 'track' => 'Track' );
function mobileheader($active)
{
global $titles;
$title = $titles[$active];
echo <<<EXCERPT
<div data-role='header' data-position='fixed' data-id='hhead'>
<h1 id="title$active">$title</h1>
<div data-role='navbar'>
<ul>
EXCERPT;
print " <li><a href='#radio' ".($active == "radio" ? "class='ui-btn-active'" : "").">Radio</a></li>";
print " <li><a href='#album' ".($active == "album" ? "class='ui-btn-active'" : "").">Album</a></li>";
print " <li><a href='#track' ".($active == "track" ? "class='ui-btn-active'" : "").">Track</a></li>";
echo <<<EXCERPT
</ul>
</div>
</div><!-- /header -->
EXCERPT;
}
mobileheader("main");
?>
<div data-role="content">
<a href="#radio" id="start" data-role="button">Click me to start</a>
</div><!-- /content -->
<?php
$version = shell_exec('git show --oneline HEAD | head -n 1');
function mobilefooter($active)
{
global $version;
echo <<<EXCERPT
<div data-role="footer" data-position="fixed">
<span class='version'>version: $version</span>
EXCERPT;
print " <a href='#". ($active == "player" ? "back" : "player")."' data-transition='slideup'>". ($active == "player" ? "Back" : "Player")."</a>";
echo <<<EXCERPT
</div><!-- /header -->
EXCERPT;
}
mobilefooter("main");
?>
</div><!-- /page -->
<div data-role="page" id="radio">
<?php
mobileheader("radio");
?>
<div data-role="content">
<ul data-role="listview" id="radiolist">
<li class="radiostation" data-icon="false"><a href="#player" data-transition="slideup"><span class="listname">loading...</span><span class="playtext">playing...</span></a></li>
</ul>
</div><!-- /content -->
<?php
mobilefooter("radio");
?>
</div><!-- /page -->
<div data-role="page" id="album">
<?php
mobileheader("album");
?>
<div data-role="content">
<ul data-role="listview" id="albumlist">
<li data-icon="false"><a href="#track"><span class="listname">Search</span><span class="playtext">playing...</span></a></li>
</ul>
</div><!-- /content -->
<?php
mobilefooter("album");
?>
</div><!-- /page -->
<div data-role="page" id="track">
<?php
mobileheader("track");
?>
<div data-role="content">
<ul data-role="listview" id="tracklist">
<li data-icon="false"><a href="#player" data-transition="slideup"><span class="listname">Search</span><span class="playtext">playing...</span></a></li>
</ul>
</div><!-- /content -->
<?php
mobilefooter("track");
?>
</div><!-- /page -->
<div data-role="page" id="player">
<div data-role="header" data-position="fixed" data-id="hhead" data-theme="b">
<h1 id="playtitle">Not playing</h1>
<a href="#" data-rel="back">Back</a>
</div><!-- /header -->
<div data-role="content" id="nowplaying">
<button type="button" class="jp-pause">Pause</button>
<button type="button" class="jp-play">Play</button>
<img id="cover" />
<a href="#album" data-role="button" data-direction="reverse"><span id="artist"></span></a>
<a href="#track" data-role="button" data-direction="reverse"><span id="album"></span></a>
</div><!-- /content -->
<?php
mobilefooter("player");
?>
</div><!-- /page -->
<div id='jplayer'></div>
<script type="text/javascript">
var listenerId = initApplication();
</script>
</body>
</html>