1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00

Fix issue where a new WebSocket() call can crash the script if it fails. Fix positioning of theater mode status and action overlay.

This commit is contained in:
SirStendec 2015-01-27 17:05:51 -05:00
parent d6619af92e
commit c9bd39de8a
6 changed files with 49 additions and 16 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules
npm-debug.log
build
build
Extension Building

View file

@ -1742,13 +1742,20 @@ FFZ.ws_commands = {};
// ----------------
FFZ.prototype.ws_create = function() {
var f = this;
var f = this, ws;
this._ws_last_req = 0;
this._ws_callbacks = {};
this._ws_pending = this._ws_pending || [];
var ws = this._ws_sock = new WebSocket("ws://ffz.stendec.me/");
try {
ws = this._ws_sock = new WebSocket("ws://ffz.stendec.me/");
} catch(err) {
this._ws_exists = false;
return this.log("Error Creating WebSocket: " + err);
}
this._ws_exists = true;
ws.onopen = function(e) {
f._ws_open = true;
@ -2041,10 +2048,18 @@ FFZ.prototype.build_ui_popup = function(view) {
var c = this._emotes_for_sets(inner, view, room && room.menu_sets || []);
if ( c === 0 )
btn.addEventListener('click', this._add_emote.bind(this, view, "To use custom emoticons in tons of channels, get FrankerFaceZ from http://www.frankerfacez.com"));
else
btn.addEventListener('click', this._add_emote.bind(this, view, "To view this channel's emoticons, get FrankerFaceZ from http://www.frankerfacez.com"));
if ( ! this._ws_exists ) {
btn.className = "button ffz-button primary";
btn.innerHTML = "Server Error";
btn.title = "FFZ Server Error";
btn.addEventListener('click', alert.bind(window, "The FrankerFaceZ client was unable to create a WebSocket to communicate with the FrankerFaceZ server.\n\nThis is most likely due to your browser's configuration either disabling WebSockets entirely or limiting the number of simultaneous connections. Please ensure that WebSockets have not been disabled."));
} else {
if ( c === 0 )
btn.addEventListener('click', this._add_emote.bind(this, view, "To use custom emoticons in tons of channels, get FrankerFaceZ from http://www.frankerfacez.com"));
else
btn.addEventListener('click', this._add_emote.bind(this, view, "To view this channel's emoticons, get FrankerFaceZ from http://www.frankerfacez.com"));
}
// Feature Friday!
this._feature_friday_ui(room_id, inner, view);

4
script.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -11,13 +11,20 @@ FFZ.ws_commands = {};
// ----------------
FFZ.prototype.ws_create = function() {
var f = this;
var f = this, ws;
this._ws_last_req = 0;
this._ws_callbacks = {};
this._ws_pending = this._ws_pending || [];
var ws = this._ws_sock = new WebSocket("ws://ffz.stendec.me/");
try {
ws = this._ws_sock = new WebSocket("ws://ffz.stendec.me/");
} catch(err) {
this._ws_exists = false;
return this.log("Error Creating WebSocket: " + err);
}
this._ws_exists = true;
ws.onopen = function(e) {
f._ws_open = true;

View file

@ -67,10 +67,18 @@ FFZ.prototype.build_ui_popup = function(view) {
var c = this._emotes_for_sets(inner, view, room && room.menu_sets || []);
if ( c === 0 )
btn.addEventListener('click', this._add_emote.bind(this, view, "To use custom emoticons in tons of channels, get FrankerFaceZ from http://www.frankerfacez.com"));
else
btn.addEventListener('click', this._add_emote.bind(this, view, "To view this channel's emoticons, get FrankerFaceZ from http://www.frankerfacez.com"));
if ( ! this._ws_exists ) {
btn.className = "button ffz-button primary";
btn.innerHTML = "Server Error";
btn.title = "FFZ Server Error";
btn.addEventListener('click', alert.bind(window, "The FrankerFaceZ client was unable to create a WebSocket to communicate with the FrankerFaceZ server.\n\nThis is most likely due to your browser's configuration either disabling WebSockets entirely or limiting the number of simultaneous connections. Please ensure that WebSockets have not been disabled."));
} else {
if ( c === 0 )
btn.addEventListener('click', this._add_emote.bind(this, view, "To use custom emoticons in tons of channels, get FrankerFaceZ from http://www.frankerfacez.com"));
else
btn.addEventListener('click', this._add_emote.bind(this, view, "To view this channel's emoticons, get FrankerFaceZ from http://www.frankerfacez.com"));
}
// Feature Friday!
this._feature_friday_ui(room_id, inner, view);

View file

@ -59,6 +59,7 @@
.ffz-button {
float: right;
margin-top: -6px;
text-transform: none;
}
.ffz-noty .noty_message {
@ -147,7 +148,8 @@
position: absolute;
bottom: 10px;
right: 10px;
margin-right: 150px;
left: 10px;
z-index: 7;
padding: 10px;
opacity: 0.95;