1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 15:27:43 +00:00

Modified how capitalization is handled. Added code to clean up localStorage of old script's remnants. Added sorting and capitalization of the viewer list.

This commit is contained in:
SirStendec 2015-01-15 16:42:21 -05:00
parent 1663b8e2ea
commit d961cb954f
5 changed files with 296 additions and 41 deletions

View file

@ -32,7 +32,11 @@ FFZ.prototype.log = function(msg, data, to_json) {
msg = "FFZ: " + msg + (to_json ? " -- " + JSON.stringify(data) : "");
if ( data !== undefined && console.groupCollapsed && console.dir ) {
console.groupCollapsed(msg);
console.dir(data);
if ( navigator.userAgent.indexOf("Firefox/") !== -1 )
console.log(data);
else
console.dir(data);
console.groupEnd(msg);
} else
console.log(msg);
@ -64,6 +68,7 @@ require('./badges');
require('./ember/room');
require('./ember/line');
require('./ember/chatview');
require('./ember/viewers');
require('./debug');
@ -106,10 +111,24 @@ FFZ.prototype.initialize = function(increment, delay) {
FFZ.prototype.setup = function(delay) {
var start = (window.performance && performance.now) ? performance.now() : Date.now();
this.log("Found Twitch application after " + (delay||0) + " ms in \"" + location + "\". Initializing FrankerFaceZ version " + FFZ.version_info);
this.users = {};
// Cleanup localStorage
for(var key in localStorage) {
if ( key.substr(0,4) == "ffz_" )
localStorage.removeItem(key);
}
// Store the capitalization of our own name.
var user = this.get_user();
if ( user && user.name )
FFZ.capitalization[user.login] = [user.name, Date.now()];
// Initialize all the modules.
try {
this.ws_create();
this.setup_emoticons();
@ -118,6 +137,7 @@ FFZ.prototype.setup = function(delay) {
this.setup_room();
this.setup_line();
this.setup_chatview();
this.setup_viewers();
this.setup_css();
this.setup_menu();
@ -130,5 +150,11 @@ FFZ.prototype.setup = function(delay) {
return;
}
this.log("Initialization complete.");
if ( window.console && console.time )
console.timeEnd("FrankerFaceZ Initialization");
var end = (window.performance && performance.now) ? performance.now() : Date.now(),
duration = end - start;
this.log("Initialization complete in " + duration + "ms");
}