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>
|
<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>
|
<label for="Debug">Debug Mode</label>
|
||||||
<div class="clear"></div>
|
<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>
|
<label for="ForceFlash">Force Flash</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -216,6 +216,13 @@
|
||||||
<span class="changes"></span>
|
<span class="changes"></span>
|
||||||
</li>
|
</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>
|
<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>
|
<span class="changes">Added ability to force Flash on the sound plugin</span>
|
||||||
</li>
|
</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 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>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>
|
<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>
|
</ul>
|
||||||
<h3 class="title">Thanks</h3>
|
<h3 class="title">Thanks</h3>
|
||||||
<ul class="preferences">
|
<ul class="preferences">
|
||||||
|
|
26
js/app.js
26
js/app.js
|
@ -4,6 +4,10 @@ var audio;
|
||||||
var hostURL = location.href;
|
var hostURL = location.href;
|
||||||
var baseURL;
|
var baseURL;
|
||||||
var version;
|
var version;
|
||||||
|
var username;
|
||||||
|
var password;
|
||||||
|
var passwordenc;
|
||||||
|
var server;
|
||||||
|
|
||||||
//Sound manager
|
//Sound manager
|
||||||
soundManager.url = 'js/sm/swf';
|
soundManager.url = 'js/sm/swf';
|
||||||
|
@ -22,12 +26,15 @@ var s = getParameterByName('s');
|
||||||
if (u && p && s) {
|
if (u && p && s) {
|
||||||
if (!$.cookie('username')) {
|
if (!$.cookie('username')) {
|
||||||
$.cookie('username', u, { expires: 365 });
|
$.cookie('username', u, { expires: 365 });
|
||||||
|
username = u;
|
||||||
}
|
}
|
||||||
if (!$.cookie('password')) {
|
if (!$.cookie('password')) {
|
||||||
$.cookie('password', p, { expires: 365 });
|
$.cookie('password', p, { expires: 365 });
|
||||||
|
password = p;
|
||||||
}
|
}
|
||||||
if (!$.cookie('Server')) {
|
if (!$.cookie('Server')) {
|
||||||
$.cookie('Server', s, { expires: 365 });
|
$.cookie('Server', s, { expires: 365 });
|
||||||
|
baseURL = $.cookie('Server') + '/rest';
|
||||||
}
|
}
|
||||||
window.location.href = getPathFromUrl(window.location);
|
window.location.href = getPathFromUrl(window.location);
|
||||||
}
|
}
|
||||||
|
@ -40,13 +47,25 @@ if ($.cookie('ApplicationName')) {
|
||||||
} else {
|
} else {
|
||||||
applicationName = 'MiniSub';
|
applicationName = 'MiniSub';
|
||||||
}
|
}
|
||||||
var username = $.cookie('username');
|
if ($.cookie('username')) {
|
||||||
var password = $.cookie('password');
|
username = $.cookie('username');
|
||||||
|
}
|
||||||
|
if ($.cookie('passwordenc')) {
|
||||||
|
password = $.cookie('passwordenc');
|
||||||
|
} else {
|
||||||
|
if ($.cookie('password')) {
|
||||||
|
password = 'enc:' + HexEncode($.cookie('password'));
|
||||||
|
}
|
||||||
|
}
|
||||||
var auth = makeBaseAuth(username, 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';
|
var version = '1.6.0';
|
||||||
|
|
||||||
function loadTabContent(tab) {
|
function loadTabContent(tab) {
|
||||||
|
if (username && password) {
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case '#tabLibrary':
|
case '#tabLibrary':
|
||||||
if (debug) { console.log("TAG LIBRARY"); }
|
if (debug) { console.log("TAG LIBRARY"); }
|
||||||
|
@ -72,6 +91,7 @@ function loadTabContent(tab) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
113
js/libs/api.js
113
js/libs/api.js
|
@ -5,11 +5,11 @@ function loadArtists(id, refresh) {
|
||||||
}
|
}
|
||||||
var url;
|
var url;
|
||||||
if (id == "all") {
|
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) {
|
} 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 {
|
} 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); }
|
if (debug) { console.log(url); }
|
||||||
var content = $('#ArtistContainer').html();
|
var content = $('#ArtistContainer').html();
|
||||||
|
@ -75,13 +75,10 @@ function loadArtists(id, refresh) {
|
||||||
}
|
}
|
||||||
function getMusicFolders() {
|
function getMusicFolders() {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].musicFolders.musicFolder !== undefined) {
|
if (data["subsonic-response"].musicFolders.musicFolder !== undefined) {
|
||||||
// There is a bug in the API that doesn't return a JSON array for one artist
|
// 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) {
|
function getAlbums(id, action, appendto) {
|
||||||
$('.first').trigger('click');
|
$('.first').trigger('click');
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (action === '') {
|
if (action === '') {
|
||||||
$('#AlbumRows').empty();
|
$('#AlbumRows').empty();
|
||||||
|
@ -181,13 +175,10 @@ function getAlbumListBy(id) {
|
||||||
size = $.cookie('AutoAlbumSize');
|
size = $.cookie('AutoAlbumSize');
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].albumList.album !== undefined) {
|
if (data["subsonic-response"].albumList.album !== undefined) {
|
||||||
$("#AlbumRows").empty();
|
$("#AlbumRows").empty();
|
||||||
|
@ -230,13 +221,10 @@ function getRandomSongList(action, appendto) {
|
||||||
size = $.cookie('AutoPlaylistSize');
|
size = $.cookie('AutoPlaylistSize');
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].randomSongs.song !== undefined) {
|
if (data["subsonic-response"].randomSongs.song !== undefined) {
|
||||||
if (appendto === '#TrackContainer') {
|
if (appendto === '#TrackContainer') {
|
||||||
|
@ -285,13 +273,10 @@ function updateNowPlaying() {
|
||||||
updaterNowPlaying = $.periodic({ period: 4000, decay: 1.5, max_period: 1800000 }, function () {
|
updaterNowPlaying = $.periodic({ period: 4000, decay: 1.5, max_period: 1800000 }, function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
periodic: this,
|
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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].nowPlaying.entry === undefined) {
|
if (data["subsonic-response"].nowPlaying.entry === undefined) {
|
||||||
this.periodic.increment();
|
this.periodic.increment();
|
||||||
|
@ -334,13 +319,10 @@ function stopUpdateNowPlaying() {
|
||||||
|
|
||||||
function search(type, query) {
|
function search(type, query) {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].searchResult2 !== "") {
|
if (data["subsonic-response"].searchResult2 !== "") {
|
||||||
$("#AlbumRows").empty();
|
$("#AlbumRows").empty();
|
||||||
|
@ -398,13 +380,10 @@ function loadPlaylists(refresh) {
|
||||||
if (content === "") {
|
if (content === "") {
|
||||||
// Load Playlists
|
// Load Playlists
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var playlists = [];
|
var playlists = [];
|
||||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
||||||
|
@ -429,20 +408,19 @@ function loadPlaylists(refresh) {
|
||||||
function loadPlaylistsForMenu(menu) {
|
function loadPlaylistsForMenu(menu) {
|
||||||
$('#' + menu).empty();
|
$('#' + menu).empty();
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var playlists = [];
|
var playlists = [];
|
||||||
|
if (data["subsonic-response"].playlists.playlist !== undefined) {
|
||||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
||||||
playlists = data["subsonic-response"].playlists.playlist;
|
playlists = data["subsonic-response"].playlists.playlist;
|
||||||
} else {
|
} else {
|
||||||
playlists[0] = data["subsonic-response"].playlists.playlist;
|
playlists[0] = data["subsonic-response"].playlists.playlist;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (menu === 'submenu_AddCurrentToPlaylist') {
|
if (menu === 'submenu_AddCurrentToPlaylist') {
|
||||||
$("<a href=\"#\" onclick=\"javascript:addToPlaylist('new', 'current'); return false;\">+ New</a><br />").appendTo("#" + menu);
|
$("<a href=\"#\" onclick=\"javascript:addToPlaylist('new', 'current'); return false;\">+ New</a><br />").appendTo("#" + menu);
|
||||||
} else {
|
} else {
|
||||||
|
@ -462,15 +440,12 @@ function loadPlaylistsForMenu(menu) {
|
||||||
}
|
}
|
||||||
function newPlaylist() {
|
function newPlaylist() {
|
||||||
var reply = prompt("Choose a name for your new playlist.", "");
|
var reply = prompt("Choose a name for your new playlist.", "");
|
||||||
if (reply) {
|
if (reply != null || reply != "") {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
loadPlaylists(true);
|
loadPlaylists(true);
|
||||||
}
|
}
|
||||||
|
@ -479,13 +454,10 @@ function newPlaylist() {
|
||||||
}
|
}
|
||||||
function deletePlaylist(id) {
|
function deletePlaylist(id) {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
loadPlaylists(true);
|
loadPlaylists(true);
|
||||||
$('#TrackContainer tbody').empty();
|
$('#TrackContainer tbody').empty();
|
||||||
|
@ -508,13 +480,10 @@ function addToPlaylist(playlistid, from) {
|
||||||
// Get songs from playlist
|
// Get songs from playlist
|
||||||
var currentsongs = [];
|
var currentsongs = [];
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
// There is a bug in the API that doesn't return a JSON array for one artist
|
// There is a bug in the API that doesn't return a JSON array for one artist
|
||||||
var children = [];
|
var children = [];
|
||||||
|
@ -539,13 +508,10 @@ function addToPlaylist(playlistid, from) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseURL + '/createPlaylist.view',
|
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs },
|
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs },
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
$('table.songlist tr.song').each(function () {
|
$('table.songlist tr.song').each(function () {
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
|
@ -559,15 +525,13 @@ function addToPlaylist(playlistid, from) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var reply = prompt("Choose a name for your new playlist.", "");
|
var reply = prompt("Choose a name for your new playlist.", "");
|
||||||
|
if (reply) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseURL + '/createPlaylist.view',
|
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", name: "" + reply + "", songId: selected },
|
data: { v: version, c: applicationName, f: "jsonp", name: "" + reply + "", songId: selected },
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
$('table.songlist tr.song').each(function () {
|
$('table.songlist tr.song').each(function () {
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
|
@ -577,6 +541,7 @@ function addToPlaylist(playlistid, from) {
|
||||||
traditional: true // Fixes POST with an array in JQuery 1.4
|
traditional: true // Fixes POST with an array in JQuery 1.4
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setTimeout(function () { $('div.submenu').fadeOut(); }, 100);
|
setTimeout(function () { $('div.submenu').fadeOut(); }, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,25 +575,9 @@ function downloadItem(id, type) {
|
||||||
reqDownload = 'playlistUtf8Hex=' + id;
|
reqDownload = 'playlistUtf8Hex=' + id;
|
||||||
}
|
}
|
||||||
if (reqDownload) {
|
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;
|
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) {
|
function savePlaylist(playlistid) {
|
||||||
var songs = [];
|
var songs = [];
|
||||||
|
@ -638,13 +587,10 @@ function savePlaylist(playlistid) {
|
||||||
if (songs.length > 0) {
|
if (songs.length > 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseURL + '/createPlaylist.view',
|
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: songs },
|
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: songs },
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
getPlaylist(playlistid);
|
getPlaylist(playlistid);
|
||||||
updateMessage('Playlist Updated!');
|
updateMessage('Playlist Updated!');
|
||||||
|
@ -655,13 +601,10 @@ function savePlaylist(playlistid) {
|
||||||
}
|
}
|
||||||
function getPlaylist(id, action, appendto) {
|
function getPlaylist(id, action, appendto) {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].playlist.entry !== undefined) {
|
if (data["subsonic-response"].playlist.entry !== undefined) {
|
||||||
if (appendto === '#TrackContainer tbody') {
|
if (appendto === '#TrackContainer tbody') {
|
||||||
|
@ -682,6 +625,7 @@ function getPlaylist(id, action, appendto) {
|
||||||
|
|
||||||
var rowcolor;
|
var rowcolor;
|
||||||
var html;
|
var html;
|
||||||
|
var count = children.length;
|
||||||
$.each(children, function (i, child) {
|
$.each(children, function (i, child) {
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
rowcolor = 'even';
|
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 = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, child.artist, child.album, child.coverArt, child.userRating, time['m'], time['s']);
|
||||||
$(html).appendTo(appendto);
|
$(html).appendTo(appendto);
|
||||||
});
|
});
|
||||||
|
updateMessage(count + ' Songs');
|
||||||
if (appendto === '#CurrentPlaylistContainer tbody') {
|
if (appendto === '#CurrentPlaylistContainer tbody') {
|
||||||
updateMessage(children.length + ' Song(s) Added');
|
updateMessage(children.length + ' Song(s) Added');
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,10 @@ function updateChatMessages() {
|
||||||
updater = $.periodic({ period: 1000, decay: 1.5, max_period: 1800000 }, function () {
|
updater = $.periodic({ period: 1000, decay: 1.5, max_period: 1800000 }, function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
periodic: this,
|
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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data["subsonic-response"].chatMessages.chatMessage === undefined) {
|
if (data["subsonic-response"].chatMessages.chatMessage === undefined) {
|
||||||
this.periodic.increment();
|
this.periodic.increment();
|
||||||
|
@ -51,13 +48,10 @@ function stopUpdateChatMessages() {
|
||||||
function addChatMessage(msg) {
|
function addChatMessage(msg) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: baseURL + '/addChatMessage.view',
|
url: baseURL + '/addChatMessage.view?u=' + username + '&p=' + password,
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
data: { u: username, p: passwordenc, v: version, c: applicationName, f: "jsonp", message: msg },
|
data: { v: version, c: applicationName, f: "jsonp", message: msg },
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
updater.reset();
|
updater.reset();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
var scrobbled = false;
|
var scrobbled = false;
|
||||||
function playSong(el, songid, albumid) {
|
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({
|
$.ajax({
|
||||||
url: baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + passwordenc + '&v=' + version + '&c=' + applicationName + '&f=jsonp&id=' + albumid,
|
url: ajaxUrl,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var title, artist, album, rating;
|
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
|
// There is a bug in the API that doesn't return a JSON array for one artist
|
||||||
var children = [];
|
var children = [];
|
||||||
if (data["subsonic-response"].directory.child.length > 0) {
|
if (data["subsonic-response"].directory.child.length > 0) {
|
||||||
|
@ -63,7 +62,7 @@ function playSong(el, songid, albumid) {
|
||||||
}
|
}
|
||||||
audio = soundManager.createSound({
|
audio = soundManager.createSound({
|
||||||
id: 'audio',
|
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,
|
stream: true,
|
||||||
whileloading: function () {
|
whileloading: function () {
|
||||||
if (debug) { console.log('loaded:' + this.bytesLoaded + ' total:' + this.bytesTotal); }
|
if (debug) { console.log('loaded:' + this.bytesLoaded + ' total:' + this.bytesTotal); }
|
||||||
|
@ -136,13 +135,10 @@ function playSong(el, songid, albumid) {
|
||||||
function scrobbleSong(submission) {
|
function scrobbleSong(submission) {
|
||||||
var songid = $('#songdetails_song').attr('childid');
|
var songid = $('#songdetails_song').attr('childid');
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
if (submission) {
|
if (submission) {
|
||||||
scrobbled = true;
|
scrobbled = true;
|
||||||
|
@ -152,13 +148,10 @@ function scrobbleSong(submission) {
|
||||||
}
|
}
|
||||||
function rateSong(songid, rating) {
|
function rateSong(songid, rating) {
|
||||||
$.ajax({
|
$.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',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
beforeSend: function (req) {
|
|
||||||
req.setRequestHeader('Authorization', auth);
|
|
||||||
},
|
|
||||||
success: function () {
|
success: function () {
|
||||||
updateMessage('Rating Updated!');
|
updateMessage('Rating Updated!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
// Tabs
|
// Tabs
|
||||||
$(".tabcontent").hide(); //Hide all content
|
$(".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 () {
|
$('ul.tabs li a').each(function () {
|
||||||
if ($(this).attr("href") == '#tabPreferences') {
|
if ($(this).attr("href") == '#tabPreferences') {
|
||||||
$(this).addClass("active"); //Add "active" class to selected tab
|
$(this).addClass("active"); //Add "active" class to selected tab
|
||||||
|
@ -88,10 +88,12 @@
|
||||||
if (source != 'Search' && source != 'ChatMsg') {
|
if (source != 'Search' && source != 'ChatMsg') {
|
||||||
var unicode = e.charCode ? e.charCode : e.keyCode;
|
var unicode = e.charCode ? e.charCode : e.keyCode;
|
||||||
// a-z
|
// a-z
|
||||||
if (unicode >= 65 && unicode <= 90) {
|
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) {
|
||||||
var key = findKeyForCode(unicode);
|
var key = findKeyForCode(unicode);
|
||||||
var el = '#index_' + key.toUpperCase();
|
var el = '#index_' + key.toUpperCase();
|
||||||
|
if ($(el).length > 0) {
|
||||||
$('#Artists').stop().scrollTo(el, 400);
|
$('#Artists').stop().scrollTo(el, 400);
|
||||||
|
}
|
||||||
// right arrow
|
// right arrow
|
||||||
} else if (unicode == 39 || unicode == 176) {
|
} else if (unicode == 39 || unicode == 176) {
|
||||||
var next = $('#CurrentPlaylistContainer tr.playing').next();
|
var next = $('#CurrentPlaylistContainer tr.playing').next();
|
||||||
|
@ -105,7 +107,7 @@
|
||||||
// spacebar
|
// spacebar
|
||||||
} else if (unicode == 32 || unicode == 179 || unicode == 0179) {
|
} else if (unicode == 32 || unicode == 179 || unicode == 0179) {
|
||||||
playPauseSong();
|
playPauseSong();
|
||||||
} else if (unicode == 36) {
|
} else if (unicode == 36 && $('#tabLibrary').is(':visible')) {
|
||||||
$('#Artists').stop().scrollTo('#auto', 400);
|
$('#Artists').stop().scrollTo('#auto', 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +210,7 @@
|
||||||
//$(this).addClass('playing').siblings().removeClass('playing');
|
//$(this).addClass('playing').siblings().removeClass('playing');
|
||||||
var songid = $(this).attr('childid');
|
var songid = $(this).attr('childid');
|
||||||
var albumid = $(this).attr('parentid');
|
var albumid = $(this).attr('parentid');
|
||||||
playSong('', this, songid, albumid);
|
playSong(this, songid, albumid);
|
||||||
});
|
});
|
||||||
$('table.songlist tr.song a.play').live('click', function (event) {
|
$('table.songlist tr.song a.play').live('click', function (event) {
|
||||||
var songid = $(this).parent().parent().attr('childid');
|
var songid = $(this).parent().parent().attr('childid');
|
||||||
|
@ -233,11 +235,6 @@
|
||||||
} else {
|
} else {
|
||||||
playSong($(this).parent().parent(), songid, albumid);
|
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;
|
return false;
|
||||||
});
|
});
|
||||||
$('table.songlist tr.song a.download').live('click', function (event) {
|
$('table.songlist tr.song a.download').live('click', function (event) {
|
||||||
|
@ -530,7 +527,9 @@
|
||||||
var username = $('#Username').val();
|
var username = $('#Username').val();
|
||||||
var password = $('#Password').val();
|
var password = $('#Password').val();
|
||||||
$.cookie('username', username, { expires: 365 });
|
$.cookie('username', username, { expires: 365 });
|
||||||
$.cookie('password', password, { expires: 365 });
|
if (password != "") {
|
||||||
|
$.cookie('passwordenc', 'enc:' + HexEncode(password), { expires: 365 });
|
||||||
|
}
|
||||||
var AutoAlbumSize = $('#AutoAlbumSize').val();
|
var AutoAlbumSize = $('#AutoAlbumSize').val();
|
||||||
var AutoPlaylistSize = $('#AutoPlaylistSize').val();
|
var AutoPlaylistSize = $('#AutoPlaylistSize').val();
|
||||||
$.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 });
|
$.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue