IIFE and 'use strict'

master
William Toohey 10 years ago
parent 235a4f2a86
commit 08781b2b52
  1. 8
      js/HuesCanvas.js
  2. 7
      js/HuesCore.js
  3. 6
      js/HuesInfo.js
  4. 7
      js/HuesSettings.js
  5. 11
      js/HuesUI.js
  6. 7
      js/ResourceManager.js
  7. 7
      js/SoundManager.js

@ -20,10 +20,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
/* Takes an element name to attach to, and an audio context element for /* Takes an element name to attach to, and an audio context element for
getting the current time with reasonable accuracy */ getting the current time with reasonable accuracy */
function HuesCanvas(element, audioContext, core) { function HuesCanvas(element, audioContext, core) {
'use strict';
this.audio = audioContext; this.audio = audioContext;
core.addEventListener("newimage", this.setImage.bind(this)); core.addEventListener("newimage", this.setImage.bind(this));
core.addEventListener("newcolour", this.setColour.bind(this)); core.addEventListener("newcolour", this.setColour.bind(this));
@ -550,3 +552,7 @@ HuesCanvas.prototype.drawSnow = function() {
} }
this.lastSnow = this.audio.currentTime; this.lastSnow = this.audio.currentTime;
}; };
window.HuesCanvas = HuesCanvas;
})(window, document);

@ -22,6 +22,9 @@
/* We don't want localstorage variables 'optimised' to different identifiers*/ /* We don't want localstorage variables 'optimised' to different identifiers*/
/*jshint -W069 */ /*jshint -W069 */
(function(window, document) {
"use strict";
function HuesCore(defaults) { function HuesCore(defaults) {
// Bunch-o-initialisers // Bunch-o-initialisers
this.version = "0x0B"; this.version = "0x0B";
@ -1062,3 +1065,7 @@ HuesCore.prototype.weedColours =
{'c': 0xB62084, 'n': "Harold's Crayon"}, {'c': 0xB62084, 'n': "Harold's Crayon"},
{'c': 0x694489, 'n': 'Purple Rain'}, {'c': 0x694489, 'n': 'Purple Rain'},
{'c': 0xFFD700, 'n': 'Gold'}]; {'c': 0xFFD700, 'n': 'Gold'}];
window.HuesCore = HuesCore;
})(window, document);

@ -20,6 +20,8 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
/* HuesInfo.js populates the beat glossary, shortcut list, and version string. /* HuesInfo.js populates the beat glossary, shortcut list, and version string.
* This means the HTML should rarely need to be updated. * This means the HTML should rarely need to be updated.
@ -100,3 +102,7 @@ var addInfo = function(titleText, list) {
}); });
info.appendChild(listElem); info.appendChild(listElem);
}; };
window.populateHuesInfo = populateHuesInfo;
})(window, document);

@ -20,6 +20,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
/* If you're modifying settings for your hues, DON'T EDIT THIS /* If you're modifying settings for your hues, DON'T EDIT THIS
- Go to the HTML and edit the `defaults` object instead! - Go to the HTML and edit the `defaults` object instead!
*/ */
@ -405,3 +408,7 @@ HuesSettings.prototype.setDefaults = function() {
} }
} }
}; };
window.HuesSettings = HuesSettings;
})(window, document);

@ -19,6 +19,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
/* /*
Base UI Class for Hues display. Parent is an element Base UI Class for Hues display. Parent is an element
to put all your own elements under, but make a div to put all your own elements under, but make a div
@ -1134,3 +1137,11 @@ var xbottom = [
{"angle": -18.378894807, "x": 2627.55, "y": 24.9}, {"angle": -18.378894807, "x": 2627.55, "y": 24.9},
{"angle": -4.561224264, "x": 2710.4, "y": 14.4} {"angle": -4.561224264, "x": 2710.4, "y": 14.4}
]; ];
window.RetroUI = RetroUI;
window.WeedUI = WeedUI;
window.ModernUI = ModernUI;
window.XmasUI = XmasUI;
window.HalloweenUI = HalloweenUI;
})(window, document);

@ -19,6 +19,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
// NOTE: Any packs referenced need CORS enabled or loads fail // NOTE: Any packs referenced need CORS enabled or loads fail
var packsURL = "http://cdn.0x40hu.es/getRespacks.php"; var packsURL = "http://cdn.0x40hu.es/getRespacks.php";
@ -843,3 +846,7 @@ Resources.prototype.appendSimpleListItem = function(value, root, onclick) {
root.appendChild(div); root.appendChild(div);
return label; return label;
}; };
window.Resources = Resources;
})(window, document);

@ -19,6 +19,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
(function(window, document) {
"use strict";
// Flash value // Flash value
var LAME_DELAY_START = 2258; var LAME_DELAY_START = 2258;
var LAME_DELAY_END = 0; var LAME_DELAY_END = 0;
@ -485,3 +488,7 @@ SoundManager.prototype.fadeOut = function(callback) {
} }
setTimeout(callback, 2000); setTimeout(callback, 2000);
} }
window.SoundManager = SoundManager;
})(window, document);
Loading…
Cancel
Save