From 24667c8d015ec13861a66ec395febf919ad834a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Betn=C3=A9r?= Date: Mon, 21 Mar 2005 19:53:39 +0000 Subject: [PATCH] Code cleanup, fixed browse queries, --- admin-root/mt-daapd.css | 2 +- admin-root/playlist.html | 6 +- admin-root/playlist.js | 132 +++++++++++++++++++++------------------ 3 files changed, 76 insertions(+), 64 deletions(-) diff --git a/admin-root/mt-daapd.css b/admin-root/mt-daapd.css index c50aacd0..544dac08 100644 --- a/admin-root/mt-daapd.css +++ b/admin-root/mt-daapd.css @@ -956,8 +956,8 @@ table.calendar td.todaynoevent { border-collapse: collapse; border-left: 1px solid #8CACBB; border-bottom: 1px solid #8CACBB; - font-size: 80%; margin: 1em 0em 1em 0em; + font: icon; !important; clear: both; } diff --git a/admin-root/playlist.html b/admin-root/playlist.html index 3bb1e396..0ffd10d3 100644 --- a/admin-root/playlist.html +++ b/admin-root/playlist.html @@ -14,19 +14,19 @@ Genre
- Artist
- Album
- diff --git a/admin-root/playlist.js b/admin-root/playlist.js index af27665b..a635421c 100644 --- a/admin-root/playlist.js +++ b/admin-root/playlist.js @@ -20,7 +20,6 @@ */ /* Detta script finns att hämta på http://www.jojoxx.net och får användas fritt så länge som dessa rader står kvar. */ - function DataDumper(obj,n,prefix){ var str=""; prefix=(prefix)?prefix:""; n=(n)?n+1:1; var ind=""; for(var i=0;i 0) { + // Just to be able to pull ourseves up by our boot straps + window.setTimeout(Requestor_queChecker,5); + return; + } else { + g_requestor.busy = false; + } + } +}; +function Requestor_queChecker() { + if (url = g_requestor.que.shift()) { + g_requestor._openRequest(url); + } +} + +function response(xmldoc) { if ('daap.databaseplaylists' == xmldoc.firstChild.nodeName) { el = document.getElementById('source'); addPlaylists(el,xmldoc); @@ -115,6 +141,8 @@ Requestor_handleRequest = function() { case 'daap.browsealbumlisting': el = document.getElementById('album'); addOptions(el,'album',xmldoc); + // All other boxes are updated, now get the songs + getSongs(); break; default: // We got something else back... @@ -123,28 +151,14 @@ Requestor_handleRequest = function() { // Songlist addSongs(xmldoc); } - } - if (g_requestor.que.length > 0) { - // Just to be able to pull ourseves up by our boot straps - window.setTimeout(Requestor_queChecker,5); - return; - } else { - g_requestor.busy = false; - } - } -}; -function Requestor_queChecker() { - if (url = g_requestor.que.shift()) { - g_requestor._openRequest(url); - } } - function init() { - g_requestor = new Requestor(baseUrl); - g_requestor.addRequest('databases/1/containers'); - g_requestor.addRequest('databases/1/browse/genres'); - g_requestor.addRequest('databases/1/browse/artists'); - g_requestor.addRequest('databases/1/browse/albums'); + req = new Requestor(baseUrl); + req.setResponseHandler(response); + req.addRequest('databases/1/containers'); + req.addRequest('databases/1/browse/genres'); + req.addRequest('databases/1/browse/artists'); + req.addRequest('databases/1/browse/albums'); el = document.getElementById('source'); el.addEventListener('change',playlistSelect,true); @@ -154,26 +168,10 @@ function init() { el = document.getElementById('artist'); el.addEventListener('change',artistSelect,true); -//###FIXME album select -return; - // get playlists - - g_req.open('get',baseUrl+'databases/1/containers?output=xml',false); - g_req.send(null); - - - g_req.open('get',baseUrl+'databases/1/browse/genres?output=xml',false); - g_req.send(null); - - g_req.open('get',baseUrl+'databases/1/browse/artists?output=xml',false); - g_req.send(null); - - g_req.open('get',baseUrl+'databases/1/browse/albums?output=xml',false); - g_req.send(null); el = document.getElementById('album'); - addOptions(el,'album',g_req.responseXML); - + el.addEventListener('change',albumSelect,true); } + function addOptions(el,label,xmldoc) { while(el.hasChildNodes()) { el.removeChild(el.firstChild); @@ -191,26 +189,27 @@ function addOptions(el,label,xmldoc) { el.appendChild(option); items = xmldoc.getElementsByTagName('dmap.listingitem'); + selectAll = true; for (i=0; i