mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 22:25:56 -05:00
patches from Stefan Bruns for js speedups, konq support
This commit is contained in:
parent
ab17d88879
commit
3acd647a55
@ -59,11 +59,6 @@ a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
table {
|
||||
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
border: none;
|
||||
vertical-align: middle;
|
||||
@ -226,6 +221,7 @@ select {
|
||||
font: 100% Verdana, Helvetica, Arial, sans-serif;
|
||||
border: 1px solid #8cacbb;
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
abbr, acronym, .explain {
|
||||
@ -948,20 +944,21 @@ table.calendar td.todaynoevent {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
.mytbody {
|
||||
height: 300px;
|
||||
overflow: auto;
|
||||
font: icon; !important
|
||||
/*height: 300px;
|
||||
overflow: auto;*/
|
||||
font: icon !important;
|
||||
}
|
||||
#browse {
|
||||
font: icon; !important
|
||||
font: icon !important;
|
||||
width: 100%;
|
||||
}
|
||||
.mytable {
|
||||
/* The default table for document listings. Contains name, document types, modification times etc in a file-browser-like fashion */
|
||||
border-collapse: collapse;
|
||||
border-left: 1px solid #8CACBB;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
border: 1px solid #8CACBB;
|
||||
margin: 1em 0em 1em 0em;
|
||||
font: icon; !important;
|
||||
font: icon !important;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@ -978,6 +975,8 @@ table.calendar td.todaynoevent {
|
||||
}
|
||||
.mytable td {
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
border-right: 1px solid #BCDCDF;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
@ -1,30 +1,31 @@
|
||||
@include hdr.html@
|
||||
<table>
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<td valign="top" style="width:20%;">
|
||||
Source<br />
|
||||
<select id="source" name="select" size="20">
|
||||
<option value="1">Library</option>
|
||||
</select>
|
||||
<div id="busymsg" style="text-align:center;color:red;">Busy ...</div>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<td valign="top" style="width:80%;" >
|
||||
|
||||
<table id="browse">
|
||||
<tr>
|
||||
<td>
|
||||
<td style="width:30%;" >
|
||||
Genre<br />
|
||||
<select id="genre" name="select" multiple="multiple" size="10">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<td style="width:35%;">
|
||||
Artist<br />
|
||||
<select id="artist" name="select" multiple="multiple" size="10">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<td style="width:35%;">
|
||||
Album<br />
|
||||
<select id="album" name="select" multiple="multiple" size="10">
|
||||
|
||||
|
@ -123,13 +123,13 @@ function Requestor_queChecker() {
|
||||
}
|
||||
|
||||
function response(xmldoc) {
|
||||
if ('daap.databaseplaylists' == xmldoc.firstChild.nodeName) {
|
||||
if ('daap.databaseplaylists' == xmldoc.documentElement.nodeName) {
|
||||
el = document.getElementById('source');
|
||||
addPlaylists(el,xmldoc);
|
||||
} else if ('daap.databasebrowse' == xmldoc.firstChild.nodeName) {
|
||||
} else if ('daap.databasebrowse' == xmldoc.documentElement.nodeName) {
|
||||
// Ok we have response from a browse query
|
||||
|
||||
switch (xmldoc.firstChild.childNodes[3].nodeName) {
|
||||
switch (xmldoc.documentElement.childNodes[3].nodeName) {
|
||||
case 'daap.browsegenrelisting':
|
||||
el = document.getElementById('genre');
|
||||
addOptions(el,'genre',xmldoc);
|
||||
@ -147,7 +147,8 @@ function response(xmldoc) {
|
||||
default:
|
||||
// We got something else back...
|
||||
}
|
||||
} else if ('daap.databasesongs' == xmldoc.firstChild.nodeName) {
|
||||
} else if ( ('daap.databasesongs' == xmldoc.documentElement.nodeName) ||
|
||||
('daap.playlistsongs' == xmldoc.documentElement.nodeName) ) {
|
||||
// Songlist
|
||||
addSongs(xmldoc);
|
||||
}
|
||||
@ -176,7 +177,7 @@ function addOptions(el,label,xmldoc) {
|
||||
while(el.hasChildNodes()) {
|
||||
el.removeChild(el.firstChild);
|
||||
}
|
||||
itemCnt = xmldoc.getElementsByTagName('dmap.specifiedtotalcount').item(0).textContent;
|
||||
itemCnt = xmldoc.getElementsByTagName('dmap.specifiedtotalcount').item(0).firstChild.data;
|
||||
if (parseInt(itemCnt) > 1) {
|
||||
plural = 's';
|
||||
} else {
|
||||
@ -192,7 +193,7 @@ function addOptions(el,label,xmldoc) {
|
||||
selectAll = true;
|
||||
for (i=0; i<items.length; i++) {
|
||||
option = document.createElement('option');
|
||||
itemName = items[i].textContent;
|
||||
itemName = items[i].firstChild.data;
|
||||
option.value = itemName;
|
||||
switch (label) {
|
||||
case 'genre':
|
||||
@ -242,12 +243,12 @@ function addOptions(el,label,xmldoc) {
|
||||
|
||||
function addPlaylists(el,xmldoc) {
|
||||
//items = xmldoc.getElementsByTagName('dmap.listingitem');
|
||||
list = xmldoc.childNodes[0].childNodes[4];
|
||||
list = xmldoc.documentElement.childNodes[4];
|
||||
// Start on 1 since the first node is the name of the daap server
|
||||
for (i=1; i < list.childNodes.length; i++) {
|
||||
option = document.createElement('option');
|
||||
listNumber = list.childNodes[i].childNodes[0].textContent;
|
||||
listName = list.childNodes[i].childNodes[2].textContent;
|
||||
listNumber = list.childNodes[i].childNodes[0].firstChild.data;
|
||||
listName = list.childNodes[i].childNodes[2].firstChild.data;
|
||||
option.appendChild(document.createTextNode(listName));
|
||||
option.setAttribute('value',listNumber);
|
||||
el.appendChild(option);
|
||||
@ -256,7 +257,10 @@ function addPlaylists(el,xmldoc) {
|
||||
|
||||
function playlistSelect(event) {
|
||||
table = document.getElementById('songs');
|
||||
tableBody = removeRows(table);
|
||||
if (tableBody = table.getElementsByTagName('tbody').item(0))
|
||||
table.removeChild(tableBody);
|
||||
document.getElementById('busymsg').style.visibility='visible';
|
||||
|
||||
playlistNumber = document.getElementById('source').value;
|
||||
browse = document.getElementById('browse');
|
||||
if (1 == playlistNumber) {
|
||||
@ -264,44 +268,10 @@ function playlistSelect(event) {
|
||||
} else {
|
||||
browse.style.display = 'none';
|
||||
}
|
||||
g_req.open('get',baseUrl + 'databases/1/containers/' + playlistNumber +
|
||||
'/items?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime&output=xml',false);
|
||||
g_req.send(null);
|
||||
|
||||
items = g_req.responseXML.getElementsByTagName('dmap.listingitem');
|
||||
className = 'odd';
|
||||
for (i=0; i < items.length; i++) {
|
||||
// Have to check if the tag really was returned from the server
|
||||
if (song = items[i].getElementsByTagName('dmap.itemname').item(0)) {
|
||||
song = song.textContent;
|
||||
} else {
|
||||
song = '';
|
||||
}
|
||||
time = ''; //items[i].getElementsByTagName('daap.songtime').item(0).textContent;
|
||||
if (artist = items[i].getElementsByTagName('daap.songartist').item(0)) {
|
||||
artist = artist.textContent;
|
||||
} else {
|
||||
artist = '';
|
||||
}
|
||||
if (album = items[i].getElementsByTagName('daap.songalbum').item(0)) {
|
||||
album = album.textContent;
|
||||
} else {
|
||||
album = '';
|
||||
}
|
||||
if (genre = items[i].getElementsByTagName('daap.songgenre').item(0)) {
|
||||
genre = genre.textContent;
|
||||
} else {
|
||||
genre = '';
|
||||
}
|
||||
if ('odd' == className) {
|
||||
className = 'even';
|
||||
} else {
|
||||
className = 'odd';
|
||||
}
|
||||
addRow(tableBody,className,song,time,artist,album,genre);
|
||||
}
|
||||
|
||||
g_requestor.addRequest('databases/1/containers/' + playlistNumber +
|
||||
'/items?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime&output=xml');
|
||||
}
|
||||
|
||||
function addRow(tbody,className,song,time,artist,album,genre) {
|
||||
row = document.createElement("tr");
|
||||
row.setAttribute('class',className);
|
||||
@ -336,7 +306,9 @@ function removeRows(table) {
|
||||
table.appendChild(tableBody);
|
||||
return tableBody;
|
||||
}
|
||||
|
||||
function genreSelect(event) {
|
||||
document.getElementById('busymsg').style.visibility='visible';
|
||||
selectObject = event.target;
|
||||
if (selectObject.options[0].selected) {
|
||||
filter = '';
|
||||
@ -393,6 +365,7 @@ function artistSelect(event) {
|
||||
// If all is selected then search on all artists but honor genre
|
||||
filter = '?filter=' + filter.join(',');
|
||||
}
|
||||
document.getElementById('busymsg').style.visibility='visible';
|
||||
g_requestor.addRequest('databases/1/browse/albums' + filter);
|
||||
}
|
||||
|
||||
@ -423,6 +396,7 @@ function getSongs() {
|
||||
query = '&query=' + query.join(' ');
|
||||
}
|
||||
//alert(query);
|
||||
document.getElementById('busymsg').style.visibility='visible';
|
||||
g_requestor.addRequest('databases/1/items' +
|
||||
'?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime'+query);
|
||||
///items?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime&output=xml
|
||||
@ -432,28 +406,33 @@ function addSongs(xmldoc) {
|
||||
items = xmldoc.getElementsByTagName('dmap.listingitem');
|
||||
className = 'odd';
|
||||
table = document.getElementById('songs');
|
||||
tableBody = removeRows(table);
|
||||
if(tableBody = table.getElementsByTagName('tbody').item(0))
|
||||
table.removeChild(tableBody);
|
||||
tableBody = document.createElement('tbody');
|
||||
tableBody.setAttribute('class','mytbody');
|
||||
|
||||
for (i=0; i < items.length; i++) {
|
||||
var count = items.length;
|
||||
for (i=0; i < count; i++) {
|
||||
item = items[i];
|
||||
// Have to check if the tag really was returned from the server
|
||||
if (song = items[i].getElementsByTagName('dmap.itemname').item(0)) {
|
||||
song = song.textContent;
|
||||
if (song = item.getElementsByTagName('dmap.itemname').item(0)) {
|
||||
song = song.firstChild.data;
|
||||
} else {
|
||||
song = '';
|
||||
}
|
||||
time = ''; //items[i].getElementsByTagName('daap.songtime').item(0).textContent;
|
||||
if (artist = items[i].getElementsByTagName('daap.songartist').item(0)) {
|
||||
artist = artist.textContent;
|
||||
time = ''; //item.getElementsByTagName('daap.songtime').item(0).textContent;
|
||||
if (artist = item.getElementsByTagName('daap.songartist').item(0)) {
|
||||
artist = artist.firstChild.data;
|
||||
} else {
|
||||
artist = '';
|
||||
}
|
||||
if (album = items[i].getElementsByTagName('daap.songalbum').item(0)) {
|
||||
album = album.textContent;
|
||||
if (album = item.getElementsByTagName('daap.songalbum').item(0)) {
|
||||
album = album.firstChild.data;
|
||||
} else {
|
||||
album = '';
|
||||
}
|
||||
if (genre = items[i].getElementsByTagName('daap.songgenre').item(0)) {
|
||||
genre = genre.textContent;
|
||||
if (genre = item.getElementsByTagName('daap.songgenre').item(0)) {
|
||||
genre = genre.firstChild.data;
|
||||
} else {
|
||||
genre = '';
|
||||
}
|
||||
@ -464,5 +443,7 @@ function addSongs(xmldoc) {
|
||||
}
|
||||
addRow(tableBody,className,song,time,artist,album,genre);
|
||||
}
|
||||
table.appendChild(tableBody);
|
||||
document.getElementById('busymsg').style.visibility='hidden';
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user