This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
forked from dickfink/ptb.la
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·67 lines (60 loc) · 2.29 KB
/
index.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
<?php
$files = glob("clips/*.mp3")
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Parker's Soundboard</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/base/base-min.css">
<style type="text/css" media="screen">
button {
-moz-border-radius: 5px;
background-color: #f2f2f2;
border: 1px solid black;
display: inline-block;
cursor: pointer;
padding: 5px 5px;
margin: 5px;
color: black;
text-transform: uppercase;
}
button:hover {background-color: #999; }
html {
background: url(https://si0.twimg.com/profile_images/1887271832/image.jpg);
}
h1 {
color: white;
}
audio {display: none;}
</style>
</head>
<body>
<div id="doc">
<h1>Parker's Soundboard</h1>
<!-- JS here to prevent 'flash' of all the default audio players -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$("audio").removeAttr("controls").each(function(i, audioElement) {
var audio = $(this);
var that = this; //closure to keep reference to current audio tag
$("#doc").append($('<button>'+audio.attr("title")+'</button>').click(function() {
that.play();
document.location.hash = "#" + encodeURIComponent(audio.attr("title"));
}));
});
if(document.location.hash !== "") {
var el = $('audio[title="' + decodeURIComponent(document.location.hash.substr(1)) + '"]');
if(el.size() > 0) el[0].play();
}
});
</script>
<?php foreach($files as $file) { ?>
<?php $title = str_replace(".mp3", "", str_replace("clips/", "", $file)); ?>
<audio src="<?php echo $file; ?>" controls autobuffer="true" title="<?php echo $title ?>"></audio>
<?php } ?>
</div>
</body>
</html>