2.1.7 Small Tweaks

This commit is contained in:
Trevor Squillario 2012-10-13 13:48:39 -04:00
parent aefc7d04ba
commit db8cb0865a
9 changed files with 189 additions and 130 deletions

View file

@ -11,14 +11,46 @@ var server;
var smwidth; var smwidth;
var volume = 50; var volume = 50;
function getCookie(value) {
if ($.cookie(value)) {
return $.cookie(value);
} else {
return false;
}
/* jQuery.cookies.js
if (browserStorageCheck) {
var item = localStorage.getItem(value);
if (item != '' && item != undefined) {
return true;
} else {
return false;
}
} else {
if (debug) { console.log('HTML5::loadStorage not supported on your browser' + html.length + ' characters'); }
}
*/
}
function setCookie(key, value) {
$.cookie(key, value, { expires: 365 });
/* jQuery.cookies.js
try {
if (debug) { console.log('Saving : ' + key + ':' + value); }
localStorage.setItem(key, value);
} catch (e) {
if (e == QUOTA_EXCEEDED_ERR) {
alert('Quota exceeded!');
}
}
*/
}
//Sound manager //Sound manager
soundManager.url = 'js/sm/swf'; soundManager.url = 'js/sm/swf';
if ($.cookie('ForceFlash')) { if (getCookie('ForceFlash')) {
soundManager.preferFlash = true; soundManager.preferFlash = true;
} else { } else {
soundManager.preferFlash = false; soundManager.preferFlash = false;
} }
soundManager.debugMode = false;
soundManager.useHTML5Audio = true; soundManager.useHTML5Audio = true;
// Set auth cookies if specified in URL on launch // Set auth cookies if specified in URL on launch
@ -26,43 +58,43 @@ var u = getParameterByName('u');
var p = getParameterByName('p'); var p = getParameterByName('p');
var s = getParameterByName('s'); var s = getParameterByName('s');
if (u && p && s) { if (u && p && s) {
if (!$.cookie('username')) { if (!getCookie('username')) {
$.cookie('username', u, { expires: 365 }); setCookie('username', u);
username = u; username = u;
} }
if (!$.cookie('passwordenc')) { if (!getCookie('passwordenc')) {
$.cookie('passwordenc', p, { expires: 365 }); setCookie('passwordenc', p);
password = p; password = p;
} }
if (!$.cookie('Server')) { if (!getCookie('Server')) {
$.cookie('Server', s, { expires: 365 }); setCookie('Server', s, { expires: 365 });
baseURL = $.cookie('Server') + '/rest'; baseURL = getCookie('Server') + '/rest';
} }
window.location.href = getPathFromUrl(window.location); window.location.href = getPathFromUrl(window.location);
} }
if ($.cookie('Server')) { if (getCookie('Server')) {
baseURL = $.cookie('Server') + '/rest'; baseURL = getCookie('Server') + '/rest';
} }
var applicationName; var applicationName;
if ($.cookie('ApplicationName')) { if (getCookie('ApplicationName')) {
applicationName = $.cookie('ApplicationName'); applicationName = getCookie('ApplicationName');
} else { } else {
applicationName = 'MiniSub'; applicationName = 'MiniSub';
} }
if ($.cookie('username')) { if (getCookie('username')) {
username = $.cookie('username'); username = getCookie('username');
} }
if ($.cookie('passwordenc')) { if (getCookie('passwordenc')) {
password = $.cookie('passwordenc'); password = getCookie('passwordenc');
} else { } else {
if ($.cookie('password')) { if (getCookie('password')) {
password = 'enc:' + HexEncode($.cookie('password')); password = 'enc:' + HexEncode(getCookie('password'));
} }
} }
var auth = makeBaseAuth(username, password); var auth = makeBaseAuth(username, password);
if ($.cookie('password')) { if (getCookie('password')) {
$.cookie('passwordenc', 'enc:' + HexEncode($.cookie('password')), { expires: 365 }); setCookie('passwordenc', 'enc:' + HexEncode(getCookie('password')));
$.cookie('password', null); setCookie('password', null);
} }
var version = '1.6.0'; var version = '1.6.0';
@ -71,8 +103,8 @@ function loadTabContent(tab) {
switch (tab) { switch (tab) {
case '#tabLibrary': case '#tabLibrary':
if (debug) { console.log("TAG LIBRARY"); } if (debug) { console.log("TAG LIBRARY"); }
if ($.cookie('MusicFolders')) { if (getCookie('MusicFolders')) {
loadArtists($.cookie('MusicFolders'), false); loadArtists(getCookie('MusicFolders'), false);
} else { } else {
loadArtists(); loadArtists();
} }
@ -110,3 +142,5 @@ function loadTabContent(tab) {

View file

@ -125,7 +125,7 @@ function getMusicFolders() {
folders[0] = data["subsonic-response"].musicFolders.musicFolder; folders[0] = data["subsonic-response"].musicFolders.musicFolder;
} }
var savedMusicFolder = $.cookie('MusicFolders'); var savedMusicFolder = getCookie('MusicFolders');
var options = []; var options = [];
options.push('<option value="all">All Folders</option>'); options.push('<option value="all">All Folders</option>');
$.each(folders, function (i, folder) { $.each(folders, function (i, folder) {
@ -158,7 +158,7 @@ function loadAutoPlaylists(refresh) {
} }
var content = $('#AutoPlaylistContainer').html(); var content = $('#AutoPlaylistContainer').html();
if (content === "") { if (content === "") {
var genres = $.cookie('AutoPlaylists'); var genres = getCookie('AutoPlaylists');
var genresArr = []; var genresArr = [];
if (genres) { if (genres) {
genresArr = genres.split(','); genresArr = genres.split(',');
@ -237,10 +237,10 @@ function getAlbums(id, action, appendto) {
} }
function getAlbumListBy(id) { function getAlbumListBy(id) {
var size; var size;
if ($.cookie('AutoAlbumSize') === null) { if (getCookie('AutoAlbumSize') === null) {
size = 15; size = 15;
} else { } else {
size = $.cookie('AutoAlbumSize'); size = getCookie('AutoAlbumSize');
} }
$.ajax({ $.ajax({
url: baseURL + '/getAlbumList.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id, url: baseURL + '/getAlbumList.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id,
@ -285,8 +285,8 @@ function getAlbumListBy(id) {
function getRandomSongList(action, appendto, genre, folder) { function getRandomSongList(action, appendto, genre, folder) {
var size, gstring; var size, gstring;
gstring = ''; gstring = '';
if ($.cookie('AutoPlaylistSize')) { if (getCookie('AutoPlaylistSize')) {
size = $.cookie('AutoPlaylistSize'); size = getCookie('AutoPlaylistSize');
} else { } else {
size = 25; size = 25;
} }
@ -296,7 +296,7 @@ function getRandomSongList(action, appendto, genre, folder) {
if (genre == 'Random') { if (genre == 'Random') {
gstring = ''; gstring = '';
} }
if (folder !== undefined) { if (folder !== undefined && folder != '') {
gstring = '&musicFolderId=' + folder; gstring = '&musicFolderId=' + folder;
} }
if (genre == 'Starred') { if (genre == 'Starred') {
@ -334,10 +334,11 @@ function getRandomSongList(action, appendto, genre, folder) {
} else { } else {
rowcolor = 'odd'; rowcolor = 'odd';
} }
var track, starred; var track, starred, duration;
if (item.starred !== undefined) { starred = true; } else { starred = false; } if (item.starred !== undefined) { starred = true; } else { starred = false; }
if (item.track === undefined) { track = "&nbsp;"; } else { track = item.track; } if (item.track === undefined) { track = "&nbsp;"; } else { track = item.track; }
html = generateSongHTML(rowcolor, item.id, item.parent, track, item.title, '', item.artist, item.album, item.coverArt, item.userRating, starred, item.duration); if (item.duration !== undefined) { duration = item.duration; } else { duration = ''; }
html = generateSongHTML(rowcolor, item.id, item.parent, track, item.title, '', item.artist, item.album, item.coverArt, item.userRating, starred, duration);
$(html).appendTo(appendto); $(html).appendTo(appendto);
}); });
if (appendto === '#TrackContainer tbody') { if (appendto === '#TrackContainer tbody') {
@ -360,8 +361,8 @@ function getRandomSongList(action, appendto, genre, folder) {
} }
function getStarred(action, appendto, type) { function getStarred(action, appendto, type) {
var size; var size;
if ($.cookie('AutoPlaylistSize')) { if (getCookie('AutoPlaylistSize')) {
size = $.cookie('AutoPlaylistSize'); size = getCookie('AutoPlaylistSize');
} else { } else {
size = 25; size = 25;
} }
@ -501,7 +502,7 @@ function updateNowPlaying(showPopup) {
} else { } else {
coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=json&size=50&id=' + msg.coverArt; coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=json&size=50&id=' + msg.coverArt;
} }
if ($.cookie('Notification_NowPlaying')) { if (getCookie('Notification_NowPlaying')) {
var sid = msg.username + '-' + msg.id; var sid = msg.username + '-' + msg.id;
if (jQuery.inArray(sid, updaterNowPlayingIdList) === -1 && username != msg.username) { if (jQuery.inArray(sid, updaterNowPlayingIdList) === -1 && username != msg.username) {
showNotification(coverartSrc, toHTML.un(msg.username + ':' + msg.playerName), toHTML.un(msg.artist + ' - ' + msg.title), 'text'); showNotification(coverartSrc, toHTML.un(msg.username + ':' + msg.playerName), toHTML.un(msg.artist + ' - ' + msg.title), 'text');
@ -562,10 +563,11 @@ function search(type, query) {
if (isDir === true) { if (isDir === true) {
albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating, starred); albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating, starred);
} else { } else {
var track, starred; var track, starred, duration;
if (child.starred !== undefined) { starred = true; } else { starred = false; } if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; } if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; }
albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, child.duration); if (child.duration !== undefined) { duration = child.duration; } else { duration = ''; }
albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, duration);
} }
$(albumhtml).appendTo("#AlbumRows"); $(albumhtml).appendTo("#AlbumRows");
}); });
@ -821,7 +823,7 @@ function countCurrentPlaylist(container) {
var time = 0; var time = 0;
$(container + ' tr.song').each(function (index) { $(container + ' tr.song').each(function (index) {
var duration = $(this).attr('duration'); var duration = $(this).attr('duration');
if (duration !== undefined && duration != '') { if (duration != '') {
time += parseInt(duration); time += parseInt(duration);
} }
}); });
@ -851,7 +853,7 @@ function saveCurrentPlaylist() {
function deleteCurrentPlaylist() { function deleteCurrentPlaylist() {
if (browserStorageCheck) { if (browserStorageCheck) {
localStorage.removeItem('CurrentPlaylist'); localStorage.removeItem('CurrentPlaylist');
$.cookie('CurrentSong', null); setCookie('CurrentSong', null);
if (debug) { console.log('Removing Current Playlist'); } if (debug) { console.log('Removing Current Playlist'); }
} else { } else {
if (debug) { console.log('HTML5::loadStorage not supported on your browser' + html.length + ' characters'); } if (debug) { console.log('HTML5::loadStorage not supported on your browser' + html.length + ' characters'); }
@ -935,10 +937,11 @@ function getPlaylist(id, action, appendto) {
} else { } else {
rowcolor = 'odd'; rowcolor = 'odd';
} }
var track, starred; var track, starred, duration;
if (child.starred !== undefined) { starred = true; } else { starred = false; } if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; } if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; }
html = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, child.duration); if (child.duration !== undefined) { duration = child.duration; } else { duration = ''; }
html = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, duration);
$(html).appendTo(appendto); $(html).appendTo(appendto);
}); });
if (appendto === '#TrackContainer tbody') { if (appendto === '#TrackContainer tbody') {
@ -1047,10 +1050,11 @@ function getPodcast(id, action, appendto) {
var description = 'Published: ' + date + '\n\n'; var description = 'Published: ' + date + '\n\n';
description += child.description; description += child.description;
var starred; var starred, duration;
if (child.starred !== undefined) { starred = true; } else { starred = false; } if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (child.duration !== undefined) { duration = child.duration; } else { duration = ''; }
var time = secondsToTime(child.duration); var time = secondsToTime(child.duration);
html = generateSongHTML(rowcolor, child.streamId, child.parent, child.track, child.title, description, child.artist, child.album, child.coverArt, child.userRating, starred, child.duration); html = generateSongHTML(rowcolor, child.streamId, child.parent, child.track, child.title, description, child.artist, child.album, child.coverArt, child.userRating, starred, duration);
$(html).appendTo(appendto); $(html).appendTo(appendto);
count++; count++;
}); });

View file

@ -1,13 +1,14 @@
function generateRowHTML(child, appendto, rowcolor) { function generateRowHTML(child, appendto, rowcolor) {
var albumhtml, isDir, starred, i; var albumhtml, isDir, starred, duration, i;
isDir = child.isDir; isDir = child.isDir;
if (child.starred !== undefined) { starred = true; } else { starred = false; } if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (child.duration !== undefined) { duration = child.duration; } else { duration = ''; }
if (isDir === true) { if (isDir === true) {
albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating, starred); albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist, child.userRating, starred);
} else { } else {
var track; var track;
if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; } if (child.track === undefined) { track = "&nbsp;"; } else { track = child.track; }
albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, child.duration); albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, '', child.artist, child.album, child.coverArt, child.userRating, starred, duration);
} }
return albumhtml; return albumhtml;
} }
@ -44,7 +45,12 @@ function generateSongHeaderHTML() {
return html; return html;
} }
function generateSongHTML(rowcolor, childid, parentid, track, title, description, artist, album, coverart, rating, starred, duration) { function generateSongHTML(rowcolor, childid, parentid, track, title, description, artist, album, coverart, rating, starred, duration) {
var time = secondsToTime(duration); var time;
if (duration == '') {
time = '00:00'
} else {
time = secondsToTime(duration);
}
var html; var html;
html = '<tr class=\"song ' + rowcolor + '\" id=\"' + childid + '\" childid=\"' + childid + '\" parentid=\"' + parentid + '\" duration=\"' + duration + '\" userrating=\"' + rating + '\">'; html = '<tr class=\"song ' + rowcolor + '\" id=\"' + childid + '\" childid=\"' + childid + '\" parentid=\"' + parentid + '\" duration=\"' + duration + '\" userrating=\"' + rating + '\">';
html += '<td class=\"itemactions\"><a class=\"add\" href=\"\" title=\"Add To Current Playlist\"></a>'; html += '<td class=\"itemactions\"><a class=\"add\" href=\"\" title=\"Add To Current Playlist\"></a>';

View file

@ -128,7 +128,7 @@ function playSong(el, songid, albumid, position, loadonly) {
onfinish: function () { onfinish: function () {
var next = $('#CurrentPlaylistContainer tr.playing').next(); var next = $('#CurrentPlaylistContainer tr.playing').next();
if (!changeTrack(next)) { if (!changeTrack(next)) {
if ($.cookie('AutoPilot')) { if (getCookie('AutoPilot')) {
//var genre = $(this).data('genre'); //var genre = $(this).data('genre');
//var folder = $(this).data('folder'); //var folder = $(this).data('folder');
getRandomSongList('', '#CurrentPlaylistContainer tbody', '', ''); getRandomSongList('', '#CurrentPlaylistContainer tbody', '', '');
@ -161,10 +161,10 @@ function playSong(el, songid, albumid, position, loadonly) {
scrobbleSong(false); scrobbleSong(false);
scrobbled = false; scrobbled = false;
if ($.cookie('Notification_Song')) { if (getCookie('Notification_Song')) {
showNotification(coverartSrc, toHTML.un(title), toHTML.un(artist + ' - ' + album), 'text'); showNotification(coverartSrc, toHTML.un(title), toHTML.un(artist + ' - ' + album), 'text');
} }
if ($.cookie('ScrollTitle')) { if (getCookie('ScrollTitle')) {
scrollTitle(toHTML.un(artist) + ' - ' + toHTML.un(title)); scrollTitle(toHTML.un(artist) + ' - ' + toHTML.un(title));
} else { } else {
setTitle(toHTML.un(artist) + ' - ' + toHTML.un(title)); setTitle(toHTML.un(artist) + ' - ' + toHTML.un(title));
@ -254,8 +254,8 @@ function playPauseSong() {
var el = $('#songdetails_song'); var el = $('#songdetails_song');
var songid = el.attr('childid'); var songid = el.attr('childid');
if (songid != '') { if (songid != '') {
if ($.cookie("CurrentSong")) { if (getCookie("CurrentSong")) {
var currentSong = JSON.parse($.cookie("CurrentSong")); var currentSong = JSON.parse(getCookie("CurrentSong"));
playSong($('#' + songid), currentSong.songid, currentSong.albumid, currentSong.position, false); playSong($('#' + songid), currentSong.songid, currentSong.albumid, currentSong.position, false);
var playing = $('#' + songid); var playing = $('#' + songid);
if (playing != undefined) { if (playing != undefined) {
@ -333,7 +333,7 @@ function saveTrackPosition() {
albumid: albumid, albumid: albumid,
position: position position: position
}; };
$.cookie('CurrentSong', JSON.stringify(currentSong)); setCookie('CurrentSong', JSON.stringify(currentSong));
saveCurrentPlaylist(); saveCurrentPlaylist();
} }
} }

View file

@ -1,16 +1,16 @@
$(window).load(function () { $(window).load(function () {
if ($.cookie('defaultsmwidth')) { if (getCookie('defaultsmwidth')) {
var width = $.cookie('defaultsmwidth'); var width = getCookie('defaultsmwidth');
smwidth = width; smwidth = width;
resizeSMSection(width); resizeSMSection(width);
} }
if ($.cookie('sidebar') && $.cookie('username') && $.cookie('passwordenc')) { if (getCookie('sidebar') && getCookie('username') && getCookie('passwordenc')) {
$('#SideBar').show(); $('#SideBar').show();
updateChatMessages(); updateChatMessages();
updateNowPlaying(); updateNowPlaying();
} }
if ($.cookie('HideAZ')) { if (getCookie('HideAZ')) {
$('#BottomContainer').hide(); $('#BottomContainer').hide();
} }
$('ul#ChangeLog li.log').each(function (i, el) { $('ul#ChangeLog li.log').each(function (i, el) {
@ -18,9 +18,9 @@
$(el).hide(); $(el).hide();
} }
}); });
if ($.cookie('SaveTrackPosition')) { if (getCookie('SaveTrackPosition')) {
window.setInterval(function () { window.setInterval(function () {
if ($.cookie('SaveTrackPosition')) { if (getCookie('SaveTrackPosition')) {
var sm = soundManager.getSoundById('audio'); var sm = soundManager.getSoundById('audio');
if (sm !== undefined) { if (sm !== undefined) {
saveTrackPosition(); saveTrackPosition();
@ -28,8 +28,8 @@
} }
}, 5000); }, 5000);
} }
if ($.cookie('CurrentSong')) { if (getCookie('CurrentSong')) {
var currentSong = JSON.parse($.cookie("CurrentSong")); var currentSong = JSON.parse(getCookie("CurrentSong"));
playSong(null, currentSong.songid, currentSong.albumid, currentSong.position, true); playSong(null, currentSong.songid, currentSong.albumid, currentSong.position, true);
loadCurrentPlaylist(); loadCurrentPlaylist();
} }
@ -48,7 +48,7 @@ function resizeContent() {
var smheight = $('.smsection').height(); var smheight = $('.smsection').height();
var smwidth = $('.smsection').width(); var smwidth = $('.smsection').width();
$('#BottomContainer').css({ 'top': smheight + 35 + 'px' }); $('#BottomContainer').css({ 'top': smheight + 35 + 'px' });
if ($.cookie('sidebar')) { if (getCookie('sidebar')) {
var tabwidth = $(window).width() - 264; var tabwidth = $(window).width() - 264;
if (tabwidth >= 700) { if (tabwidth >= 700) {
$('.tabcontent').css({ 'width': tabwidth + 'px' }); $('.tabcontent').css({ 'width': tabwidth + 'px' });
@ -76,7 +76,7 @@ function resizeSMSection(x) {
$('.smsection').css({ 'width': (newsmwidth) + 'px' }); $('.smsection').css({ 'width': (newsmwidth) + 'px' });
$('.actions').css({ 'width': (newsmwidth - 5) + 'px' }); $('.actions').css({ 'width': (newsmwidth - 5) + 'px' });
$('#BottomContainer').css({ 'width': (newsmwidth - 23) + 'px' }); $('#BottomContainer').css({ 'width': (newsmwidth - 23) + 'px' });
$.cookie('defaultsmwidth', newwidth, { expires: 365, path: '/' }); setCookie('defaultsmwidth', newwidth);
var ulwidth = newsmwidth + 6; var ulwidth = newsmwidth + 6;
$('#AlbumContainer, #TrackContainer, #PodcastContainer').css({ 'margin-left': ulwidth + 'px' }); $('#AlbumContainer, #TrackContainer, #PodcastContainer').css({ 'margin-left': ulwidth + 'px' });
} }

View file

@ -1,63 +1,63 @@
$(document).ready(function () { $(document).ready(function () {
//User config staff //User config staff
$('#Username').val($.cookie('username')); if (getCookie('username')) { $('#Username').val(getCookie('username')); }
//$('#Password').val($.cookie('passwordenc')); //$('#Password').val(getCookie('passwordenc'));
$('#AutoPlaylists').val($.cookie('AutoPlaylists')); if (getCookie('AutoPlaylists')) { $('#AutoPlaylists').val(getCookie('AutoPlaylists')); }
$('#AutoAlbumSize').val($.cookie('AutoAlbumSize')); if (getCookie('AutoAlbumSize')) { $('#AutoAlbumSize').val(getCookie('AutoAlbumSize')); }
$('#AutoPlaylistSize').val($.cookie('AutoPlaylistSize')); if (getCookie('AutoPlaylistSize')) { $('#AutoPlaylistSize').val(getCookie('AutoPlaylistSize')); }
$('#Server').val($.cookie('Server')); if (getCookie('Server')) { $('#Server').val(getCookie('Server')); }
$('#ApplicationName').val($.cookie('ApplicationName')); if (getCookie('ApplicationName')) { $('#ApplicationName').val(getCookie('ApplicationName')); }
// Set Preferences defaults // Set Preferences defaults
if ($.cookie('Theme')) { if (getCookie('Theme')) {
$('#Theme').val($.cookie('Theme')); $('#Theme').val(getCookie('Theme'));
var theme = $.cookie('Theme'); var theme = getCookie('Theme');
switchTheme(theme); switchTheme(theme);
} }
if ($.cookie('HideAZ')) { if (getCookie('HideAZ')) {
$('#HideAZ').attr('checked', true); $('#HideAZ').attr('checked', true);
} else { } else {
$('#HideAZ').attr('checked', false); $('#HideAZ').attr('checked', false);
} }
if ($.cookie('Notification_Song')) { if (getCookie('Notification_Song')) {
$('#Notification_Song').attr('checked', true); $('#Notification_Song').attr('checked', true);
} else { } else {
$('#Notification_Song').attr('checked', false); $('#Notification_Song').attr('checked', false);
} }
if ($.cookie('Notification_NowPlaying')) { if (getCookie('Notification_NowPlaying')) {
$('#Notification_NowPlaying').attr('checked', true); $('#Notification_NowPlaying').attr('checked', true);
} else { } else {
$('#Notification_NowPlaying').attr('checked', false); $('#Notification_NowPlaying').attr('checked', false);
} }
if ($.cookie('ScrollTitle')) { if (getCookie('ScrollTitle')) {
$('#ScrollTitle').attr('checked', true); $('#ScrollTitle').attr('checked', true);
} else { } else {
$('#ScrollTitle').attr('checked', false); $('#ScrollTitle').attr('checked', false);
} }
if ($.cookie('Debug')) { if (getCookie('Debug')) {
$('#Debug').attr('checked', true); $('#Debug').attr('checked', true);
debug = true; debug = true;
soundManager.debugMode = true; soundManager.debugMode = true;
} else { } else {
$('#Debug').attr('checked', false); $('#Debug').attr('checked', false);
} }
if ($.cookie('ForceFlash')) { if (getCookie('ForceFlash')) {
$('#ForceFlash').attr('checked', true); $('#ForceFlash').attr('checked', true);
} else { } else {
$('#ForceFlash').attr('checked', false); $('#ForceFlash').attr('checked', false);
} }
if ($.cookie('SaveTrackPosition')) { if (getCookie('SaveTrackPosition')) {
$('#SaveTrackPosition').attr('checked', true); $('#SaveTrackPosition').attr('checked', true);
} else { } else {
$('#SaveTrackPosition').attr('checked', false); $('#SaveTrackPosition').attr('checked', false);
} }
if ($.cookie('AutoPilot')) { if (getCookie('AutoPilot')) {
$.cookie('AutoPilot', null) setCookie('AutoPilot', null)
} }
// Tabs // Tabs
$('.tabcontent').hide(); //Hide all content $('.tabcontent').hide(); //Hide all content
if (!$.cookie('username') && !$.cookie('passwordenc') && !$.cookie('Server')) { if (!getCookie('username') && !getCookie('passwordenc') && !getCookie('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
@ -81,9 +81,9 @@
var firstTab = $("ul.tabs li:first a").attr("href"); var firstTab = $("ul.tabs li:first a").attr("href");
loadTabContent(firstTab); loadTabContent(firstTab);
} }
$('a#logo').attr("href", $.cookie('Server')); $('a#logo').attr("href", getCookie('Server'));
$('a#logo').attr("title", 'Launch Subsonic'); $('a#logo').attr("title", 'Launch Subsonic');
if ($.cookie('Notification_NowPlaying')) { if (getCookie('Notification_NowPlaying')) {
updateNowPlaying(true); updateNowPlaying(true);
} }
ping(); ping();
@ -158,7 +158,7 @@
$('#MusicFolders').live('change', function () { $('#MusicFolders').live('change', function () {
var folder = $(this).val(); var folder = $(this).val();
loadArtists(folder, true); loadArtists(folder, true);
$.cookie('MusicFolders', folder, { expires: 365 }); setCookie('MusicFolders', folder);
}); });
$('#ArtistContainer li.item').live('click', function () { $('#ArtistContainer li.item').live('click', function () {
$('#AutoAlbumContainer li').removeClass('selected'); $('#AutoAlbumContainer li').removeClass('selected');
@ -375,8 +375,8 @@
}); });
$('#action_RefreshArtists').click(function () { $('#action_RefreshArtists').click(function () {
//loadArtists("", true); //loadArtists("", true);
if ($.cookie('MusicFolders')) { if (getCookie('MusicFolders')) {
loadArtists($.cookie('MusicFolders'), true); loadArtists(getCookie('MusicFolders'), true);
} else { } else {
loadArtists(null, true); loadArtists(null, true);
} }
@ -535,16 +535,18 @@
}); });
$('#action_AutoPilot').click(function () { $('#action_AutoPilot').click(function () {
var msg; var msg;
if ($.cookie('AutoPilot')) { if (getCookie('AutoPilot')) {
$.cookie('AutoPilot', null); setCookie('AutoPilot', null);
msg = 'Autopilot Off'; msg = 'Autopilot Off';
$('#action_AutoPilot').removeClass('selected'); $('#action_AutoPilot').removeClass('selected');
} else { } else {
$('#CurrentPlaylistContainer tbody').empty(); setCookie('AutoPilot', true);
getRandomSongList('', '#CurrentPlaylistContainer tbody', '', '');
$.cookie('AutoPilot', true, { expires: 365 });
$('#action_AutoPilot').addClass('selected'); $('#action_AutoPilot').addClass('selected');
msg = 'Autopilot On'; msg = 'Autopilot On';
if ($('#CurrentPlaylistContainer tbody').html() == '') {
$('#CurrentPlaylistContainer tbody').empty();
getRandomSongList('', '#CurrentPlaylistContainer tbody', '', '');
}
} }
$(this).attr("title", msg); $(this).attr("title", msg);
updateMessage(msg); updateMessage(msg);
@ -696,13 +698,13 @@
// Side Bar Click Events // Side Bar Click Events
$('#action_ToggleSideBar').live('click', function () { $('#action_ToggleSideBar').live('click', function () {
if ($.cookie('sidebar')) { if (getCookie('sidebar')) {
$.cookie('sidebar', null); setCookie('sidebar', null);
$('#SideBar').hide(); $('#SideBar').hide();
stopUpdateChatMessages(); stopUpdateChatMessages();
stopUpdateNowPlaying(); stopUpdateNowPlaying();
} else { } else {
$.cookie('sidebar', true, { expires: 365 }); setCookie('sidebar', true);
$('#SideBar').show(); $('#SideBar').show();
updateChatMessages(); updateChatMessages();
updateNowPlaying(false); updateNowPlaying(false);
@ -725,30 +727,30 @@
$('#SavePreferences').live('click', function () { $('#SavePreferences').live('click', function () {
var username = $('#Username').val(); var username = $('#Username').val();
var password = $('#Password').val(); var password = $('#Password').val();
$.cookie('username', username, { expires: 365 }); setCookie('username', username);
if (password != "") { if (password != "") {
$.cookie('passwordenc', 'enc:' + HexEncode(password), { expires: 365 }); setCookie('passwordenc', 'enc:' + HexEncode(password));
} }
var AutoPlaylists = $('#AutoPlaylists').val(); var AutoPlaylists = $('#AutoPlaylists').val();
$.cookie('AutoPlaylists', AutoPlaylists, { expires: 365 }); setCookie('AutoPlaylists', AutoPlaylists);
var AutoAlbumSize = $('#AutoAlbumSize').val(); var AutoAlbumSize = $('#AutoAlbumSize').val();
$.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 }); setCookie('AutoAlbumSize', AutoAlbumSize);
var AutoPlaylistSize = $('#AutoPlaylistSize').val(); var AutoPlaylistSize = $('#AutoPlaylistSize').val();
$.cookie('AutoPlaylistSize', AutoPlaylistSize, { expires: 365 }); setCookie('AutoPlaylistSize', AutoPlaylistSize);
var server = $('#Server').val(); var server = $('#Server').val();
if (server != "") { if (server != "") {
$.cookie('Server', server, { expires: 365 }); setCookie('Server', server);
} }
var applicationname = $('#ApplicationName').val(); var applicationname = $('#ApplicationName').val();
if (applicationname != "") { if (applicationname != "") {
$.cookie('ApplicationName', applicationname, { expires: 365 }); setCookie('ApplicationName', applicationname);
} }
location.reload(true); location.reload(true);
}); });
$('#Theme').live('change', function () { $('#Theme').live('change', function () {
var theme = $(this).val(); var theme = $(this).val();
switchTheme(theme); switchTheme(theme);
$.cookie('Theme', theme, { expires: 365 }); setCookie('Theme', theme);
}); });
$('#Genres').live('change', function () { $('#Genres').live('change', function () {
var genre = $(this).val(); var genre = $(this).val();
@ -763,10 +765,10 @@
}); });
$('#HideAZ').live('click', function () { $('#HideAZ').live('click', function () {
if ($('#HideAZ').is(':checked')) { if ($('#HideAZ').is(':checked')) {
$.cookie('HideAZ', '1', { expires: 365 }); setCookie('HideAZ', '1');
$('#BottomContainer').hide(); $('#BottomContainer').hide();
} else { } else {
$.cookie('HideAZ', null); setCookie('HideAZ', null);
$('#BottomContainer').show(); $('#BottomContainer').show();
} }
}); });
@ -774,54 +776,60 @@
if ($('#Notification_Song').is(':checked')) { if ($('#Notification_Song').is(':checked')) {
requestPermissionIfRequired(); requestPermissionIfRequired();
if (hasNotificationPermission()) { if (hasNotificationPermission()) {
$.cookie('Notification_Song', '1', { expires: 365 }); setCookie('Notification_Song', '1');
} else {
alert('HTML5 Notifications are not available for your current browser, Sorry :(');
return false;
} }
} else { } else {
$.cookie('Notification_Song', null); setCookie('Notification_Song', null);
} }
}); });
$('#Notification_NowPlaying').live('click', function () { $('#Notification_NowPlaying').live('click', function () {
if ($('#Notification_NowPlaying').is(':checked')) { if ($('#Notification_NowPlaying').is(':checked')) {
requestPermissionIfRequired(); requestPermissionIfRequired();
if (hasNotificationPermission()) { if (hasNotificationPermission()) {
$.cookie('Notification_NowPlaying', '1', { expires: 365 }); setCookie('Notification_NowPlaying', '1');
} else {
alert('HTML5 Notifications are not available for your current browser, Sorry :(');
return false;
} }
} else { } else {
$.cookie('Notification_NowPlaying', null); setCookie('Notification_NowPlaying', null);
} }
}); });
$('#ScrollTitle').live('click', function () { $('#ScrollTitle').live('click', function () {
if ($('#ScrollTitle').is(':checked')) { if ($('#ScrollTitle').is(':checked')) {
$.cookie('ScrollTitle', '1', { expires: 365 }); setCookie('ScrollTitle', '1');
} }
}); });
$('#Debug').live('click', function () { $('#Debug').live('click', function () {
if ($('#Debug').is(':checked')) { if ($('#Debug').is(':checked')) {
$.cookie('Debug', '1', { expires: 365 }); setCookie('Debug', '1');
debug = true; debug = true;
} else { } else {
$.cookie('Debug', null); setCookie('Debug', null);
debug = false; debug = false;
} }
}); });
$('#ForceFlash').live('click', function () { $('#ForceFlash').live('click', function () {
if ($('#ForceFlash').is(':checked')) { if ($('#ForceFlash').is(':checked')) {
$.cookie('ForceFlash', '1', { expires: 365 }); setCookie('ForceFlash', '1');
} else { } else {
$.cookie('ForceFlash', null); setCookie('ForceFlash', null);
} }
location.reload(true); location.reload(true);
}); });
$('#SaveTrackPosition').live('click', function () { $('#SaveTrackPosition').live('click', function () {
if ($('#SaveTrackPosition').is(':checked')) { if ($('#SaveTrackPosition').is(':checked')) {
$.cookie('SaveTrackPosition', '1', { expires: 365 }); setCookie('SaveTrackPosition', '1');
var sm = soundManager.getSoundById('audio'); var sm = soundManager.getSoundById('audio');
if (sm !== undefined) { if (sm !== undefined) {
saveTrackPosition(); saveTrackPosition();
} }
} else { } else {
$.cookie('SaveTrackPosition', null); setCookie('SaveTrackPosition', null);
$.cookie('CurrentSong', null); setCookie('CurrentSong', null);
deleteCurrentPlaylist(); deleteCurrentPlaylist();
} }
//location.reload(true); //location.reload(true);
@ -833,13 +841,13 @@
} }
}); });
$('#ResetPreferences').live('click', function () { $('#ResetPreferences').live('click', function () {
$.cookie('username', null); setCookie('username', null);
$.cookie('password', null); setCookie('password', null);
$.cookie('AutoAlbumSize', null); setCookie('AutoAlbumSize', null);
$.cookie('AutoPlaylistSize', null); setCookie('AutoPlaylistSize', null);
$.cookie('Server', null); setCookie('Server', null);
$.cookie('ApplicationName', null); setCookie('ApplicationName', null);
$.cookie('HideAZ', null); setCookie('HideAZ', null);
location.reload(true); location.reload(true);
}); });
$('#ChangeLogShowMore').live('click', function () { $('#ChangeLogShowMore').live('click', function () {

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "MiniSub (Beta)", "name": "MiniSub (Beta)",
"description": "MiniSub - HTML5 Mini Player for Subsonic", "description": "MiniSub - HTML5 Mini Player for Subsonic",
"version": "2.1.6", "version": "2.1.7",
"app": { "app": {
"launch": { "launch": {
"local_path": "index.html" "local_path": "index.html"

View file

@ -100,6 +100,12 @@ h3.title {
background: #2e2e2e; background: #2e2e2e;
border: 1px solid #5a5a5a; border: 1px solid #5a5a5a;
} }
#status
{
background: #222;
border-top: 1px solid #1D1D1D;
border-left: 1px solid #1D1D1D;
}
#player #player
{ {
background: #2E2E2E; background: #2E2E2E;
@ -130,7 +136,7 @@ a.button {
-moz-transition: border .218s; -moz-transition: border .218s;
-o-transition: border-color .218s; -o-transition: border-color .218s;
transition: border-color .218s; transition: border-color .218s;
background: #f3f3f3; background: #2E2E2E;
background: -webkit-gradient(linear,0% 40%,0% 70%,from(#323232),to(#2e2e2e)); background: -webkit-gradient(linear,0% 40%,0% 70%,from(#323232),to(#2e2e2e));
background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#323232),to(#2e2e2e)); background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#323232),to(#2e2e2e));
border: solid 1px #1d1d1d; border: solid 1px #1d1d1d;

View file

@ -494,7 +494,8 @@ table.songlist tr.song td.itemactions
{ {
width: 85px; width: 85px;
padding-left: 26px; padding-left: 26px;
display: block; /*display: block;*/
margin: auto 0;
height: 18px; height: 18px;
} }
table.songlist tr.song td.track table.songlist tr.song td.track
@ -609,7 +610,7 @@ table.songlist tr.playing
} }
table.songlist tr.playing td:first-child table.songlist tr.playing td:first-child
{ {
background: url('../images/play_alt_gd_16x16.png') 8px 11px no-repeat; background: url('../images/play_alt_gd_16x16.png') 8px center no-repeat;
} }
table.songlist tr.selected table.songlist tr.selected
{ {