2.0.4 Minor bug fixes
This commit is contained in:
parent
ae49d258fb
commit
d8331b7a2c
6 changed files with 121 additions and 163 deletions
11
index.html
11
index.html
|
@ -192,7 +192,7 @@
|
|||
<div class="inputwrap"><input type="checkbox" id="Debug" name="Debug" value="1" title="Enable Debug Mode (Events will be logged to the Javascript Console)"/></div>
|
||||
<label for="Debug">Debug Mode</label>
|
||||
<div class="clear"></div>
|
||||
<div class="inputwrap"><input type="checkbox" id="ForceFlash" name="ForceFlash" value="1" title="Force Flash (Will force use of Flash for audio)"/></div>
|
||||
<div class="inputwrap"><input type="checkbox" id="ForceFlash" name="ForceFlash" value="1" title="Force Flash (Option doesn't work with Chrome App)"/></div>
|
||||
<label for="ForceFlash">Force Flash</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -216,6 +216,13 @@
|
|||
<span class="changes"></span>
|
||||
</li>
|
||||
-->
|
||||
<li class="log"><span class="version">7/15/2012 - 2.0.4</span>
|
||||
<span class="changes">Minor bug fix</span>
|
||||
</li>
|
||||
<li class="log"><span class="version">7/15/2012 - 2.0.3</span>
|
||||
<span class="changes">Fixed double click bug</span>
|
||||
<span class="changes">Fixed plaintext password issue</span>
|
||||
</li>
|
||||
<li class="log"><span class="version">7/5/2012 - 2.0.2</span>
|
||||
<span class="changes">Added ability to force Flash on the sound plugin</span>
|
||||
</li>
|
||||
|
@ -284,7 +291,7 @@
|
|||
<li>MiniSub on GitHub - <a href="https://github.com/tsquillario/MiniSub" target="_blank">https://github.com/tsquillario/MiniSub</a></li>
|
||||
<li>MiniSub Chrome App - <a href="https://chrome.google.com/webstore/detail/jccdpflnecheidefpofmlblgebobbloc" target="_blank">Chrome Web Store</a></li>
|
||||
<li><a href="https://twitter.com/tsquillario" class="twitter-follow-button" data-show-count="false">Follow @tsquillario</a>
|
||||
<script> !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } } (document, "script", "twitter-wjs");</script></li>
|
||||
<script> !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } } (document, "script", "twitter-wjs");</script></li>
|
||||
</ul>
|
||||
<h3 class="title">Thanks</h3>
|
||||
<ul class="preferences">
|
||||
|
|
72
js/app.js
72
js/app.js
|
@ -4,6 +4,10 @@ var audio;
|
|||
var hostURL = location.href;
|
||||
var baseURL;
|
||||
var version;
|
||||
var username;
|
||||
var password;
|
||||
var passwordenc;
|
||||
var server;
|
||||
|
||||
//Sound manager
|
||||
soundManager.url = 'js/sm/swf';
|
||||
|
@ -22,12 +26,15 @@ var s = getParameterByName('s');
|
|||
if (u && p && s) {
|
||||
if (!$.cookie('username')) {
|
||||
$.cookie('username', u, { expires: 365 });
|
||||
username = u;
|
||||
}
|
||||
if (!$.cookie('password')) {
|
||||
$.cookie('password', p, { expires: 365 });
|
||||
password = p;
|
||||
}
|
||||
if (!$.cookie('Server')) {
|
||||
$.cookie('Server', s, { expires: 365 });
|
||||
baseURL = $.cookie('Server') + '/rest';
|
||||
}
|
||||
window.location.href = getPathFromUrl(window.location);
|
||||
}
|
||||
|
@ -40,36 +47,49 @@ if ($.cookie('ApplicationName')) {
|
|||
} else {
|
||||
applicationName = 'MiniSub';
|
||||
}
|
||||
var username = $.cookie('username');
|
||||
var password = $.cookie('password');
|
||||
if ($.cookie('username')) {
|
||||
username = $.cookie('username');
|
||||
}
|
||||
if ($.cookie('passwordenc')) {
|
||||
password = $.cookie('passwordenc');
|
||||
} else {
|
||||
if ($.cookie('password')) {
|
||||
password = 'enc:' + HexEncode($.cookie('password'));
|
||||
}
|
||||
}
|
||||
var auth = makeBaseAuth(username, password);
|
||||
var passwordenc = 'enc:' + HexEncode($.cookie('password'));
|
||||
if ($.cookie('password')) {
|
||||
$.cookie('passwordenc', 'enc:' + HexEncode($.cookie('password')), { expires: 365 });
|
||||
$.cookie('password', null);
|
||||
}
|
||||
var version = '1.6.0';
|
||||
|
||||
function loadTabContent(tab) {
|
||||
switch (tab) {
|
||||
case '#tabLibrary':
|
||||
if (debug) { console.log("TAG LIBRARY"); }
|
||||
if ($.cookie('MusicFolders')) {
|
||||
loadArtists($.cookie('MusicFolders'), false);
|
||||
} else {
|
||||
loadArtists();
|
||||
}
|
||||
getMusicFolders();
|
||||
break;
|
||||
case '#tabCurrent':
|
||||
if (debug) { console.log("TAG CURRENT"); }
|
||||
var header = generateSongHeaderHTML();
|
||||
$("#CurrentPlaylistContainer thead").html(header);
|
||||
break;
|
||||
case '#tabPlaylists':
|
||||
if (debug) { console.log("TAG PLAYLIST"); }
|
||||
loadPlaylists();
|
||||
break;
|
||||
case '#tabPreferences':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (username && password) {
|
||||
switch (tab) {
|
||||
case '#tabLibrary':
|
||||
if (debug) { console.log("TAG LIBRARY"); }
|
||||
if ($.cookie('MusicFolders')) {
|
||||
loadArtists($.cookie('MusicFolders'), false);
|
||||
} else {
|
||||
loadArtists();
|
||||
}
|
||||
getMusicFolders();
|
||||
break;
|
||||
case '#tabCurrent':
|
||||
if (debug) { console.log("TAG CURRENT"); }
|
||||
var header = generateSongHeaderHTML();
|
||||
$("#CurrentPlaylistContainer thead").html(header);
|
||||
break;
|
||||
case '#tabPlaylists':
|
||||
if (debug) { console.log("TAG PLAYLIST"); }
|
||||
loadPlaylists();
|
||||
break;
|
||||
case '#tabPreferences':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
145
js/libs/api.js
145
js/libs/api.js
|
@ -5,11 +5,11 @@ function loadArtists(id, refresh) {
|
|||
}
|
||||
var url;
|
||||
if (id == "all") {
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp';
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp';
|
||||
} else if (id) {
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&musicFolderId=' + id;
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&musicFolderId=' + id;
|
||||
} else {
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp';
|
||||
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp';
|
||||
}
|
||||
if (debug) { console.log(url); }
|
||||
var content = $('#ArtistContainer').html();
|
||||
|
@ -75,13 +75,10 @@ function loadArtists(id, refresh) {
|
|||
}
|
||||
function getMusicFolders() {
|
||||
$.ajax({
|
||||
url: baseURL + '/getMusicFolders.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
url: baseURL + '/getMusicFolders.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].musicFolders.musicFolder !== undefined) {
|
||||
// There is a bug in the API that doesn't return a JSON array for one artist
|
||||
|
@ -111,13 +108,10 @@ function getMusicFolders() {
|
|||
function getAlbums(id, action, appendto) {
|
||||
$('.first').trigger('click');
|
||||
$.ajax({
|
||||
url: baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
url: baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (action === '') {
|
||||
$('#AlbumRows').empty();
|
||||
|
@ -181,13 +175,10 @@ function getAlbumListBy(id) {
|
|||
size = $.cookie('AutoAlbumSize');
|
||||
}
|
||||
$.ajax({
|
||||
url: baseURL + '/getAlbumList.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size + '&type=' + id,
|
||||
url: baseURL + '/getAlbumList.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size + '&type=' + id,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].albumList.album !== undefined) {
|
||||
$("#AlbumRows").empty();
|
||||
|
@ -230,13 +221,10 @@ function getRandomSongList(action, appendto) {
|
|||
size = $.cookie('AutoPlaylistSize');
|
||||
}
|
||||
$.ajax({
|
||||
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size,
|
||||
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].randomSongs.song !== undefined) {
|
||||
if (appendto === '#TrackContainer') {
|
||||
|
@ -285,13 +273,10 @@ function updateNowPlaying() {
|
|||
updaterNowPlaying = $.periodic({ period: 4000, decay: 1.5, max_period: 1800000 }, function () {
|
||||
$.ajax({
|
||||
periodic: this,
|
||||
url: baseURL + '/getNowPlaying.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
url: baseURL + '/getNowPlaying.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].nowPlaying.entry === undefined) {
|
||||
this.periodic.increment();
|
||||
|
@ -334,13 +319,10 @@ function stopUpdateNowPlaying() {
|
|||
|
||||
function search(type, query) {
|
||||
$.ajax({
|
||||
url: baseURL + '/search2.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&query=' + query,
|
||||
url: baseURL + '/search2.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&query=' + query,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].searchResult2 !== "") {
|
||||
$("#AlbumRows").empty();
|
||||
|
@ -398,13 +380,10 @@ function loadPlaylists(refresh) {
|
|||
if (content === "") {
|
||||
// Load Playlists
|
||||
$.ajax({
|
||||
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
var playlists = [];
|
||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
||||
|
@ -429,19 +408,18 @@ function loadPlaylists(refresh) {
|
|||
function loadPlaylistsForMenu(menu) {
|
||||
$('#' + menu).empty();
|
||||
$.ajax({
|
||||
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
var playlists = [];
|
||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
||||
playlists = data["subsonic-response"].playlists.playlist;
|
||||
} else {
|
||||
playlists[0] = data["subsonic-response"].playlists.playlist;
|
||||
if (data["subsonic-response"].playlists.playlist !== undefined) {
|
||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
||||
playlists = data["subsonic-response"].playlists.playlist;
|
||||
} else {
|
||||
playlists[0] = data["subsonic-response"].playlists.playlist;
|
||||
}
|
||||
}
|
||||
if (menu === 'submenu_AddCurrentToPlaylist') {
|
||||
$("<a href=\"#\" onclick=\"javascript:addToPlaylist('new', 'current'); return false;\">+ New</a><br />").appendTo("#" + menu);
|
||||
|
@ -462,15 +440,12 @@ function loadPlaylistsForMenu(menu) {
|
|||
}
|
||||
function newPlaylist() {
|
||||
var reply = prompt("Choose a name for your new playlist.", "");
|
||||
if (reply) {
|
||||
if (reply != null || reply != "") {
|
||||
$.ajax({
|
||||
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&name=' + reply,
|
||||
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&name=' + reply,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
loadPlaylists(true);
|
||||
}
|
||||
|
@ -479,13 +454,10 @@ function newPlaylist() {
|
|||
}
|
||||
function deletePlaylist(id) {
|
||||
$.ajax({
|
||||
url: baseURL + '/deletePlaylist.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
url: baseURL + '/deletePlaylist.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
loadPlaylists(true);
|
||||
$('#TrackContainer tbody').empty();
|
||||
|
@ -508,13 +480,10 @@ function addToPlaylist(playlistid, from) {
|
|||
// Get songs from playlist
|
||||
var currentsongs = [];
|
||||
$.ajax({
|
||||
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + playlistid,
|
||||
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + playlistid,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
// There is a bug in the API that doesn't return a JSON array for one artist
|
||||
var children = [];
|
||||
|
@ -539,13 +508,10 @@ function addToPlaylist(playlistid, from) {
|
|||
if (count > 0) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL + '/createPlaylist.view',
|
||||
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs },
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs },
|
||||
success: function () {
|
||||
$('table.songlist tr.song').each(function () {
|
||||
$(this).removeClass('selected');
|
||||
|
@ -559,23 +525,22 @@ function addToPlaylist(playlistid, from) {
|
|||
});
|
||||
} else {
|
||||
var reply = prompt("Choose a name for your new playlist.", "");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL + '/createPlaylist.view',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", name: "" + reply + "", songId: selected },
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function () {
|
||||
$('table.songlist tr.song').each(function () {
|
||||
$(this).removeClass('selected');
|
||||
});
|
||||
updateMessage('Playlist Created!');
|
||||
},
|
||||
traditional: true // Fixes POST with an array in JQuery 1.4
|
||||
});
|
||||
if (reply) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
data: { v: version, c: applicationName, f: "jsonp", name: "" + reply + "", songId: selected },
|
||||
success: function () {
|
||||
$('table.songlist tr.song').each(function () {
|
||||
$(this).removeClass('selected');
|
||||
});
|
||||
updateMessage('Playlist Created!');
|
||||
},
|
||||
traditional: true // Fixes POST with an array in JQuery 1.4
|
||||
});
|
||||
}
|
||||
}
|
||||
setTimeout(function () { $('div.submenu').fadeOut(); }, 100);
|
||||
}
|
||||
|
@ -610,25 +575,9 @@ function downloadItem(id, type) {
|
|||
reqDownload = 'playlistUtf8Hex=' + id;
|
||||
}
|
||||
if (reqDownload) {
|
||||
url = baseURL + '/download.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&' + reqDownload;
|
||||
url = baseURL + '/download.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&' + reqDownload;
|
||||
window.location = url;
|
||||
}
|
||||
/* 20120520 OwnCloud Merge
|
||||
var url;
|
||||
if (id) {
|
||||
url = baseURL + '/download.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id;
|
||||
window.location = url;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
$('table.songlist tr.selected').each(function (index) {
|
||||
id = $(this).attr('childid');
|
||||
if (id) {
|
||||
url = baseURL + '/download.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id;
|
||||
window.location = url;
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
function savePlaylist(playlistid) {
|
||||
var songs = [];
|
||||
|
@ -638,13 +587,10 @@ function savePlaylist(playlistid) {
|
|||
if (songs.length > 0) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL + '/createPlaylist.view',
|
||||
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: songs },
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: songs },
|
||||
success: function () {
|
||||
getPlaylist(playlistid);
|
||||
updateMessage('Playlist Updated!');
|
||||
|
@ -655,13 +601,10 @@ function savePlaylist(playlistid) {
|
|||
}
|
||||
function getPlaylist(id, action, appendto) {
|
||||
$.ajax({
|
||||
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + id,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].playlist.entry !== undefined) {
|
||||
if (appendto === '#TrackContainer tbody') {
|
||||
|
@ -682,6 +625,7 @@ function getPlaylist(id, action, appendto) {
|
|||
|
||||
var rowcolor;
|
||||
var html;
|
||||
var count = children.length;
|
||||
$.each(children, function (i, child) {
|
||||
if (i % 2 === 0) {
|
||||
rowcolor = 'even';
|
||||
|
@ -694,6 +638,7 @@ function getPlaylist(id, action, appendto) {
|
|||
html = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, child.artist, child.album, child.coverArt, child.userRating, time['m'], time['s']);
|
||||
$(html).appendTo(appendto);
|
||||
});
|
||||
updateMessage(count + ' Songs');
|
||||
if (appendto === '#CurrentPlaylistContainer tbody') {
|
||||
updateMessage(children.length + ' Song(s) Added');
|
||||
}
|
||||
|
|
|
@ -4,13 +4,10 @@ function updateChatMessages() {
|
|||
updater = $.periodic({ period: 1000, decay: 1.5, max_period: 1800000 }, function () {
|
||||
$.ajax({
|
||||
periodic: this,
|
||||
url: baseURL + '/getChatMessages.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&since=' + starttime,
|
||||
url: baseURL + '/getChatMessages.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&since=' + starttime,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].chatMessages.chatMessage === undefined) {
|
||||
this.periodic.increment();
|
||||
|
@ -51,13 +48,10 @@ function stopUpdateChatMessages() {
|
|||
function addChatMessage(msg) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL + '/addChatMessage.view',
|
||||
url: baseURL + '/addChatMessage.view?u=' + username + '&p=' + password,
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", message: msg },
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
data: { v: version, c: applicationName, f: "jsonp", message: msg },
|
||||
success: function () {
|
||||
updater.reset();
|
||||
},
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
var scrobbled = false;
|
||||
function playSong(el, songid, albumid) {
|
||||
ajaxUrl = baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + albumid;
|
||||
if (debug) { console.log(ajaxUrl) }
|
||||
$.ajax({
|
||||
url: baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + albumid,
|
||||
url: ajaxUrl,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function (data) {
|
||||
var title, artist, album, rating;
|
||||
if (data["subsonic-response"].directory !== undefined) {
|
||||
if (data["subsonic-response"].directory.child !== undefined) {
|
||||
// There is a bug in the API that doesn't return a JSON array for one artist
|
||||
var children = [];
|
||||
if (data["subsonic-response"].directory.child.length > 0) {
|
||||
|
@ -63,7 +62,7 @@ function playSong(el, songid, albumid) {
|
|||
}
|
||||
audio = soundManager.createSound({
|
||||
id: 'audio',
|
||||
url: baseURL + '/stream.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
|
||||
url: baseURL + '/stream.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
|
||||
stream: true,
|
||||
whileloading: function () {
|
||||
if (debug) { console.log('loaded:' + this.bytesLoaded + ' total:' + this.bytesTotal); }
|
||||
|
@ -136,13 +135,10 @@ function playSong(el, songid, albumid) {
|
|||
function scrobbleSong(submission) {
|
||||
var songid = $('#songdetails_song').attr('childid');
|
||||
$.ajax({
|
||||
url: baseURL + '/scrobble.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + songid + "&submission=" + submission,
|
||||
url: baseURL + '/scrobble.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + songid + "&submission=" + submission,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function () {
|
||||
if (submission) {
|
||||
scrobbled = true;
|
||||
|
@ -152,13 +148,10 @@ function scrobbleSong(submission) {
|
|||
}
|
||||
function rateSong(songid, rating) {
|
||||
$.ajax({
|
||||
url: baseURL + '/setRating.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + songid + "&rating=" + rating,
|
||||
url: baseURL + '/setRating.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + songid + "&rating=" + rating,
|
||||
method: 'GET',
|
||||
dataType: 'jsonp',
|
||||
timeout: 10000,
|
||||
beforeSend: function (req) {
|
||||
req.setRequestHeader('Authorization', auth);
|
||||
},
|
||||
success: function () {
|
||||
updateMessage('Rating Updated!');
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
// Tabs
|
||||
$(".tabcontent").hide(); //Hide all content
|
||||
if (!$.cookie('username') && !$.cookie('password') && !$.cookie('Server')) {
|
||||
if (!$.cookie('username') && !$.cookie('passwordenc') && !$.cookie('Server')) {
|
||||
$('ul.tabs li a').each(function () {
|
||||
if ($(this).attr("href") == '#tabPreferences') {
|
||||
$(this).addClass("active"); //Add "active" class to selected tab
|
||||
|
@ -88,10 +88,12 @@
|
|||
if (source != 'Search' && source != 'ChatMsg') {
|
||||
var unicode = e.charCode ? e.charCode : e.keyCode;
|
||||
// a-z
|
||||
if (unicode >= 65 && unicode <= 90) {
|
||||
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) {
|
||||
var key = findKeyForCode(unicode);
|
||||
var el = '#index_' + key.toUpperCase();
|
||||
$('#Artists').stop().scrollTo(el, 400);
|
||||
if ($(el).length > 0) {
|
||||
$('#Artists').stop().scrollTo(el, 400);
|
||||
}
|
||||
// right arrow
|
||||
} else if (unicode == 39 || unicode == 176) {
|
||||
var next = $('#CurrentPlaylistContainer tr.playing').next();
|
||||
|
@ -105,7 +107,7 @@
|
|||
// spacebar
|
||||
} else if (unicode == 32 || unicode == 179 || unicode == 0179) {
|
||||
playPauseSong();
|
||||
} else if (unicode == 36) {
|
||||
} else if (unicode == 36 && $('#tabLibrary').is(':visible')) {
|
||||
$('#Artists').stop().scrollTo('#auto', 400);
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +210,7 @@
|
|||
//$(this).addClass('playing').siblings().removeClass('playing');
|
||||
var songid = $(this).attr('childid');
|
||||
var albumid = $(this).attr('parentid');
|
||||
playSong('', this, songid, albumid);
|
||||
playSong(this, songid, albumid);
|
||||
});
|
||||
$('table.songlist tr.song a.play').live('click', function (event) {
|
||||
var songid = $(this).parent().parent().attr('childid');
|
||||
|
@ -233,11 +235,6 @@
|
|||
} else {
|
||||
playSong($(this).parent().parent(), songid, albumid);
|
||||
}
|
||||
/* 20120520 OwnCloud Merge
|
||||
var songid = $(this).parent().parent().attr('childid');
|
||||
var albumid = $(this).parent().parent().attr('parentid');
|
||||
playSong($(this).parent().parent(), songid, albumid);
|
||||
*/
|
||||
return false;
|
||||
});
|
||||
$('table.songlist tr.song a.download').live('click', function (event) {
|
||||
|
@ -530,7 +527,9 @@
|
|||
var username = $('#Username').val();
|
||||
var password = $('#Password').val();
|
||||
$.cookie('username', username, { expires: 365 });
|
||||
$.cookie('password', password, { expires: 365 });
|
||||
if (password != "") {
|
||||
$.cookie('passwordenc', 'enc:' + HexEncode(password), { expires: 365 });
|
||||
}
|
||||
var AutoAlbumSize = $('#AutoAlbumSize').val();
|
||||
var AutoPlaylistSize = $('#AutoPlaylistSize').val();
|
||||
$.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 });
|
||||
|
@ -629,4 +628,4 @@
|
|||
}
|
||||
}).disableSelection();
|
||||
|
||||
}); // End document.ready
|
||||
}); // End document.ready
|
Loading…
Add table
Add a link
Reference in a new issue