req.onreadystatechange = function () {
if (this.readyState != 4 || this.status != 200) return;
document.getElementById('nowplaying_content').innerHTML=this.responseText;
- document.title='MPD Player: '+this.responseText;
};
req.open("GET", "ajax/trackinfo.php", true);
}
+function RefreshTitle() {
+
+var req = new XMLHttpRequest();
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ document.title='MPD Player: '+this.responseText;
+};
+
+req.open("GET", "ajax/trackname.php", true);
+req.send();
+}
+
function RefreshPlayerState() {
var req = new XMLHttpRequest();
function RefreshPageStatus() {
+ RefreshTitle();
RefreshNowPlaying();
RefreshPlayerState();
RefreshRepeatState();
}
+function LoadPlayList() {
+
+var req = new XMLHttpRequest();
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ document.getElementById('playlist').innerHTML=this.responseText;
+};
+
+req.open("GET", "ajax/playlists.php", true);
+req.send();
+
+}
+
+function SavePlayList() {
+
+var name=window.prompt('Имя списка','');
+
+var req = new XMLHttpRequest();
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ if (this.responseText != 'OK') {
+ window.alert(this.responseText);
+ }
+};
+
+req.open("GET", "ajax/save.php?item="+name, true);
+req.send();
+
+}
+
+function DelPlayList(item) {
+
+var req = new XMLHttpRequest();
+
+//if (! window.alert("Удалить список "+item+"?")) return;
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ RefreshPageStatus();
+ LoadPlayList();
+};
+
+req.open("GET", "ajax/playlist-command.php?task=dellist&item="+item, true);
+req.send();
+
+}
+
function RefreshPageContent() {
RefreshPageStatus();
}
+function PlaylistCommandRefStatus(cmd,item) {
+
+var req = new XMLHttpRequest();
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ RefreshPageStatus();
+};
+
+req.open("GET", "ajax/playlist-command.php?item="+item+"&task="+cmd, true);
+req.send();
+
+}
+
function PlaylistEditCommand(cmd,item) {
var req = new XMLHttpRequest();
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ RefreshPageStatus();
+};
+
+req.open("GET", "ajax/playlist-command.php?item="+item+"&task="+cmd, true);
+req.send();
+
+}
+
+function PlaylistEditCommandRefFull(cmd,item) {
+
+var req = new XMLHttpRequest();
+
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ RefreshPageContent();
+};
+
req.open("GET", "ajax/playlist-command.php?item="+item+"&task="+cmd, true);
req.send();
return 'itemlist[]=' + encodeURIComponent(el);
}).join('&');
+req.onreadystatechange = function () {
+ if (this.readyState != 4 || this.status != 200) return;
+ RefreshPageStatus();
+};
+
req.open("POST", "ajax/playlist-command.php?dir="+dir+"&task="+cmd, true);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.send(params);
}
-// setInterval(RefreshPageStatus, 5000);
+setInterval(RefreshPageStatus, 10000);