IIFE and 'use strict'

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

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

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

@ -19,8 +19,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
(function(window, document) {
"use strict";
/* HuesInfo.js populates the beat glossary, shortcut list, and version string.
* This means the HTML should rarely need to be updated.
* If the element IDs are not present, the DOM is not modified. If you would
@ -99,4 +101,8 @@ var addInfo = function(titleText, list) {
listElem.appendChild(item);
});
info.appendChild(listElem);
};
};
window.populateHuesInfo = populateHuesInfo;
})(window, document);

@ -20,6 +20,9 @@
* THE SOFTWARE.
*/
(function(window, document) {
"use strict";
/* If you're modifying settings for your hues, DON'T EDIT THIS
- Go to the HTML and edit the `defaults` object instead!
*/
@ -404,4 +407,8 @@ HuesSettings.prototype.setDefaults = function() {
localStorage[attr] = this.defaults[attr];
}
}
};
};
window.HuesSettings = HuesSettings;
})(window, document);

@ -19,6 +19,9 @@
* THE SOFTWARE.
*/
(function(window, document) {
"use strict";
/*
Base UI Class for Hues display. Parent is an element
to put all your own elements under, but make a div
@ -1133,4 +1136,12 @@ var xbottom = [
{"angle": 17.6989154099, "x": 2540.2, "y": 28.5},
{"angle": -18.378894807, "x": 2627.55, "y": 24.9},
{"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.
*/
(function(window, document) {
"use strict";
// NOTE: Any packs referenced need CORS enabled or loads fail
var packsURL = "http://cdn.0x40hu.es/getRespacks.php";
@ -842,4 +845,8 @@ Resources.prototype.appendSimpleListItem = function(value, root, onclick) {
div.appendChild(label);
root.appendChild(div);
return label;
};
};
window.Resources = Resources;
})(window, document);

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