1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-30 00:19:54 +00:00

Merge pull request #78 from hsoft/master

Fix browsing for non-ascii entity URI under Safari
This commit is contained in:
Andy 2015-06-24 20:17:05 +02:00
commit 7b05dc1010

View File

@ -185,11 +185,15 @@ function webSocketConnect() {
if(current_app !== 'browse' && current_app !== 'search') if(current_app !== 'browse' && current_app !== 'search')
break; break;
/* The use of encodeURI() below might seem useless, but it's not. It prevents
* some browsers, such as Safari, from changing the normalization form of the
* URI from NFD to NFC, breaking our link with MPD.
*/
for (var item in obj.data) { for (var item in obj.data) {
switch(obj.data[item].type) { switch(obj.data[item].type) {
case "directory": case "directory":
$('#salamisandwich > tbody').append( $('#salamisandwich > tbody').append(
"<tr uri=\"" + obj.data[item].dir + "\" class=\"dir\">" + "<tr uri=\"" + encodeURI(obj.data[item].dir) + "\" class=\"dir\">" +
"<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" + "<td><span class=\"glyphicon glyphicon-folder-open\"></span></td>" +
"<td><a>" + basename(obj.data[item].dir) + "</a></td>" + "<td><a>" + basename(obj.data[item].dir) + "</a></td>" +
"<td></td><td></td></tr>" "<td></td><td></td></tr>"
@ -197,7 +201,7 @@ function webSocketConnect() {
break; break;
case "playlist": case "playlist":
$('#salamisandwich > tbody').append( $('#salamisandwich > tbody').append(
"<tr uri=\"" + obj.data[item].plist + "\" class=\"plist\">" + "<tr uri=\"" + encodeURI(obj.data[item].plist) + "\" class=\"plist\">" +
"<td><span class=\"glyphicon glyphicon-list\"></span></td>" + "<td><span class=\"glyphicon glyphicon-list\"></span></td>" +
"<td><a>" + basename(obj.data[item].plist) + "</a></td>" + "<td><a>" + basename(obj.data[item].plist) + "</a></td>" +
"<td></td><td></td></tr>" "<td></td><td></td></tr>"
@ -208,7 +212,7 @@ function webSocketConnect() {
var seconds = obj.data[item].duration - minutes * 60; var seconds = obj.data[item].duration - minutes * 60;
$('#salamisandwich > tbody').append( $('#salamisandwich > tbody').append(
"<tr uri=\"" + obj.data[item].uri + "\" class=\"song\">" + "<tr uri=\"" + encodeURI(obj.data[item].uri) + "\" class=\"song\">" +
"<td><span class=\"glyphicon glyphicon-music\"></span></td>" + "<td><span class=\"glyphicon glyphicon-music\"></span></td>" +
"<td>" + obj.data[item].title +"</td>" + "<td>" + obj.data[item].title +"</td>" +
"<td>"+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds + "<td>"+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds +