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