Add preloader customisation

alternate-visualiser
William Toohey 10 years ago
parent 75b591ad3b
commit 36e3225e2b
  1. 7
      js/HuesCore.js
  2. 9
      js/HuesSettings.js

@ -61,6 +61,8 @@ HuesCore = function(defaults) {
this.uiArray.push(new RetroUI(), new WeedUI(), new ModernUI(), new XmasUI()); this.uiArray.push(new RetroUI(), new WeedUI(), new ModernUI(), new XmasUI());
this.settings.connectCore(this); this.settings.connectCore(this);
// Update with merged
defaults = this.settings.defaults;
this.setColour(this.colourIndex); this.setColour(this.colourIndex);
if(defaults.load) { if(defaults.load) {
@ -79,8 +81,9 @@ HuesCore = function(defaults) {
} }
}, function(progress) { }, function(progress) {
var prog = document.getElementById("preMain"); var prog = document.getElementById("preMain");
var scale = Math.floor(progress * 0x40); var scale = Math.floor(progress * defaults.preloadMax);
prog.textContent = '0x' + ("00"+scale.toString(16)).slice(-2); var padding = defaults.preloadMax.toString(defaults.preloadBase).length;
prog.textContent = defaults.preloadPrefix + (Array(padding).join("0")+scale.toString(defaults.preloadBase)).slice(-padding);
}); });
} else { } else {
document.getElementById("preloadHelper").style.display = "none"; document.getElementById("preloadHelper").style.display = "none";

@ -31,6 +31,10 @@ HuesSettings.prototype.defaultSettings = {
firstSong: null, firstSong: null,
// If set, will disable the remote resources menu. For custom pages. // If set, will disable the remote resources menu. For custom pages.
disableRemoteResources: false, disableRemoteResources: false,
// Preloader customisation
preloadPrefix: "0x",
preloadBase: 16,
preloadMax: 0x40,
// 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
@ -52,7 +56,10 @@ HuesSettings.prototype.ephemeralSettings = [
"overwriteLocal", "overwriteLocal",
"respacks", "respacks",
"firstSong", "firstSong",
"disableRemoteResources" "disableRemoteResources",
"preloadPrefix",
"preloadBase",
"preloadMax"
]; ];
// To dynamically build the UI like the cool guy I am // To dynamically build the UI like the cool guy I am

Loading…
Cancel
Save