create catalog /js with scripts from index.php

This commit is contained in:
santic-zombie
2020-03-28 18:19:56 +03:00
parent ae80382e28
commit cf7ac86270
3 changed files with 61 additions and 65 deletions

View File

@@ -54,71 +54,8 @@
</div>
</div>
<script language="JavaScript">
var audio = new Audio('http://stream.santic-zombie.ru');
var play = document.getElementById('play');
play.addEventListener('click', function() {
$("#myPlay").text("Now playing:");
audio.play();
}, false);
var pause = document.getElementById('pause');
pause.addEventListener('click', function() {
$("#myPlay").text("Paused");
audio.pause();
}, false);
audio.addEventListener("timeupdate", function() {
var duration = document.getElementById('duration');
var s = parseInt(audio.currentTime % 60);
var m = parseInt((audio.currentTime / 60) % 60);
var h = parseInt((audio.currentTime / 3600) % 60);
if (s < 10) s = '0' + s;
if (m < 10) m = '0' + m;
if (h < 10) h = '0' + h;
duration.innerHTML = h + ':' + m + ':' + s;
}, false);
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
});
</script>
<script language="JavaScript">
function show()
{
$.ajax({
url: '/trackname.php',
cache: false,
success: function(html){
$('#title').html(html);
}
});
}
$(document).ready(function(){
show();
setInterval('show()',5000);
});
</script>
<script language="JavaScript">
function show1()
{
$.ajax({
url: '/online.php',
cache: false,
success: function(html){
$('#listeners').html(html);
}
});
}
$(document).ready(function(){
show1();
setInterval('show1()',5000);
});
</script>
<script src="js/audio.js"></script>
<script src="js/radio.js"></script>
</body>

28
js/audio.js Normal file
View File

@@ -0,0 +1,28 @@
var audio = new Audio('http://stream.santic-zombie.ru');
var play = document.getElementById('play');
play.addEventListener('click', function() {
$("#myPlay").text("Now playing:");
audio.play();
}, false);
var pause = document.getElementById('pause');
pause.addEventListener('click', function() {
$("#myPlay").text("Paused");
audio.pause();
}, false);
audio.addEventListener("timeupdate", function() {
var duration = document.getElementById('duration');
var s = parseInt(audio.currentTime % 60);
var m = parseInt((audio.currentTime / 60) % 60);
var h = parseInt((audio.currentTime / 3600) % 60);
if (s < 10) s = '0' + s;
if (m < 10) m = '0' + m;
if (h < 10) h = '0' + h;
duration.innerHTML = h + ':' + m + ':' + s;
}, false);
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
});

31
js/radio.js Normal file
View File

@@ -0,0 +1,31 @@
function show()
{
$.ajax({
url: '../trackname.php',
cache: false,
success: function(html){
$('#title').html(html);
}
});
}
$(document).ready(function(){
show();
setInterval('show()',5000);
});
function show1()
{
$.ajax({
url: '../online.php',
cache: false,
success: function(html){
$('#listeners').html(html);
}
});
}
$(document).ready(function(){
show1();
setInterval('show1()',5000);
});