1.9.4 Querystring support for required parameters
This commit is contained in:
parent
c3d7435c43
commit
a0df9b6197
3 changed files with 39 additions and 2 deletions
|
@ -216,6 +216,11 @@
|
|||
<span class="changes"></span>
|
||||
</li>
|
||||
-->
|
||||
<li class="log"><span class="version">4/3/2012 - 1.9.4</span>
|
||||
<span class="changes">URL Querystring support for setting of variables</span>
|
||||
<span class="changes">Added legacy support for Subsonic 4.5</span>
|
||||
<span class="changes">Fixed Chrome audio bugs</span>
|
||||
</li>
|
||||
<li class="log"><span class="version">3/31/2012 - 1.9</span>
|
||||
<span class="changes">Switched to SoundManager2 audio library (changing track position currently not functional, next update)</span>
|
||||
<span class="changes">Other minor bug fixes</span>
|
||||
|
|
34
js/app.js
34
js/app.js
|
@ -3,6 +3,23 @@ var debug = false;
|
|||
var audio;
|
||||
var hostURL = location.href;
|
||||
var baseURL;
|
||||
|
||||
// Set auth cookies if specified in URL on launch
|
||||
var u = getParameterByName('u');
|
||||
var p = getParameterByName('p');
|
||||
var s = getParameterByName('s');
|
||||
if (u && p && s) {
|
||||
if (!$.cookie('username')) {
|
||||
$.cookie('username', u, { expires: 365 });
|
||||
}
|
||||
if (!$.cookie('password')) {
|
||||
$.cookie('password', p, { expires: 365 });
|
||||
}
|
||||
if (!$.cookie('Server')) {
|
||||
$.cookie('Server', s, { expires: 365 });
|
||||
}
|
||||
window.location.href = getPathFromUrl(window.location);
|
||||
}
|
||||
if ($.cookie('Server')) {
|
||||
baseURL = $.cookie('Server') + '/rest';
|
||||
}
|
||||
|
@ -468,7 +485,7 @@ function playSong(el, songid, albumid) {
|
|||
scrobbled = false;
|
||||
|
||||
if ($.cookie('EnableNotifications')) {
|
||||
showNotification(baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=50&id=' + coverart, title, artist + ' - ' + album);
|
||||
showNotification(baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=50&id=' + coverart, toHTML.un(title), toHTML.un(artist + ' - ' + album));
|
||||
}
|
||||
if ($.cookie('ScrollTitle')) {
|
||||
scrollTitle(toHTML.un(artist) + ' - ' + toHTML.un(title));
|
||||
|
@ -1121,6 +1138,21 @@ var toHTML = {
|
|||
})
|
||||
}
|
||||
};
|
||||
function getParameterByName(name) {
|
||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||
var regex = new RegExp(regexS);
|
||||
var results = regex.exec(window.location.search);
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
function getPathFromUrl(url) {
|
||||
var strurl = url.toString();
|
||||
var u = strurl.substring(0, strurl.indexOf('?'));
|
||||
return u
|
||||
}
|
||||
function setTitle(text) {
|
||||
if (text != "") {
|
||||
document.title = text;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
$(document).ready(function () {
|
||||
// Tabs
|
||||
$(".tabcontent").hide(); //Hide all content
|
||||
if ($.cookie('username') == null) {
|
||||
if (!$.cookie('username') && !$.cookie('password') && !$.cookie('Server')) {
|
||||
$('ul.tabs li a').each(function () {
|
||||
if ($(this).attr("href") == '#tabPreferences') {
|
||||
$(this).addClass("active"); //Add "active" class to selected tab
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue