Add option to disable remote respacks list - for integrated deployments

alternate-visualiser
William Toohey 10 years ago
parent a385bd25f3
commit d79e0d36e2
  1. 4
      css/hues-res.css
  2. 24
      js/HuesSettings.js
  3. 28
      js/ResourceManager.js

@ -34,6 +34,10 @@
height: 120px;
}
#res-packlist.noremotes {
height: 305px;
}
#res-remotelist {
height: 155px;
}

@ -29,6 +29,8 @@ HuesSettings.prototype.defaultSettings = {
overwriteLocal : false,
// If set, will attempt to play the named song first
firstSong: null,
// If set, will disable the remote resources menu. For custom pages.
disableRemoteResources: false,
// UI accessible config
// Autosong stuff is a todo, becuase why even implement that
@ -43,6 +45,16 @@ HuesSettings.prototype.defaultSettings = {
volume : 0.7
}
// Don't get saved to localStorage
HuesSettings.prototype.ephemeralSettings = [
"load",
"autoplay",
"overwriteLocal",
"respacks",
"firstSong",
"disableRemoteResources"
];
// To dynamically build the UI like the cool guy I am
HuesSettings.prototype.settingsCategories = {
"Image Settings" : [
@ -104,12 +116,14 @@ function HuesSettings(defaults) {
this.hide();
for(var attr in this.defaultSettings) {
if(attr == "respacks") {
continue;
}
if(defaults[attr] == undefined) {
defaults[attr] = this.defaultSettings[attr];
} else if(defaults.overwriteLocal) {
}
// don't write to local if it's a temp settings
if(this.ephemeralSettings.indexOf(attr) != -1) {
continue;
}
if(defaults.overwriteLocal) {
localStorage[attr] = defaults[attr];
}
// populate defaults, ignoring current
@ -234,7 +248,7 @@ HuesSettings.prototype.set = function(setting, value) {
// the defaults given in the initialiser
HuesSettings.prototype.setDefaults = function() {
for(var attr in this.defaults) {
if(attr == "respacks") {
if(this.ephemeralSettings.indexOf(attr) != -1) {
continue;
}
localStorage[attr] = this.defaults[attr];

@ -302,15 +302,19 @@ Resources.prototype.initUI = function() {
packList.className = "res-list";
packList.id = "res-packlist";
this.packsView.respackList = packList;
var remoteHeader = document.createElement("div");
remoteHeader.textContent = "Remote respacks";
remoteHeader.className = "res-header";
var remoteList = document.createElement("div");
remoteList.className = "res-list";
remoteList.id = "res-remotelist";
this.appendSimpleListItem("Click to load the list", remoteList,
function() {that.loadRemotes();});
this.packsView.remoteList = remoteList;
if(!this.core.settings.defaults.disableRemoteResources) {
var remoteHeader = document.createElement("div");
remoteHeader.textContent = "Remote respacks";
remoteHeader.className = "res-header";
var remoteList = document.createElement("div");
remoteList.className = "res-list";
remoteList.id = "res-remotelist";
this.appendSimpleListItem("Click to load the list", remoteList,
function() {that.loadRemotes();});
this.packsView.remoteList = remoteList;
} else {
packList.className += " noremotes";
}
var buttons = document.createElement("div");
buttons.className = "res-buttons";
@ -368,8 +372,10 @@ Resources.prototype.initUI = function() {
packsContainer.appendChild(packHeader);
packsContainer.appendChild(packList);
packsContainer.appendChild(remoteHeader);
packsContainer.appendChild(remoteList);
if(!this.core.settings.defaults.disableRemoteResources) {
packsContainer.appendChild(remoteHeader);
packsContainer.appendChild(remoteList);
}
packsContainer.appendChild(buttons);
packsContainer.appendChild(progressContainer);

Loading…
Cancel
Save