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; height: 120px;
} }
#res-packlist.noremotes {
height: 305px;
}
#res-remotelist { #res-remotelist {
height: 155px; height: 155px;
} }

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

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

Loading…
Cancel
Save