-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplay.php
More file actions
136 lines (136 loc) · 3.02 KB
/
Copy pathplay.php
File metadata and controls
136 lines (136 loc) · 3.02 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
<?php
$s0 = 0;
$s1 = $s2 = '';
$flag = false;
$dir='/data';
$files = scandir('.' . $dir);
if (is_array($files)){
foreach ($files as $val){
if (is_dir('.' . $dir . '/' . $val) == false){
if($flag){
$s0 = $s0 + 1;
$s1 = $s1.'</li><li>';
$s2 = $s2."','";
}
else{
$flag = true;
}
$s1 = $s1.$val;
$s2 = $s2.$dir.'/'.$val;
}
}
}
?>
<html>
<head>
<title>GH/tzchz/PHPlayer</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="manifest" href="manifest.json">
<script>
window.addEventListener('beforeinstallprompt', event => {
event.userChoice.then(result => {console.log(result.outcome)})
}
)
</script>
<link rel="icon" href="https://assets.060418.best/favicon.ico">
<script src="/app.js"></script>
<style>*{
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
}
#player{
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
height: 250px;
width: 300px;
border: 3px solid black;
border-radius: 10%;
background-image: url(bkg.jpg);
background-size: cover;
}
.play{
color: white;
background-color: #87CEFA;
margin:0 6px;
}
#player .mlist{
margin:10px;
background-color: rgba(1,1,1,0.5);
height: 165px;
border-radius: 5px;
overflow-y: scroll;
}
#player ul li{
line-height:30px;
text-align: center;
cursor:pointer;
border-radius: 4px;
}
#player ul li:hover{
line-height:45px;
text-align: center;
cursor:pointer;
margin:0 5px;
background-color: #F0F8FF;
border-radius:6px;
}</style>
</head>
<body>
<div id=player>
<audio src="" controls class="music"></audio>
<ul class="mlist">
<li class="play"><?php echo $s1;?></li>
</ul>
</div>
<script>
var musicNode = document.getElementsByClassName('music')[0];
var mlist = document.getElementsByClassName('mlist')[0];
var lis = document.getElementsByTagName('li');
var len = lis.length;
var musicsrc =['<?php echo $s2;?>'
];
musicNode.src = musicsrc[0];
for (var i = 0; i < len; i++) {
(function(i){
lis[i].onclick =function(){
musicNode.src = musicsrc[i];
musicNode.load();
musicNode.play();
for (var j= 0; j < len; j++) {
lis[j].className = '';
}
this.className = 'play';
}})(i);
}
musicNode.onended =function(){
var ended = getPlay();
if (ended == <?php echo $s0;?>) {
musicNode.src = musicsrc[0];
lis[0].className = 'play'
lis[ended].className = '';
musicNode.load();
musicNode.play();
}else{
musicNode.src = musicsrc[ended + 1];
lis[ended + 1].className = 'play';
lis[ended].className = '';
musicNode.load();
musicNode.play(); }
}
function getPlay(){
for (var i = 0; i < len; i++) {
if (lis[i].getAttribute('class') == 'play') {
return i;
}
}
}
</script>
</body>
</html>