From cf7ac862705b4f5bad3cbb2a8b4429adc4209298 Mon Sep 17 00:00:00 2001 From: santic-zombie Date: Sat, 28 Mar 2020 18:19:56 +0300 Subject: [PATCH] create catalog /js with scripts from index.php --- index.php | 67 ++--------------------------------------------------- js/audio.js | 28 ++++++++++++++++++++++ js/radio.js | 31 +++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 65 deletions(-) create mode 100644 js/audio.js create mode 100644 js/radio.js diff --git a/index.php b/index.php index 965aae8..eb69c31 100755 --- a/index.php +++ b/index.php @@ -54,71 +54,8 @@ - - - - - - + + diff --git a/js/audio.js b/js/audio.js new file mode 100644 index 0000000..a645769 --- /dev/null +++ b/js/audio.js @@ -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); + }); diff --git a/js/radio.js b/js/radio.js new file mode 100644 index 0000000..e67082d --- /dev/null +++ b/js/radio.js @@ -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); + });