/* * $Id$ * Javascript for playlist.html * * Copyright (C) 2005 Anders Betnér (andbe611@users.sourceforge.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ var g_req; var baseUrl = window.location.toString(); baseUrl = baseUrl.substr(0,baseUrl.length-13); function createRequest() { // All browsers but IE g_req = false; if (window.XMLHttpRequest) { g_req = new XMLHttpRequest(); // MS IE } else if (window.ActiveXObject) { g_req = new ActiveXObject("Microsoft.XMLHTTP"); } } function init() { // get playlists createRequest(); //alert(baseUrl+'databases/1/browse/genres?output=xml'); g_req.open('get',baseUrl+'databases/1/containers?output=xml',false); g_req.send(null); el = document.getElementById('source'); addPlaylists(el,g_req.responseXML); el.addEventListener('change',playlistSelect,true); g_req.open('get',baseUrl+'databases/1/browse/genres?output=xml',false); g_req.send(null); el = document.getElementById('genre'); addOptions(el,g_req.responseXML); g_req.open('get',baseUrl+'databases/1/browse/artists?output=xml',false); g_req.send(null); el = document.getElementById('artist'); addOptions(el,g_req.responseXML); g_req.open('get',baseUrl+'databases/1/browse/albums?output=xml',false); g_req.send(null); el = document.getElementById('album'); addOptions(el,g_req.responseXML); } function addOptions(el,xmldoc) { items = xmldoc.getElementsByTagName('dmap.listingitem'); for (i=0; i