diff --git a/src/FileSaver.js b/src/FileSaver.js
index 6ceec7df..f37c0161 100644
--- a/src/FileSaver.js
+++ b/src/FileSaver.js
@@ -275,6 +275,6 @@ if (typeof module !== "undefined" && module.exports) {
module.exports.saveAs = saveAs;
} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) {
define([], function() {
- return saveAs;
+ return saveAs;
});
}
\ No newline at end of file
diff --git a/src/badges.js b/src/badges.js
index 903c8d84..a36ee36e 100644
--- a/src/badges.js
+++ b/src/badges.js
@@ -132,9 +132,9 @@ FFZ.settings_info.sub_notice_badges = {
name: "Old-Style Subscriber Notice Badges",
no_bttv: true,
- help: "Display a subscriber badge on old-style chat messages about new subscribers.",
+ help: "Display a subscriber badge on old-style chat messages about new subscribers.",
- on_update: function(val) {
+ on_update: function(val) {
this.toggle_style('badges-sub-notice', ! this.has_bttv && ! val);
this.toggle_style('badges-sub-notice-on', ! this.has_bttv && val);
}
@@ -231,8 +231,8 @@ FFZ.prototype.setup_badges = function() {
this.toggle_style('badges-transparent', val === 5);
document.body.classList.toggle('ffz-transparent-badges', val === 5);
- this.toggle_style('badges-sub-notice', ! this.settings.sub_notice_badges);
- this.toggle_style('badges-sub-notice-on', this.settings.sub_notice_badges);
+ this.toggle_style('badges-sub-notice', ! this.settings.sub_notice_badges);
+ this.toggle_style('badges-sub-notice-on', this.settings.sub_notice_badges);
}
this.toggle_style('badges-legacy', this.settings.legacy_badges === 3);
@@ -345,9 +345,9 @@ FFZ.prototype.get_line_badges = function(msg) {
last_id = -1,
had_last = false,
- room = msg.get && msg.get('room') || msg.room,
- from = msg.get && msg.get('from') || msg.from,
- tags = msg.get && msg.get('tags') || msg.tags || {},
+ room = msg.get && msg.get('room') || msg.room,
+ from = msg.get && msg.get('from') || msg.from,
+ tags = msg.get && msg.get('tags') || msg.tags || {},
badge_tag = tags.badges || {},
service = utils.ember_lookup('service:badges'),
diff --git a/src/colors.js b/src/colors.js
index 38b1abbb..d18d85af 100644
--- a/src/colors.js
+++ b/src/colors.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require('./utils'),
+ utils = require('./utils'),
hue2rgb = function(p, q, t) {
if ( t < 0 ) t += 1;
@@ -66,30 +66,30 @@ FFZ.settings_info.luv_contrast = {
method: function() {
var f = this,
- old_val = this.settings.luv_contrast;
+ old_val = this.settings.luv_contrast;
- utils.prompt(
- "Luv Adjustment Minimum Contrast Ratio",
- "Please enter a new value for the minimum contrast ratio required between username colors and the background.
Default: 4.5",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Luv Adjustment Minimum Contrast Ratio",
+ "Please enter a new value for the minimum contrast ratio required between username colors and the background.
Default: 4.5",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var parsed = parseFloat(new_val);
- if ( Number.isNaN(parsed) || ! Number.isFinite(parsed) )
- parsed = 4.5;
+ var parsed = parseFloat(new_val);
+ if ( Number.isNaN(parsed) || ! Number.isFinite(parsed) )
+ parsed = 4.5;
- f.settings.set("luv_contrast", parsed);
- });
+ f.settings.set("luv_contrast", parsed);
+ });
},
on_update: function(val) {
this._rebuild_contrast();
- this._rebuild_filter_styles();
+ this._rebuild_filter_styles();
if ( ! this.has_bttv && this.settings.fix_color == '1' )
- this._rebuild_colors();
+ this._rebuild_colors();
}
};
@@ -199,26 +199,26 @@ RGBAColor.prototype.eq = function(rgb) {
}
RGBAColor.fromName = function(name) {
- var context = FFZ.Color._context;
- if ( ! context ) {
- var canvas = FFZ.Color._canvas = document.createElement('canvas');
- context = FFZ.Color._context = canvas.getContext("2d");
- }
+ var context = FFZ.Color._context;
+ if ( ! context ) {
+ var canvas = FFZ.Color._canvas = document.createElement('canvas');
+ context = FFZ.Color._context = canvas.getContext("2d");
+ }
- context.clearRect(0,0,1,1);
- context.fillStyle = name;
- context.fillRect(0,0,1,1);
- var data = context.getImageData(0,0,1,1);
+ context.clearRect(0,0,1,1);
+ context.fillStyle = name;
+ context.fillRect(0,0,1,1);
+ var data = context.getImageData(0,0,1,1);
- if ( ! data || ! data.data || data.data.length !== 4 )
- return null;
+ if ( ! data || ! data.data || data.data.length !== 4 )
+ return null;
- return new RGBAColor(data.data[0], data.data[1], data.data[2], data.data[3] / 255);
+ return new RGBAColor(data.data[0], data.data[1], data.data[2], data.data[3] / 255);
}
RGBAColor.fromCSS = function(rgb) {
- if ( ! rgb )
- return null;
+ if ( ! rgb )
+ return null;
rgb = rgb.trim();
@@ -230,7 +230,7 @@ RGBAColor.fromCSS = function(rgb) {
var r = match[1],
g = match[2],
b = match[3],
- a = match[4];
+ a = match[4];
if ( r.charAt(r.length-1) === '%' )
r = 255 * (parseInt(r) / 100);
@@ -247,19 +247,19 @@ RGBAColor.fromCSS = function(rgb) {
else
b = parseInt(b);
- if ( a )
- if ( a.charAt(a.length-1) === '%' )
- a = parseInt(a) / 100;
- else
- a = parseFloat(a);
- else
- a = 1;
+ if ( a )
+ if ( a.charAt(a.length-1) === '%' )
+ a = parseInt(a) / 100;
+ else
+ a = parseFloat(a);
+ else
+ a = 1;
return new RGBAColor(
Math.min(Math.max(0, r), 255),
Math.min(Math.max(0, g), 255),
Math.min(Math.max(0, b), 255),
- Math.min(Math.max(0, a), 1)
+ Math.min(Math.max(0, a), 1)
);
}
@@ -272,7 +272,7 @@ RGBAColor.fromHex = function(code) {
(raw >> 16), // Red
(raw >> 8 & 0x00FF), // Green
(raw & 0x0000FF), // Blue,
- 1 // Alpha
+ 1 // Alpha
)
}
@@ -298,7 +298,7 @@ RGBAColor.fromHSVA = function(h, s, v, a) {
Math.round(Math.min(Math.max(0, r*255), 255)),
Math.round(Math.min(Math.max(0, g*255), 255)),
Math.round(Math.min(Math.max(0, b*255), 255)),
- a === undefined ? 1 : a
+ a === undefined ? 1 : a
);
}
@@ -312,7 +312,7 @@ RGBAColor.fromXYZA = function(x, y, z, a) {
Math.max(0, Math.min(255, 255 * XYZAColor.channelConverter(R))),
Math.max(0, Math.min(255, 255 * XYZAColor.channelConverter(G))),
Math.max(0, Math.min(255, 255 * XYZAColor.channelConverter(B))),
- a === undefined ? 1 : a
+ a === undefined ? 1 : a
);
}
@@ -329,7 +329,7 @@ RGBAColor.fromHSLA = function(h, s, l, a) {
Math.round(Math.min(Math.max(0, 255 * hue2rgb(p, q, h + 1/3)), 255)),
Math.round(Math.min(Math.max(0, 255 * hue2rgb(p, q, h)), 255)),
Math.round(Math.min(Math.max(0, 255 * hue2rgb(p, q, h - 1/3)), 255)),
- a === undefined ? 1 : a
+ a === undefined ? 1 : a
);
}
@@ -366,7 +366,7 @@ RGBAColor.prototype.brighten = function(amount) {
Math.max(0, Math.min(255, this.r + amount)),
Math.max(0, Math.min(255, this.g + amount)),
Math.max(0, Math.min(255, this.b + amount)),
- this.a
+ this.a
);
}
@@ -548,7 +548,7 @@ XYZAColor.fromRGBA = function(r, g, b, a) {
0.412453 * R + 0.357580 * G + 0.180423 * B,
0.212671 * R + 0.715160 * G + 0.072169 * B,
0.019334 * R + 0.119193 * G + 0.950227 * B,
- a === undefined ? 1 : a
+ a === undefined ? 1 : a
);
}
@@ -638,8 +638,8 @@ FFZ.prototype._rebuild_contrast = function() {
this._luv_required_bright = new XYZAColor(0, (this.settings.luv_contrast * (new RGBAColor(35,35,35,1).toXYZA().y + 0.05) - 0.05), 0, 1).toLUVA().l;
this._luv_required_dark = new XYZAColor(0, ((new RGBAColor(217,217,217,1).toXYZA().y + 0.05) / this.settings.luv_contrast - 0.05), 0, 1).toLUVA().l;
- this._luv_background_bright = new XYZAColor(0, (this.settings.luv_contrast * (RGBAColor.fromCSS("#3c3a41").toXYZA().y + 0.05) - 0.05), 0, 1).toLUVA().l;
- this._luv_background_dark = new XYZAColor(0, ((RGBAColor.fromCSS("#acacbf").toXYZA().y + 0.05) / this.settings.luv_contrast - 0.05), 0, 1).toLUVA().l;
+ this._luv_background_bright = new XYZAColor(0, (this.settings.luv_contrast * (RGBAColor.fromCSS("#3c3a41").toXYZA().y + 0.05) - 0.05), 0, 1).toLUVA().l;
+ this._luv_background_dark = new XYZAColor(0, ((RGBAColor.fromCSS("#acacbf").toXYZA().y + 0.05) / this.settings.luv_contrast - 0.05), 0, 1).toLUVA().l;
}
FFZ.prototype._rebuild_colors = function() {
@@ -658,7 +658,7 @@ FFZ.prototype._update_colors = function(darkness_only) {
Settings = utils.ember_lookup('controller:settings'),
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
- cr_dark = this.settings.dark_twitch || (Layout && Layout.get('isTheatreMode'));
+ cr_dark = this.settings.dark_twitch || (Layout && Layout.get('isTheatreMode'));
if ( darkness_only && this._color_old_darkness === is_dark )
return;
@@ -680,20 +680,20 @@ FFZ.prototype._update_colors = function(darkness_only) {
FFZ.prototype._handle_filter_color = function(color) {
- if (!( color instanceof RGBAColor ))
- color = RGBAColor.fromCSS(color);
+ if (!( color instanceof RGBAColor ))
+ color = RGBAColor.fromCSS(color);
- var light_color = color,
- dark_color = color,
- luv = color.toLUVA();
+ var light_color = color,
+ dark_color = color,
+ luv = color.toLUVA();
- if ( luv.l < this._luv_background_bright )
- light_color = luv._l(this._luv_background_bright).toRGBA();
+ if ( luv.l < this._luv_background_bright )
+ light_color = luv._l(this._luv_background_bright).toRGBA();
- if ( luv.l > this._luv_background_dark )
- dark_color = luv._l(this._luv_background_dark).toRGBA();
+ if ( luv.l > this._luv_background_dark )
+ dark_color = luv._l(this._luv_background_dark).toRGBA();
- return [light_color, dark_color];
+ return [light_color, dark_color];
}
@@ -701,90 +701,90 @@ FFZ.prototype._handle_color = function(color) {
if ( color instanceof RGBAColor )
color = color.toCSS();
- if ( ! color )
- return null;
+ if ( ! color )
+ return null;
if ( this._hex_colors.hasOwnProperty(color) )
- return this._hex_colors[color];
+ return this._hex_colors[color];
- var rgb = RGBAColor.fromCSS(color),
+ var rgb = RGBAColor.fromCSS(color),
- light_color = rgb,
- dark_color = rgb;
+ light_color = rgb,
+ dark_color = rgb;
- // Color Blindness Handling
- if ( this.settings.color_blind !== '0' ) {
- var new_color = rgb.daltonize(this.settings.color_blind);
- if ( ! rgb.eq(new_color) ) {
- rgb = new_color;
- light_color = dark_color = rgb;
- }
- }
+ // Color Blindness Handling
+ if ( this.settings.color_blind !== '0' ) {
+ var new_color = rgb.daltonize(this.settings.color_blind);
+ if ( ! rgb.eq(new_color) ) {
+ rgb = new_color;
+ light_color = dark_color = rgb;
+ }
+ }
- // Color Processing - RGB
- if ( this.settings.fix_color === '4' ) {
- var lum = rgb.luminance();
+ // Color Processing - RGB
+ if ( this.settings.fix_color === '4' ) {
+ var lum = rgb.luminance();
- if ( lum > 0.3 ) {
- var s = 127, nc = rgb;
- while(s--) {
- nc = nc.brighten(-1);
- if ( nc.luminance() <= 0.3 )
- break;
- }
+ if ( lum > 0.3 ) {
+ var s = 127, nc = rgb;
+ while(s--) {
+ nc = nc.brighten(-1);
+ if ( nc.luminance() <= 0.3 )
+ break;
+ }
- light_color = nc;
- }
+ light_color = nc;
+ }
- if ( lum < 0.15 ) {
- var s = 127, nc = rgb;
- while(s--) {
- nc = nc.brighten();
- if ( nc.luminance() >= 0.15 )
- break;
- }
+ if ( lum < 0.15 ) {
+ var s = 127, nc = rgb;
+ while(s--) {
+ nc = nc.brighten();
+ if ( nc.luminance() >= 0.15 )
+ break;
+ }
- dark_color = nc;
- }
- }
+ dark_color = nc;
+ }
+ }
- // Color Processing - HSL
- if ( this.settings.fix_color === '2' ) {
- var hsl = rgb.toHSLA();
+ // Color Processing - HSL
+ if ( this.settings.fix_color === '2' ) {
+ var hsl = rgb.toHSLA();
- light_color = hsl._l(Math.min(Math.max(0, 0.7 * hsl.l), 1)).toRGBA();
- dark_color = hsl._l(Math.min(Math.max(0, 0.3 + (0.7 * hsl.l)), 1)).toRGBA();
- }
+ light_color = hsl._l(Math.min(Math.max(0, 0.7 * hsl.l), 1)).toRGBA();
+ dark_color = hsl._l(Math.min(Math.max(0, 0.3 + (0.7 * hsl.l)), 1)).toRGBA();
+ }
- // Color Processing - HSV
- if ( this.settings.fix_color === '3' ) {
- var hsv = rgb.toHSVA();
+ // Color Processing - HSV
+ if ( this.settings.fix_color === '3' ) {
+ var hsv = rgb.toHSVA();
- if ( hsv.s === 0 ) {
- // Black and White
- light_color = hsv._v(Math.min(Math.max(0.5, 0.5 * hsv.v), 1)).toRGBA();
- dark_color = hsv._v(Math.min(Math.max(0.5, 0.5 + (0.5 * hsv.v)), 1)).toRGBA();
+ if ( hsv.s === 0 ) {
+ // Black and White
+ light_color = hsv._v(Math.min(Math.max(0.5, 0.5 * hsv.v), 1)).toRGBA();
+ dark_color = hsv._v(Math.min(Math.max(0.5, 0.5 + (0.5 * hsv.v)), 1)).toRGBA();
- } else {
- light_color = RGBAColor.fromHSVA(hsv.h, Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.s)), 1), Math.min(0.7, hsv.v), hsv.a);
- dark_color = RGBAColor.fromHSVA(hsv.h, Math.min(0.7, hsv.s), Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.v)), 1), hsv.a);
- }
- }
+ } else {
+ light_color = RGBAColor.fromHSVA(hsv.h, Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.s)), 1), Math.min(0.7, hsv.v), hsv.a);
+ dark_color = RGBAColor.fromHSVA(hsv.h, Math.min(0.7, hsv.s), Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.v)), 1), hsv.a);
+ }
+ }
- // Color Processing - LUV
- if ( this.settings.fix_color === '1' ) {
- var luv = rgb.toLUVA();
+ // Color Processing - LUV
+ if ( this.settings.fix_color === '1' ) {
+ var luv = rgb.toLUVA();
- if ( luv.l > this._luv_required_dark )
- light_color = luv._l(this._luv_required_dark).toRGBA();
+ if ( luv.l > this._luv_required_dark )
+ light_color = luv._l(this._luv_required_dark).toRGBA();
- if ( luv.l < this._luv_required_bright )
- dark_color = luv._l(this._luv_required_bright).toRGBA();
- }
+ if ( luv.l < this._luv_required_bright )
+ dark_color = luv._l(this._luv_required_bright).toRGBA();
+ }
- var out = this._hex_colors[color] = [light_color.toHex(), dark_color.toHex()];
- return out;
+ var out = this._hex_colors[color] = [light_color.toHex(), dark_color.toHex()];
+ return out;
}
\ No newline at end of file
diff --git a/src/constants.js b/src/constants.js
index 68db9d71..a7aeadfe 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -6,12 +6,12 @@ var SVGPATH = 'm120.95 1.74c4.08-0.09 8.33-0.84 12.21 0.82 3.61 1.8 7 4.16 11.01
IS_OSX = navigator.platform ? navigator.platform.indexOf('Mac') !== -1 : /OS X/.test(navigator.userAgent),
IS_WIN = navigator.platform ? navigator.platform.indexOf('Win') !== -1 : /Windows/.test(navigator.userAgent),
- SEPARATORS = "[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]",
+ SEPARATORS = "[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]",
SPLITTER = new RegExp(SEPARATORS + "*," + SEPARATORS + "*"),
- svg = function(cls, width, height, path, viewbox) {
- return '';
- };
+ svg = function(cls, width, height, path, viewbox) {
+ return '';
+ };
module.exports = FrankerFaceZ.constants = {
@@ -22,8 +22,8 @@ module.exports = FrankerFaceZ.constants = {
IS_WIN: IS_WIN,
META_NAME: IS_OSX ? "⌘" : (IS_WIN ? "Win" : "Meta"),
- // Twitch Client ID for API Stuff
- CLIENT_ID: "a3bc9znoz6vi8ozsoca0inlcr4fcvkl",
+ // Twitch Client ID for API Stuff
+ CLIENT_ID: "a3bc9znoz6vi8ozsoca0inlcr4fcvkl",
API_SERVER: "https://api.frankerfacez.com/",
@@ -36,12 +36,12 @@ module.exports = FrankerFaceZ.constants = {
["wss://localhost:8001/", 1]]
},
- CHAT_COLORS: ["#FF0000", "#0000FF", "#008000", "#B22222", "#FF7F50", "#9ACD32", "#FF4500", "#2E8B57", "#DAA520", "#D2691E", "#5F9EA0", "#1E90FF", "#FF69B4", "#8A2BE2", "#00FF7F"],
+ CHAT_COLORS: ["#FF0000", "#0000FF", "#008000", "#B22222", "#FF7F50", "#9ACD32", "#FF4500", "#2E8B57", "#DAA520", "#D2691E", "#5F9EA0", "#1E90FF", "#FF69B4", "#8A2BE2", "#00FF7F"],
TOOLTIP_DISTANCE: 50,
- SEPARATORS: SEPARATORS,
- SPLITTER: SPLITTER,
+ SEPARATORS: SEPARATORS,
+ SPLITTER: SPLITTER,
UUID_TEST: /(?:^| +)([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) *$/i,
@@ -92,44 +92,44 @@ module.exports = FrankerFaceZ.constants = {
EMOJI_REGEX: /(\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc41\u200d\ud83d\udde8|(?:[\u0023\u002a\u0030-\u0039])\ufe0f?\u20e3|(?:(?:[\u261d\u270c])(?:\ufe0f|(?!\ufe0e))|\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca\udfcb]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd75\udd90\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0]|\ud83e\udd18|[\u26f9\u270a\u270b\u270d])(?:\ud83c[\udffb-\udfff]|)|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf21\udf24-\udf84\udf86-\udf93\udf96\udf97\udf99-\udf9b\udf9e-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcc-\udff0\udff3-\udff5\udff7-\udfff]|\ud83d[\udc00-\udc41\udc44\udc45\udc51-\udc65\udc6a-\udc6d\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udca9\udcab-\udcfd\udcff-\udd3d\udd49-\udd4e\udd50-\udd67\udd6f\udd70\udd73\udd74\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\udecb-\uded0\udee0-\udee5\udee9\udeeb\udeec\udef0\udef3]|\ud83e[\udd10-\udd17\udd80-\udd84\uddc0]|[\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\u2602-\u2604\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638\u2692\u2694\u2696\u2697\u2699\u269b\u269c\u26b0\u26b1\u26c8\u26ce\u26cf\u26d1\u26d3\u26e9\u26f0\u26f1\u26f4\u26f7\u26f8\u2705\u271d\u2721\u2728\u274c\u274e\u2753-\u2755\u2763\u2795-\u2797\u27b0\u27bf\ue50a]|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37]|[\u00a9\u00ae\u203c\u2049\u2122\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600\u2601\u260e\u2611\u2614\u2615\u2639\u263a\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2693\u26a0\u26a1\u26aa\u26ab\u26bd\u26be\u26c4\u26c5\u26d4\u26ea\u26f2\u26f3\u26f5\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u2733\u2734\u2744\u2747\u2757\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e)))/g,
- EMOJI_CATEGORIES: {
- people: "People & Smileys",
- nature: "Animals & Nature",
- food: "Food & Drink",
- activity: "Activity",
- travel: "Travel & Places",
- objects: "Objects",
- symbols: "Symbols",
- flags: "Flags"
- //modifier: "Modifiers"
- },
+ EMOJI_CATEGORIES: {
+ people: "People & Smileys",
+ nature: "Animals & Nature",
+ food: "Food & Drink",
+ activity: "Activity",
+ travel: "Travel & Places",
+ objects: "Objects",
+ symbols: "Symbols",
+ flags: "Flags"
+ //modifier: "Modifiers"
+ },
- EMOJI_LOGOS: {
- activity: '26bd',
- food: '1f34e',
- flags: '1f1fa-1f1f8',
- nature: '1f436',
- objects: '1f4a1',
- people: '1f632',
- symbols: '2049',
- travel: '1f697'
- //modifier: '262f'
- },
+ EMOJI_LOGOS: {
+ activity: '26bd',
+ food: '1f34e',
+ flags: '1f1fa-1f1f8',
+ nature: '1f436',
+ objects: '1f4a1',
+ people: '1f632',
+ symbols: '2049',
+ travel: '1f697'
+ //modifier: '262f'
+ },
- ZREKNARF: svg('glyph_views svg-zreknarf', 16, 12.5, SVGPATH, '0 0 249 195'),
- CHAT_BUTTON: svg('emoticons', 24, 18, SVGPATH, '0 0 249 195'),
- ROOMS: svg('glyph_views svg-roomlist', 16, 16, 'M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z'),
- CAMERA: svg('camera', 16, 16, 'M24,20v6H4V10h20v6l8-6v16L24,20z', '0 0 36 36'),
- INVITE: svg('plus', 16, 16, 'M15,9h-3v3h-2V9H7V7h3V4h2v3h3V9z M9,6H6v4h2h1v3h4l0,0l0,0v1h-3H4H1v-1l3-3h2L4,8V2h6v1H9V6z'),
- LIVE: svg('glyph_live_small', 13, 16,'M11,14H5H2v-1l3-3h2L5,8V2h6v6l-2,2h2l3,3v1H11z'),
- EYE: svg('glyph_views svg-eye', 16, 16, 'M11,13H5L1,9V8V7l4-4h6l4,4v1v1L11,13z M8,5C6.344,5,5,6.343,5,8c0,1.656,1.344,3,3,3c1.657,0,3-1.344,3-3C11,6.343,9.657,5,8,5z M8,9C7.447,9,7,8.552,7,8s0.447-1,1-1s1,0.448,1,1S8.553,9,8,9z'),
- CLOCK: svg('glyph_views svg-clock', 16, 16, 'M8,15c-3.866,0-7-3.134-7-7s3.134-7,7-7s7,3.134,7,7 S11.866,15,8,15z M8,3C5.238,3,3,5.238,3,8s2.238,5,5,5s5-2.238,5-5S10.762,3,8,3z M7.293,8.707L7,8l1-4l0.902,3.607L11,11 L7.293,8.707z'),
- GEAR: svg('gear', 16, 16, 'M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z'),
- HEART: svg('heart', 16, 16, 'M8,13.5L1.5,7V4l2-2h3L8,3.5L9.5,2h3l2,2v3L8,13.5z'),
- UNHEART: svg('unheart', 16, 16, 'M1,9V7h14v2H1z M1,4l2-2h3l2,2l2-2h3l2,2v2H1V4z M8,14l-4.667-4h9.333L8,14z'),
- EMOTE: svg('emote', 16, 16, 'M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z', '0 0 18 18'),
- STAR: svg('star', 16, 16, 'M15,6l-4.041,2.694L13,14l-5-3.333L3,14l2.041-5.306L1,6h5.077L8,1l1.924,5H15z'),
- CLOSE: svg('close_small', 16, 16, 'M12.657,4.757L9.414,8l3.243,3.242l-1.415,1.415L8,9.414l-3.243,3.243l-1.414-1.415L6.586,8L3.343,4.757l1.414-1.414L8,6.586l3.242-3.243L12.657,4.757z'),
- EDIT: svg('edit', 16, 16, 'M6.414,12.414L3.586,9.586l8-8l2.828,2.828L6.414,12.414z M4.829,14H2l0,0v-2.828l0.586-0.586l2.828,2.828L4.829,14z'),
- GRAPH: svg('glyph_views graph', 16, 16, 'M1,16V2h16v14H1z M5,4H3v1h2V4z M5,7H3v1h2V7z M5,10H3v1h2V10zM5,13H3v1h2V13z M9,7H7v7h2V7z M12,10h-2v4h2V10z M15,4h-2v10h2V4z', '0 0 18 18')
+ ZREKNARF: svg('glyph_views svg-zreknarf', 16, 12.5, SVGPATH, '0 0 249 195'),
+ CHAT_BUTTON: svg('emoticons', 24, 18, SVGPATH, '0 0 249 195'),
+ ROOMS: svg('glyph_views svg-roomlist', 16, 16, 'M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z'),
+ CAMERA: svg('camera', 16, 16, 'M24,20v6H4V10h20v6l8-6v16L24,20z', '0 0 36 36'),
+ INVITE: svg('plus', 16, 16, 'M15,9h-3v3h-2V9H7V7h3V4h2v3h3V9z M9,6H6v4h2h1v3h4l0,0l0,0v1h-3H4H1v-1l3-3h2L4,8V2h6v1H9V6z'),
+ LIVE: svg('glyph_live_small', 13, 16,'M11,14H5H2v-1l3-3h2L5,8V2h6v6l-2,2h2l3,3v1H11z'),
+ EYE: svg('glyph_views svg-eye', 16, 16, 'M11,13H5L1,9V8V7l4-4h6l4,4v1v1L11,13z M8,5C6.344,5,5,6.343,5,8c0,1.656,1.344,3,3,3c1.657,0,3-1.344,3-3C11,6.343,9.657,5,8,5z M8,9C7.447,9,7,8.552,7,8s0.447-1,1-1s1,0.448,1,1S8.553,9,8,9z'),
+ CLOCK: svg('glyph_views svg-clock', 16, 16, 'M8,15c-3.866,0-7-3.134-7-7s3.134-7,7-7s7,3.134,7,7 S11.866,15,8,15z M8,3C5.238,3,3,5.238,3,8s2.238,5,5,5s5-2.238,5-5S10.762,3,8,3z M7.293,8.707L7,8l1-4l0.902,3.607L11,11 L7.293,8.707z'),
+ GEAR: svg('gear', 16, 16, 'M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z'),
+ HEART: svg('heart', 16, 16, 'M8,13.5L1.5,7V4l2-2h3L8,3.5L9.5,2h3l2,2v3L8,13.5z'),
+ UNHEART: svg('unheart', 16, 16, 'M1,9V7h14v2H1z M1,4l2-2h3l2,2l2-2h3l2,2v2H1V4z M8,14l-4.667-4h9.333L8,14z'),
+ EMOTE: svg('emote', 16, 16, 'M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z', '0 0 18 18'),
+ STAR: svg('star', 16, 16, 'M15,6l-4.041,2.694L13,14l-5-3.333L3,14l2.041-5.306L1,6h5.077L8,1l1.924,5H15z'),
+ CLOSE: svg('close_small', 16, 16, 'M12.657,4.757L9.414,8l3.243,3.242l-1.415,1.415L8,9.414l-3.243,3.243l-1.414-1.415L6.586,8L3.343,4.757l1.414-1.414L8,6.586l3.242-3.243L12.657,4.757z'),
+ EDIT: svg('edit', 16, 16, 'M6.414,12.414L3.586,9.586l8-8l2.828,2.828L6.414,12.414z M4.829,14H2l0,0v-2.828l0.586-0.586l2.828,2.828L4.829,14z'),
+ GRAPH: svg('glyph_views graph', 16, 16, 'M1,16V2h16v14H1z M5,4H3v1h2V4z M5,7H3v1h2V7z M5,10H3v1h2V10zM5,13H3v1h2V13z M9,7H7v7h2V7z M12,10h-2v4h2V10z M15,4h-2v10h2V4z', '0 0 18 18')
}
\ No newline at end of file
diff --git a/src/ember/channel.js b/src/ember/channel.js
index 9f1486e9..63963fb2 100644
--- a/src/ember/channel.js
+++ b/src/ember/channel.js
@@ -241,8 +241,8 @@ FFZ.prototype.modify_channel_index = function(view) {
var top = event && event.target && event.target.scrollTop,
height = this.get('layout.playerSize.1');
- if ( ! top )
- top = jQuery(this.get('element')).parents('.tse-scroll-content').scrollTop();
+ if ( ! top )
+ top = jQuery(this.get('element')).parents('.tse-scroll-content').scrollTop();
document.body.classList.toggle('ffz-small-player', f.settings.small_player && top >= height);
},
diff --git a/src/ember/chat-input.js b/src/ember/chat-input.js
index 350d6542..1cbb21cd 100644
--- a/src/ember/chat-input.js
+++ b/src/ember/chat-input.js
@@ -4,10 +4,10 @@ var FFZ = window.FrankerFaceZ,
is_android = navigator.userAgent.indexOf('Android') !== -1,
- CHARCODES = {
- AT_SIGN: 64,
- COLON: 58
- },
+ CHARCODES = {
+ AT_SIGN: 64,
+ COLON: 58
+ },
KEYCODES = {
BACKSPACE: 8,
@@ -15,10 +15,10 @@ var FFZ = window.FrankerFaceZ,
ENTER: 13,
ESC: 27,
SPACE: 32,
- PAGE_UP: 33,
- PAGE_DOWN: 34,
- END: 35,
- HOME: 36,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34,
+ END: 35,
+ HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
@@ -55,15 +55,15 @@ var FFZ = window.FrankerFaceZ,
},
- build_sort_key = function(item, now, is_whisper) {
- if ( item.type === 'emoticon' )
- return '2|' + (item.favorite ? 1 : 2) + '|' + item.sort + '|' + item.label;
+ build_sort_key = function(item, now, is_whisper) {
+ if ( item.type === 'emoticon' )
+ return '2|' + (item.favorite ? 1 : 2) + '|' + item.sort + '|' + item.label;
- else if ( item.type === 'emoji' )
- return '3|' + (item.favorite ? 1 : 2) + '|' + item.label;
+ else if ( item.type === 'emoji' )
+ return '3|' + (item.favorite ? 1 : 2) + '|' + item.label;
- return '4|' + item.label;
- };
+ return '4|' + item.label;
+ };
// ---------------------
@@ -93,101 +93,101 @@ FFZ.settings_info.input_mru = {
};
FFZ.settings_info.input_complete_emotes = {
- type: "select",
- options: {
- 0: "Disabled",
- 1: "Channel and Sub Only",
- 2: "All Emoticons"
- },
+ type: "select",
+ options: {
+ 0: "Disabled",
+ 1: "Channel and Sub Only",
+ 2: "All Emoticons"
+ },
- value: 0,
+ value: 0,
- process_value: function(val) {
- if ( typeof val === 'string' )
- return parseInt(val) || 0;
- return val;
- },
+ process_value: function(val) {
+ if ( typeof val === 'string' )
+ return parseInt(val) || 0;
+ return val;
+ },
- category: "Chat Input",
- no_bttv: true,
+ category: "Chat Input",
+ no_bttv: true,
- name: "Tab-Complete Emoticons Beta",
- help: "Use tab completion to complete emoticon names in chat.",
+ name: "Tab-Complete Emoticons Beta",
+ help: "Use tab completion to complete emoticon names in chat.",
- on_update: function(val) {
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
- }
+ on_update: function(val) {
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
+ }
}
FFZ.settings_info.input_complete_aliases = {
- type: "select",
- options: {
- 0: "Disabled",
- 1: "By Name or Alias",
- 2: "Aliases Only"
- },
+ type: "select",
+ options: {
+ 0: "Disabled",
+ 1: "By Name or Alias",
+ 2: "Aliases Only"
+ },
- value: 1,
+ value: 1,
- process_value: function(val) {
- if ( typeof val === 'string' )
- return parseInt(val) || 0;
- return val;
- },
+ process_value: function(val) {
+ if ( typeof val === 'string' )
+ return parseInt(val) || 0;
+ return val;
+ },
- category: "Chat Input",
- no_bttv: true,
+ category: "Chat Input",
+ no_bttv: true,
- name: "Tab-Complete User Aliases",
- help: "Use tab completion to complete aliases you've given to users rather than their username.",
+ name: "Tab-Complete User Aliases",
+ help: "Use tab completion to complete aliases you've given to users rather than their username.",
- on_update: function(val) {
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_name_suggestions');
- }
+ on_update: function(val) {
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_name_suggestions');
+ }
}
FFZ.settings_info.input_complete_name_at = {
- type: "boolean",
- value: true,
+ type: "boolean",
+ value: true,
- category: "Chat Input",
- no_bttv: true,
+ category: "Chat Input",
+ no_bttv: true,
- name: "Tab-Complete Usernames with At Sign",
- help: "When enabled, tab-completed usernames will have an @ sign before them if you typed one. This is default Twitch behavior, but unnecessary."
+ name: "Tab-Complete Usernames with At Sign",
+ help: "When enabled, tab-completed usernames will have an @ sign before them if you typed one. This is default Twitch behavior, but unnecessary."
}
FFZ.settings_info.input_emoticons_case_sensitive = {
- type: "boolean",
- value: true,
+ type: "boolean",
+ value: true,
- category: "Chat Input",
- no_bttv: true,
+ category: "Chat Input",
+ no_bttv: true,
- name: "Tab-Complete Emoticons Case Sensitive",
- help: "When enabled, tab-completion for emoticons is case sensitive."
+ name: "Tab-Complete Emoticons Case Sensitive",
+ help: "When enabled, tab-completion for emoticons is case sensitive."
}
FFZ.settings_info.input_complete_without_prefix = {
- type: "boolean",
- value: true,
+ type: "boolean",
+ value: true,
- category: "Chat Input",
- no_bttv: true,
+ category: "Chat Input",
+ no_bttv: true,
- name: "Tab-Complete Sub Emotes without Prefix",
- help: "Allow you to tab complete a sub emote without including its prefix. Example: Battery into chrisBattery",
+ name: "Tab-Complete Sub Emotes without Prefix",
+ help: "Allow you to tab complete a sub emote without including its prefix. Example: Battery into chrisBattery",
- on_update: function(val) {
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
- }
+ on_update: function(val) {
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
+ }
}
@@ -210,7 +210,7 @@ FFZ.settings_info.input_emoji = {
FFZ.prototype.setup_chat_input = function() {
this.log("Hooking the Ember Chat Input component.");
- this.update_views("component:chat/twitch-chat-input", this.modify_chat_input);
+ this.update_views("component:chat/twitch-chat-input", this.modify_chat_input);
}
@@ -218,13 +218,13 @@ FFZ.prototype.modify_chat_input = function(component) {
var f = this;
utils.ember_reopen_view(component, {
ffz_mru_index: -1,
- ffz_current_suggestion: 0,
- ffz_partial_word: '',
- ffz_partial_word_start: -1,
- ffz_suggestions_visible: false,
- ffz_freeze_suggestions: -1,
- ffz_suggestions_el: null,
- ffz_name_suggestions: [],
+ ffz_current_suggestion: 0,
+ ffz_partial_word: '',
+ ffz_partial_word_start: -1,
+ ffz_suggestions_visible: false,
+ ffz_freeze_suggestions: -1,
+ ffz_suggestions_el: null,
+ ffz_name_suggestions: [],
ffz_chatters: [],
ffz_init: function() {
@@ -234,17 +234,17 @@ FFZ.prototype.modify_chat_input = function(component) {
s.id = 'ffz-minimal-chat-textarea-height';
document.head.appendChild(s);
- this.set('ffz_name_suggestions', this.get('suggestions'));
+ this.set('ffz_name_suggestions', this.get('suggestions'));
// Redo our key bindings.
var t = this.$("textarea");
- if ( ! t || ! t.length )
- f.error("Cannot find textarea in Twitch Chat Input.");
+ if ( ! t || ! t.length )
+ f.error("Cannot find textarea in Twitch Chat Input.");
t.off("keydown");
- t.off("keyup");
- t.on("keypress", this._ffzKeyPress.bind(this));
+ t.off("keyup");
+ t.on("keypress", this._ffzKeyPress.bind(this));
t.on("keydown", this._ffzKeyDown.bind(this));
t.attr('rows', 1);
@@ -269,512 +269,512 @@ FFZ.prototype.modify_chat_input = function(component) {
t.attr('rows', undefined);
- t.off("keyup");
+ t.off("keyup");
t.off("keydown");
- t.off("keypress");
+ t.off("keypress");
- t.on("keyup", this._onKeyUp.bind(this));
+ t.on("keyup", this._onKeyUp.bind(this));
t.on("keydown", this._onKeyDown.bind(this));
},
- // Suggestions
-
- ffzBuildSuggestionItem: function(i, item) {
- // Returns a new element for the suggestions list.
- if ( ! item )
- return null;
+ // Suggestions
+
+ ffzBuildSuggestionItem: function(i, item) {
+ // Returns a new element for the suggestions list.
+ if ( ! item )
+ return null;
- var t = this,
- el = utils.createElement('div', 'suggestion'),
- inner = utils.createElement('div'),
- width = item.width ? (246 - item.width) + 'px' : null;
-
- el.setAttribute('data-id', i);
- el.classList.toggle('ffz-is-favorite', item.favorite || false);
-
- if ( item.image ) {
- el.classList.add('has-image');
- el.classList.toggle('is-emoji', item.type === 'emoji');
- el.style.backgroundImage = 'url("' + utils.quote_attr(item.image) + '")';
- }
-
- inner.innerHTML = item.label;
- if ( width )
- inner.style.maxWidth = width;
- el.appendChild(inner);
-
- if ( f.settings.input_complete_emotes && item.info ) {
- var info = utils.createElement('span');
- info.innerHTML = item.info;
- el.classList.add('has-info');
- if ( width )
- info.style.maxWidth = width;
- el.appendChild(info);
- }
+ var t = this,
+ el = utils.createElement('div', 'suggestion'),
+ inner = utils.createElement('div'),
+ width = item.width ? (246 - item.width) + 'px' : null;
+
+ el.setAttribute('data-id', i);
+ el.classList.toggle('ffz-is-favorite', item.favorite || false);
+
+ if ( item.image ) {
+ el.classList.add('has-image');
+ el.classList.toggle('is-emoji', item.type === 'emoji');
+ el.style.backgroundImage = 'url("' + utils.quote_attr(item.image) + '")';
+ }
+
+ inner.innerHTML = item.label;
+ if ( width )
+ inner.style.maxWidth = width;
+ el.appendChild(inner);
+
+ if ( f.settings.input_complete_emotes && item.info ) {
+ var info = utils.createElement('span');
+ info.innerHTML = item.info;
+ el.classList.add('has-info');
+ if ( width )
+ info.style.maxWidth = width;
+ el.appendChild(info);
+ }
- el.addEventListener('mouseenter', function() {
- if ( t.get('ffz_freeze_suggestions') === -1 ) {
- var els = el.parentElement.querySelectorAll('.suggestion'),
- middle = els[Math.floor(els.length / 2)];
- t.set('ffz_freeze_suggestions', middle ? parseInt(middle.getAttribute('data-id')) : i)
- }
-
- t.set('ffz_current_suggestion', i);
- });
+ el.addEventListener('mouseenter', function() {
+ if ( t.get('ffz_freeze_suggestions') === -1 ) {
+ var els = el.parentElement.querySelectorAll('.suggestion'),
+ middle = els[Math.floor(els.length / 2)];
+ t.set('ffz_freeze_suggestions', middle ? parseInt(middle.getAttribute('data-id')) : i)
+ }
+
+ t.set('ffz_current_suggestion', i);
+ });
- el.addEventListener('mouseup', function() {
- t.ffzCompleteSuggestion(item);
- });
-
- el.addEventListener('wheel', function(e) {
- // We want to scroll the list up or down. Harder than it sounds. In order
- // to scroll it well, we should use the center item, not the one under
- // the mouse.
- var suggestions = t.get('ffz_sorted_suggestions'),
- first_el = el.parentElement.querySelector('.suggestion:first-of-type'),
- first = first_el && parseInt(first_el.getAttribute('data-id'));
+ el.addEventListener('mouseup', function() {
+ t.ffzCompleteSuggestion(item);
+ });
+
+ el.addEventListener('wheel', function(e) {
+ // We want to scroll the list up or down. Harder than it sounds. In order
+ // to scroll it well, we should use the center item, not the one under
+ // the mouse.
+ var suggestions = t.get('ffz_sorted_suggestions'),
+ first_el = el.parentElement.querySelector('.suggestion:first-of-type'),
+ first = first_el && parseInt(first_el.getAttribute('data-id'));
- first += event.deltaY > 0 ? 1 : -1;
+ first += event.deltaY > 0 ? 1 : -1;
- t.set('ffz_freeze_suggestions', -1);
- t.set('ffz_current_suggestion', Math.min(first + 2, suggestions.length - 1));
- });
-
- return el;
- },
-
-
- ffzUpdateSuggestions: function() {
- var visible = this.get('ffz_suggestions_visible');
- if ( visible ) {
- if ( this.get('ffz_updating') )
- return;
-
- this.set('ffz_updating', true);
+ t.set('ffz_freeze_suggestions', -1);
+ t.set('ffz_current_suggestion', Math.min(first + 2, suggestions.length - 1));
+ });
+
+ return el;
+ },
+
+
+ ffzUpdateSuggestions: function() {
+ var visible = this.get('ffz_suggestions_visible');
+ if ( visible ) {
+ if ( this.get('ffz_updating') )
+ return;
+
+ this.set('ffz_updating', true);
- var el = this.ffz_suggestions_el,
- current = this.get('ffz_current_suggestion') || 0;
-
- if ( ! el ) {
- el = this.ffz_suggestions_el = utils.createElement('div', 'suggestions ffz-suggestions');
- this.get('element').appendChild(el);
-
- } else
- el.innerHTML = '';
-
- var suggestions = this.get('ffz_sorted_suggestions'),
- freeze = this.get('ffz_freeze_suggestions'),
- middle = freeze === -1 ? current : freeze,
-
- first = Math.max(0, middle - 2),
- last = Math.min(suggestions.length, first + 5),
- added = false;
-
- first = Math.min(first, Math.max(0, last - 5));
+ var el = this.ffz_suggestions_el,
+ current = this.get('ffz_current_suggestion') || 0;
+
+ if ( ! el ) {
+ el = this.ffz_suggestions_el = utils.createElement('div', 'suggestions ffz-suggestions');
+ this.get('element').appendChild(el);
+
+ } else
+ el.innerHTML = '';
+
+ var suggestions = this.get('ffz_sorted_suggestions'),
+ freeze = this.get('ffz_freeze_suggestions'),
+ middle = freeze === -1 ? current : freeze,
+
+ first = Math.max(0, middle - 2),
+ last = Math.min(suggestions.length, first + 5),
+ added = false;
+
+ first = Math.min(first, Math.max(0, last - 5));
- if ( current >= suggestions.length ) {
- this.set('ffz_current_suggestion', first);
- current = first;
- }
-
- for(var i=first; i < last; i++) {
- var item = suggestions[i],
- item_el = this.ffzBuildSuggestionItem(i, item);
+ if ( current >= suggestions.length ) {
+ this.set('ffz_current_suggestion', first);
+ current = first;
+ }
+
+ for(var i=first; i < last; i++) {
+ var item = suggestions[i],
+ item_el = this.ffzBuildSuggestionItem(i, item);
- if ( i === current )
- item_el.classList.add('highlighted');
+ if ( i === current )
+ item_el.classList.add('highlighted');
- if ( item_el ) {
- el.appendChild(item_el);
- added = true;
- }
- }
-
- if ( ! added ) {
- var item_el = utils.createElement('div', 'suggestion disabled');
- item_el.textContent = 'No matches.';
- el.appendChild(item_el);
- }
+ if ( item_el ) {
+ el.appendChild(item_el);
+ added = true;
+ }
+ }
+
+ if ( ! added ) {
+ var item_el = utils.createElement('div', 'suggestion disabled');
+ item_el.textContent = 'No matches.';
+ el.appendChild(item_el);
+ }
- this.set('ffz_updating', false);
+ this.set('ffz_updating', false);
- } else if ( this.ffz_suggestions_el ) {
- this.ffz_suggestions_el.parentElement.removeChild(this.ffz_suggestions_el);
- this.ffz_suggestions_el = null;
- }
+ } else if ( this.ffz_suggestions_el ) {
+ this.ffz_suggestions_el.parentElement.removeChild(this.ffz_suggestions_el);
+ this.ffz_suggestions_el = null;
+ }
- }.observes('ffz_suggestions_visible', 'ffz_sorted_suggestions', 'ffz_current_suggestion'),
+ }.observes('ffz_suggestions_visible', 'ffz_sorted_suggestions', 'ffz_current_suggestion'),
- ffzHideSuggestions: function() {
- this.set('ffz_suggestions_visible', false);
- this.set('ffz_freeze_suggestions', -1);
- this.set('ffz_current_suggestion', 0);
- },
+ ffzHideSuggestions: function() {
+ this.set('ffz_suggestions_visible', false);
+ this.set('ffz_freeze_suggestions', -1);
+ this.set('ffz_current_suggestion', 0);
+ },
- ffzShowSuggestions: function() {
- this.set('ffz_current_suggestion', 0);
- this.ffzFetchNameSuggestions();
- this.set('ffz_freeze_suggestions', -1);
- this.set('ffz_suggestions_visible', true);
- this.ffzSetPartialWord();
- },
+ ffzShowSuggestions: function() {
+ this.set('ffz_current_suggestion', 0);
+ this.ffzFetchNameSuggestions();
+ this.set('ffz_freeze_suggestions', -1);
+ this.set('ffz_suggestions_visible', true);
+ this.ffzSetPartialWord();
+ },
- ffzSetPartialWord: function() {
- var area = this.get('chatTextArea');
- if ( area && this.get('ffz_suggestions_visible') ) {
- var text = this.get('textareaValue'),
- ind = selection_start(area);
+ ffzSetPartialWord: function() {
+ var area = this.get('chatTextArea');
+ if ( area && this.get('ffz_suggestions_visible') ) {
+ var text = this.get('textareaValue'),
+ ind = selection_start(area);
- if ( ind === -1 )
- return this.ffzHideSuggestions();
+ if ( ind === -1 )
+ return this.ffzHideSuggestions();
- var start = text.lastIndexOf(' ', ind - 1) + 1;
- this.set('ffz_partial_word_start', start);
-
- var match = text.substr(start).match(/^[^ ]*/);
- if ( match && match[0] )
- this.set('ffz_partial_word', match[0]);
- else if ( text.charAt(0) === '/' && text.charAt(1) !== ' ' && start === (text.indexOf(' ') + 1) )
- // Assume the first word after a command is a username.
- this.set('ffz_partial_word', '@');
- else
- this.ffzHideSuggestions();
- }
- }.observes('textareaValue'),
+ var start = text.lastIndexOf(' ', ind - 1) + 1;
+ this.set('ffz_partial_word_start', start);
+
+ var match = text.substr(start).match(/^[^ ]*/);
+ if ( match && match[0] )
+ this.set('ffz_partial_word', match[0]);
+ else if ( text.charAt(0) === '/' && text.charAt(1) !== ' ' && start === (text.indexOf(' ') + 1) )
+ // Assume the first word after a command is a username.
+ this.set('ffz_partial_word', '@');
+ else
+ this.ffzHideSuggestions();
+ }
+ }.observes('textareaValue'),
- ffzFetchNameSuggestions: function() {
- if ( ! this.get('ffz_suggestions_visible') )
- this.set('ffz_name_suggestions', this.get('suggestions'));
- }.observes('suggestions'),
+ ffzFetchNameSuggestions: function() {
+ if ( ! this.get('ffz_suggestions_visible') )
+ this.set('ffz_name_suggestions', this.get('suggestions'));
+ }.observes('suggestions'),
- ffzCompleteSuggestion: function(item) {
- if ( ! item ) {
- var suggestions = this.get('ffz_sorted_suggestions'),
- current = this.get('ffz_current_suggestion');
-
- item = suggestions && suggestions[current];
- }
-
- this.ffzHideSuggestions();
- if ( ! item )
- return;
-
- var t = this,
- ind = this.get('ffz_partial_word_start'),
- text = this.get('textareaValue'),
-
- first_char = text.charAt(0),
- is_cmd = first_char === '/' || first_char === '.',
-
- content = ((f.settings.input_complete_name_at && ! is_cmd && item.type === 'user' && this.get('ffz_partial_word').charAt(0) === '@') ? '@' : '') +
- ((item.command_content && is_cmd ?
- item.command_content : item.content) || item.label),
-
- trail = text.substr(ind + this.get('ffz_partial_word').length),
- prefix = text.substr(0, ind) + content + (trail ? '' : ' ');
-
-
- this.set('textareaValue', prefix + trail);
- this.set('ffz_partial_word', '');
- this.set('ffz_partial_word_start', -1);
- this.trackSuggestionsCompleted();
- Ember.run.next(function() {
- var area = t.get('chatTextArea');
- move_selection(area, prefix.length);
- area.focus();
- });
- },
-
-
- ffz_emoticons: function() {
- var emotes = {},
-
- room = this.get('parentView.context.model'),
- room_id = room && room.get('id'),
- tmi = room && room.tmiSession,
-
- set_name, replacement, url, is_sub_set, fav_list,
- emote_set, emote, emote_id, code,
-
- user = f.get_user(),
- ffz_sets = f.getEmotes(user && user.login, room_id),
-
- setting = f.settings.input_complete_emotes;
-
- if ( ! setting )
- return {};
-
-
- if ( tmi ) {
- var es = tmi.getEmotes();
- if ( es && es.emoticon_sets ) {
- for(var set_id in es.emoticon_sets) {
- emote_set = es.emoticon_sets[set_id];
- fav_list = f.settings.favorite_emotes['twitch-' + set_id] || [];
- is_sub_set = false;
- set_name = f._twitch_set_to_channel[set_id];
- if ( ! emote_set )
- continue;
-
- if ( set_name ) {
- if ( set_name === '--global--' )
- set_name = 'Twitch Global';
- else if ( set_name === '--twitch-turbo--' || set_name === 'turbo' || set_name === '--turbo-faces--' )
- set_name = 'Twitch Turbo';
- else {
- set_name = 'Channel: ' + FFZ.get_capitalization(set_name);
- is_sub_set = true;
- }
-
- } else
- set_name = "Unknown Source";
-
- if ( setting === 1 && ! is_sub_set )
- continue;
-
- for(var i = 0; i < emote_set.length; i++) {
- emote = emote_set[i];
- code = emote && emote.code;
- code = code && (constants.KNOWN_CODES[code] || code);
- replacement = f.settings.replace_bad_emotes && constants.EMOTE_REPLACEMENTS[emote.id];
- url = replacement ?
- (constants.EMOTE_REPLACEMENT_BASE + replacement) :
- (constants.TWITCH_BASE + emote.id + "/1.0");
-
- if ( ! emotes[code] || ! emotes[code][0] )
- emotes[code] = [true, code, true, is_sub_set, set_name, url, null, fav_list.indexOf(emote.id) !== -1];
-
- if ( f.settings.input_complete_without_prefix && is_sub_set ) {
- // It's a sub emote, so try splitting off the end of the code.
- // It's a bit weird, but people might like it. Also, make sure
- // we aren't just grabbing an initial capital.
- var unprefixed = code.substr(1).match(/[A-Z].+$/);
- unprefixed = unprefixed ? unprefixed[0] : null;
- if ( unprefixed && ! emotes[unprefixed] )
- emotes[unprefixed] = [false, code, true, is_sub_set, set_name, url, null, fav_list.indexOf(emote.id) !== -1];
- }
- }
- }
- }
- }
-
- for(var i=0; i < ffz_sets.length; i++) {
- emote_set = f.emote_sets[ffz_sets[i]];
- if ( ! emote_set )
- continue;
-
- if ( setting === 1 && f.default_sets.indexOf(emote_set.id) !== -1 )
- continue;
-
- set_name = (emote_set.source || "FFZ") + " " + (emote_set.title || "Global");
- fav_list = f.settings.favorite_emotes[emote_set.hasOwnProperty('source_ext') ? 'ffz-ext-' + emote_set.source_ext + '-' + emote_set.source_id : 'ffz-' + emote_set.id] || [];
-
- for(emote_id in emote_set.emoticons) {
- emote = emote_set.emoticons[emote_id];
- if ( ! emote.hidden && emote.name && (! emotes[emote.name] || ! emotes[emote.name][0]) )
- emotes[emote.name] = [true, emote.name, false, emote_set.id, set_name, emote.urls[1], emote.width, fav_list.indexOf(emote.id) !== -1];
- }
- }
-
- return emotes;
- }.property(),
-
- _setPartialName: function() { },
-
- ffz_suggestions: function() {
- var output = [],
- emotes = this.get('ffz_emoticons'),
- suggestions = this.get('ffz_name_suggestions'); //.mapBy('id').uniq();
-
- if ( f.settings.input_complete_emotes ) {
- // Include Emoticons
- for(var emote_name in emotes) {
- var emote = emotes[emote_name],
- sort_factor = 9,
- label = emote[1] === emote_name ? emote[1] : ('' + emote[1].substr(0, emote[1].length - emote_name.length) + '' + emote_name);
-
- if ( emote[2] ) {
- if ( emote[3] )
- sort_factor = 1;
-
- } else {
- var set_data = f.emote_sets[emote[3]];
- if ( set_data )
- if ( set_data._type === 1 )
- sort_factor = 3;
- else
- sort_factor = ffz.default_sets.indexOf(set_data.id) === -1 ? 2 : 6;
- }
-
- output.push({
- type: "emoticon",
- match: emote_name,
- sort: sort_factor,
- content: emote[1],
- label: label,
- info: emote[4],
- image: emote[5],
- width: emote[6],
- favorite: emote[7] || false
- });
- }
-
-
- if ( f.settings.parse_emoji ) {
- // Include Emoji
- var setting = f.settings.parse_emoji,
- fav_list = f.settings.favorite_emotes['emoji'] || [];
-
- for(var short_name in f.emoji_names) {
- var eid = f.emoji_names[short_name],
- emoji = f.emoji_data[eid];
-
- if ( ! emoji || !(setting === 3 ? emoji.one : (setting === 2 ? emoji.noto : emoji.tw)) )
- continue;
-
- var sn = ':' + short_name + ':',
- src = (f.settings.parse_emoji === 3 ? emoji.one_src : (f.settings.parse_emoji === 2 ? emoji.noto_src : emoji.tw_src));
-
- output.push({
- type: "emoji",
- match: ':' + short_name + ':',
- content: emoji.raw,
- label: emoji.name,
- info: sn,
- image: src,
- width: 18,
- favorite: fav_list.indexOf(emoji.raw) !== -1
- });
- }
- }
- }
-
-
- // Always include Users
- var user_output = {},
- alias_setting = f.settings.input_complete_aliases;
-
- for(var i=0; i < suggestions.length; i++) {
- var suggestion = suggestions[i],
- name = suggestion.id,
- alias = f.aliases[name];
-
- if ( user_output[name] && ! user_output[name].is_alias ) {
- var token = user_output[name];
- token.whispered |= suggestion.whispered;
- if ( suggestion.timestamp > token.timestamp )
- token.timestamp = suggestion.timestamp;
-
- } else {
- if ( alias_setting !== 2 )
- output.push(user_output[name] = {
- type: "user",
- command_content: name,
- label: FFZ.get_capitalization(name),
- whispered: suggestion.whispered,
- timestamp: suggestion.timestamp || new Date(0),
- info: 'User',
- is_alias: false
- });
-
- if ( alias && alias_setting ) {
- if ( user_output[alias] && user_output[alias].is_alias ) {
- var token = user_output[name];
- token.whispered |= suggestion.whispered;
- token.timestamp = Math.max(token.timestamp, suggestion.timestamp);
-
- } else if ( ! user_output[alias] )
- output.push(user_output[alias] = {
- type: "user",
- command_content: name,
- label: alias,
- whispered: suggestion.whispered,
- timestamp: suggestion.timestamp || new Date(0),
- info: 'User Alias',
- is_alias: true
- });
- }
- }
- }
-
- return output;
-
- }.property('ffz_emoticons', 'ffz_name_suggestions'),
-
-
- ffz_filtered_suggestions: Ember.computed("ffz_suggestions", "ffz_partial_word", function() {
- var suggestions = this.get('ffz_suggestions'),
- partial = this.get('ffz_partial_word'),
- part2 = partial.substr(1),
- char = partial.charAt(0);
-
- return suggestions.filter(function(item) {
- var name = item.match || item.content || item.label,
- type = item.type;
-
- if ( ! name )
- return false;
-
- if ( type === 'user' ) {
- // Names are case insensitive, and we have to ignore the leading @ of our
- // partial word when matching.
- name = name.toLowerCase();
- return char === '@' ? name.indexOf(part2.toLowerCase()) === 0 : name.indexOf(partial.toLowerCase()) === 0;
-
- } else if ( type === 'emoji' || ! f.settings.input_emoticons_case_sensitive ) {
- name = name.toLowerCase();
- return name.indexOf(partial.toLowerCase()) === 0;
- }
-
- return name.indexOf(partial) === 0;
- });
- }),
-
-
- ffz_sorted_suggestions: Ember.computed("ffz_filtered_suggestions.[]", function() {
- var text = this.get('textareaValue'),
- now = Date.now(),
- is_whisper = text.substr(0,3) === '/w ';
-
- return this.get('ffz_filtered_suggestions').sort(function(a, b) {
- // First off, sort users ahead of everything else.
- if ( a.type === 'user' ) {
- if ( b.type !== 'user' )
- return -1;
-
- else if ( is_whisper ) {
- if ( a.whisper && ! b.whisper )
- return -1;
- else if ( ! a.whisper && b.whisper )
- return 1;
- }
-
- if ( a.timestamp > b.timestamp ) return -1;
- else if ( a.timestamp < b.timestamp ) return 1;
-
- var an = a.label.toLowerCase(),
- bn = b.label.toLowerCase();
-
- if ( an < bn ) return -1;
- else if ( an > bn ) return 1;
- return 0;
-
- } else if ( b.type === 'user' )
- return 1;
-
- var an = build_sort_key(a, now, is_whisper),
- bn = build_sort_key(b, now, is_whisper);
-
- if ( an < bn ) return -1;
- if ( an > bn ) return 1;
- return 0;
- });
- }),
+ ffzCompleteSuggestion: function(item) {
+ if ( ! item ) {
+ var suggestions = this.get('ffz_sorted_suggestions'),
+ current = this.get('ffz_current_suggestion');
+
+ item = suggestions && suggestions[current];
+ }
+
+ this.ffzHideSuggestions();
+ if ( ! item )
+ return;
+
+ var t = this,
+ ind = this.get('ffz_partial_word_start'),
+ text = this.get('textareaValue'),
+
+ first_char = text.charAt(0),
+ is_cmd = first_char === '/' || first_char === '.',
+
+ content = ((f.settings.input_complete_name_at && ! is_cmd && item.type === 'user' && this.get('ffz_partial_word').charAt(0) === '@') ? '@' : '') +
+ ((item.command_content && is_cmd ?
+ item.command_content : item.content) || item.label),
+
+ trail = text.substr(ind + this.get('ffz_partial_word').length),
+ prefix = text.substr(0, ind) + content + (trail ? '' : ' ');
+
+
+ this.set('textareaValue', prefix + trail);
+ this.set('ffz_partial_word', '');
+ this.set('ffz_partial_word_start', -1);
+ this.trackSuggestionsCompleted();
+ Ember.run.next(function() {
+ var area = t.get('chatTextArea');
+ move_selection(area, prefix.length);
+ area.focus();
+ });
+ },
+
+
+ ffz_emoticons: function() {
+ var emotes = {},
+
+ room = this.get('parentView.context.model'),
+ room_id = room && room.get('id'),
+ tmi = room && room.tmiSession,
+
+ set_name, replacement, url, is_sub_set, fav_list,
+ emote_set, emote, emote_id, code,
+
+ user = f.get_user(),
+ ffz_sets = f.getEmotes(user && user.login, room_id),
+
+ setting = f.settings.input_complete_emotes;
+
+ if ( ! setting )
+ return {};
+
+
+ if ( tmi ) {
+ var es = tmi.getEmotes();
+ if ( es && es.emoticon_sets ) {
+ for(var set_id in es.emoticon_sets) {
+ emote_set = es.emoticon_sets[set_id];
+ fav_list = f.settings.favorite_emotes['twitch-' + set_id] || [];
+ is_sub_set = false;
+ set_name = f._twitch_set_to_channel[set_id];
+ if ( ! emote_set )
+ continue;
+
+ if ( set_name ) {
+ if ( set_name === '--global--' )
+ set_name = 'Twitch Global';
+ else if ( set_name === '--twitch-turbo--' || set_name === 'turbo' || set_name === '--turbo-faces--' )
+ set_name = 'Twitch Turbo';
+ else {
+ set_name = 'Channel: ' + FFZ.get_capitalization(set_name);
+ is_sub_set = true;
+ }
+
+ } else
+ set_name = "Unknown Source";
+
+ if ( setting === 1 && ! is_sub_set )
+ continue;
+
+ for(var i = 0; i < emote_set.length; i++) {
+ emote = emote_set[i];
+ code = emote && emote.code;
+ code = code && (constants.KNOWN_CODES[code] || code);
+ replacement = f.settings.replace_bad_emotes && constants.EMOTE_REPLACEMENTS[emote.id];
+ url = replacement ?
+ (constants.EMOTE_REPLACEMENT_BASE + replacement) :
+ (constants.TWITCH_BASE + emote.id + "/1.0");
+
+ if ( ! emotes[code] || ! emotes[code][0] )
+ emotes[code] = [true, code, true, is_sub_set, set_name, url, null, fav_list.indexOf(emote.id) !== -1];
+
+ if ( f.settings.input_complete_without_prefix && is_sub_set ) {
+ // It's a sub emote, so try splitting off the end of the code.
+ // It's a bit weird, but people might like it. Also, make sure
+ // we aren't just grabbing an initial capital.
+ var unprefixed = code.substr(1).match(/[A-Z].+$/);
+ unprefixed = unprefixed ? unprefixed[0] : null;
+ if ( unprefixed && ! emotes[unprefixed] )
+ emotes[unprefixed] = [false, code, true, is_sub_set, set_name, url, null, fav_list.indexOf(emote.id) !== -1];
+ }
+ }
+ }
+ }
+ }
+
+ for(var i=0; i < ffz_sets.length; i++) {
+ emote_set = f.emote_sets[ffz_sets[i]];
+ if ( ! emote_set )
+ continue;
+
+ if ( setting === 1 && f.default_sets.indexOf(emote_set.id) !== -1 )
+ continue;
+
+ set_name = (emote_set.source || "FFZ") + " " + (emote_set.title || "Global");
+ fav_list = f.settings.favorite_emotes[emote_set.hasOwnProperty('source_ext') ? 'ffz-ext-' + emote_set.source_ext + '-' + emote_set.source_id : 'ffz-' + emote_set.id] || [];
+
+ for(emote_id in emote_set.emoticons) {
+ emote = emote_set.emoticons[emote_id];
+ if ( ! emote.hidden && emote.name && (! emotes[emote.name] || ! emotes[emote.name][0]) )
+ emotes[emote.name] = [true, emote.name, false, emote_set.id, set_name, emote.urls[1], emote.width, fav_list.indexOf(emote.id) !== -1];
+ }
+ }
+
+ return emotes;
+ }.property(),
+
+ _setPartialName: function() { },
+
+ ffz_suggestions: function() {
+ var output = [],
+ emotes = this.get('ffz_emoticons'),
+ suggestions = this.get('ffz_name_suggestions'); //.mapBy('id').uniq();
+
+ if ( f.settings.input_complete_emotes ) {
+ // Include Emoticons
+ for(var emote_name in emotes) {
+ var emote = emotes[emote_name],
+ sort_factor = 9,
+ label = emote[1] === emote_name ? emote[1] : ('' + emote[1].substr(0, emote[1].length - emote_name.length) + '' + emote_name);
+
+ if ( emote[2] ) {
+ if ( emote[3] )
+ sort_factor = 1;
+
+ } else {
+ var set_data = f.emote_sets[emote[3]];
+ if ( set_data )
+ if ( set_data._type === 1 )
+ sort_factor = 3;
+ else
+ sort_factor = ffz.default_sets.indexOf(set_data.id) === -1 ? 2 : 6;
+ }
+
+ output.push({
+ type: "emoticon",
+ match: emote_name,
+ sort: sort_factor,
+ content: emote[1],
+ label: label,
+ info: emote[4],
+ image: emote[5],
+ width: emote[6],
+ favorite: emote[7] || false
+ });
+ }
+
+
+ if ( f.settings.parse_emoji ) {
+ // Include Emoji
+ var setting = f.settings.parse_emoji,
+ fav_list = f.settings.favorite_emotes['emoji'] || [];
+
+ for(var short_name in f.emoji_names) {
+ var eid = f.emoji_names[short_name],
+ emoji = f.emoji_data[eid];
+
+ if ( ! emoji || !(setting === 3 ? emoji.one : (setting === 2 ? emoji.noto : emoji.tw)) )
+ continue;
+
+ var sn = ':' + short_name + ':',
+ src = (f.settings.parse_emoji === 3 ? emoji.one_src : (f.settings.parse_emoji === 2 ? emoji.noto_src : emoji.tw_src));
+
+ output.push({
+ type: "emoji",
+ match: ':' + short_name + ':',
+ content: emoji.raw,
+ label: emoji.name,
+ info: sn,
+ image: src,
+ width: 18,
+ favorite: fav_list.indexOf(emoji.raw) !== -1
+ });
+ }
+ }
+ }
+
+
+ // Always include Users
+ var user_output = {},
+ alias_setting = f.settings.input_complete_aliases;
+
+ for(var i=0; i < suggestions.length; i++) {
+ var suggestion = suggestions[i],
+ name = suggestion.id,
+ alias = f.aliases[name];
+
+ if ( user_output[name] && ! user_output[name].is_alias ) {
+ var token = user_output[name];
+ token.whispered |= suggestion.whispered;
+ if ( suggestion.timestamp > token.timestamp )
+ token.timestamp = suggestion.timestamp;
+
+ } else {
+ if ( alias_setting !== 2 )
+ output.push(user_output[name] = {
+ type: "user",
+ command_content: name,
+ label: FFZ.get_capitalization(name),
+ whispered: suggestion.whispered,
+ timestamp: suggestion.timestamp || new Date(0),
+ info: 'User',
+ is_alias: false
+ });
+
+ if ( alias && alias_setting ) {
+ if ( user_output[alias] && user_output[alias].is_alias ) {
+ var token = user_output[name];
+ token.whispered |= suggestion.whispered;
+ token.timestamp = Math.max(token.timestamp, suggestion.timestamp);
+
+ } else if ( ! user_output[alias] )
+ output.push(user_output[alias] = {
+ type: "user",
+ command_content: name,
+ label: alias,
+ whispered: suggestion.whispered,
+ timestamp: suggestion.timestamp || new Date(0),
+ info: 'User Alias',
+ is_alias: true
+ });
+ }
+ }
+ }
+
+ return output;
+
+ }.property('ffz_emoticons', 'ffz_name_suggestions'),
+
+
+ ffz_filtered_suggestions: Ember.computed("ffz_suggestions", "ffz_partial_word", function() {
+ var suggestions = this.get('ffz_suggestions'),
+ partial = this.get('ffz_partial_word'),
+ part2 = partial.substr(1),
+ char = partial.charAt(0);
+
+ return suggestions.filter(function(item) {
+ var name = item.match || item.content || item.label,
+ type = item.type;
+
+ if ( ! name )
+ return false;
+
+ if ( type === 'user' ) {
+ // Names are case insensitive, and we have to ignore the leading @ of our
+ // partial word when matching.
+ name = name.toLowerCase();
+ return char === '@' ? name.indexOf(part2.toLowerCase()) === 0 : name.indexOf(partial.toLowerCase()) === 0;
+
+ } else if ( type === 'emoji' || ! f.settings.input_emoticons_case_sensitive ) {
+ name = name.toLowerCase();
+ return name.indexOf(partial.toLowerCase()) === 0;
+ }
+
+ return name.indexOf(partial) === 0;
+ });
+ }),
+
+
+ ffz_sorted_suggestions: Ember.computed("ffz_filtered_suggestions.[]", function() {
+ var text = this.get('textareaValue'),
+ now = Date.now(),
+ is_whisper = text.substr(0,3) === '/w ';
+
+ return this.get('ffz_filtered_suggestions').sort(function(a, b) {
+ // First off, sort users ahead of everything else.
+ if ( a.type === 'user' ) {
+ if ( b.type !== 'user' )
+ return -1;
+
+ else if ( is_whisper ) {
+ if ( a.whisper && ! b.whisper )
+ return -1;
+ else if ( ! a.whisper && b.whisper )
+ return 1;
+ }
+
+ if ( a.timestamp > b.timestamp ) return -1;
+ else if ( a.timestamp < b.timestamp ) return 1;
+
+ var an = a.label.toLowerCase(),
+ bn = b.label.toLowerCase();
+
+ if ( an < bn ) return -1;
+ else if ( an > bn ) return 1;
+ return 0;
+
+ } else if ( b.type === 'user' )
+ return 1;
+
+ var an = build_sort_key(a, now, is_whisper),
+ bn = build_sort_key(b, now, is_whisper);
+
+ if ( an < bn ) return -1;
+ if ( an > bn ) return 1;
+ return 0;
+ });
+ }),
// Input Control
@@ -813,237 +813,237 @@ FFZ.prototype.modify_chat_input = function(component) {
this._ffz_last_height = height;
},
- hideSuggestions: Ember.on("document.mouseup", function(event) {
- var target = event.target,
- cl = target.classList;
+ hideSuggestions: Ember.on("document.mouseup", function(event) {
+ var target = event.target,
+ cl = target.classList;
- if ( ! this.get('ffz_suggestions_visible') || cl.contains('suggestion') || cl.contains('suggestions') || target === this.get('chatTextArea') )
- return;
+ if ( ! this.get('ffz_suggestions_visible') || cl.contains('suggestion') || cl.contains('suggestions') || target === this.get('chatTextArea') )
+ return;
- this.ffzHideSuggestions();
- }),
+ this.ffzHideSuggestions();
+ }),
- _ffzKeyPress: function(event) {
- var t = this,
- e = event || window.event,
- key = e.charCode || e.keyCode;
+ _ffzKeyPress: function(event) {
+ var t = this,
+ e = event || window.event,
+ key = e.charCode || e.keyCode;
- switch(key) {
- case CHARCODES.AT_SIGN:
- // If we get an @, show the menu. But only if we're at a new word
- // boundary, or the start of the line.
- if ( ! this.get('ffz_suggestions_visible') ) {
- var ind = selection_start(this.get('chatTextArea')) - 1;
- Ember.run.next(function() {
- if ( ind < 0 || t.get('textareaValue').charAt(ind) === ' ' ) {
- t.ffzShowSuggestions();
- t.trackSuggestions("@");
- }
- });
- }
+ switch(key) {
+ case CHARCODES.AT_SIGN:
+ // If we get an @, show the menu. But only if we're at a new word
+ // boundary, or the start of the line.
+ if ( ! this.get('ffz_suggestions_visible') ) {
+ var ind = selection_start(this.get('chatTextArea')) - 1;
+ Ember.run.next(function() {
+ if ( ind < 0 || t.get('textareaValue').charAt(ind) === ' ' ) {
+ t.ffzShowSuggestions();
+ t.trackSuggestions("@");
+ }
+ });
+ }
- break;
+ break;
- case CHARCODES.COLON:
- if ( f.settings.input_emoji ) {
- var textarea = this.get('chatTextArea'),
- ind = selection_start(textarea);
+ case CHARCODES.COLON:
+ if ( f.settings.input_emoji ) {
+ var textarea = this.get('chatTextArea'),
+ ind = selection_start(textarea);
- ind > 0 && Ember.run.next(function() {
- var text = t.get('textareaValue'),
- emoji_start = text.lastIndexOf(':', ind - 1);
+ ind > 0 && Ember.run.next(function() {
+ var text = t.get('textareaValue'),
+ emoji_start = text.lastIndexOf(':', ind - 1);
- if ( emoji_start !== -1 && ind !== -1 && text.charAt(ind) === ':' ) {
- var match = text.substr(emoji_start + 1, ind - emoji_start - 1),
- emoji_id = f.emoji_names[match],
- emoji = f.emoji_data[emoji_id];
+ if ( emoji_start !== -1 && ind !== -1 && text.charAt(ind) === ':' ) {
+ var match = text.substr(emoji_start + 1, ind - emoji_start - 1),
+ emoji_id = f.emoji_names[match],
+ emoji = f.emoji_data[emoji_id];
- if ( emoji ) {
- var prefix = text.substr(0, emoji_start) + emoji.raw;
- t.ffzHideSuggestions();
- t.set('textareaValue', prefix + text.substr(ind + 1));
- Ember.run.next(function() {
- move_selection(t.get('chatTextArea'), prefix.length);
- });
- }
- }
- })
- }
- }
- },
+ if ( emoji ) {
+ var prefix = text.substr(0, emoji_start) + emoji.raw;
+ t.ffzHideSuggestions();
+ t.set('textareaValue', prefix + text.substr(ind + 1));
+ Ember.run.next(function() {
+ move_selection(t.get('chatTextArea'), prefix.length);
+ });
+ }
+ }
+ })
+ }
+ }
+ },
_ffzKeyDown: function(event) {
var t = this,
- e = event || window.event,
+ e = event || window.event,
key = e.charCode || e.keyCode;
switch(key) {
- case KEYCODES.ESC:
- if ( this.get('ffz_suggestions_visible') ) {
- this.ffzHideSuggestions();
- e.preventDefault();
- }
+ case KEYCODES.ESC:
+ if ( this.get('ffz_suggestions_visible') ) {
+ this.ffzHideSuggestions();
+ e.preventDefault();
+ }
- break;
+ break;
- case KEYCODES.BACKSPACE:
- if ( this.get('ffz_suggestions_visible') && (this.get('ffz_partial_word').length === 1 || selection_start(this.get('chatTextArea')) === 0) )
- this.ffzHideSuggestions();
+ case KEYCODES.BACKSPACE:
+ if ( this.get('ffz_suggestions_visible') && (this.get('ffz_partial_word').length === 1 || selection_start(this.get('chatTextArea')) === 0) )
+ this.ffzHideSuggestions();
- break;
+ break;
- case KEYCODES.TAB:
- // If we do Ctrl-Tab or Alt-Tab. Just don't
- // even think of doing suggestions.
- if ( e.ctrlKey || e.altKey || e.metaKey )
- break;
+ case KEYCODES.TAB:
+ // If we do Ctrl-Tab or Alt-Tab. Just don't
+ // even think of doing suggestions.
+ if ( e.ctrlKey || e.altKey || e.metaKey )
+ break;
- e.preventDefault();
+ e.preventDefault();
- var text = this.get('textareaValue');
- if ( text.length === 0 )
- break;
+ var text = this.get('textareaValue');
+ if ( text.length === 0 )
+ break;
- if ( text.charAt(0) !== '/' ) {
- var parts = text.split(' ');
- if ( parts[parts.length - 1].length === 0 )
- break;
- }
+ if ( text.charAt(0) !== '/' ) {
+ var parts = text.split(' ');
+ if ( parts[parts.length - 1].length === 0 )
+ break;
+ }
- // If suggestions aren't visible... show them. And set that we
- // triggered the suggestions with tab.
- if ( ! this.get('ffz_suggestions_visible') ) {
- this.ffzFetchNameSuggestions();
- this.set('ffz_suggestions_visible', true);
- this.ffzSetPartialWord();
- this.trackSuggestions("Tab");
+ // If suggestions aren't visible... show them. And set that we
+ // triggered the suggestions with tab.
+ if ( ! this.get('ffz_suggestions_visible') ) {
+ this.ffzFetchNameSuggestions();
+ this.set('ffz_suggestions_visible', true);
+ this.ffzSetPartialWord();
+ this.trackSuggestions("Tab");
- // If suggestions *are* visible, enter a suggestion.
- } else
- this.ffzCompleteSuggestion();
+ // If suggestions *are* visible, enter a suggestion.
+ } else
+ this.ffzCompleteSuggestion();
- break;
+ break;
- case KEYCODES.PAGE_UP:
- case KEYCODES.PAGE_DOWN:
- // Navigate through suggestions if those are open.
- if ( this.get('ffz_suggestions_visible') && !( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey ) ) {
- var suggestions = this.get('ffz_sorted_suggestions'),
- current = this.get('ffz_current_suggestion') + (key === KEYCODES.PAGE_UP ? -5 : 5);
+ case KEYCODES.PAGE_UP:
+ case KEYCODES.PAGE_DOWN:
+ // Navigate through suggestions if those are open.
+ if ( this.get('ffz_suggestions_visible') && !( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey ) ) {
+ var suggestions = this.get('ffz_sorted_suggestions'),
+ current = this.get('ffz_current_suggestion') + (key === KEYCODES.PAGE_UP ? -5 : 5);
- if ( current < 0 )
- current = 0;
- else if ( current >= suggestions.length )
- current = suggestions.length - 1;
+ if ( current < 0 )
+ current = 0;
+ else if ( current >= suggestions.length )
+ current = suggestions.length - 1;
- this.set('ffz_freeze_suggestions', -1);
- this.set('ffz_current_suggestion', current);
- e.preventDefault();
- }
+ this.set('ffz_freeze_suggestions', -1);
+ this.set('ffz_current_suggestion', current);
+ e.preventDefault();
+ }
- break;
+ break;
case KEYCODES.UP:
case KEYCODES.DOWN:
- // First, navigate through suggestions if those are open.
- if ( this.get('ffz_suggestions_visible') && !( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey ) ) {
- var suggestions = this.get('ffz_sorted_suggestions'),
- current = this.get('ffz_current_suggestion') + (key === KEYCODES.UP ? -1 : 1);
+ // First, navigate through suggestions if those are open.
+ if ( this.get('ffz_suggestions_visible') && !( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey ) ) {
+ var suggestions = this.get('ffz_sorted_suggestions'),
+ current = this.get('ffz_current_suggestion') + (key === KEYCODES.UP ? -1 : 1);
- if ( current < 0 )
- current = suggestions.length - 1;
- else if ( current >= suggestions.length )
- current = 0;
+ if ( current < 0 )
+ current = suggestions.length - 1;
+ else if ( current >= suggestions.length )
+ current = 0;
- this.set('ffz_freeze_suggestions', -1);
- this.set('ffz_current_suggestion', current);
- e.preventDefault();
- break;
-
- // Otherwise, if we're holding any special modifiers, don't do
- // anything special to avoid breaking functionality.
- } else if ( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey )
+ this.set('ffz_freeze_suggestions', -1);
+ this.set('ffz_current_suggestion', current);
+ e.preventDefault();
break;
- // If MRU is enabled, cycle through it if the cursor's position doesn't
- // change as a result of this action.
+ // Otherwise, if we're holding any special modifiers, don't do
+ // anything special to avoid breaking functionality.
+ } else if ( e.shiftKey || e.shiftLeft || e.ctrlKey || e.metaKey )
+ break;
+
+ // If MRU is enabled, cycle through it if the cursor's position doesn't
+ // change as a result of this action.
else if ( f.settings.input_mru )
Ember.run.next(this.ffzCycleMRU.bind(this, key, selection_start(this.get("chatTextArea"))));
- // If MRU isn't enabled, cycle through the whisper targets.
- else
- Ember.run.next(this.cycleWhisperTargets.bind(this, key));
+ // If MRU isn't enabled, cycle through the whisper targets.
+ else
+ Ember.run.next(this.cycleWhisperTargets.bind(this, key));
- break;
+ break;
- case KEYCODES.ENTER:
- if ( e.shiftKey || e.shiftLeft )
- break;
+ case KEYCODES.ENTER:
+ if ( e.shiftKey || e.shiftLeft )
+ break;
- this.set('ffz_mru_index', -1);
+ this.set('ffz_mru_index', -1);
- if ( this.get('ffz_suggestions_visible') )
- this.ffzCompleteSuggestion();
- else {
- this.set("_currentWhisperTarget", -1);
- setTimeout(this.ffzResizeInput.bind(this), 25);
- this.sendAction("sendMessage");
- }
+ if ( this.get('ffz_suggestions_visible') )
+ this.ffzCompleteSuggestion();
+ else {
+ this.set("_currentWhisperTarget", -1);
+ setTimeout(this.ffzResizeInput.bind(this), 25);
+ this.sendAction("sendMessage");
+ }
- if ( e.stopPropagation )
- e.stopPropagation();
+ if ( e.stopPropagation )
+ e.stopPropagation();
- e.preventDefault();
- break;
+ e.preventDefault();
+ break;
case KEYCODES.SPACE:
- // First things first, if we're currently showing suggestions, get rid of them.
- if ( this.get('ffz_suggestions_visible') )
- this.ffzHideSuggestions();
+ // First things first, if we're currently showing suggestions, get rid of them.
+ if ( this.get('ffz_suggestions_visible') )
+ this.ffzHideSuggestions();
- // After pressing space, if we're entering a command, do stuff!
- // TODO: Better support for commands.
- var sel = selection_start(this.get('chatTextArea'));
- Ember.run.next(function() {
- var text = t.get("textareaValue"),
- ind = text.indexOf(' '),
- start = ind !== -1 && text.substr(0, ind);
+ // After pressing space, if we're entering a command, do stuff!
+ // TODO: Better support for commands.
+ var sel = selection_start(this.get('chatTextArea'));
+ Ember.run.next(function() {
+ var text = t.get("textareaValue"),
+ ind = text.indexOf(' '),
+ start = ind !== -1 && text.substr(0, ind);
- if ( ind !== sel )
- return;
+ if ( ind !== sel )
+ return;
- if ( f.settings.input_quick_reply && start === '/r' ) {
- var target = t.get("uniqueWhisperSuggestions.0");
- if ( target ) {
- t.set("_currentWhisperTarget", 0);
- t.set("textareaValue", "/w " + target + t.get("textareaValue").substr(2));
+ if ( f.settings.input_quick_reply && start === '/r' ) {
+ var target = t.get("uniqueWhisperSuggestions.0");
+ if ( target ) {
+ t.set("_currentWhisperTarget", 0);
+ t.set("textareaValue", "/w " + target + t.get("textareaValue").substr(2));
- Ember.run.next(function() {
- move_selection(t.get('chatTextArea'), 4 + target.length);
- });
- } else {
- t.set("textareaValue", "/w " + t.get('textareaValue').substr(2));
- Ember.run.next(function() {
- move_selection(t.get('chatTextArea'), 3);
- t.ffzFetchNameSuggestions();
- t.set("ffz_suggestions_visible", true);
- t.ffzSetPartialWord();
- });
- }
+ Ember.run.next(function() {
+ move_selection(t.get('chatTextArea'), 4 + target.length);
+ });
+ } else {
+ t.set("textareaValue", "/w " + t.get('textareaValue').substr(2));
+ Ember.run.next(function() {
+ move_selection(t.get('chatTextArea'), 3);
+ t.ffzFetchNameSuggestions();
+ t.set("ffz_suggestions_visible", true);
+ t.ffzSetPartialWord();
+ });
+ }
- } else if ( start === '/w' || start === '/ignore' || start === '/unignore' || start === '/mod' || start === '/unmod' || start === '/ban' || start === '/unban' || start === '/timeout' || start === '/purge' ) {
- t.ffzFetchNameSuggestions();
- t.set("ffz_suggestions_visible", true);
- t.ffzSetPartialWord();
- }
- });
+ } else if ( start === '/w' || start === '/ignore' || start === '/unignore' || start === '/mod' || start === '/unmod' || start === '/ban' || start === '/unban' || start === '/timeout' || start === '/purge' ) {
+ t.ffzFetchNameSuggestions();
+ t.set("ffz_suggestions_visible", true);
+ t.ffzSetPartialWord();
+ }
+ });
}
},
diff --git a/src/ember/chatview.js b/src/ember/chatview.js
index 8bc35a1c..0207770a 100644
--- a/src/ember/chatview.js
+++ b/src/ember/chatview.js
@@ -14,11 +14,11 @@ FFZ.basic_settings.delayed_chat = {
300: "Minor (Bot Moderation; 0.3s)",
1200: "Normal (Human Moderation; 1.2s)",
5000: "Large (Spoiler Removal / Really Slow Mods; 5s)",
- 10000: "Extra Large (10s)",
- 15000: "Extremely Large (15s)",
- 20000: "Mods Asleep; Delay Chat (20s)",
- 30000: "Half a Minute (30s)",
- 60000: "Why??? (1m)"
+ 10000: "Extra Large (10s)",
+ 15000: "Extremely Large (15s)",
+ 20000: "Mods Asleep; Delay Chat (20s)",
+ 30000: "Half a Minute (30s)",
+ 60000: "Why??? (1m)"
},
category: "Chat",
@@ -141,11 +141,11 @@ FFZ.settings_info.chat_delay = {
300: "Minor (Bot Moderation; 0.3s)",
1200: "Normal (Human Moderation; 1.2s)",
5000: "Large (Spoiler Removal / Really Slow Mods; 5s)",
- 10000: "Extra Large (10s)",
- 15000: "Extremely Large (15s)",
- 20000: "Mods Asleep; Delay Chat (20s)",
- 30000: "Half a Minute (30s)",
- 60000: "Why??? (1m)"
+ 10000: "Extra Large (10s)",
+ 15000: "Extremely Large (15s)",
+ 20000: "Mods Asleep; Delay Chat (20s)",
+ 30000: "Half a Minute (30s)",
+ 60000: "Why??? (1m)"
},
value: 0,
@@ -328,22 +328,22 @@ FFZ.settings_info.visible_rooms = {
// --------------------
FFZ.prototype.refresh_chat = function() {
- var parents, lines = jQuery('ul.chat-lines');
- if ( this.has_bttv || ! lines || ! lines.length )
- return;
+ var parents, lines = jQuery('ul.chat-lines');
+ if ( this.has_bttv || ! lines || ! lines.length )
+ return;
- parents = lines.parents('.chatReplay');
- if ( parents && parents.length )
- return;
+ parents = lines.parents('.chatReplay');
+ if ( parents && parents.length )
+ return;
- // There are chat-lines in the DOM and they aren't chat replay.
- var controller = utils.ember_lookup('controller:chat');
- if ( ! controller )
- return;
+ // There are chat-lines in the DOM and they aren't chat replay.
+ var controller = utils.ember_lookup('controller:chat');
+ if ( ! controller )
+ return;
- var current_room = controller.get("currentRoom");
- controller.blurRoom();
- controller.focusRoom(current_room);
+ var current_room = controller.get("currentRoom");
+ controller.blurRoom();
+ controller.focusRoom(current_room);
}
FFZ.prototype.setup_chatview = function() {
@@ -402,10 +402,10 @@ FFZ.prototype.setup_chatview = function() {
f._chatv.ffzUpdateMenuUnread();
}.observes("invitedPrivateGroupRooms"),
- ffzChangedRoom: function() {
- if ( f._inputv )
- Ember.propertyDidChange(f._inputv, 'ffz_emoticons');
- }.observes('currentRoom'),
+ ffzChangedRoom: function() {
+ if ( f._inputv )
+ Ember.propertyDidChange(f._inputv, 'ffz_emoticons');
+ }.observes('currentRoom'),
notificationsCount: function() {
if ( ! f._chatv || f.has_bttv )
@@ -487,7 +487,7 @@ FFZ.prototype.modify_chat_view = function(view) {
var f = this;
utils.ember_reopen_view(view, {
ffz_init: function() {
- f._chatv = this;
+ f._chatv = this;
var room_id = this.get('controller.currentRoom.id'),
el = this.get('element');
@@ -559,7 +559,7 @@ FFZ.prototype.modify_chat_view = function(view) {
ffzChangeRoom: Ember.observer('controller.currentRoom', function() {
f.update_ui_link();
- this.ffz_unread = this.ffz_unread || {};
+ this.ffz_unread = this.ffz_unread || {};
// Close mod cards when changing to a new room.
if ( f._mod_card )
@@ -699,7 +699,7 @@ FFZ.prototype.modify_chat_view = function(view) {
ffzUpdateUnread: function(target_id) {
var current_id = this.get('controller.currentRoom.id');
- this.ffz_unread = this.ffz_unread || {};
+ this.ffz_unread = this.ffz_unread || {};
if ( target_id === current_id )
// We don't care about updates to the current room.
@@ -1036,7 +1036,7 @@ FFZ.prototype.modify_chat_view = function(view) {
link.title = "Chat Room Management";
link.innerHTML = '' + constants.ROOMS + '';
- jQuery(link).tipsy({gravity: "n", offset: 5});
+ jQuery(link).tipsy({gravity: "n", offset: 5});
link.addEventListener('click', function() {
var controller = view.get('controller');
diff --git a/src/ember/conversations.js b/src/ember/conversations.js
index 2fe165fa..14186536 100644
--- a/src/ember/conversations.js
+++ b/src/ember/conversations.js
@@ -177,22 +177,22 @@ FFZ.prototype.modify_conversation_line = function(component) {
return this._super(e);
},
- didUpdate: function() { this.ffzRender() },
- ffz_init: function() { this.ffzRender() },
+ didUpdate: function() { this.ffzRender() },
+ ffz_init: function() { this.ffzRender() },
ffzRender: function() {
- var el = this.get('element'),
- e = [],
+ var el = this.get('element'),
+ e = [],
- user = this.get('message.from.username'),
+ user = this.get('message.from.username'),
raw_color = this.get('message.from.color'),
colors = raw_color && f._handle_color(raw_color),
is_dark = (Layout && Layout.get('isTheatreMode')) || f.settings.dark_twitch,
- myself = f.get_user(),
- from_me = myself && myself.login === user,
+ myself = f.get_user(),
+ from_me = myself && myself.login === user,
- alias = f.aliases[user],
+ alias = f.aliases[user],
name = this.get('message.from.displayName') || (user && user.capitalize()) || "unknown user",
style = colors && 'color:' + (is_dark ? colors[1] : colors[0]),
colored = style ? ' has-color' : '';
@@ -212,7 +212,7 @@ FFZ.prototype.modify_conversation_line = function(component) {
e.push('');
e.push(f.render_tokens(this.get('tokenizedMessage'), true, f.settings.filter_whispered_links && !from_me));
e.push('');
- el.innerHTML = e.join('');
+ el.innerHTML = e.join('');
}
});
}
\ No newline at end of file
diff --git a/src/ember/directory.js b/src/ember/directory.js
index ae10ddab..1b098153 100644
--- a/src/ember/directory.js
+++ b/src/ember/directory.js
@@ -246,13 +246,13 @@ FFZ.prototype._modify_following = function() {
this.log("Found Following model.");
Following.reopen({
ffz_streams: {},
- ffz_hosts_for: {},
+ ffz_hosts_for: {},
ffz_skipped: 0,
empty: function() {
this._super();
this.set("ffz_streams", {});
- this.set("ffz_hosts_for", {});
+ this.set("ffz_hosts_for", {});
this.set("ffz_skipped", 0);
},
@@ -260,7 +260,7 @@ FFZ.prototype._modify_following = function() {
// We have to override request with nearly the same logic
// to prevent infinitely trying to load more streams.
if (!Twitch.user.isLoggedIn() || window.App.get("disableFollowingDirectory")) return RSVP.resolve({
- hosts: [], _total: 0
+ hosts: [], _total: 0
});
var t = {
@@ -268,16 +268,16 @@ FFZ.prototype._modify_following = function() {
offset: this.get('content.length') + this.get('ffz_skipped')
};
- // Don't use FFZ's Client ID because loading hosts is a normal part
- // of the dashboard. We're just manipulating the logic a bit.
+ // Don't use FFZ's Client ID because loading hosts is a normal part
+ // of the dashboard. We're just manipulating the logic a bit.
return Twitch.api.get("/api/users/:login/followed/hosting", t);
},
afterSuccess: function(e) {
- var valid_hosts = [],
+ var valid_hosts = [],
streams = this.get('ffz_streams'),
skipped = this.get('ffz_skipped'),
- hosts_for = this.get('ffz_hosts_for'),
+ hosts_for = this.get('ffz_hosts_for'),
t = this;
@@ -285,27 +285,27 @@ FFZ.prototype._modify_following = function() {
var host = e.hosts[i],
target = host && host.target && host.target.id;
- if ( host.rollbackData )
- host.rollbackData = undefined;
+ if ( host.rollbackData )
+ host.rollbackData = undefined;
if ( f.settings.directory_group_hosts && streams[target] ) {
skipped++;
- //hosts_for[target] && hosts_for[target]
- streams[target].ffz_hosts && streams[target].ffz_hosts.push({logo: host.logo, name: host.name, display_name: host.display_name});
+ //hosts_for[target] && hosts_for[target]
+ streams[target].ffz_hosts && streams[target].ffz_hosts.push({logo: host.logo, name: host.name, display_name: host.display_name});
continue;
}
streams[target] = host;
- //hosts_for[target] = [{logo: host.logo, name: host.name, display_name: host.display_name}];
+ //hosts_for[target] = [{logo: host.logo, name: host.name, display_name: host.display_name}];
host.ffz_hosts = [{logo: host.logo, name: host.name, display_name: host.display_name}];
valid_hosts.push(host);
}
- //f.log("Stuff!", [this, e, valid_hosts, skipped]);
+ //f.log("Stuff!", [this, e, valid_hosts, skipped]);
- this.set('ffz_skipped', skipped);
- this.setContent(valid_hosts);
+ this.set('ffz_skipped', skipped);
+ this.setContent(valid_hosts);
// We could get non-empty results even with no new hosts.
this.set('gotNonEmptyResults', e.hosts && e.hosts.length);
@@ -321,31 +321,31 @@ FFZ.prototype._modify_following = function() {
// TODO: Something less stupid.
for(var i=0; i < content.length; i++) {
- var host = content[i];
+ var host = content[i];
host_copy.push({
- display_name: host.display_name,
- game: host.game,
- id: host.id,
- logo: host.logo,
- name: host.name,
- target: {
- _id: host.target._id,
- channel: {
- display_name: host.target.channel.display_name,
- id: host.target.channel.id,
- logo: host.target.channel.logo,
- name: host.target.channel.name,
- url: host.target.channel.url
- },
- id: host.target.id,
- meta_game: host.target.meta_game,
- preview: host.target.preview,
- title: host.target.title,
- url: host.target.url,
- viewers: host.target.viewers
- }
- });
- }
+ display_name: host.display_name,
+ game: host.game,
+ id: host.id,
+ logo: host.logo,
+ name: host.name,
+ target: {
+ _id: host.target._id,
+ channel: {
+ display_name: host.target.channel.display_name,
+ id: host.target.channel.id,
+ logo: host.target.channel.logo,
+ name: host.target.channel.name,
+ url: host.target.channel.url
+ },
+ id: host.target.id,
+ meta_game: host.target.meta_game,
+ preview: host.target.preview,
+ title: host.target.title,
+ url: host.target.url,
+ viewers: host.target.viewers
+ }
+ });
+ }
Following.clear();
Following.afterSuccess({hosts: host_copy, _total: total});
@@ -421,7 +421,7 @@ FFZ.prototype.modify_game_follow_button = function(component) {
FFZ.prototype.modify_directory_live = function(component, is_csgo) {
var f = this,
- pref = is_csgo ? 'channel.' : 'stream.';
+ pref = is_csgo ? 'channel.' : 'stream.';
utils.ember_reopen_view(component, {
ffz_init: function() {
@@ -429,11 +429,11 @@ FFZ.prototype.modify_directory_live = function(component, is_csgo) {
meta = el && el.querySelector('.meta'),
thumb = el && el.querySelector('.thumb'),
cap = thumb && thumb.querySelector('.cap'),
- channel_id = this.get(pref + 'channel.name'),
+ channel_id = this.get(pref + 'channel.name'),
game = this.get(pref + 'game');
el.classList.add('ffz-directory-preview');
- el.setAttribute('data-channel', channel_id);
+ el.setAttribute('data-channel', channel_id);
el.setAttribute('data-game', game);
el.classList.toggle('ffz-game-banned', f.settings.banned_games.indexOf(game && game.toLowerCase()) !== -1);
@@ -450,8 +450,8 @@ FFZ.prototype.modify_directory_live = function(component, is_csgo) {
this.ffzUpdateUptime();
}
- this._ffz_image_timer = setInterval(this.ffzRotateImage.bind(this), 30000);
- this.ffzRotateImage();
+ this._ffz_image_timer = setInterval(this.ffzRotateImage.bind(this), 30000);
+ this.ffzRotateImage();
if ( f.settings.directory_logos ) {
el.classList.add('ffz-directory-logo');
@@ -468,8 +468,8 @@ FFZ.prototype.modify_directory_live = function(component, is_csgo) {
link.href = '/' + channel_id;
link.addEventListener('click', function(e) {
- if ( e.button !== 0 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey )
- return;
+ if ( e.button !== 0 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey )
+ return;
var Channel = utils.ember_resolve('model:deprecated-channel');
if ( ! Channel )
@@ -494,21 +494,21 @@ FFZ.prototype.modify_directory_live = function(component, is_csgo) {
if ( this._ffz_uptime_timer )
clearInterval(this._ffz_uptime_timer);
- if ( this._ffz_image_timer )
- clearInterval(this._ffz_image_timer);
+ if ( this._ffz_image_timer )
+ clearInterval(this._ffz_image_timer);
},
- ffzRotateImage: function() {
- var url = this.get(pref + 'preview.medium'),
- now = Math.round((new Date).getTime() / 150000);
+ ffzRotateImage: function() {
+ var url = this.get(pref + 'preview.medium'),
+ now = Math.round((new Date).getTime() / 150000);
- if ( FFZ._image_cache[url] && FFZ._image_cache[url] !== now )
- url += '?_=' + now;
- else
- FFZ._image_cache[url] = now;
+ if ( FFZ._image_cache[url] && FFZ._image_cache[url] !== now )
+ url += '?_=' + now;
+ else
+ FFZ._image_cache[url] = now;
- this.$('.thumb .cap img').attr('src', url);
- },
+ this.$('.thumb .cap img').attr('src', url);
+ },
ffzUpdateUptime: function() {
var raw_created = this.get(pref + 'created_at'),
@@ -554,7 +554,7 @@ FFZ.prototype.modify_video_preview = function(component) {
boxart.setAttribute('original-title', game);
boxart.addEventListener('click', function(e) {
if ( e.button !== 0 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey )
- return;
+ return;
e.preventDefault();
jQuery('.tipsy').remove();
@@ -661,25 +661,25 @@ FFZ.prototype.modify_directory_host = function(component) {
f.show_popup(menu, [x, y], document.querySelector('#main_col > .tse-scroll-content > .tse-content'));
},
- ffzRotateImage: function() {
- var url = this.get('stream.target.preview'),
- now = Math.round((new Date).getTime() / 150000);
+ ffzRotateImage: function() {
+ var url = this.get('stream.target.preview'),
+ now = Math.round((new Date).getTime() / 150000);
- if ( FFZ._image_cache[url] && FFZ._image_cache[url] !== now )
- url += '?_=' + now;
- else
- FFZ._image_cache[url] = now;
+ if ( FFZ._image_cache[url] && FFZ._image_cache[url] !== now )
+ url += '?_=' + now;
+ else
+ FFZ._image_cache[url] = now;
- this.$('.thumb .cap img').attr('src', url);
- },
+ this.$('.thumb .cap img').attr('src', url);
+ },
ffz_destroy: function() {
var target = this.get('stream.target.channel');
if ( f._popup && f._popup.classList.contains('ffz-channel-selector') && f._popup.getAttribute('data-channel') === target )
f.close_popup();
- if ( this._ffz_image_timer )
- clearInterval(this._ffz_image_timer);
+ if ( this._ffz_image_timer )
+ clearInterval(this._ffz_image_timer);
},
ffz_init: function() {
@@ -700,8 +700,8 @@ FFZ.prototype.modify_directory_host = function(component) {
el.classList.toggle('ffz-game-banned', f.settings.banned_games.indexOf(game && game.toLowerCase()) !== -1);
el.classList.toggle('ffz-game-spoilered', f.settings.spoiler_games.indexOf(game && game.toLowerCase()) !== -1);
- this._ffz_image_timer = setInterval(this.ffzRotateImage.bind(this), 30000);
- this.ffzRotateImage();
+ this._ffz_image_timer = setInterval(this.ffzRotateImage.bind(this), 30000);
+ this.ffzRotateImage();
if ( f.settings.directory_logos ) {
el.classList.add('ffz-directory-logo');
diff --git a/src/ember/following.js b/src/ember/following.js
index 229c4c62..49a33e3e 100644
--- a/src/ember/following.js
+++ b/src/ember/following.js
@@ -140,7 +140,7 @@ FFZ.prototype.setup_profile_following = function() {
}
});
- // TODO: Add nice Manage Following button to the directory.
+ // TODO: Add nice Manage Following button to the directory.
// Now, rebuild any views.
try { FollowedItem.create().destroy();
@@ -148,9 +148,9 @@ FFZ.prototype.setup_profile_following = function() {
var views = utils.ember_views();
- if ( views ) {
- for(var key in views) {
- var view = views[key];
+ if ( views ) {
+ for(var key in views) {
+ var view = views[key];
if ( view instanceof FollowedItem ) {
this.log("Manually updating existing component:display-followed-item.", view);
try {
@@ -161,7 +161,7 @@ FFZ.prototype.setup_profile_following = function() {
this.error("setup: component:display-followed-item ffzInit: " + err);
}
}
- }
+ }
}
@@ -358,11 +358,11 @@ FFZ.prototype._modify_display_followed_item = function(component) {
FFZ.prototype._hook_following = function(Following) {
var f = this;
- if ( ! Following || Following.ffz_hooked )
- return;
+ if ( ! Following || Following.ffz_hooked )
+ return;
Following.reopen({
- ffz_hooked: true,
+ ffz_hooked: true,
apiLoad: function(e) {
var channel_id = this.get('id'),
t = this;
@@ -398,11 +398,11 @@ FFZ.prototype._hook_following = function(Following) {
FFZ.prototype._hook_followers = function(Followers) {
var f = this;
- if ( ! Followers || Followers.ffz_hooked )
- return;
+ if ( ! Followers || Followers.ffz_hooked )
+ return;
Followers.reopen({
- ffz_hooked: true,
+ ffz_hooked: true,
apiLoad: function(e) {
var channel_id = this.get('id'),
t = this;
diff --git a/src/ember/layout.js b/src/ember/layout.js
index cce6a7e1..08db35c3 100644
--- a/src/ember/layout.js
+++ b/src/ember/layout.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require('../utils');
+ utils = require('../utils');
// --------------------
@@ -108,18 +108,18 @@ FFZ.settings_info.right_column_width = {
method: function() {
var f = this,
- old_val = this.settings.right_column_width || 340;
+ old_val = this.settings.right_column_width || 340;
- utils.prompt("Right Sidebar Width", "Please enter a new width for the right sidebar, in pixels.
Minimum: 250 Default: 340", old_val, function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt("Right Sidebar Width", "Please enter a new width for the right sidebar, in pixels.
Minimum: 250 Default: 340", old_val, function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var width = parseInt(new_val);
- if ( ! width || Number.isNaN(width) || ! Number.isFinite(width) )
- width = 340;
+ var width = parseInt(new_val);
+ if ( ! width || Number.isNaN(width) || ! Number.isFinite(width) )
+ width = 340;
- f.settings.set('right_column_width', Math.max(250, width));
- });
+ f.settings.set('right_column_width', Math.max(250, width));
+ });
},
on_update: function(val) {
@@ -223,19 +223,19 @@ FFZ.prototype.setup_layout = function() {
height = size[1],
host_height = size[2];
- return "";
+ return "";
}.property("playerSize"),
ffzPortraitWarning: function() {
- var t = this;
- // Delay this, in case we're just resizing the window.
- setTimeout(function() {
- if ( ! f.settings.portrait_mode || f._portrait_warning || f.settings.portrait_warning || document.body.getAttribute('data-current-path').indexOf('user.') !== 0 || ! t.get('isTooSmallForRightColumn') )
- return;
+ var t = this;
+ // Delay this, in case we're just resizing the window.
+ setTimeout(function() {
+ if ( ! f.settings.portrait_mode || f._portrait_warning || f.settings.portrait_warning || document.body.getAttribute('data-current-path').indexOf('user.') !== 0 || ! t.get('isTooSmallForRightColumn') )
+ return;
- f._portrait_warning = true;
- f.show_message('Twitch\'s Chat Sidebar has been hidden as a result of FrankerFaceZ\'s Portrait Mode because the window is too wide.
Do not show this message again');
- }, 50);
+ f._portrait_warning = true;
+ f.show_message('Twitch\'s Chat Sidebar has been hidden as a result of FrankerFaceZ\'s Portrait Mode because the window is too wide.
Do not show this message again');
+ }, 50);
}.observes("isTooSmallForRightColumn"),
@@ -253,73 +253,73 @@ FFZ.prototype.setup_layout = function() {
out += 'width: 50vh !important; height: 28.125vh !important;';
if ( ! f.has_bttv ) {
- if ( this.get('isRightColumnClosed') )
+ if ( this.get('isRightColumnClosed') )
out += 'top: 0; right: 0}';
- else {
- if ( this.get('portraitMode') ) {
- var size = this.get('playerSize'),
- video_below = this.get('portraitVideoBelow'),
+ else {
+ if ( this.get('portraitMode') ) {
+ var size = this.get('playerSize'),
+ video_below = this.get('portraitVideoBelow'),
- video_height = size[1] + 120 + 60,
- chat_height = window_height - video_height,
+ video_height = size[1] + 120 + 60,
+ chat_height = window_height - video_height,
- video_top = video_below ? chat_height : 0,
- chat_top = video_below ? 0 : video_height,
+ video_top = video_below ? chat_height : 0,
+ chat_top = video_below ? 0 : video_height,
- theatre_video_height = Math.floor(Math.max(window_height * 0.1, Math.min(window_height - 300, 9 * window_width / 16))),
- theatre_chat_height = window_height - theatre_video_height,
+ theatre_video_height = Math.floor(Math.max(window_height * 0.1, Math.min(window_height - 300, 9 * window_width / 16))),
+ theatre_chat_height = window_height - theatre_video_height,
- theatre_video_top = video_below ? theatre_chat_height : 0,
- theatre_chat_top = video_below ? 0 : theatre_video_height;
+ theatre_video_top = video_below ? theatre_chat_height : 0,
+ theatre_chat_top = video_below ? 0 : theatre_video_height;
out += 'top: ' + video_top + 'px;right: 0}' +
'body[data-current-path^="user."] #left_col .warp { min-height: inherit }' +
'body[data-current-path^="user."] #left_col { overflow: hidden }' +
- 'body[data-current-path^="user."] #left_col .warp,' +
+ 'body[data-current-path^="user."] #left_col .warp,' +
'body[data-current-path^="user."] #left_col,' +
- 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) #main_col{' +
- 'margin-right:0 !important;' +
- 'top:' + video_top + 'px;' +
- 'height:' + video_height + 'px}' +
- 'body[data-current-path^="user."].ffz-sidebar-swap #main_col{' +
- 'margin-left:0 !important;' +
- 'top:' + video_top + 'px;' +
- 'height:' + video_height + 'px}' +
- 'body[data-current-path^="user."] #right_col{' +
- 'width:100%;' +
- 'top:' + chat_top + 'px;' +
- 'height:' + chat_height + 'px}' +
+ 'body[data-current-path^="user."]:not(.ffz-sidebar-swap) #main_col{' +
+ 'margin-right:0 !important;' +
+ 'top:' + video_top + 'px;' +
+ 'height:' + video_height + 'px}' +
+ 'body[data-current-path^="user."].ffz-sidebar-swap #main_col{' +
+ 'margin-left:0 !important;' +
+ 'top:' + video_top + 'px;' +
+ 'height:' + video_height + 'px}' +
+ 'body[data-current-path^="user."] #right_col{' +
+ 'width:100%;' +
+ 'top:' + chat_top + 'px;' +
+ 'height:' + chat_height + 'px}' +
'body[data-current-path^="user."] .app-main.theatre #left_col .warp,' +
- 'body[data-current-path^="user."] .app-main.theatre #left_col,' +
- 'body[data-current-path^="user."] .app-main.theatre #main_col{' +
- 'top:' + theatre_video_top + 'px;' +
- 'height:' + theatre_video_height + 'px}' +
- 'body[data-current-path^="user."] .app-main.theatre #right_col{' +
- 'top:' + theatre_chat_top + 'px;' +
- 'height:' + theatre_chat_height + 'px}';
+ 'body[data-current-path^="user."] .app-main.theatre #left_col,' +
+ 'body[data-current-path^="user."] .app-main.theatre #main_col{' +
+ 'top:' + theatre_video_top + 'px;' +
+ 'height:' + theatre_video_height + 'px}' +
+ 'body[data-current-path^="user."] .app-main.theatre #right_col{' +
+ 'top:' + theatre_chat_top + 'px;' +
+ 'height:' + theatre_chat_height + 'px}';
- } else {
- var width = this.get('rightColumnWidth');
+ } else {
+ var width = this.get('rightColumnWidth');
out += 'top: 0; right: ' + width + 'px}' +
'#main_col.expandRight #right_close{left: none !important}' +
- '#right_col{width:' + width + 'px}' +
- 'body:not(.ffz-sidebar-swap) #main_col:not(.expandRight){' +
- 'margin-right:' + width + 'px}' +
- 'body.ffz-sidebar-swap #main_col:not(.expandRight){' +
- 'margin-left:' + width + 'px}';
- }
- }
+ '#right_col{width:' + width + 'px}' +
+ 'body:not(.ffz-sidebar-swap) #main_col:not(.expandRight){' +
+ 'margin-right:' + width + 'px}' +
+ 'body.ffz-sidebar-swap #main_col:not(.expandRight){' +
+ 'margin-left:' + width + 'px}';
+ }
+ }
f._layout_style.innerHTML = out;
}
}.observes("isRightColumnClosed", "playerSize", "rightColumnWidth", "portraitMode", "windowHeight", "windowWidth"),
- ffzUpdatePlayerStyle: function() {
- Ember.propertyDidChange(Layout, 'playerStyle');
- }.observes('windowHeight', 'windowWidth'),
+ ffzUpdatePlayerStyle: function() {
+ Ember.propertyDidChange(Layout, 'playerStyle');
+ }.observes('windowHeight', 'windowWidth'),
ffzUpdatePortraitCSS: function() {
var portrait = this.get("portraitMode");
diff --git a/src/ember/line.js b/src/ember/line.js
index 9a8b022b..dd9b5b8f 100644
--- a/src/ember/line.js
+++ b/src/ember/line.js
@@ -12,14 +12,14 @@ FFZ.settings_info.alias_italics = {
value: true,
category: "Chat Appearance",
- no_bttv: true,
+ no_bttv: true,
- name: "Display Aliases in Italics",
- help: "Format the names of users that have aliases with italics to make it obvious at a glance that they have been renamed.",
+ name: "Display Aliases in Italics",
+ help: "Format the names of users that have aliases with italics to make it obvious at a glance that they have been renamed.",
on_update: function(val) {
- document.body.classList.toggle('ffz-alias-italics', val);
- }
+ document.body.classList.toggle('ffz-alias-italics', val);
+ }
};
FFZ.settings_info.room_status = {
@@ -33,9 +33,9 @@ FFZ.settings_info.room_status = {
help: "Display the current room state (slow mode, sub mode, and r9k mode) next to the Chat button.",
on_update: function() {
- if ( this._roomv )
- this._roomv.ffzUpdateStatus();
- }
+ if ( this._roomv )
+ this._roomv.ffzUpdateStatus();
+ }
};
@@ -52,14 +52,14 @@ FFZ.settings_info.replace_bad_emotes = {
FFZ.settings_info.parse_emoticons = {
- type: "boolean",
- value: true,
+ type: "boolean",
+ value: true,
- category: "Chat Appearance",
- no_bttv: true,
+ category: "Chat Appearance",
+ no_bttv: true,
- name: "Display Emoticons",
- help: "Display emoticons in chat messages rather than just text."
+ name: "Display Emoticons",
+ help: "Display emoticons in chat messages rather than just text."
};
@@ -69,7 +69,7 @@ FFZ.settings_info.parse_emoji = {
0: "No Images / Font Only",
1: "Twitter Emoji Images",
2: "Google Noto Images",
- 3: "EmojiOne Images"
+ 3: "EmojiOne Images"
},
value: 1,
@@ -102,32 +102,32 @@ FFZ.settings_info.scrollback_length = {
help: "Set the maximum number of lines to keep in chat.",
method: function() {
- var f = this;
- utils.prompt(
- "Scrollback Length",
- "Please enter a new maximum length for the chat scrollback. Please note that setting this too high may cause your computer to begin lagging as chat messages accumulate.
Default: 150",
- this.settings.scrollback_length,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ var f = this;
+ utils.prompt(
+ "Scrollback Length",
+ "Please enter a new maximum length for the chat scrollback. Please note that setting this too high may cause your computer to begin lagging as chat messages accumulate.
Default: 150",
+ this.settings.scrollback_length,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- new_val = parseInt(new_val);
- if ( Number.isNaN(new_val) || ! Number.isFinite(new_val) )
- new_val = 150;
+ new_val = parseInt(new_val);
+ if ( Number.isNaN(new_val) || ! Number.isFinite(new_val) )
+ new_val = 150;
- new_val = Math.max(10, new_val);
+ new_val = Math.max(10, new_val);
- f.settings.set("scrollback_length", new_val);
+ f.settings.set("scrollback_length", new_val);
- // Update our everything.
- var Chat = utils.ember_lookup('controller:chat'),
- current_id = Chat && Chat.get('currentRoom.id');
+ // Update our everything.
+ var Chat = utils.ember_lookup('controller:chat'),
+ current_id = Chat && Chat.get('currentRoom.id');
- for(var room_id in f.rooms) {
- var room = f.rooms[room_id];
- room.room && room.room.set('messageBufferSize', new_val + ((f._roomv && !f._roomv.get('stuckToBottom') && current_id === room_id) ? 150 : 0));
- }
- });
+ for(var room_id in f.rooms) {
+ var room = f.rooms[room_id];
+ room.room && room.room.set('messageBufferSize', new_val + ((f._roomv && !f._roomv.get('stuckToBottom') && current_id === room_id) ? 150 : 0));
+ }
+ });
}
};
@@ -149,7 +149,7 @@ FFZ.settings_info.filter_whispered_links = {
value: true,
category: "Chat Filtering",
- warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
+ warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Auto-Hide Potentially Dangerous Whispered Links",
help: "Removes whispered links and displays a placeholder, with a warning that the link has not been approved by moderation or staff. Links remain accessible with an additional click."
@@ -169,27 +169,27 @@ FFZ.settings_info.banned_words = {
method: function() {
var f = this,
- old_val = this.settings.banned_words.join(", ");
+ old_val = this.settings.banned_words.join(", ");
- utils.prompt(
- "Banned Words",
- "Please enter a comma-separated list of words that you would like to have removed from chat messages.",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Banned Words",
+ "Please enter a comma-separated list of words that you would like to have removed from chat messages.",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- new_val = new_val.trim().split(constants.SPLITTER);
- var vals = [];
+ new_val = new_val.trim().split(constants.SPLITTER);
+ var vals = [];
- for(var i=0; i < new_val.length; i++)
- new_val[i] && vals.push(new_val[i]);
+ for(var i=0; i < new_val.length; i++)
+ new_val[i] && vals.push(new_val[i]);
- if ( vals.length == 1 && vals[0] == "disable" )
- vals = [];
+ if ( vals.length == 1 && vals[0] == "disable" )
+ vals = [];
- f.settings.set("banned_words", vals);
- });
+ f.settings.set("banned_words", vals);
+ });
}
};
@@ -200,35 +200,35 @@ FFZ.settings_info.keywords = {
category: "Chat Filtering",
- warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
+ warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Highlight Keywords",
help: "Set additional keywords that will be highlighted in chat.",
method: function() {
var f = this,
- old_val = this.settings.keywords.join(", ");
+ old_val = this.settings.keywords.join(", ");
- utils.prompt(
- "Highlight Keywords",
- "Please enter a comma-separated list of words that you would like to be highlighted in chat.",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Highlight Keywords",
+ "Please enter a comma-separated list of words that you would like to be highlighted in chat.",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- // Split them up.
- new_val = new_val.trim().split(constants.SPLITTER);
- var vals = [];
+ // Split them up.
+ new_val = new_val.trim().split(constants.SPLITTER);
+ var vals = [];
- for(var i=0; i < new_val.length; i++)
- new_val[i] && vals.push(new_val[i]);
+ for(var i=0; i < new_val.length; i++)
+ new_val[i] && vals.push(new_val[i]);
- if ( vals.length == 1 && vals[0] == "disable" )
- vals = [];
+ if ( vals.length == 1 && vals[0] == "disable" )
+ vals = [];
- f.settings.set("keywords", vals);
- });
+ f.settings.set("keywords", vals);
+ });
}
};
@@ -311,7 +311,7 @@ FFZ.settings_info.chat_rows = {
on_update: function(val) {
this.toggle_style('chat-background', !this.has_bttv && val);
- this.toggle_style('chat-setup', !this.has_bttv && (val || this.settings.chat_separators || this.settings.highlight_messages_with_mod_card));
+ this.toggle_style('chat-setup', !this.has_bttv && (val || this.settings.chat_separators || this.settings.highlight_messages_with_mod_card));
}
};
@@ -344,7 +344,7 @@ FFZ.settings_info.chat_separators = {
help: "Display thin lines between chat messages for further visual separation.",
on_update: function(val) {
- this.toggle_style('chat-setup', !this.has_bttv && (val || this.settings.chat_rows || this.settings.highlight_messages_with_mod_card));
+ this.toggle_style('chat-setup', !this.has_bttv && (val || this.settings.chat_rows || this.settings.highlight_messages_with_mod_card));
this.toggle_style('chat-separator', !this.has_bttv && val);
this.toggle_style('chat-separator-3d', !this.has_bttv && val === 2);
@@ -355,28 +355,28 @@ FFZ.settings_info.chat_separators = {
FFZ.settings_info.old_sub_notices = {
- type: "boolean",
- value: false,
+ type: "boolean",
+ value: false,
- category: "Chat Appearance",
- no_bttv: true,
+ category: "Chat Appearance",
+ no_bttv: true,
- name: "Old-Style Subscriber Notices",
- help: "Display the old style subscriber notices, with the message on a separate line."
+ name: "Old-Style Subscriber Notices",
+ help: "Display the old style subscriber notices, with the message on a separate line."
};
FFZ.settings_info.emote_alignment = {
- type: "boolean",
- value: false,
+ type: "boolean",
+ value: false,
- category: "Chat Appearance",
- no_bttv: true,
+ category: "Chat Appearance",
+ no_bttv: true,
- name: "Baseline Emoticon Alignment",
- help: "Align emotes on the text baseline, making messages taller but ensuring emotes don't overlap.",
+ name: "Baseline Emoticon Alignment",
+ help: "Align emotes on the text baseline, making messages taller but ensuring emotes don't overlap.",
- on_update: function(val) { document.body.classList.toggle('ffz-baseline-emoticons', !this.has_bttv && val) }
+ on_update: function(val) { document.body.classList.toggle('ffz-baseline-emoticons', !this.has_bttv && val) }
};
FFZ.settings_info.chat_padding = {
@@ -439,23 +439,23 @@ FFZ.settings_info.chat_font_family = {
help: "Change the font used for rendering chat messages.",
method: function() {
- var f = this,
- old_val = this.settings.chat_font_family || "";
+ var f = this,
+ old_val = this.settings.chat_font_family || "";
- utils.prompt(
- "Chat Font Family",
- "Please enter a font family to use rendering chat. Leave this blank to use the default.",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Chat Font Family",
+ "Please enter a font family to use rendering chat. Leave this blank to use the default.",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- // Should we wrap this with quotes?
- if ( ! new_val )
- new_val = null;
+ // Should we wrap this with quotes?
+ if ( ! new_val )
+ new_val = null;
- f.settings.set("chat_font_family", new_val);
- });
+ f.settings.set("chat_font_family", new_val);
+ });
},
on_update: function(val) {
@@ -491,23 +491,23 @@ FFZ.settings_info.chat_font_size = {
help: "Make the chat font bigger or smaller.",
method: function() {
- var f = this,
- old_val = this.settings.chat_font_size;
+ var f = this,
+ old_val = this.settings.chat_font_size;
- utils.prompt(
- "Chat Font Size",
- "Please enter a new size for the chat font.
Default: 12",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Chat Font Size",
+ "Please enter a new size for the chat font.
Default: 12",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var parsed = parseInt(new_val);
- if ( ! parsed || Number.isNaN(parsed) || parsed < 1 )
- parsed = 12;
+ var parsed = parseInt(new_val);
+ if ( ! parsed || Number.isNaN(parsed) || parsed < 1 )
+ parsed = 12;
- f.settings.set("chat_font_size", parsed);
- });
+ f.settings.set("chat_font_size", parsed);
+ });
},
on_update: function(val) {
@@ -542,26 +542,26 @@ FFZ.settings_info.chat_ts_size = {
help: "Make the chat timestamp font bigger or smaller.",
method: function() {
- var f = this,
- old_val = this.settings.chat_ts_size;
+ var f = this,
+ old_val = this.settings.chat_ts_size;
if ( ! old_val )
old_val = this.settings.chat_font_size;
- utils.prompt(
- "Chat Timestamp Font Size",
- "Please enter a new size for the chat timestamp font. The default is to match the regular chat font size.",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Chat Timestamp Font Size",
+ "Please enter a new size for the chat timestamp font. The default is to match the regular chat font size.",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var parsed = parseInt(new_val);
- if ( parsed < 1 || Number.isNaN(parsed) || ! Number.isFinite(parsed) )
- parsed = null;
+ var parsed = parseInt(new_val);
+ if ( parsed < 1 || Number.isNaN(parsed) || ! Number.isFinite(parsed) )
+ parsed = null;
- f.settings.set("chat_ts_size", parsed);
- });
+ f.settings.set("chat_ts_size", parsed);
+ });
},
on_update: function(val) {
@@ -612,8 +612,8 @@ FFZ.prototype.setup_line = function() {
// Chat Enhancements
- document.body.classList.toggle('ffz-alias-italics', this.settings.alias_italics);
- document.body.classList.toggle('ffz-baseline-emoticons', !this.has_bttv && this.settings.emote_alignment);
+ document.body.classList.toggle('ffz-alias-italics', this.settings.alias_italics);
+ document.body.classList.toggle('ffz-baseline-emoticons', !this.has_bttv && this.settings.emote_alignment);
this.toggle_style('chat-setup', !this.has_bttv && (this.settings.chat_rows || this.settings.chat_separators || this.settings.highlight_messages_with_mod_card));
this.toggle_style('chat-padding', !this.has_bttv && this.settings.chat_padding);
@@ -631,33 +631,33 @@ FFZ.prototype.setup_line = function() {
this._last_row = {};
- /*this.log("Hooking the Ember Chat Line component.");
+ /*this.log("Hooking the Ember Chat Line component.");
var Line = utils.ember_resolve('component:chat-line');
if ( Line )
this._modify_chat_line(Line);*/
- this.log("Hooking the Ember VOD Chat Line component.");
- var VOD = utils.ember_resolve('component:vod-chat-line');
- if ( VOD )
- this._modify_vod_line(VOD);
- else
- this.log("Couldn't find VOD Chat Line component.");
+ this.log("Hooking the Ember VOD Chat Line component.");
+ var VOD = utils.ember_resolve('component:vod-chat-line');
+ if ( VOD )
+ this._modify_vod_line(VOD);
+ else
+ this.log("Couldn't find VOD Chat Line component.");
- this.log("Hooking the Ember Message Line component.");
- var MLine = utils.ember_resolve('component:chat/message-line');
- if ( MLine )
- this._modify_chat_subline(MLine);
- else
- this.error("Couldn't find the Message Line component.");
+ this.log("Hooking the Ember Message Line component.");
+ var MLine = utils.ember_resolve('component:chat/message-line');
+ if ( MLine )
+ this._modify_chat_subline(MLine);
+ else
+ this.error("Couldn't find the Message Line component.");
- this.log("Hooking the Ember Whisper Line component.");
- var WLine = utils.ember_resolve('component:chat/whisper-line');
- if ( WLine )
- this._modify_chat_subline(WLine);
- else
- this.error("Couldn't find the Whisper Line component.");
+ this.log("Hooking the Ember Whisper Line component.");
+ var WLine = utils.ember_resolve('component:chat/whisper-line');
+ if ( WLine )
+ this._modify_chat_subline(WLine);
+ else
+ this.error("Couldn't find the Whisper Line component.");
// Store the capitalization of our own name.
@@ -674,16 +674,16 @@ FFZ.prototype.save_aliases = function() {
FFZ.prototype._modify_chat_line = function(component, is_vod) {
- var f = this,
- Layout = utils.ember_lookup('service:layout'),
+ var f = this,
+ Layout = utils.ember_lookup('service:layout'),
Settings = utils.ember_lookup('controller:settings');
- component.reopen({
- tokenizedMessage: function() {
- return [];
- }.property('msgObject.message'),
+ component.reopen({
+ tokenizedMessage: function() {
+ return [];
+ }.property('msgObject.message'),
- ffzTokenizedMessage: function() {
+ ffzTokenizedMessage: function() {
try {
return f.tokenize_chat_line(this.get('msgObject'));
} catch(err) {
@@ -692,19 +692,19 @@ FFZ.prototype._modify_chat_line = function(component, is_vod) {
}
}.property("msgObject.message", "isChannelLinksDisabled", "currentUserNick", "msgObject.from", "msgObject.tags.emotes"),
- lineChanged: Ember.observer("msgObject.deleted", "isModeratorOrHigher", "msgObject.ffz_old_messages", "ffzTokenizedMessage", function() {
- this.$(".mod-icons").replaceWith(this.buildModIconsHTML());
- if ( this.get("msgObject.deleted") ) {
- this.$(".message").replaceWith(this.buildDeletedMessageHTML());
- } else
- this.$(".deleted,.message").replaceWith(this.buildMessageHTML());
- }),
+ lineChanged: Ember.observer("msgObject.deleted", "isModeratorOrHigher", "msgObject.ffz_old_messages", "ffzTokenizedMessage", function() {
+ this.$(".mod-icons").replaceWith(this.buildModIconsHTML());
+ if ( this.get("msgObject.deleted") ) {
+ this.$(".message").replaceWith(this.buildDeletedMessageHTML());
+ } else
+ this.$(".deleted,.message").replaceWith(this.buildMessageHTML());
+ }),
- ffzUpdateBadges: function() {
- this.$(".badges").html(f.render_badges(f.get_line_badges(this.get('msgObject'))));
- },
+ ffzUpdateBadges: function() {
+ this.$(".badges").html(f.render_badges(f.get_line_badges(this.get('msgObject'))));
+ },
- ffzUserLevel: function() {
+ ffzUserLevel: function() {
if ( this.get('isStaff') )
return 5;
else if ( this.get('isAdmin') )
@@ -718,239 +718,239 @@ FFZ.prototype._modify_chat_line = function(component, is_vod) {
return 0;
}.property('msgObject.labels.[]'),
- buildModIconsHTML: function() {
- var user = this.get('msgObject.from'),
- room_id = this.get('msgObject.room'),
- room = f.rooms && f.rooms[room_id],
+ buildModIconsHTML: function() {
+ var user = this.get('msgObject.from'),
+ room_id = this.get('msgObject.room'),
+ room = f.rooms && f.rooms[room_id],
- deleted = this.get('msgObject.deleted'),
+ deleted = this.get('msgObject.deleted'),
- recipient = this.get('msgObject.to'),
- is_whisper = recipient && recipient.length,
+ recipient = this.get('msgObject.to'),
+ is_whisper = recipient && recipient.length,
- this_ul = this.get('ffzUserLevel'),
- other_ul = room && room.room && room.room.get('ffzUserLevel') || 0,
+ this_ul = this.get('ffzUserLevel'),
+ other_ul = room && room.room && room.room.get('ffzUserLevel') || 0,
- output;
+ output;
- if ( is_whisper || this_ul >= other_ul || f.settings.mod_buttons.length === 0 )
- return '';
+ if ( is_whisper || this_ul >= other_ul || f.settings.mod_buttons.length === 0 )
+ return '';
- output = '';
+ output = '';
- for(var i=0, l = f.settings.mod_buttons.length; i < l; i++) {
- var pair = f.settings.mod_buttons[i],
- prefix = pair[0], btn = pair[1],
+ for(var i=0, l = f.settings.mod_buttons.length; i < l; i++) {
+ var pair = f.settings.mod_buttons[i],
+ prefix = pair[0], btn = pair[1],
- cmd, tip;
+ cmd, tip;
- if ( btn === false ) {
- if ( deleted )
- output += 'Unban';
- else
- output += 'Ban';
+ if ( btn === false ) {
+ if ( deleted )
+ output += 'Unban';
+ else
+ output += 'Ban';
- } else if ( btn === 600 )
- output += 'Timeout';
+ } else if ( btn === 600 )
+ output += 'Timeout';
- else {
- if ( typeof btn === "string" ) {
- cmd = btn.replace(/{user}/g, user).replace(/{id}/g, this.get('msgObject.tags.id')).replace(/ * */, "\n");
- tip = "Custom Command" + (cmd.indexOf("\n") !== -1 ? 's' : '') + ' ' + utils.quote_san(cmd).replace('\n',' ');
- } else {
- cmd = "/timeout " + user + " " + btn;
- tip = "Timeout User (" + utils.duration_string(btn) + ")";
- }
- output += '' + prefix + '';
- }
- }
+ else {
+ if ( typeof btn === "string" ) {
+ cmd = btn.replace(/{user}/g, user).replace(/{id}/g, this.get('msgObject.tags.id')).replace(/ * */, "\n");
+ tip = "Custom Command" + (cmd.indexOf("\n") !== -1 ? 's' : '') + ' ' + utils.quote_san(cmd).replace('\n',' ');
+ } else {
+ cmd = "/timeout " + user + " " + btn;
+ tip = "Timeout User (" + utils.duration_string(btn) + ")";
+ }
+ output += '' + prefix + '';
+ }
+ }
- return output + '';
- },
+ return output + '';
+ },
- buildSenderHTML: function() {
- var user = this.get('msgObject.from'),
- room_id = this.get('msgObject.room'),
- room = f.rooms && f.rooms[room_id],
+ buildSenderHTML: function() {
+ var user = this.get('msgObject.from'),
+ room_id = this.get('msgObject.room'),
+ room = f.rooms && f.rooms[room_id],
- deleted = this.get('msgObject.deleted'),
- r = this,
+ deleted = this.get('msgObject.deleted'),
+ r = this,
- recipient = this.get('msgObject.to'),
- is_whisper = recipient && recipient.length,
- is_replay = this.get('ffz_is_replay'),
+ recipient = this.get('msgObject.to'),
+ is_whisper = recipient && recipient.length,
+ is_replay = this.get('ffz_is_replay'),
- this_ul = this.get('ffzUserLevel'),
- other_ul = room && room.room && room.room.get('ffzUserLevel') || 0,
+ this_ul = this.get('ffzUserLevel'),
+ other_ul = room && room.room && room.room.get('ffzUserLevel') || 0,
- raw_color = this.get('msgObject.color'),
- colors = raw_color && f._handle_color(raw_color),
+ raw_color = this.get('msgObject.color'),
+ colors = raw_color && f._handle_color(raw_color),
- is_dark = (Layout && Layout.get('isTheatreMode')) || (is_replay ? f.settings.dark_twitch : (Settings && Settings.get('settings.darkMode'))),
+ is_dark = (Layout && Layout.get('isTheatreMode')) || (is_replay ? f.settings.dark_twitch : (Settings && Settings.get('settings.darkMode'))),
- system_msg = this.get('systemMsg'),
- output = '';
+ system_msg = this.get('systemMsg'),
+ output = '';
- output = '
';
+ output = '';
- // System Message
- if ( system_msg ) {
- output += '
' + utils.sanitize(system_msg) + '
';
- if ( this.get('ffzShouldRenderMessageBody') === false )
- return output;
- }
+ // System Message
+ if ( system_msg ) {
+ output += '
To " +
- "send multiple commands, separate them with <LINE>.
Numeric values will become timeout buttons for " +
- "that number of seconds. The text <BAN> is a special value that will act like the normal Ban button in chat.
" +
- "To assign a specific letter for use as the icon, specify it at the start of the command followed by an equals sign.
" +
- "Example:A=\"!reg add\"
Default:<BAN> 600",
- old_val.substr(1),
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ "send multiple commands, separate them with <LINE>.
Numeric values will become timeout buttons for " +
+ "that number of seconds. The text <BAN> is a special value that will act like the normal Ban button in chat.
" +
+ "To assign a specific letter for use as the icon, specify it at the start of the command followed by an equals sign.
" +
+ "Example:A=\"!reg add\"
Default:<BAN> 600",
+ old_val.substr(1),
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var vals = [], prefix = '';
- new_val = new_val.trim();
+ var vals = [], prefix = '';
+ new_val = new_val.trim();
- while(new_val) {
- if ( new_val.charAt(1) === '=' ) {
- prefix = new_val.charAt(0);
- new_val = new_val.substr(2);
- continue;
- }
+ while(new_val) {
+ if ( new_val.charAt(1) === '=' ) {
+ prefix = new_val.charAt(0);
+ new_val = new_val.substr(2);
+ continue;
+ }
- if ( new_val.charAt(0) === '"' ) {
- var end = new_val.indexOf('"', 1);
- if ( end === -1 )
- end = new_val.length;
+ if ( new_val.charAt(0) === '"' ) {
+ var end = new_val.indexOf('"', 1);
+ if ( end === -1 )
+ end = new_val.length;
- var segment = new_val.substr(1, end - 1);
- if ( segment ) {
- vals.push([prefix, segment]);
- prefix = '';
- }
+ var segment = new_val.substr(1, end - 1);
+ if ( segment ) {
+ vals.push([prefix, segment]);
+ prefix = '';
+ }
- new_val = new_val.substr(end + 1);
+ new_val = new_val.substr(end + 1);
- } else {
- var ind = new_val.indexOf(' ');
- if ( ind === -1 ) {
- if ( new_val ) {
- vals.push([prefix, new_val]);
- prefix = '';
- }
+ } else {
+ var ind = new_val.indexOf(' ');
+ if ( ind === -1 ) {
+ if ( new_val ) {
+ vals.push([prefix, new_val]);
+ prefix = '';
+ }
- new_val = '';
+ new_val = '';
- } else {
- var segment = new_val.substr(0, ind);
- if ( segment ) {
- vals.push([prefix, segment]);
- prefix = '';
- }
+ } else {
+ var segment = new_val.substr(0, ind);
+ if ( segment ) {
+ vals.push([prefix, segment]);
+ prefix = '';
+ }
- new_val = new_val.substr(ind + 1);
- }
- }
- }
+ new_val = new_val.substr(ind + 1);
+ }
+ }
+ }
- var final = [];
- for(var i=0; i < vals.length; i++) {
- var had_prefix = false, prefix = vals[i][0], val = vals[i][1];
- if ( val === "" )
- val = false;
+ var final = [];
+ for(var i=0; i < vals.length; i++) {
+ var had_prefix = false, prefix = vals[i][0], val = vals[i][1];
+ if ( val === "" )
+ val = false;
- var num = parseInt(val);
- if ( num > 0 && ! Number.isNaN(num) )
- val = num;
+ var num = parseInt(val);
+ if ( num > 0 && ! Number.isNaN(num) )
+ val = num;
- if ( ! prefix ) {
- var tmp;
- if ( typeof val === "string" )
- tmp = /\w/.exec(val);
- else
- tmp = utils.duration_string(val);
+ if ( ! prefix ) {
+ var tmp;
+ if ( typeof val === "string" )
+ tmp = /\w/.exec(val);
+ else
+ tmp = utils.duration_string(val);
- prefix = tmp && tmp.length ? tmp[0].toUpperCase() : "C";
- } else
- had_prefix = true;
+ prefix = tmp && tmp.length ? tmp[0].toUpperCase() : "C";
+ } else
+ had_prefix = true;
- if ( typeof val === "string" ) {
- // Split it up for this step.
- var lines = val.split(/ * */);
- for(var x=0; x < lines.length; x++) {
- if ( lines[x].indexOf('{user}') === -1 )
- lines[x] += ' {user}';
- }
- val = lines.join("");
- }
+ if ( typeof val === "string" ) {
+ // Split it up for this step.
+ var lines = val.split(/ * */);
+ for(var x=0; x < lines.length; x++) {
+ if ( lines[x].indexOf('{user}') === -1 )
+ lines[x] += ' {user}';
+ }
+ val = lines.join("");
+ }
- final.push([prefix, val, had_prefix]);
- }
+ final.push([prefix, val, had_prefix]);
+ }
- f.settings.set('mod_buttons', final);
+ f.settings.set('mod_buttons', final);
- // Update existing chat lines.
- var CL = utils.ember_resolve('component:chat/chat-line'),
- views = CL ? utils.ember_views() : [];
+ // Update existing chat lines.
+ var CL = utils.ember_resolve('component:chat/chat-line'),
+ views = CL ? utils.ember_views() : [];
- for(var vid in views) {
- var view = views[vid];
- if ( view instanceof CL && view.buildModIconsHTML )
- view.$('.mod-icons').replaceWith(view.buildModIconsHTML());
- }
+ for(var vid in views) {
+ var view = views[vid];
+ if ( view instanceof CL && view.buildModIconsHTML )
+ view.$('.mod-icons').replaceWith(view.buildModIconsHTML());
+ }
- }, 600);
+ }, 600);
}
};
@@ -472,7 +472,7 @@ FFZ.settings_info.mod_card_buttons = {
method: function() {
var f = this,
- old_val = "";
+ old_val = "";
for(var i=0; i < this.settings.mod_card_buttons.length; i++) {
var cmd = this.settings.mod_card_buttons[i];
if ( cmd.indexOf(' ') !== -1 )
@@ -481,51 +481,51 @@ FFZ.settings_info.mod_card_buttons = {
old_val += ' ' + cmd;
}
- utils.prompt(
- "Moderation Card Additional Buttons",
- "Please enter a list of additional commands to display buttons for on moderation cards. Commands are separated by spaces. " +
- "To include spaces in a command, surround the command with double quotes (\"). Use {user} to insert the " +
- "user's name into the command, otherwise it will be appended to the end.
Example: !permit \"!reg add {user}\"",
- old_val.substr(1),
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Moderation Card Additional Buttons",
+ "Please enter a list of additional commands to display buttons for on moderation cards. Commands are separated by spaces. " +
+ "To include spaces in a command, surround the command with double quotes (\"). Use {user} to insert the " +
+ "user's name into the command, otherwise it will be appended to the end.
Example: !permit \"!reg add {user}\"",
+ old_val.substr(1),
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- var vals = [];
- new_val = new_val.trim();
+ var vals = [];
+ new_val = new_val.trim();
- while(new_val) {
- if ( new_val.charAt(0) === '"' ) {
- var end = new_val.indexOf('"', 1);
- if ( end === -1 )
- end = new_val.length;
+ while(new_val) {
+ if ( new_val.charAt(0) === '"' ) {
+ var end = new_val.indexOf('"', 1);
+ if ( end === -1 )
+ end = new_val.length;
- var segment = new_val.substr(1, end - 1);
- if ( segment )
- vals.push(segment);
+ var segment = new_val.substr(1, end - 1);
+ if ( segment )
+ vals.push(segment);
- new_val = new_val.substr(end + 1);
+ new_val = new_val.substr(end + 1);
- } else {
- var ind = new_val.indexOf(' ');
- if ( ind === -1 ) {
- if ( new_val )
- vals.push(new_val);
+ } else {
+ var ind = new_val.indexOf(' ');
+ if ( ind === -1 ) {
+ if ( new_val )
+ vals.push(new_val);
- new_val = '';
+ new_val = '';
- } else {
- var segment = new_val.substr(0, ind);
- if ( segment )
- vals.push(segment);
+ } else {
+ var segment = new_val.substr(0, ind);
+ if ( segment )
+ vals.push(segment);
- new_val = new_val.substr(ind + 1);
- }
- }
- }
+ new_val = new_val.substr(ind + 1);
+ }
+ }
+ }
- f.settings.set("mod_card_buttons", vals);
- }, 600);
+ f.settings.set("mod_card_buttons", vals);
+ }, 600);
}
};
@@ -541,36 +541,36 @@ FFZ.settings_info.mod_card_durations = {
help: "Add additional timeout buttons to moderation cards with specific durations.",
method: function() {
- var f = this,
- old_val = this.settings.mod_card_durations.join(", ");
+ var f = this,
+ old_val = this.settings.mod_card_durations.join(", ");
- utils.prompt(
- "Moderation Card Timeout Buttons",
- "Please enter a comma-separated list of durations that you would like to have timeout buttons for. " +
- "Durations must be expressed in seconds.
Default: 300, 600, 3600, 43200, 86400, 604800",
- old_val,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ utils.prompt(
+ "Moderation Card Timeout Buttons",
+ "Please enter a comma-separated list of durations that you would like to have timeout buttons for. " +
+ "Durations must be expressed in seconds.
Default: 300, 600, 3600, 43200, 86400, 604800",
+ old_val,
+ function(new_val) {
+ if ( new_val === null || new_val === undefined )
+ return;
- if ( new_val === "reset" )
- new_val = FFZ.settings_info.mod_card_durations.value.join(", ");
+ if ( new_val === "reset" )
+ new_val = FFZ.settings_info.mod_card_durations.value.join(", ");
- // Split them up.
- new_val = new_val.trim().split(/[ ,]+/);
- var vals = [];
+ // Split them up.
+ new_val = new_val.trim().split(/[ ,]+/);
+ var vals = [];
- for(var i=0; i < new_val.length; i++) {
- var val = parseInt(new_val[i]);
- if ( val === 0 )
- val = 1;
+ for(var i=0; i < new_val.length; i++) {
+ var val = parseInt(new_val[i]);
+ if ( val === 0 )
+ val = 1;
- if ( ! Number.isNaN(val) && val > 0 )
- vals.push(val);
- }
+ if ( ! Number.isNaN(val) && val > 0 )
+ vals.push(val);
+ }
- f.settings.set("mod_card_durations", vals);
- }, 600);
+ f.settings.set("mod_card_durations", vals);
+ }, 600);
}
};
@@ -1335,11 +1335,11 @@ FFZ.prototype._build_mod_card_history = function(msg, modcard, show_from) {
// Interactivity
jQuery('a.undelete', l_el).click(function(e) { this.parentElement.outerHTML = this.getAttribute('data-message'); });
- jQuery('.deleted-word', l_el).click(function(e) { jQuery(this).trigger('mouseout'); this.outerHTML = this.getAttribute('data-text'); });
+ jQuery('.deleted-word', l_el).click(function(e) { jQuery(this).trigger('mouseout'); this.outerHTML = this.getAttribute('data-text'); });
jQuery('a.deleted-link', l_el).click(f._deleted_link_click);
jQuery('img.emoticon', l_el).click(function(e) { f._click_emote(this, e) });
//jQuery('.html-tooltip', l_el).tipsy({html:true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 's')});
- //jQuery('.ffz-tooltip', l_el).tipsy({live: true, html: true, title: f.render_tooltip(), gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 's')});
+ //jQuery('.ffz-tooltip', l_el).tipsy({live: true, html: true, title: f.render_tooltip(), gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 's')});
if ( modcard ) {
modcard.get('cardInfo.user.id') !== msg.from && jQuery('span.from', l_el).click(function(e) {
@@ -1379,8 +1379,8 @@ FFZ.prototype._update_alias = function(user) {
var line = lines[i],
el_from = line.querySelector('.from');
- if ( ! el_from )
- continue;
+ if ( ! el_from )
+ continue;
el_from.classList.toggle('ffz-alias', alias);
el_from.textContent = display_name;
@@ -1389,8 +1389,8 @@ FFZ.prototype._update_alias = function(user) {
// Update tab completion.
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_name_suggestions');
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_name_suggestions');
// TODO: Update conversations~
}
diff --git a/src/ember/player.js b/src/ember/player.js
index bc67023c..0970eddc 100644
--- a/src/ember/player.js
+++ b/src/ember/player.js
@@ -1,6 +1,6 @@
var FFZ = window.FrankerFaceZ,
- utils = require('../utils'),
- constants = require('../constants');
+ utils = require('../utils'),
+ constants = require('../constants');
// ---------------
@@ -88,9 +88,9 @@ FFZ.prototype.modify_twitch_player = function(player) {
var id = this.get('channel.id');
f.players[id] = this;
- var player = this.get('player');
- if ( player )
- this.ffzPostPlayer();
+ var player = this.get('player');
+ if ( player )
+ this.ffzPostPlayer();
},
ffz_destroy: function() {
@@ -128,11 +128,11 @@ FFZ.prototype.modify_twitch_player = function(player) {
ffzPostPlayer: function() {
var player = this.get('player');
if ( ! player )
- return;
+ return;
- // Make the stats window draggable and fix the button.
- var stats = this.$('.player .js-playback-stats');
- stats.draggable({cancel: 'li', containment: 'parent'});
+ // Make the stats window draggable and fix the button.
+ var stats = this.$('.player .js-playback-stats');
+ stats.draggable({cancel: 'li', containment: 'parent'});
// Add an option to the menu to recreate the player.
var t = this,
diff --git a/src/ember/room.js b/src/ember/room.js
index 6a0e23d6..e395e4e3 100644
--- a/src/ember/room.js
+++ b/src/ember/room.js
@@ -332,7 +332,7 @@ FFZ.prototype.modify_room_view = function(view) {
if ( this._ffz_mouse_move ) {
messages.removeEventListener('mousemove', this._ffz_mouse_move);
- messages.removeEventListener('touchmove', this._ffz_mouse_move);
+ messages.removeEventListener('touchmove', this._ffz_mouse_move);
this._ffz_mouse_move = undefined;
}
@@ -1502,17 +1502,17 @@ FFZ.prototype._modify_room = function(room) {
// Tokenization
f.tokenize_chat_line(msg, false, this.get('roomProperties.hide_chat_links'));
- // If it's from Twitch notify, and it's directly related to
- if ( msg.from === 'twitchnotify' && msg.message.indexOf('subscribed to') === -1 && msg.message.indexOf('subscribed') !== -1 ) {
- if ( ! msg.tags )
- msg.tags = {};
+ // If it's from Twitch notify, and it's directly related to
+ if ( msg.from === 'twitchnotify' && msg.message.indexOf('subscribed to') === -1 && msg.message.indexOf('subscribed') !== -1 ) {
+ if ( ! msg.tags )
+ msg.tags = {};
if ( ! msg.tags.badges )
msg.tags.badges = {};
msg.tags.badges.subscriber = '1';
- msg.tags.subscriber = true;
- if ( msg.labels && msg.labels.indexOf("subscriber") === -1 )
- msg.labels.push("subscriber");
- }
+ msg.tags.subscriber = true;
+ if ( msg.labels && msg.labels.indexOf("subscriber") === -1 )
+ msg.labels.push("subscriber");
+ }
// Keep the history.
if ( ! is_whisper && msg.from && msg.from !== 'jtv' && msg.from !== 'twitchnotify' && f.settings.mod_card_history ) {
@@ -1610,9 +1610,9 @@ FFZ.prototype._modify_room = function(room) {
ids[msg_id] = msg;
}
- // Report this message to the dashboard.
- if ( window !== window.parent && parent.postMessage && msg.from && msg.from !== "jtv" && msg.from !== "twitchnotify" )
- parent.postMessage({from_ffz: true, command: 'chat_message', data: {from: msg.from, room: msg.room}}, "*"); //location.protocol + "//www.twitch.tv/");
+ // Report this message to the dashboard.
+ if ( window !== window.parent && parent.postMessage && msg.from && msg.from !== "jtv" && msg.from !== "twitchnotify" )
+ parent.postMessage({from_ffz: true, command: 'chat_message', data: {from: msg.from, room: msg.room}}, "*"); //location.protocol + "//www.twitch.tv/");
// Add the message.
return this._super(msg);
@@ -1735,8 +1735,8 @@ FFZ.prototype._modify_room = function(room) {
if ( f._cindex )
f._cindex.ffzUpdateChatters();
- if ( window !== window.parent && parent.postMessage )
- parent.postMessage({from_ffz: true, command: 'chatter_count', data: Object.keys(this.get('ffz_chatters') || {}).length}, "*"); //location.protocol + "//www.twitch.tv/");
+ if ( window !== window.parent && parent.postMessage )
+ parent.postMessage({from_ffz: true, command: 'chatter_count', data: Object.keys(this.get('ffz_chatters') || {}).length}, "*"); //location.protocol + "//www.twitch.tv/");
},
diff --git a/src/ember/router.js b/src/ember/router.js
index acb85457..2a1ff700 100644
--- a/src/ember/router.js
+++ b/src/ember/router.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require("../utils");
+ utils = require("../utils");
// --------------------
diff --git a/src/ember/sidebar.js b/src/ember/sidebar.js
index f2b01f7e..a596ad1a 100644
--- a/src/ember/sidebar.js
+++ b/src/ember/sidebar.js
@@ -48,7 +48,7 @@ FFZ.settings_info.sidebar_hide_recommended_channels = {
no_mobile: true,
name: "Hide Recommended Channels",
- help: "Hide the Recommended Channels section from the sidebar.",
+ help: "Hide the Recommended Channels section from the sidebar.",
on_update: utils.toggle_cls('ffz-hide-recommended-channels')
};
@@ -62,7 +62,7 @@ FFZ.settings_info.sidebar_hide_recommended_friends = {
no_mobile: true,
name: "Hide Recommended Friends",
- help: "Hide the Recommended Friends section from the sidebar.",
+ help: "Hide the Recommended Friends section from the sidebar.",
on_update: utils.toggle_cls('ffz-hide-recommended-friends')
};
diff --git a/src/ember/viewers.js b/src/ember/viewers.js
index 11d3a140..75869455 100644
--- a/src/ember/viewers.js
+++ b/src/ember/viewers.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require('../utils');
+ utils = require('../utils');
// --------------------
diff --git a/src/ember/vod-chat.js b/src/ember/vod-chat.js
index 020e11e5..8f23a566 100644
--- a/src/ember/vod-chat.js
+++ b/src/ember/vod-chat.js
@@ -12,206 +12,206 @@ var FFZ = window.FrankerFaceZ,
// ---------------------
FFZ.prototype.setup_vod_chat = function() {
- // Get the VOD Chat Service
- var f = this,
- VODService = utils.ember_lookup('service:vod-chat-service');
+ // Get the VOD Chat Service
+ var f = this,
+ VODService = utils.ember_lookup('service:vod-chat-service');
- if ( VODService )
- VODService.reopen({
- messageBufferSize: f.settings.scrollback_length,
+ if ( VODService )
+ VODService.reopen({
+ messageBufferSize: f.settings.scrollback_length,
- pushMessage: function(msg) {
- if ( msg.get("color") === null ) {
- var colors = this.get("colorSettings"),
- from = msg.get("from");
+ pushMessage: function(msg) {
+ if ( msg.get("color") === null ) {
+ var colors = this.get("colorSettings"),
+ from = msg.get("from");
- if ( ! colors.get(from) )
- colors.set(from, constants.CHAT_COLORS[Math.floor(Math.random() * constants.CHAT_COLORS.length)]);
+ if ( ! colors.get(from) )
+ colors.set(from, constants.CHAT_COLORS[Math.floor(Math.random() * constants.CHAT_COLORS.length)]);
- msg.set("color", colors.get(from));
- }
+ msg.set("color", colors.get(from));
+ }
- this.get("messages").pushObject(msg);
+ this.get("messages").pushObject(msg);
- var messages = this.get("messages"),
- len = this.get("messages.length"),
- limit = this.get("messageBufferSize");
+ var messages = this.get("messages"),
+ len = this.get("messages.length"),
+ limit = this.get("messageBufferSize");
- if ( len > limit )
- messages.removeAt(0, len - limit);
- }
- });
- else
- f.error("Unable to locate VOD Chat Service.");
+ if ( len > limit )
+ messages.removeAt(0, len - limit);
+ }
+ });
+ else
+ f.error("Unable to locate VOD Chat Service.");
- this.update_views('component:vod-right-column', this.modify_vod_right_column);
- this.update_views('view:vod', this.modify_vod_view);
- this.update_views('component:vod-chat-display', this.modify_vod_chat_display);
+ this.update_views('component:vod-right-column', this.modify_vod_right_column);
+ this.update_views('view:vod', this.modify_vod_view);
+ this.update_views('component:vod-chat-display', this.modify_vod_chat_display);
}
FFZ.prototype.modify_vod_view = function(view) {
- var f = this;
- utils.ember_reopen_view(view, {
- ffz_init: function() {
- f._vodv = this;
+ var f = this;
+ utils.ember_reopen_view(view, {
+ ffz_init: function() {
+ f._vodv = this;
- var channel_id = this.get('context.channel.name');
+ var channel_id = this.get('context.channel.name');
- if ( f.settings.auto_theater ) {
+ if ( f.settings.auto_theater ) {
var player = f.players && f.players[channel_id] && f.players[channel_id].get('player');
if ( player )
player.setTheatre(true);
}
- // Listen to scrolling.
+ // Listen to scrolling.
this._ffz_scroller = this.ffzOnScroll.bind(this);
jQuery(this.get('element')).parents('.tse-scroll-content').on('scroll', this._ffz_scroller);
- },
+ },
- ffz_destroy: function() {
- if ( f._vodv === this )
- f._vodv = null;
+ ffz_destroy: function() {
+ if ( f._vodv === this )
+ f._vodv = null;
- if ( this._ffz_scroller ) {
+ if ( this._ffz_scroller ) {
jQuery(this.get('element')).parents('.tse-scroll-content').off('scroll', this._ffz_scroller);
this._ffz_scroller = null;
}
- },
+ },
- ffzOnScroll: function(event) {
+ ffzOnScroll: function(event) {
// When we scroll past the bottom of the player, do stuff!
var top = event && event.target && event.target.scrollTop,
height = this.get('layout.playerSize.1');
- if ( ! top )
- top = jQuery(this.get('element')).parents('.tse-scroll-content').scrollTop();
+ if ( ! top )
+ top = jQuery(this.get('element')).parents('.tse-scroll-content').scrollTop();
document.body.classList.toggle('ffz-small-player', f.settings.small_player && top >= height);
}
- });
+ });
}
FFZ.prototype.modify_vod_right_column = function(component) {
- var f = this;
- utils.ember_reopen_view(component, {
- ffz_init: function() {
- if ( f.settings.dark_twitch ) {
- var el = this.get('element'),
- cont = el && el.querySelector('.chat-container');
+ var f = this;
+ utils.ember_reopen_view(component, {
+ ffz_init: function() {
+ if ( f.settings.dark_twitch ) {
+ var el = this.get('element'),
+ cont = el && el.querySelector('.chat-container');
- if ( cont )
- cont.classList.add('dark');
- }
- }
- });
+ if ( cont )
+ cont.classList.add('dark');
+ }
+ }
+ });
}
FFZ.prototype.modify_vod_chat_display = function(component) {
- var f = this,
- VODService = utils.ember_lookup('service:vod-chat-service');
+ var f = this,
+ VODService = utils.ember_lookup('service:vod-chat-service');
- utils.ember_reopen_view(component, {
- _prepareToolTips: function() {
- this.$(".tooltip").tipsy({
- live: true,
- gravity: utils.tooltip_placement(constants.TOOLTIP_DISTANCE, 's')
- })
- },
+ utils.ember_reopen_view(component, {
+ _prepareToolTips: function() {
+ this.$(".tooltip").tipsy({
+ live: true,
+ gravity: utils.tooltip_placement(constants.TOOLTIP_DISTANCE, 's')
+ })
+ },
- ffz_init: function() {
- f._vodc = this;
+ ffz_init: function() {
+ f._vodc = this;
- // Load the room, if necessary
- var room_id = this.get('video.channel.name');
- if ( room_id && ! f.rooms[room_id] )
- f.load_room(room_id); // TODO: Function to reprocess existing messages.
+ // Load the room, if necessary
+ var room_id = this.get('video.channel.name');
+ if ( room_id && ! f.rooms[room_id] )
+ f.load_room(room_id); // TODO: Function to reprocess existing messages.
- this.ffz_frozen = false;
- if ( f.settings.chat_hover_pause )
- this.ffzEnableFreeze();
- },
+ this.ffz_frozen = false;
+ if ( f.settings.chat_hover_pause )
+ this.ffzEnableFreeze();
+ },
- ffz_destroy: function() {
- if ( f._vodc === this )
- f._vodc = undefined;
+ ffz_destroy: function() {
+ if ( f._vodc === this )
+ f._vodc = undefined;
- // TODO: Function to unload the old room?
+ // TODO: Function to unload the old room?
- this.ffzDisableFreeze();
- },
+ this.ffzDisableFreeze();
+ },
- ffzEnableFreeze: function() {
- var scroller = this.get('chatMessagesScroller');
- if ( ! scroller )
- return;
+ ffzEnableFreeze: function() {
+ var scroller = this.get('chatMessagesScroller');
+ if ( ! scroller )
+ return;
- this._ffz_interval = setInterval(this.ffzPulse.bind(this), 200);
+ this._ffz_interval = setInterval(this.ffzPulse.bind(this), 200);
- this._ffz_mouse_move = this.ffzMouseMove.bind(this);
- this._ffz_mouse_out = this.ffzMouseOut.bind(this);
+ this._ffz_mouse_move = this.ffzMouseMove.bind(this);
+ this._ffz_mouse_out = this.ffzMouseOut.bind(this);
- scroller.on('mousemove', this._ffz_mouse_move);
- scroller.on('touchmove', this._ffz_mouse_move);
- scroller.on('mouseout', this._ffz_mouse_out);
- },
+ scroller.on('mousemove', this._ffz_mouse_move);
+ scroller.on('touchmove', this._ffz_mouse_move);
+ scroller.on('mouseout', this._ffz_mouse_out);
+ },
- ffzDisableFreeze: function() {
- if ( this._ffz_interval ) {
- clearInterval(this._ffz_interval);
- this._ffz_interval = undefined;
- }
+ ffzDisableFreeze: function() {
+ if ( this._ffz_interval ) {
+ clearInterval(this._ffz_interval);
+ this._ffz_interval = undefined;
+ }
- this.ffzUnfreeze();
- var scroller = this.get('chatMessagesScroller');
- if ( ! scroller )
- return;
+ this.ffzUnfreeze();
+ var scroller = this.get('chatMessagesScroller');
+ if ( ! scroller )
+ return;
- if ( this._ffz_mouse_move ) {
- scroller.off('mousemove', this._ffz_mouse_move);
- scroller.off('touchmove', this._ffz_mouse_move);
- this._ffz_mouse_move = undefined;
- }
+ if ( this._ffz_mouse_move ) {
+ scroller.off('mousemove', this._ffz_mouse_move);
+ scroller.off('touchmove', this._ffz_mouse_move);
+ this._ffz_mouse_move = undefined;
+ }
- if ( this._ffz_mouse_out ) {
- scroller.off('mouseout', this._ffz_mouse_out);
- this._ffz_mouse_out = undefined;
- }
- },
+ if ( this._ffz_mouse_out ) {
+ scroller.off('mouseout', this._ffz_mouse_out);
+ this._ffz_mouse_out = undefined;
+ }
+ },
- ffzUnfreeze: function(from_stuck) {
- this.ffz_frozen = false;
- this._ffz_last_move = 0;
- this.ffzUnwarnPaused();
+ ffzUnfreeze: function(from_stuck) {
+ this.ffz_frozen = false;
+ this._ffz_last_move = 0;
+ this.ffzUnwarnPaused();
- if ( ! from_stuck && this.get('stuckToBottom') )
- this._scrollToBottom();
- },
+ if ( ! from_stuck && this.get('stuckToBottom') )
+ this._scrollToBottom();
+ },
- ffzPulse: function() {
- if ( this.ffz_frozen ) {
- var elapsed = Date.now() - this._ffz_last_move;
- if ( elapsed > 750 )
- this.ffzUnfreeze();
- }
- },
+ ffzPulse: function() {
+ if ( this.ffz_frozen ) {
+ var elapsed = Date.now() - this._ffz_last_move;
+ if ( elapsed > 750 )
+ this.ffzUnfreeze();
+ }
+ },
- ffzMouseOut: function(event) {
- this._ffz_outside = true;
- var e = this;
- setTimeout(function() {
- if ( e._ffz_outside )
- e.ffzUnfreeze();
- }, 25);
- },
+ ffzMouseOut: function(event) {
+ this._ffz_outside = true;
+ var e = this;
+ setTimeout(function() {
+ if ( e._ffz_outside )
+ e.ffzUnfreeze();
+ }, 25);
+ },
- ffzMouseMove: function(event) {
- this._ffz_last_move = Date.now();
- this._ffz_outside = false;
+ ffzMouseMove: function(event) {
+ this._ffz_last_move = Date.now();
+ this._ffz_outside = false;
- if ( event.screenX === this._ffz_last_screenx && event.screenY === this._ffz_last_screeny )
+ if ( event.screenX === this._ffz_last_screenx && event.screenY === this._ffz_last_screeny )
return;
this._ffz_last_screenx = event.screenX;
@@ -222,37 +222,37 @@ FFZ.prototype.modify_vod_chat_display = function(component) {
this.ffz_frozen = true;
if ( this.get('stuckToBottom') ) {
- VODService && VODService.set("messageBufferSize", f.settings.scrollback_length + 150);
+ VODService && VODService.set("messageBufferSize", f.settings.scrollback_length + 150);
this.ffzWarnPaused();
- }
- },
+ }
+ },
- _scrollToBottom: _.throttle(function() {
- var e = this,
- scroller = e.get('chatMessagesScroller');
+ _scrollToBottom: _.throttle(function() {
+ var e = this,
+ scroller = e.get('chatMessagesScroller');
- if ( ! scroller || ! scroller.length )
- return;
+ if ( ! scroller || ! scroller.length )
+ return;
- Ember.run.next(function() {
- (window.requestAnimationFrame||setTimeout)(function() {
- if ( e.ffz_frozen )
- return;
+ Ember.run.next(function() {
+ (window.requestAnimationFrame||setTimeout)(function() {
+ if ( e.ffz_frozen )
+ return;
- scroller[0].scrollTop = scroller[0].scrollHeight;
- e._setStuckToBottom(true);
- })
- })
- }, 300),
+ scroller[0].scrollTop = scroller[0].scrollHeight;
+ e._setStuckToBottom(true);
+ })
+ })
+ }, 300),
- _setStuckToBottom: function(val) {
- this.set("stuckToBottom", val);
- VODService && VODService.set("messageBufferSize", f.settings.scrollback_length + (val ? 0 : 150));
- if ( ! val )
- this.ffUnfreeze(true);
- },
+ _setStuckToBottom: function(val) {
+ this.set("stuckToBottom", val);
+ VODService && VODService.set("messageBufferSize", f.settings.scrollback_length + (val ? 0 : 150));
+ if ( ! val )
+ this.ffUnfreeze(true);
+ },
- ffzWarnPaused: function() {
+ ffzWarnPaused: function() {
var el = this.get('element'),
warning = el && el.querySelector('.chat-interface .more-messages-indicator.ffz-freeze-indicator');
@@ -280,5 +280,5 @@ FFZ.prototype.modify_vod_chat_display = function(component) {
if ( warning )
warning.classList.add('hidden');
}
- });
+ });
}
\ No newline at end of file
diff --git a/src/ember/wrapper.js b/src/ember/wrapper.js
index 1451563b..fc836040 100644
--- a/src/ember/wrapper.js
+++ b/src/ember/wrapper.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require("../utils"),
+ utils = require("../utils"),
constants = require("../constants");
// --------------------
@@ -66,23 +66,23 @@ FFZ.prototype._update_views = function(klasses) {
// Iterate over all existing views and update them as necessary.
var views = utils.ember_views();
for(var view_id in views) {
- var view = views[view_id];
- if ( ! view )
- continue;
+ var view = views[view_id];
+ if ( ! view )
+ continue;
- for(var i=0; i < klasses.length; i++)
- if ( view instanceof klasses[i][1] ) {
- try {
- if ( ! view.ffz_modified )
- klasses[i][2].call(this, view);
+ for(var i=0; i < klasses.length; i++)
+ if ( view instanceof klasses[i][1] ) {
+ try {
+ if ( ! view.ffz_modified )
+ klasses[i][2].call(this, view);
- (view.ffz_update || view.ffz_init).call(view);
+ (view.ffz_update || view.ffz_init).call(view);
- } catch(err) {
- this.error("An error occured when updating an existing Ember instance of: " + klasses[i][0], err);
- }
+ } catch(err) {
+ this.error("An error occured when updating an existing Ember instance of: " + klasses[i][0], err);
+ }
- break;
- }
- }
+ break;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/emoticons.js b/src/emoticons.js
index 6bb83ed3..8f00a505 100644
--- a/src/emoticons.js
+++ b/src/emoticons.js
@@ -221,29 +221,29 @@ FFZ.prototype.load_emoji_data = function(callback, tries) {
emoji.code = eid;
new_data[eid] = emoji;
- if ( emoji.short_name )
- by_name[emoji.short_name] = eid;
- if ( emoji.names && emoji.names.length )
- for(var x=0,y=emoji.names.length; x < y; x++)
- by_name[emoji.names[x]] = eid;
+ if ( emoji.short_name )
+ by_name[emoji.short_name] = eid;
+ if ( emoji.names && emoji.names.length )
+ for(var x=0,y=emoji.names.length; x < y; x++)
+ by_name[emoji.names[x]] = eid;
emoji.raw = _.map(emoji.code.split("-"), utils.codepoint_to_emoji).join("");
emoji.tw_src = constants.SERVER + 'emoji/tw/' + eid + '.svg';
emoji.noto_src = constants.SERVER + 'emoji/noto-' + eid + '.svg';
- emoji.one_src = constants.SERVER + 'emoji/one/' + eid + '.svg';
+ emoji.one_src = constants.SERVER + 'emoji/one/' + eid + '.svg';
emoji.token = {
- type: "emoticon",
- imgSrc: true,
+ type: "emoticon",
+ imgSrc: true,
tw_src: emoji.tw_src,
noto_src: emoji.noto_src,
- one_src: emoji.one_src,
+ one_src: emoji.one_src,
tw: emoji.tw,
noto: emoji.noto,
- one: emoji.one,
+ one: emoji.one,
ffzEmoji: eid,
altText: emoji.raw
@@ -347,8 +347,8 @@ FFZ.prototype.unload_set = function(set_id) {
api.emote_sets[set_id] = undefined;
}
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
}
@@ -388,14 +388,14 @@ FFZ.prototype._load_set_json = function(set_id, callback, data) {
else
emote.regex = new RegExp("(^|\\W|\\b)(" + utils.escape_regex(emote.name) + ")\\b", "g");
- emote.token = {
- type: "emoticon",
- srcSet: emote.srcSet,
- imgSrc: emote.urls[1],
- ffzEmote: emote.id,
- ffzEmoteSet: set_id,
- altText: emote.hidden ? '???' : emote.name
- };
+ emote.token = {
+ type: "emoticon",
+ srcSet: emote.srcSet,
+ imgSrc: emote.urls[1],
+ ffzEmote: emote.id,
+ ffzEmoteSet: set_id,
+ altText: emote.hidden ? '???' : emote.name
+ };
output_css += build_css(emote);
data.count++;
@@ -410,8 +410,8 @@ FFZ.prototype._load_set_json = function(set_id, callback, data) {
this.update_ui_link();
- if ( this._inputv )
- Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
+ if ( this._inputv )
+ Ember.propertyDidChange(this._inputv, 'ffz_emoticons');
this.rerender_feed_cards(set_id);
diff --git a/src/ext/api.js b/src/ext/api.js
index 2af0ca84..e08493fa 100644
--- a/src/ext/api.js
+++ b/src/ext/api.js
@@ -59,7 +59,7 @@ var API = FFZ.API = function(instance, name, icon, version) {
this.name_key = this.name.replace(/[^A-Z0-9_\-]/g, '').toLowerCase();
this.icon = icon || null;
- this.version = version || null;
+ this.version = version || null;
this.ffz.log('Registered New Extension #' + this.id + ': ' + this.name);
};
@@ -169,14 +169,14 @@ API.prototype._load_set = function(real_id, set_id, data) {
else
new_emote.regex = new RegExp("(^|\\W|\\b)(" + utils.escape_regex(emote.name) + ")(?=\\W|$)", "g");
- new_emote.token = {
- type: "emoticon",
- srcSet: new_emote.srcSet,
- imgSrc: new_emote.urls[1],
- ffzEmote: id,
- ffzEmoteSet: real_id,
- altText: new_emote.hidden ? '???' : new_emote.name
- };
+ new_emote.token = {
+ type: "emoticon",
+ srcSet: new_emote.srcSet,
+ imgSrc: new_emote.urls[1],
+ ffzEmote: id,
+ ffzEmoteSet: real_id,
+ altText: new_emote.hidden ? '???' : new_emote.name
+ };
output_css += build_css(new_emote);
emote_set.count++;
@@ -294,9 +294,9 @@ API.prototype.register_global_set = function(id, emote_set) {
if ( this.ffz.default_sets && this.ffz.default_sets.indexOf(exact_id) === -1 )
this.ffz.default_sets.push(exact_id);
- // Update tab completion.
- if ( this.ffz._inputv )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ // Update tab completion.
+ if ( this.ffz._inputv )
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
};
@@ -324,9 +324,9 @@ API.prototype.unregister_global_set = function(id) {
if ( ind !== -1 )
this.ffz.default_sets.splice(ind,1);
- // Update tab completion.
- if ( this.ffz._inputv )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ // Update tab completion.
+ if ( this.ffz._inputv )
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
};
@@ -361,9 +361,9 @@ API.prototype.register_room_set = function(room_id, id, emote_set) {
room.ext_sets && room.ext_sets.push(exact_id);
emote_set.users.push(room_id);
- // Update tab completion.
- if ( this.ffz._inputv )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ // Update tab completion.
+ if ( this.ffz._inputv )
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
}
@@ -383,9 +383,9 @@ API.prototype.unregister_room_set = function(room_id, id) {
if ( ind !== -1 )
emote_set.users.splice(ind,1);
- // Update tab completion.
- if ( this.ffz._inputv )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ // Update tab completion.
+ if ( this.ffz._inputv )
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
}
@@ -473,7 +473,7 @@ API.prototype.user_add_set = function(username, set_id) {
// Update tab completion.
var user = this.ffz.get_user();
if ( this.ffz._inputv && user && user.login === username )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
}
@@ -497,7 +497,7 @@ API.prototype.user_remove_set = function(username, set_id) {
// Update tab completion.
var user = this.ffz.get_user();
if ( this.ffz._inputv && user && user.login === username )
- Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
+ Ember.propertyDidChange(this.ffz._inputv, 'ffz_emoticons');
}
diff --git a/src/ext/betterttv.js b/src/ext/betterttv.js
index 18a23a6f..5deb2d56 100644
--- a/src/ext/betterttv.js
+++ b/src/ext/betterttv.js
@@ -42,11 +42,11 @@ FFZ.prototype.setup_bttv = function(delay) {
utils.update_css(this._chat_style, 'chat_ts_font_size', '');
}
- // Remove Sub Count and the Chart
+ // Remove Sub Count and the Chart
if ( this.is_dashboard ) {
this._update_subscribers();
- this._remove_dash_chart();
- }
+ this._remove_dash_chart();
+ }
document.body.classList.add('ffz-bttv');
@@ -101,8 +101,8 @@ FFZ.prototype.setup_bttv = function(delay) {
this.toggle_style('badges-blank');
this.toggle_style('badges-circular-small');
this.toggle_style('badges-transparent');
- this.toggle_style('badges-sub-notice');
- this.toggle_style('badges-sub-notice-on');
+ this.toggle_style('badges-sub-notice');
+ this.toggle_style('badges-sub-notice-on');
// Disable other features too.
document.body.classList.remove('ffz-transparent-badges');
@@ -237,39 +237,39 @@ FFZ.prototype.setup_bttv = function(delay) {
}
};
- // Emoji!
- var parse_emoji = function(token) {
- var setting = f.settings.parse_emoji,
- output = [],
- segments = token.split(constants.EMOJI_REGEX),
- text = null;
+ // Emoji!
+ var parse_emoji = function(token) {
+ var setting = f.settings.parse_emoji,
+ output = [],
+ segments = token.split(constants.EMOJI_REGEX),
+ text = null;
- if ( setting === 0 )
- return [token];
+ if ( setting === 0 )
+ return [token];
- while(segments.length) {
- text = (text || '') + segments.shift();
- if ( segments.length ) {
- var match = segments.shift(),
- eid = utils.emoji_to_codepoint(match),
- data = f.emoji_data[eid],
- src = data && (setting === 3 ? data.one_src : (setting === 2 ? data.noto_src : data.tw_src));
+ while(segments.length) {
+ text = (text || '') + segments.shift();
+ if ( segments.length ) {
+ var match = segments.shift(),
+ eid = utils.emoji_to_codepoint(match),
+ data = f.emoji_data[eid],
+ src = data && (setting === 3 ? data.one_src : (setting === 2 ? data.noto_src : data.tw_src));
- if ( src ) {
- if ( text && text.length )
- output.push(text);
- var code = utils.quote_attr(data.raw);
- output.push(['']);
- text = null;
- } else
- text = (text || '') + match;
- }
- }
+ if ( src ) {
+ if ( text && text.length )
+ output.push(text);
+ var code = utils.quote_attr(data.raw);
+ output.push(['']);
+ text = null;
+ } else
+ text = (text || '') + match;
+ }
+ }
- if ( text && text.length )
- output.push(text);
+ if ( text && text.length )
+ output.push(text);
- return output;
+ return output;
}
// Emoticonize
@@ -283,62 +283,62 @@ FFZ.prototype.setup_bttv = function(delay) {
sets = f.getEmotes(l_sender, l_room),
emotes = {}, emote,
user = f.get_user(),
- new_tokens = [],
+ new_tokens = [],
mine = user && user.login === l_sender;
- // Build an object with all of our emotes.
- for(var i=0; i < sets.length; i++) {
- var emote_set = f.emote_sets[sets[i]];
- if ( emote_set && emote_set.emoticons )
- for(var emote_id in emote_set.emoticons) {
- emote = emote_set.emoticons[emote_id];
- if ( ! emotes.hasOwnProperty(emote.name) )
- emotes[emote.name] = emote;
- }
- }
+ // Build an object with all of our emotes.
+ for(var i=0; i < sets.length; i++) {
+ var emote_set = f.emote_sets[sets[i]];
+ if ( emote_set && emote_set.emoticons )
+ for(var emote_id in emote_set.emoticons) {
+ emote = emote_set.emoticons[emote_id];
+ if ( ! emotes.hasOwnProperty(emote.name) )
+ emotes[emote.name] = emote;
+ }
+ }
- for(var i=0, l=tokens.length; i < l; i++) {
- var token = tokens[i];
- if ( typeof token !== "string" ) {
- new_tokens.push(token);
- continue;
- }
+ for(var i=0, l=tokens.length; i < l; i++) {
+ var token = tokens[i];
+ if ( typeof token !== "string" ) {
+ new_tokens.push(token);
+ continue;
+ }
- // Split the token!
- var segments = token.split(' '),
- text = [], segment;
+ // Split the token!
+ var segments = token.split(' '),
+ text = [], segment;
- for(var x=0,y=segments.length; x < y; x++) {
- segment = segments[x];
- if ( emotes.hasOwnProperty(segment) ) {
- emote = emotes[segment];
- if ( text.length ) {
- var toks = parse_emoji(text.join(' ') + ' ');
- for(var q=0; q < toks.length; q++)
- new_tokens.push(toks[q]);
+ for(var x=0,y=segments.length; x < y; x++) {
+ segment = segments[x];
+ if ( emotes.hasOwnProperty(segment) ) {
+ emote = emotes[segment];
+ if ( text.length ) {
+ var toks = parse_emoji(text.join(' ') + ' ');
+ for(var q=0; q < toks.length; q++)
+ new_tokens.push(toks[q]);
- text = [];
- }
+ text = [];
+ }
- new_tokens.push(['']);
+ new_tokens.push(['']);
- if ( mine && l_room )
- f.add_usage(l_room, emote);
+ if ( mine && l_room )
+ f.add_usage(l_room, emote);
- text.push('');
- } else
- text.push(segment);
- }
+ text.push('');
+ } else
+ text.push(segment);
+ }
- if ( text.length > 1 || (text.length === 1 && text[0] !== '') ) {
- var toks = parse_emoji(text.join(' ') + ' ');
- for(var q=0; q < toks.length; q++)
- new_tokens.push(toks[q]);
- }
- }
+ if ( text.length > 1 || (text.length === 1 && text[0] !== '') ) {
+ var toks = parse_emoji(text.join(' ') + ' ');
+ for(var q=0; q < toks.length; q++)
+ new_tokens.push(toks[q]);
+ }
+ }
- return new_tokens;
- }
+ return new_tokens;
+ }
this.update_ui_link();
}
\ No newline at end of file
diff --git a/src/ext/emote_menu.js b/src/ext/emote_menu.js
index 9adf181c..43a14c37 100644
--- a/src/ext/emote_menu.js
+++ b/src/ext/emote_menu.js
@@ -1,5 +1,5 @@
var FFZ = window.FrankerFaceZ,
- utils = require('../utils');
+ utils = require('../utils');
// --------------------
diff --git a/src/featurefriday.js b/src/featurefriday.js
index b2b397f2..80ebcf23 100644
--- a/src/featurefriday.js
+++ b/src/featurefriday.js
@@ -1,6 +1,6 @@
var FFZ = window.FrankerFaceZ,
constants = require('./constants'),
- utils = require('./utils');
+ utils = require('./utils');
// --------------------
diff --git a/src/main.js b/src/main.js
index f3cfaea6..d46490e5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -13,16 +13,16 @@ var FFZ = window.FrankerFaceZ = function() {
this._apis = {};
this._chat_filters = [];
- // Error Logging
- var t = this;
- window.addEventListener('error', function(event) {
- if ( ! event.error )
- return;
+ // Error Logging
+ var t = this;
+ window.addEventListener('error', function(event) {
+ if ( ! event.error )
+ return;
- //var has_stack = event.error && event.error.stack;
+ //var has_stack = event.error && event.error.stack;
t.error("Uncaught JavaScript Error", event.error);
- //t.log("JavaScript Error: " + event.message + " [" + event.filename + ":" + event.lineno + ":" + event.colno + "]", has_stack ? event.error.stack : undefined, false, has_stack);
- });
+ //t.log("JavaScript Error: " + event.message + " [" + event.filename + ":" + event.lineno + ":" + event.colno + "]", has_stack ? event.error.stack : undefined, false, has_stack);
+ });
// Get things started.
this.initialize();
@@ -47,8 +47,8 @@ var VER = FFZ.version_info = {
// Logging
FFZ.prototype.log = function(msg, data, to_json, log_json) {
- if ( to_json )
- msg = msg + ' -- ' + JSON.stringify(data);
+ if ( to_json )
+ msg = msg + ' -- ' + JSON.stringify(data);
this._log_data.push(msg + ((!to_json && log_json) ? " -- " + JSON.stringify(data) : ""));
@@ -116,16 +116,16 @@ FFZ.prototype.get_user = function(force_reload) {
if ( ! force_reload && this.__user )
return this.__user;
- var LC = FFZ.utils.ember_lookup('service:login'),
- user = LC ? LC.get('userData') : undefined;
+ var LC = FFZ.utils.ember_lookup('service:login'),
+ user = LC ? LC.get('userData') : undefined;
- if ( ! user && window.PP && PP.login )
- user = PP;
+ if ( ! user && window.PP && PP.login )
+ user = PP;
- if ( user )
- this.__user = user;
+ if ( user )
+ this.__user = user;
- return user;
+ return user;
}
@@ -268,7 +268,7 @@ FFZ.prototype.initialize = function(increment, delay) {
FFZ.prototype.init_player = function(delay) {
var start = (window.performance && performance.now) ? performance.now() : Date.now();
this.log("Found Twitch Player after " + (delay||0) + " ms at: " + location);
- this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
+ this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
this.users = {};
this.is_dashboard = false;
@@ -292,7 +292,7 @@ FFZ.prototype.init_player = function(delay) {
FFZ.prototype.init_normal = function(delay, no_socket) {
var start = (window.performance && performance.now) ? performance.now() : Date.now();
this.log("Found non-Ember Twitch after " + (delay||0) + " ms at: " + location);
- this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
+ this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
this.users = {};
this.is_dashboard = false;
@@ -322,7 +322,7 @@ FFZ.prototype.init_normal = function(delay, no_socket) {
this.setup_following_count(false);
this.setup_menu();
- this.setup_message_event();
+ this.setup_message_event();
this.fix_tooltips();
this.find_bttv(10);
@@ -338,10 +338,10 @@ FFZ.prototype.is_dashboard = false;
FFZ.prototype.init_dashboard = function(delay) {
var start = (window.performance && performance.now) ? performance.now() : Date.now();
this.log("Found Twitch Dashboard after " + (delay||0) + " ms at: " + location);
- this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
+ this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
- var match = location.pathname.match(/\/([^\/]+)/);
- this.dashboard_channel = match && match[1] || undefined;
+ var match = location.pathname.match(/\/([^\/]+)/);
+ this.dashboard_channel = match && match[1] || undefined;
this.users = {};
this.is_dashboard = true;
@@ -366,7 +366,7 @@ FFZ.prototype.init_dashboard = function(delay) {
this.setup_notifications();
this.setup_following_count(false);
this.setup_menu();
- this.setup_dash_stats();
+ this.setup_dash_stats();
this.setup_dash_feed();
this._update_subscribers();
@@ -387,7 +387,7 @@ FFZ.prototype.init_dashboard = function(delay) {
FFZ.prototype.init_ember = function(delay) {
var start = (window.performance && performance.now) ? performance.now() : Date.now();
this.log("Found Twitch application after " + (delay||0) + " ms at: " + location);
- this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
+ this.log("Initializing FrankerFaceZ version " + FFZ.version_info);
this.users = {};
this.is_dashboard = false;
@@ -426,7 +426,7 @@ FFZ.prototype.init_ember = function(delay) {
this.setup_player();
this.setup_channel();
this.setup_room();
- this.setup_vod_chat();
+ this.setup_vod_chat();
this.setup_line();
this.setup_bits();
this.setup_layout();
@@ -456,13 +456,13 @@ FFZ.prototype.init_ember = function(delay) {
this.fix_tooltips();
this.connect_extra_chat();
- this.setup_message_event();
+ this.setup_message_event();
this.find_bttv(10);
this.find_emote_menu(10);
//this.check_news();
this.check_ff();
- this.refresh_chat();
+ this.refresh_chat();
var end = (window.performance && performance.now) ? performance.now() : Date.now(),
duration = end - start;
@@ -482,10 +482,10 @@ FFZ.prototype.setup_message_event = function() {
FFZ.prototype._on_window_message = function(e) {
- var msg = e.data;
- if ( typeof msg === "string" )
+ var msg = e.data;
+ if ( typeof msg === "string" )
try {
- msg = JSON.parse(msg);
+ msg = JSON.parse(msg);
} catch(err) {
// Not JSON? We don't care.
return;
@@ -495,8 +495,8 @@ FFZ.prototype._on_window_message = function(e) {
return;
var handler = FFZ.msg_commands[msg.command];
- if ( handler )
- handler.call(this, msg.data);
- else
- this.log("Invalid Message: " + msg.command, msg.data, false, true);
+ if ( handler )
+ handler.call(this, msg.data);
+ else
+ this.log("Invalid Message: " + msg.command, msg.data, false, true);
}
\ No newline at end of file
diff --git a/src/settings.js b/src/settings.js
index 6a645a59..7dc3b42c 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -1,48 +1,48 @@
var FFZ = window.FrankerFaceZ,
constants = require("./constants"),
- utils = require("./utils"),
+ utils = require("./utils"),
FileSaver = require("./FileSaver"),
- createElement = document.createElement.bind(document),
+ createElement = document.createElement.bind(document),
make_ls = function(key) {
return "ffz_setting_" + key;
},
- favorite_setting = function(swit, key, info) {
- var ind = this.settings.favorite_settings.indexOf(key);
+ favorite_setting = function(swit, key, info) {
+ var ind = this.settings.favorite_settings.indexOf(key);
- if ( ind === -1 ) {
- this.settings.favorite_settings.push(key);
- swit.setAttribute('original-title', 'Unfavorite this Setting');
- swit.classList.add('active');
- } else {
- this.settings.favorite_settings.splice(ind,1);
- swit.setAttribute('original-title', 'Favorite this Setting');
- swit.classList.remove('active');
- }
+ if ( ind === -1 ) {
+ this.settings.favorite_settings.push(key);
+ swit.setAttribute('original-title', 'Unfavorite this Setting');
+ swit.classList.add('active');
+ } else {
+ this.settings.favorite_settings.splice(ind,1);
+ swit.setAttribute('original-title', 'Favorite this Setting');
+ swit.classList.remove('active');
+ }
- jQuery(swit).trigger('mouseout').trigger('mouseover');
- this.settings.set('favorite_settings', this.settings.favorite_settings);
- },
+ jQuery(swit).trigger('mouseout').trigger('mouseover');
+ this.settings.set('favorite_settings', this.settings.favorite_settings);
+ },
toggle_setting = function(swit, key, info) {
- var val = !(info.get ? (typeof info.get === 'function' ? info.get.call(this) : this.settings.get(info.get)) : this.settings.get(key));
- if ( typeof info.set === "function" )
- info.set.call(this, val);
- else
- this.settings.set(info.set || key, val);
+ var val = !(info.get ? (typeof info.get === 'function' ? info.get.call(this) : this.settings.get(info.get)) : this.settings.get(key));
+ if ( typeof info.set === "function" )
+ info.set.call(this, val);
+ else
+ this.settings.set(info.set || key, val);
swit.classList.toggle('active', val);
},
- option_setting = function(select, key, info) {
- var val = JSON.parse(select.options[select.selectedIndex].value);
- if ( typeof info.set === "function" )
- info.set.call(this, val);
- else
- this.settings.set(info.set || key, val);
- };
+ option_setting = function(select, key, info) {
+ var val = JSON.parse(select.options[select.selectedIndex].value);
+ if ( typeof info.set === "function" )
+ info.set.call(this, val);
+ else
+ this.settings.set(info.set || key, val);
+ };
// --------------------
@@ -67,16 +67,16 @@ FFZ.prototype.load_settings = function() {
this.settings.del = this._setting_del.bind(this);
this.settings.load = this._setting_load.bind(this);
- var found_settings = false;
+ var found_settings = false;
for(var key in FFZ.settings_info) {
if ( ! FFZ.settings_info.hasOwnProperty(key) )
continue;
- var info = FFZ.settings_info[key],
- ls_key = info && info.storage_key || make_ls(key);
+ var info = FFZ.settings_info[key],
+ ls_key = info && info.storage_key || make_ls(key);
- found_settings = found_settings || localStorage.hasOwnProperty(key);
+ found_settings = found_settings || localStorage.hasOwnProperty(key);
this._setting_load(key) || found_settings;
}
@@ -113,7 +113,7 @@ FFZ.prototype.reset_settings = function() {
FFZ.prototype._get_settings_object = function() {
- var data = {
+ var data = {
version: 1,
script_version: FFZ.version_info + '',
aliases: this.aliases,
@@ -132,14 +132,14 @@ FFZ.prototype._get_settings_object = function() {
data.settings[key] = this.settings[key];
}
- return data;
+ return data;
}
FFZ.prototype.save_settings_file = function() {
- var data = this._get_settings_object(),
+ var data = this._get_settings_object(),
blob = new Blob(
- [JSON.stringify(data, null, 4)], {type: "application/json;charset=utf-8"});
+ [JSON.stringify(data, null, 4)], {type: "application/json;charset=utf-8"});
FileSaver.saveAs(blob, "ffz-settings.json");
}
@@ -158,15 +158,15 @@ FFZ.prototype.load_settings_file = function(file) {
}
FFZ.prototype._load_settings_file = function(data, hide_alert) {
- if ( typeof data === "string" )
- try {
- data = JSON.parse(data);
- } catch(err) {
- this.error("Error Loading Settings: " + err);
- if ( ! hide_alert )
- alert("There was an error attempting to read the provided settings data.");
- return [-1,-1,-1];
- }
+ if ( typeof data === "string" )
+ try {
+ data = JSON.parse(data);
+ } catch(err) {
+ this.error("Error Loading Settings: " + err);
+ if ( ! hide_alert )
+ alert("There was an error attempting to read the provided settings data.");
+ return [-1,-1,-1];
+ }
this.log("Loading Settings Data", data);
@@ -211,12 +211,12 @@ FFZ.prototype._load_settings_file = function(data, hide_alert) {
}
// Do this in a timeout so that any styles have a moment to update.
- if ( ! hide_alert )
+ if ( ! hide_alert )
setTimeout(function(){
alert('Successfully loaded ' + applied.length + ' settings and skipped ' + skipped.length + ' settings. Added ' + aliases + ' user nicknames.');
});
- return [applied.length, skipped.length, aliases];
+ return [applied.length, skipped.length, aliases];
}
@@ -225,470 +225,470 @@ FFZ.prototype._load_settings_file = function(data, hide_alert) {
// --------------------
var is_android = navigator.userAgent.indexOf('Android') !== -1,
- settings_renderer = function(settings_data, collapsable, collapsed_key, show_pin) {
- return function(view, container) {
- var f = this,
- settings = {},
- categories = [];
+ settings_renderer = function(settings_data, collapsable, collapsed_key, show_pin) {
+ return function(view, container) {
+ var f = this,
+ settings = {},
+ categories = [];
- // Searching!
- if ( show_pin ) {
- var search_cont = utils.createElement('div', 'ffz-filter-container'),
- search_input = utils.createElement('input', 'emoticon-selector__filter-input js-filter-input text text--full-width'),
- filtered_cont = utils.createElement('div', 'ffz-filter-children ffz-ui-sub-menu-page');
+ // Searching!
+ if ( show_pin ) {
+ var search_cont = utils.createElement('div', 'ffz-filter-container'),
+ search_input = utils.createElement('input', 'emoticon-selector__filter-input js-filter-input text text--full-width'),
+ filtered_cont = utils.createElement('div', 'ffz-filter-children ffz-ui-sub-menu-page');
- search_input.placeholder = 'Search for Settings';
- search_input.type = 'text';
+ search_input.placeholder = 'Search for Settings';
+ search_input.type = 'text';
- filtered_cont.style.maxHeight = (parseInt(container.style.maxHeight) - 51) + 'px';
+ filtered_cont.style.maxHeight = (parseInt(container.style.maxHeight) - 51) + 'px';
- search_cont.appendChild(search_input);
- container.appendChild(filtered_cont);
- container.appendChild(search_cont);
+ search_cont.appendChild(search_input);
+ container.appendChild(filtered_cont);
+ container.appendChild(search_cont);
- container = filtered_cont;
+ container = filtered_cont;
- search_input.addEventListener('input', function(e) {
- var filter = search_input.value || '',
- groups = filtered_cont.querySelectorAll('.chat-menu-content');
+ search_input.addEventListener('input', function(e) {
+ var filter = search_input.value || '',
+ groups = filtered_cont.querySelectorAll('.chat-menu-content');
- filter = filter.toLowerCase();
+ filter = filter.toLowerCase();
- for(var i=0; i < groups.length; i++) {
- var el = groups[i],
- settings = el.querySelectorAll('.ffz-setting'),
- hidden = true;
-
- for(var j=0; j < settings.length; j++) {
- var se = settings[j],
- shidden = filter.length && se.getAttribute('data-filter').indexOf(filter) === -1;
-
- se.classList.toggle('hidden', shidden);
- hidden = hidden && shidden;
- }
-
- var incompat = el.querySelector('.bttv-incompatibility'),
- settings = incompat && incompat.querySelectorAll('b'),
- incompat_hidden = true;
-
- if ( incompat ) {
- for(var j=0; j < settings.length; j++) {
- var se = settings[j],
- shidden = filter.length && se.getAttribute('data-filter').indexOf(filter) === -1;
-
- se.classList.toggle('hidden', shidden);
- incompat_hidden = incompat_hidden && shidden;
- }
-
- incompat.classList.toggle('hidden', incompat_hidden);
- hidden = hidden && incompat_hidden;
- }
-
- el.classList.toggle('collapsable', ! filter.length);
- el.classList.toggle('hidden', hidden);
- }
- });
- }
-
- for(var key in settings_data) {
- var info = settings_data[key],
- cat = info.category || "Miscellaneous",
- cat_store = settings[cat];
+ for(var i=0; i < groups.length; i++) {
+ var el = groups[i],
+ settings = el.querySelectorAll('.ffz-setting'),
+ hidden = true;
+
+ for(var j=0; j < settings.length; j++) {
+ var se = settings[j],
+ shidden = filter.length && se.getAttribute('data-filter').indexOf(filter) === -1;
+
+ se.classList.toggle('hidden', shidden);
+ hidden = hidden && shidden;
+ }
+
+ var incompat = el.querySelector('.bttv-incompatibility'),
+ settings = incompat && incompat.querySelectorAll('b'),
+ incompat_hidden = true;
+
+ if ( incompat ) {
+ for(var j=0; j < settings.length; j++) {
+ var se = settings[j],
+ shidden = filter.length && se.getAttribute('data-filter').indexOf(filter) === -1;
+
+ se.classList.toggle('hidden', shidden);
+ incompat_hidden = incompat_hidden && shidden;
+ }
+
+ incompat.classList.toggle('hidden', incompat_hidden);
+ hidden = hidden && incompat_hidden;
+ }
+
+ el.classList.toggle('collapsable', ! filter.length);
+ el.classList.toggle('hidden', hidden);
+ }
+ });
+ }
+
+ for(var key in settings_data) {
+ var info = settings_data[key],
+ cat = info.category || "Miscellaneous",
+ cat_store = settings[cat];
- if ( info.hasOwnProperty('visible') ) {
- var visible = info.visible;
- if ( typeof visible === "function" )
- visible = visible.call(this);
+ if ( info.hasOwnProperty('visible') ) {
+ var visible = info.visible;
+ if ( typeof visible === "function" )
+ visible = visible.call(this);
- if ( ! visible )
- continue;
- }
+ if ( ! visible )
+ continue;
+ }
- if ( is_android && info.no_mobile )
- continue;
+ if ( is_android && info.no_mobile )
+ continue;
- if ( ! cat_store ) {
- categories.push(cat);
- cat_store = settings[cat] = [];
- }
-
- cat_store.push([key, info]);
- }
-
- categories.sort(function(a,b) {
- var a = a.toLowerCase(),
- b = b.toLowerCase();
-
- if ( a === "debugging" )
- a = "zzz" + a;
-
- if ( b === "debugging" )
- b = "zzz" + b;
-
- if ( a < b ) return -1;
- else if ( a > b ) return 1;
- return 0;
- });
-
- var current_category = collapsed_key ? this[collapsed_key] || true : categories[0];
-
- for(var ci=0; ci < categories.length; ci++) {
- var category = categories[ci],
- cset = settings[category],
+ if ( ! cat_store ) {
+ categories.push(cat);
+ cat_store = settings[cat] = [];
+ }
+
+ cat_store.push([key, info]);
+ }
+
+ categories.sort(function(a,b) {
+ var a = a.toLowerCase(),
+ b = b.toLowerCase();
+
+ if ( a === "debugging" )
+ a = "zzz" + a;
+
+ if ( b === "debugging" )
+ b = "zzz" + b;
+
+ if ( a < b ) return -1;
+ else if ( a > b ) return 1;
+ return 0;
+ });
+
+ var current_category = collapsed_key ? this[collapsed_key] || true : categories[0];
+
+ for(var ci=0; ci < categories.length; ci++) {
+ var category = categories[ci],
+ cset = settings[category],
- bttv_skipped = [],
- added = 0,
+ bttv_skipped = [],
+ added = 0,
- menu = createElement('div'),
- heading = createElement('div');
+ menu = createElement('div'),
+ heading = createElement('div');
-
- heading.className = 'heading';
- menu.className = 'chat-menu-content';
- menu.setAttribute('data-category', category);
-
- if ( collapsable ) {
- menu.classList.add('collapsable');
- menu.classList.toggle('collapsed', current_category !== category);
- menu.addEventListener('click', function(e) {
- var t = this;
- if ( ! t.classList.contains('collapsable') )
- return;
- else if ( ! t.classList.contains('collapsed') ) {
- if ( e.target.classList.contains('heading') ) {
- t.classList.add('collapsed');
- if ( collapsed_key )
- f[collapsed_key] = true;
- }
-
- } else {
- jQuery(".chat-menu-content:not(.collapsed)", container).addClass("collapsed");
- t.classList.remove('collapsed');
- if ( collapsed_key )
- f[collapsed_key] = t.getAttribute('data-category');
- }
-
- setTimeout(function(){t.scrollIntoViewIfNeeded()});
- });
- }
-
- heading.innerHTML = category;
- menu.appendChild(heading);
-
- cset.sort(function(a,b) {
- var a = a[1],
- b = b[1],
-
- at = 2, //a.type === "boolean" ? 1 : 2,
- bt = 2, //b.type === "boolean" ? 1 : 2,
-
- an = a.name.toLowerCase(),
- bn = b.name.toLowerCase();
-
- if ( at < bt ) return -1;
- else if ( at > bt ) return 1;
-
- else if ( an < bn ) return -1;
- else if ( an > bn ) return 1;
-
- return 0;
- });
-
- for(var i=0; i < cset.length; i++) {
- var key = cset[i][0],
- info = cset[i][1],
-
- el = createElement('p'),
- pin_btn = createElement('a'),
- val = info.get ? (typeof info.get === 'function' ? info.get.call(this) : this.settings.get(info.get)) : this.settings.get(key);
-
- el.className = 'ffz-setting clearfix';
-
- if ( this.has_bttv && info.no_bttv ) {
- bttv_skipped.push([info.name, info.help]);
- continue;
- } else {
- if ( show_pin ) {
- var faved = this.settings.favorite_settings.indexOf(key) !== -1;
- pin_btn.className = 'pin-switch html-tooltip';
- pin_btn.classList.toggle('active', faved);
- pin_btn.addEventListener('click', favorite_setting.bind(this, pin_btn, key, info));
- pin_btn.title = (faved ? 'Unf' : 'F') + 'avorite this Setting';
- pin_btn.innerHTML = constants.STAR;
- }
-
- if ( info.type === "boolean" ) {
- var swit = createElement('a'),
- label = createElement('span');
-
- swit.className = 'switch';
- swit.classList.toggle('active', val);
- swit.appendChild(createElement('span'))
-
- label.className = 'switch-label';
- label.innerHTML = info.name;
-
- el.appendChild(swit);
- if ( show_pin )
- el.appendChild(pin_btn);
- el.appendChild(label);
-
- swit.addEventListener('click', toggle_setting.bind(this, swit, key, info))
-
- } else if ( info.type === "select" ) {
- var select = createElement('select'),
- label = createElement('span');
-
- label.className = 'option-label';
- label.innerHTML = info.name;
-
- for(var ok in info.options) {
- var op = createElement('option');
- op.value = JSON.stringify(ok);
- if ( val == ok )
- op.setAttribute('selected', true);
- op.innerHTML = info.options[ok];
- select.appendChild(op);
- }
-
- select.addEventListener('change', option_setting.bind(this, select, key, info));
-
- if ( show_pin )
- el.appendChild(pin_btn);
- el.appendChild(label);
- el.appendChild(select);
-
- } else if ( typeof info.method === "function" ) {
- el.classList.add("option");
- var link = createElement('a');
- link.innerHTML = info.name;
- link.href = '#';
-
- if ( show_pin )
- el.appendChild(pin_btn);
- el.appendChild(link);
-
- link.addEventListener('click', info.method.bind(this));
-
- } else
- continue;
-
- if ( info.help || info.experiment_warn || (this.has_bttv && info.warn_bttv) ) {
- var help = document.createElement('span');
- help.className = 'help';
- var parts = [];
- if ( info.experiment_warn )
- parts.push('Note: This affects an active Twitch experiment. Give feedback at: feedback@twitch.tv');
-
- if ( this.has_bttv && info.warn_bttv )
- parts.push('' + info.warn_bttv + '');
-
- if ( info.help )
- parts.push(info.help);
-
- help.innerHTML = parts.join(' ');
- el.appendChild(help);
- }
- }
-
- // Search by any of the present text.
- el.setAttribute('data-filter', el.textContent.toLowerCase());
-
- added++;
- menu.appendChild(el);
- }
-
- if ( ! added )
- continue;
-
- if ( bttv_skipped.length ) {
- var el = createElement('p'),
- label = createElement('span'),
- help = createElement('span');
-
- el.className = 'bttv-incompatibility clearfix disabled';
- label.className = 'switch-label';
- label.innerHTML = "Features Incompatible with BetterTTV";
-
- help.className = 'help';
- for(var i=0; i < bttv_skipped.length; i++) {
- var skipped = bttv_skipped[i],
- filter_text = skipped[0].toLowerCase() + (skipped[1] ? ' ' + skipped[1].toLowerCase() : '');
- help.innerHTML += '' + skipped[0] + '';
- }
-
- el.appendChild(label);
- el.appendChild(help);
- menu.appendChild(el);
- //jQuery('.html-tooltip', el).tipsy({html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});
- //jQuery('.ffz-tooltip', el).tipsy({live: true, html: true, title: this.render_tooltip(), gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});
- }
-
- container.appendChild(menu);
- }
- }
- },
-
- render_basic = settings_renderer(FFZ.basic_settings, false, '_ffz_basic_settings_page'),
- render_advanced = settings_renderer(FFZ.settings_info, true, '_ffz_settings_page', true);
+
+ heading.className = 'heading';
+ menu.className = 'chat-menu-content';
+ menu.setAttribute('data-category', category);
+
+ if ( collapsable ) {
+ menu.classList.add('collapsable');
+ menu.classList.toggle('collapsed', current_category !== category);
+ menu.addEventListener('click', function(e) {
+ var t = this;
+ if ( ! t.classList.contains('collapsable') )
+ return;
+ else if ( ! t.classList.contains('collapsed') ) {
+ if ( e.target.classList.contains('heading') ) {
+ t.classList.add('collapsed');
+ if ( collapsed_key )
+ f[collapsed_key] = true;
+ }
+
+ } else {
+ jQuery(".chat-menu-content:not(.collapsed)", container).addClass("collapsed");
+ t.classList.remove('collapsed');
+ if ( collapsed_key )
+ f[collapsed_key] = t.getAttribute('data-category');
+ }
+
+ setTimeout(function(){t.scrollIntoViewIfNeeded()});
+ });
+ }
+
+ heading.innerHTML = category;
+ menu.appendChild(heading);
+
+ cset.sort(function(a,b) {
+ var a = a[1],
+ b = b[1],
+
+ at = 2, //a.type === "boolean" ? 1 : 2,
+ bt = 2, //b.type === "boolean" ? 1 : 2,
+
+ an = a.name.toLowerCase(),
+ bn = b.name.toLowerCase();
+
+ if ( at < bt ) return -1;
+ else if ( at > bt ) return 1;
+
+ else if ( an < bn ) return -1;
+ else if ( an > bn ) return 1;
+
+ return 0;
+ });
+
+ for(var i=0; i < cset.length; i++) {
+ var key = cset[i][0],
+ info = cset[i][1],
+
+ el = createElement('p'),
+ pin_btn = createElement('a'),
+ val = info.get ? (typeof info.get === 'function' ? info.get.call(this) : this.settings.get(info.get)) : this.settings.get(key);
+
+ el.className = 'ffz-setting clearfix';
+
+ if ( this.has_bttv && info.no_bttv ) {
+ bttv_skipped.push([info.name, info.help]);
+ continue;
+ } else {
+ if ( show_pin ) {
+ var faved = this.settings.favorite_settings.indexOf(key) !== -1;
+ pin_btn.className = 'pin-switch html-tooltip';
+ pin_btn.classList.toggle('active', faved);
+ pin_btn.addEventListener('click', favorite_setting.bind(this, pin_btn, key, info));
+ pin_btn.title = (faved ? 'Unf' : 'F') + 'avorite this Setting';
+ pin_btn.innerHTML = constants.STAR;
+ }
+
+ if ( info.type === "boolean" ) {
+ var swit = createElement('a'),
+ label = createElement('span');
+
+ swit.className = 'switch';
+ swit.classList.toggle('active', val);
+ swit.appendChild(createElement('span'))
+
+ label.className = 'switch-label';
+ label.innerHTML = info.name;
+
+ el.appendChild(swit);
+ if ( show_pin )
+ el.appendChild(pin_btn);
+ el.appendChild(label);
+
+ swit.addEventListener('click', toggle_setting.bind(this, swit, key, info))
+
+ } else if ( info.type === "select" ) {
+ var select = createElement('select'),
+ label = createElement('span');
+
+ label.className = 'option-label';
+ label.innerHTML = info.name;
+
+ for(var ok in info.options) {
+ var op = createElement('option');
+ op.value = JSON.stringify(ok);
+ if ( val == ok )
+ op.setAttribute('selected', true);
+ op.innerHTML = info.options[ok];
+ select.appendChild(op);
+ }
+
+ select.addEventListener('change', option_setting.bind(this, select, key, info));
+
+ if ( show_pin )
+ el.appendChild(pin_btn);
+ el.appendChild(label);
+ el.appendChild(select);
+
+ } else if ( typeof info.method === "function" ) {
+ el.classList.add("option");
+ var link = createElement('a');
+ link.innerHTML = info.name;
+ link.href = '#';
+
+ if ( show_pin )
+ el.appendChild(pin_btn);
+ el.appendChild(link);
+
+ link.addEventListener('click', info.method.bind(this));
+
+ } else
+ continue;
+
+ if ( info.help || info.experiment_warn || (this.has_bttv && info.warn_bttv) ) {
+ var help = document.createElement('span');
+ help.className = 'help';
+ var parts = [];
+ if ( info.experiment_warn )
+ parts.push('Note: This affects an active Twitch experiment. Give feedback at: feedback@twitch.tv');
+
+ if ( this.has_bttv && info.warn_bttv )
+ parts.push('' + info.warn_bttv + '');
+
+ if ( info.help )
+ parts.push(info.help);
+
+ help.innerHTML = parts.join(' ');
+ el.appendChild(help);
+ }
+ }
+
+ // Search by any of the present text.
+ el.setAttribute('data-filter', el.textContent.toLowerCase());
+
+ added++;
+ menu.appendChild(el);
+ }
+
+ if ( ! added )
+ continue;
+
+ if ( bttv_skipped.length ) {
+ var el = createElement('p'),
+ label = createElement('span'),
+ help = createElement('span');
+
+ el.className = 'bttv-incompatibility clearfix disabled';
+ label.className = 'switch-label';
+ label.innerHTML = "Features Incompatible with BetterTTV";
+
+ help.className = 'help';
+ for(var i=0; i < bttv_skipped.length; i++) {
+ var skipped = bttv_skipped[i],
+ filter_text = skipped[0].toLowerCase() + (skipped[1] ? ' ' + skipped[1].toLowerCase() : '');
+ help.innerHTML += '' + skipped[0] + '';
+ }
+
+ el.appendChild(label);
+ el.appendChild(help);
+ menu.appendChild(el);
+ //jQuery('.html-tooltip', el).tipsy({html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});
+ //jQuery('.ffz-tooltip', el).tipsy({live: true, html: true, title: this.render_tooltip(), gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});
+ }
+
+ container.appendChild(menu);
+ }
+ }
+ },
+
+ render_basic = settings_renderer(FFZ.basic_settings, false, '_ffz_basic_settings_page'),
+ render_advanced = settings_renderer(FFZ.settings_info, true, '_ffz_settings_page', true);
FFZ.settings_info.favorite_settings = {
- value: [],
- hidden: true
+ value: [],
+ hidden: true
}
FFZ.menu_pages.settings = {
- name: "Settings",
+ name: "Settings",
icon: constants.GEAR,
sort_order: 99999,
wide: true,
- default_page: function() { return this.settings.favorite_settings.length ? "favorites" : this.settings.advanced_settings ? 'advanced' : 'basic' },
+ default_page: function() { return this.settings.favorite_settings.length ? "favorites" : this.settings.advanced_settings ? 'advanced' : 'basic' },
- pages: {
- favorites: {
- name: "Favorites",
- sort_order: 1,
+ pages: {
+ favorites: {
+ name: "Favorites",
+ sort_order: 1,
- render: function(view, container) {
- var favorites = this.settings.favorite_settings;
- if ( ! favorites.length ) {
- var el = utils.createElement('div');
- el.className = 'emoticon-grid ffz-no-emotes center';
- el.innerHTML = "You have no favorite settings. " +
- ' ' +
- 'To make a setting a favorite, find it on the Advanced tab and click the star icon to the right.';
+ render: function(view, container) {
+ var favorites = this.settings.favorite_settings;
+ if ( ! favorites.length ) {
+ var el = utils.createElement('div');
+ el.className = 'emoticon-grid ffz-no-emotes center';
+ el.innerHTML = "You have no favorite settings. " +
+ ' ' +
+ 'To make a setting a favorite, find it on the Advanced tab and click the star icon to the right.';
- container.appendChild(el);
- return;
- }
+ container.appendChild(el);
+ return;
+ }
- var favorite_settings = {};
- for(var i=0, l = favorites.length; i < l; i++) {
- var key = favorites[i],
- val = FFZ.settings_info[key];
+ var favorite_settings = {};
+ for(var i=0, l = favorites.length; i < l; i++) {
+ var key = favorites[i],
+ val = FFZ.settings_info[key];
- if ( val )
- favorite_settings[key] = val;
- }
+ if ( val )
+ favorite_settings[key] = val;
+ }
- return settings_renderer(favorite_settings, false, '_ffz_favorite_settings_page').call(this, view, container);
- }
- },
+ return settings_renderer(favorite_settings, false, '_ffz_favorite_settings_page').call(this, view, container);
+ }
+ },
- basic: {
- name: "Basic",
- sort_order: 2,
+ basic: {
+ name: "Basic",
+ sort_order: 2,
- render: function(view, container) {
- this.settings.set("advanced_settings", false);
- return render_basic.call(this, view, container);
- }
- },
+ render: function(view, container) {
+ this.settings.set("advanced_settings", false);
+ return render_basic.call(this, view, container);
+ }
+ },
- advanced: {
- name: "Advanced",
- sort_order: 3,
+ advanced: {
+ name: "Advanced",
+ sort_order: 3,
- render: function(view, container) {
- this.settings.set("advanced_settings", true);
- return render_advanced.call(this, view, container);
- }
- },
+ render: function(view, container) {
+ this.settings.set("advanced_settings", true);
+ return render_advanced.call(this, view, container);
+ }
+ },
- backup: {
- name: "Backup & Restore",
- sort_order: 4,
+ backup: {
+ name: "Backup & Restore",
+ sort_order: 4,
- render: function(view, container) {
- var backup_head = createElement('div'),
- restore_head = createElement('div'),
- reset_head = createElement('div'),
+ render: function(view, container) {
+ var backup_head = createElement('div'),
+ restore_head = createElement('div'),
+ reset_head = createElement('div'),
- backup_cont = createElement('div'),
- restore_cont = createElement('div'),
- reset_cont = createElement('div'),
+ backup_cont = createElement('div'),
+ restore_cont = createElement('div'),
+ reset_cont = createElement('div'),
- backup_para = createElement('p'),
- backup_link = createElement('a'),
- backup_help = createElement('span'),
+ backup_para = createElement('p'),
+ backup_link = createElement('a'),
+ backup_help = createElement('span'),
- restore_para = createElement('p'),
- restore_input = createElement('input'),
- restore_link = createElement('a'),
- restore_help = createElement('span'),
+ restore_para = createElement('p'),
+ restore_input = createElement('input'),
+ restore_link = createElement('a'),
+ restore_help = createElement('span'),
- reset_para = createElement('p'),
- reset_link = createElement('a'),
- reset_help = createElement('span'),
- f = this;
+ reset_para = createElement('p'),
+ reset_link = createElement('a'),
+ reset_help = createElement('span'),
+ f = this;
- backup_cont.className = 'chat-menu-content';
- backup_head.className = 'heading';
- backup_head.innerHTML = 'Backup Settings';
- backup_cont.appendChild(backup_head);
+ backup_cont.className = 'chat-menu-content';
+ backup_head.className = 'heading';
+ backup_head.innerHTML = 'Backup Settings';
+ backup_cont.appendChild(backup_head);
- backup_para.className = 'clearfix option';
+ backup_para.className = 'clearfix option';
- backup_link.href = '#';
- backup_link.innerHTML = 'Save to File';
- backup_link.addEventListener('click', this.save_settings_file.bind(this));
+ backup_link.href = '#';
+ backup_link.innerHTML = 'Save to File';
+ backup_link.addEventListener('click', this.save_settings_file.bind(this));
- backup_help.className = 'help';
- backup_help.innerHTML = 'This generates a JSON file containing all of your settings and prompts you to save it.';
+ backup_help.className = 'help';
+ backup_help.innerHTML = 'This generates a JSON file containing all of your settings and prompts you to save it.';
- backup_para.appendChild(backup_link);
- backup_para.appendChild(backup_help);
- backup_cont.appendChild(backup_para);
+ backup_para.appendChild(backup_link);
+ backup_para.appendChild(backup_help);
+ backup_cont.appendChild(backup_para);
- restore_cont.className = 'chat-menu-content';
- restore_head.className = 'heading';
- restore_head.innerHTML = 'Restore Settings';
- restore_cont.appendChild(restore_head);
+ restore_cont.className = 'chat-menu-content';
+ restore_head.className = 'heading';
+ restore_head.innerHTML = 'Restore Settings';
+ restore_cont.appendChild(restore_head);
- restore_para.className = 'clearfix option';
+ restore_para.className = 'clearfix option';
- restore_input.type = 'file';
- restore_input.addEventListener('change', function() { f.load_settings_file(this.files[0]); })
+ restore_input.type = 'file';
+ restore_input.addEventListener('change', function() { f.load_settings_file(this.files[0]); })
- restore_link.href = '#';
- restore_link.innerHTML = 'Restore from File';
- restore_link.addEventListener('click', function(e) { e.preventDefault(); restore_input.click(); });
+ restore_link.href = '#';
+ restore_link.innerHTML = 'Restore from File';
+ restore_link.addEventListener('click', function(e) { e.preventDefault(); restore_input.click(); });
- restore_help.className = 'help';
- restore_help.innerHTML = 'This loads settings from a previously generated JSON file.';
+ restore_help.className = 'help';
+ restore_help.innerHTML = 'This loads settings from a previously generated JSON file.';
- restore_para.appendChild(restore_link);
- restore_para.appendChild(restore_help);
- restore_cont.appendChild(restore_para);
+ restore_para.appendChild(restore_link);
+ restore_para.appendChild(restore_help);
+ restore_cont.appendChild(restore_para);
- reset_cont.className = 'chat-menu-content';
- reset_head.className = 'heading';
- reset_head.innerHTML = this.tr('Reset Settings');
- reset_cont.appendChild(reset_head);
+ reset_cont.className = 'chat-menu-content';
+ reset_head.className = 'heading';
+ reset_head.innerHTML = this.tr('Reset Settings');
+ reset_cont.appendChild(reset_head);
- reset_para.className = 'clearfix option';
+ reset_para.className = 'clearfix option';
- reset_link.href = '#';
- reset_link.innerHTML = this.tr('Reset FrankerFaceZ');
- reset_link.addEventListener('click', this.reset_settings.bind(this));
+ reset_link.href = '#';
+ reset_link.innerHTML = this.tr('Reset FrankerFaceZ');
+ reset_link.addEventListener('click', this.reset_settings.bind(this));
- reset_help.className = 'help';
- reset_help.innerHTML = this.tr('This resets all of your FFZ data. That includes chat filters, nicknames for users, and settings.');
+ reset_help.className = 'help';
+ reset_help.innerHTML = this.tr('This resets all of your FFZ data. That includes chat filters, nicknames for users, and settings.');
- reset_para.appendChild(reset_link);
- reset_para.appendChild(reset_help);
- reset_cont.appendChild(reset_para);
+ reset_para.appendChild(reset_link);
+ reset_para.appendChild(reset_help);
+ reset_cont.appendChild(reset_para);
- container.appendChild(backup_cont);
- container.appendChild(restore_cont);
- container.appendChild(reset_cont);
- }
- }
- }
+ container.appendChild(backup_cont);
+ container.appendChild(restore_cont);
+ container.appendChild(reset_cont);
+ }
+ }
+ }
};
@@ -802,7 +802,7 @@ FFZ.prototype._setting_set = function(key, val, suppress_log) {
var jval = JSON.stringify(val);
localStorage.setItem(ls_key, jval);
- if ( ! suppress_log )
+ if ( ! suppress_log )
this.log('Changed Setting "' + key + '" to: ' + jval);
if ( info.on_update )
diff --git a/src/tokenize.js b/src/tokenize.js
index 35e3552e..d85e1f2c 100644
--- a/src/tokenize.js
+++ b/src/tokenize.js
@@ -7,13 +7,13 @@ var FFZ = window.FrankerFaceZ,
bits_helpers,
bits_service,
- EXPLANATION_WARN = '
This link has been sent to you via a whisper rather than standard chat, and has not been checked or approved of by any moderators or staff members. Please treat this link with caution and do not visit it if you do not trust the sender.',
+ EXPLANATION_WARN = 'This link has been sent to you via a whisper rather than standard chat, and has not been checked or approved of by any moderators or staff members. Please treat this link with caution and do not visit it if you do not trust the sender.',
reg_escape = function(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
- LINK = /(?:https?:\/\/)?(?:[-a-zA-Z0-9@:%_\+~#=]+\.)+[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g,
+ LINK = /(?:https?:\/\/)?(?:[-a-zA-Z0-9@:%_\+~#=]+\.)+[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g,
CLIP_URL = /(?:https?:\/\/)?clips\.twitch\.tv\/(\w+)\/(\w+)/,
@@ -53,12 +53,12 @@ var FFZ = window.FrankerFaceZ,
this._link_data[href] = data;
//data.unsafe = false;
- if ( ! this.settings.link_info )
- return;
+ if ( ! this.settings.link_info )
+ return;
- // If this link is unsafe, add the unsafe-link class to all instances of the link.
- if ( data.unsafe )
- jQuery('a.chat-link[data-url="' + href + '"]').addClass('unsafe-link');
+ // If this link is unsafe, add the unsafe-link class to all instances of the link.
+ if ( data.unsafe )
+ jQuery('a.chat-link[data-url="' + href + '"]').addClass('unsafe-link');
};
@@ -85,7 +85,7 @@ FFZ._emote_mirror_swap = function(img) {
img.setAttribute('data-alt-attempts', attempts + 1);
var id = img.getAttribute('data-emote'),
- src = '//' + img.src.split('//')[1];
+ src = '//' + img.src.split('//')[1];
if ( src.substr(0, constants.TWITCH_BASE.length) === constants.TWITCH_BASE ) {
img.src = constants.EMOTE_MIRROR_BASE + id + ".png";
@@ -218,8 +218,8 @@ FFZ.prototype.setup_tokenization = function() {
var show_deleted = f.settings.show_deleted_links;
return _.chain(tokens).map(function(token) {
- if ( token.type === "text" )
- token = token.text;
+ if ( token.type === "text" )
+ token = token.text;
if ( ! _.isString(token) )
return token;
@@ -231,21 +231,21 @@ FFZ.prototype.setup_tokenization = function() {
return _.zip(
token.split(LINK),
_.map(matches, function(e) {
- var long = e.length > 255,
- out = {
- type: "link",
- length: e.length,
- isDeleted: ! show_deleted && (delete_links || long),
- isLong: long,
- isMailTo: e.indexOf("@") > -1 && (-1 === e.indexOf("/") || e.indexOf("@") < e.indexOf("/")),
- text: e,
- link: e
- };
+ var long = e.length > 255,
+ out = {
+ type: "link",
+ length: e.length,
+ isDeleted: ! show_deleted && (delete_links || long),
+ isLong: long,
+ isMailTo: e.indexOf("@") > -1 && (-1 === e.indexOf("/") || e.indexOf("@") < e.indexOf("/")),
+ text: e,
+ link: e
+ };
- if ( ! out.isMailTo && ! e.match(/^(?:https?:\/\/)/) )
- out.link = "http://" + e;
+ if ( ! out.isMailTo && ! e.match(/^(?:https?:\/\/)/) )
+ out.link = "http://" + e;
- return out;
+ return out;
})
);
}).flatten().compact().value();
@@ -290,8 +290,8 @@ FFZ.prototype.load_twitch_emote_data = function(tries) {
// ---------------------
FFZ.prototype.render_tooltip = function(el) {
- var f = this,
- func = function() {
+ var f = this,
+ func = function() {
if ( this.classList.contains('ffz-bit') ) {
var amount = parseInt(this.getAttribute('data-amount').replace(/,/g, '')),
individuals = JSON.parse(this.getAttribute('data-individuals') || "null"),
@@ -317,102 +317,102 @@ FFZ.prototype.render_tooltip = function(el) {
return image + out;
} else if ( this.classList.contains('emoticon') ) {
- var preview_url, width=0, height=0, image, set_id, emote, emote_set,
- emote_id = this.getAttribute('data-ffz-emote');
- if ( emote_id ) {
+ var preview_url, width=0, height=0, image, set_id, emote, emote_set,
+ emote_id = this.getAttribute('data-ffz-emote');
+ if ( emote_id ) {
if ( emote_id == "93269" )
return '';
- set_id = this.getAttribute('data-ffz-set');
- emote_set = f.emote_sets[set_id];
- emote = emote_set && emote_set.emoticons[emote_id];
+ set_id = this.getAttribute('data-ffz-set');
+ emote_set = f.emote_sets[set_id];
+ emote = emote_set && emote_set.emoticons[emote_id];
- if ( emote ) {
- var owner = emote.owner,
- title = emote_set.title || "Global",
- source = emote_set.source || "FFZ";
+ if ( emote ) {
+ var owner = emote.owner,
+ title = emote_set.title || "Global",
+ source = emote_set.source || "FFZ";
- if ( f.settings.emote_image_hover ) {
- if ( emote.urls[4] ) {
- height = emote.height * 4;
- width = emote.width * 4;
- preview_url = emote.urls[4];
+ if ( f.settings.emote_image_hover ) {
+ if ( emote.urls[4] ) {
+ height = emote.height * 4;
+ width = emote.width * 4;
+ preview_url = emote.urls[4];
- } else if ( emote.urls[2] ) {
- height = emote.height * 2;
- width = emote.width * 2;
- }
+ } else if ( emote.urls[2] ) {
+ height = emote.height * 2;
+ width = emote.width * 2;
+ }
- if ( width > 186 )
- height *= 186 / width;
- height = Math.min(186, height);
+ if ( width > 186 )
+ height *= 186 / width;
+ height = Math.min(186, height);
- } else
- preview_url = null;
+ } else
+ preview_url = null;
- //image = preview_url ? `` : '';
- image = preview_url ? '' : '';
- return image + 'Emoticon: ' + (emote.hidden ? '???' : emote.name) + ' ' + source + ' ' + title + (owner ? ' By: ' + owner.display_name : '');
+ //image = preview_url ? `` : '';
+ image = preview_url ? '' : '';
+ return image + 'Emoticon: ' + (emote.hidden ? '???' : emote.name) + ' ' + source + ' ' + title + (owner ? ' By: ' + owner.display_name : '');
- //return `${image}Emoticon: ${emote.hidden ? '???' : emote.name} ${source} ${title}${owner ? ' By: ' + owner.display_name : ""}`;
- }
- }
+ //return `${image}Emoticon: ${emote.hidden ? '???' : emote.name} ${source} ${title}${owner ? ' By: ' + owner.display_name : ""}`;
+ }
+ }
- emote_id = this.getAttribute('data-emote');
- if ( emote_id ) {
- set_id = f._twitch_emote_to_set[emote_id];
- emote_set = set_id && f._twitch_set_to_channel[set_id];
- var set_type = "Channel";
+ emote_id = this.getAttribute('data-emote');
+ if ( emote_id ) {
+ set_id = f._twitch_emote_to_set[emote_id];
+ emote_set = set_id && f._twitch_set_to_channel[set_id];
+ var set_type = "Channel";
- preview_url = f.settings.emote_image_hover && (constants.TWITCH_BASE + emote_id + '/3.0');
- //image = preview_url ? `` : '';
- image = preview_url ? '' : '';
+ preview_url = f.settings.emote_image_hover && (constants.TWITCH_BASE + emote_id + '/3.0');
+ //image = preview_url ? `` : '';
+ image = preview_url ? '' : '';
// Global OR Golden Kappa
- if ( emote_set === "--global--" || emote_id === '80393' ) {
- emote_set = "Twitch Global";
- set_type = null;
- } else if ( emote_set === "--twitch-turbo--" || emote_set === "turbo" || emote_set === "--turbo-faces--" ) {
- emote_set = "Twitch Turbo";
- set_type = null;
- }
+ if ( emote_set === "--global--" || emote_id === '80393' ) {
+ emote_set = "Twitch Global";
+ set_type = null;
+ } else if ( emote_set === "--twitch-turbo--" || emote_set === "turbo" || emote_set === "--turbo-faces--" ) {
+ emote_set = "Twitch Turbo";
+ set_type = null;
+ }
- if ( this.classList.contains('ffz-tooltip-no-credit') )
- return image + this.alt;
- else
- return image + 'Emoticon: ' + this.alt + ' ' + (set_type ? set_type + ': ' : '') + emote_set;
- //return `${image}Emoticon: ${this.alt} ${set_type ? set_type + ": " : ""}${emote_set}`;
- }
+ if ( this.classList.contains('ffz-tooltip-no-credit') )
+ return image + this.alt;
+ else
+ return image + 'Emoticon: ' + this.alt + ' ' + (set_type ? set_type + ': ' : '') + emote_set;
+ //return `${image}Emoticon: ${this.alt} ${set_type ? set_type + ": " : ""}${emote_set}`;
+ }
- emote_id = this.getAttribute('data-ffz-emoji');
- if ( emote_id ) {
- emote = f.emoji_data[emote_id];
- var src = emote && (f.settings.parse_emoji === 3 ? emote.one_src : (f.settings.parse_emoji === 2 ? emote.noto_src : emote.tw_src));
+ emote_id = this.getAttribute('data-ffz-emoji');
+ if ( emote_id ) {
+ emote = f.emoji_data[emote_id];
+ var src = emote && (f.settings.parse_emoji === 3 ? emote.one_src : (f.settings.parse_emoji === 2 ? emote.noto_src : emote.tw_src));
- preview_url = f.settings.emote_image_hover && src;
- //image = preview_url ? `` : '';
- image = preview_url ? '' : '';
+ preview_url = f.settings.emote_image_hover && src;
+ //image = preview_url ? `` : '';
+ image = preview_url ? '' : '';
- return image + "Emoji: " + this.alt + ' Name: ' + emote.name + (emote.short_name ? ' Short Name :' + emote.short_name + ':' : '') + (emote.cat ? ' Category: ' + utils.sanitize(constants.EMOJI_CATEGORIES[emote.cat] || emote.cat) : '');
- //return `${image}Emoji: ${this.alt} Name: ${emote.name}${emote.short_name ? ' Short Name: :' + emote.short_name + ':' : ''}`;
- }
+ return image + "Emoji: " + this.alt + ' Name: ' + emote.name + (emote.short_name ? ' Short Name :' + emote.short_name + ':' : '') + (emote.cat ? ' Category: ' + utils.sanitize(constants.EMOJI_CATEGORIES[emote.cat] || emote.cat) : '');
+ //return `${image}Emoji: ${this.alt} Name: ${emote.name}${emote.short_name ? ' Short Name: :' + emote.short_name + ':' : ''}`;
+ }
- } else if ( this.classList.contains('email-link') ) {
- var url = this.getAttribute("data-url");
- return url ? "E-Mail " + url.substr(7) : '';
+ } else if ( this.classList.contains('email-link') ) {
+ var url = this.getAttribute("data-url");
+ return url ? "E-Mail " + url.substr(7) : '';
- } else if ( this.classList.contains('chat-link') ) {
- // TODO: A lot of shit. Lookup data.
- var url = this.getAttribute("data-url"),
+ } else if ( this.classList.contains('chat-link') ) {
+ // TODO: A lot of shit. Lookup data.
+ var url = this.getAttribute("data-url"),
data = url && f._link_data[url],
preview_url = null,
preview_iframe = true,
image = '',
- text = '';
+ text = '';
- if ( ! url )
- return;
+ if ( ! url )
+ return;
// Do we have data?
if ( data && data !== true ) {
@@ -428,21 +428,21 @@ FFZ.prototype.render_tooltip = function(el) {
else
image = '';
- // If it's not a deleted link, don't waste time showing the URL in the tooltip.
- if ( this.classList.contains('deleted-link') )
- text = url;
+ // If it's not a deleted link, don't waste time showing the URL in the tooltip.
+ if ( this.classList.contains('deleted-link') )
+ text = url;
- if ( this.classList.contains('warn-link') )
- text += EXPLANATION_WARN;
+ if ( this.classList.contains('warn-link') )
+ text += EXPLANATION_WARN;
- return image + text; //`${image}${text}`;
- }
+ return image + text; //`${image}${text}`;
+ }
- f.log("Unable to Build Tooltip For: " + this.className, this);
- return "";
- };
+ f.log("Unable to Build Tooltip For: " + this.className, this);
+ return "";
+ };
- return el ? func(el) : func;
+ return el ? func(el) : func;
};
@@ -500,53 +500,53 @@ FFZ.prototype.tokenize_conversation_line = function(message, prevent_notificatio
FFZ.prototype.tokenize_vod_line = function(msgObject, delete_links) {
- var cached = msgObject.get('cachedTokens');
- if ( cached )
- return cached;
+ var cached = msgObject.get('cachedTokens');
+ if ( cached )
+ return cached;
- var msg = msgObject.get('message'),
- room_id = msgObject.get('room'),
- from_user = msgObject.get('from'),
- user = this.get_user(),
- from_me = user && from_user === user.login,
- emotes = msgObject.get('tags.emotes'),
- tokens = [msg];
+ var msg = msgObject.get('message'),
+ room_id = msgObject.get('room'),
+ from_user = msgObject.get('from'),
+ user = this.get_user(),
+ from_me = user && from_user === user.login,
+ emotes = msgObject.get('tags.emotes'),
+ tokens = [msg];
- if ( helpers && helpers.linkifyMessage )
- tokens = helpers.linkifyMessage(tokens, delete_links);
+ if ( helpers && helpers.linkifyMessage )
+ tokens = helpers.linkifyMessage(tokens, delete_links);
- if ( user && user.login && helpers && helpers.mentionizeMessage )
- tokens = helpers.mentionizeMessage(tokens, user.login, from_me);
+ if ( user && user.login && helpers && helpers.mentionizeMessage )
+ tokens = helpers.mentionizeMessage(tokens, user.login, from_me);
- if ( helpers && helpers.emoticonizeMessage && emotes && this.settings.parse_emoticons )
- tokens = helpers.emoticonizeMessage(tokens, emotes);
+ if ( helpers && helpers.emoticonizeMessage && emotes && this.settings.parse_emoticons )
+ tokens = helpers.emoticonizeMessage(tokens, emotes);
- // FrankerFaceZ Extras
- tokens = this._remove_banned(tokens);
+ // FrankerFaceZ Extras
+ tokens = this._remove_banned(tokens);
if ( this.settings.parse_emoticons && this.settings.parse_emoticons !== 2 )
- tokens = this.tokenize_emotes(from_user, room_id, tokens, from_me);
+ tokens = this.tokenize_emotes(from_user, room_id, tokens, from_me);
- if ( this.settings.parse_emoji )
- tokens = this.tokenize_emoji(tokens);
+ if ( this.settings.parse_emoji )
+ tokens = this.tokenize_emoji(tokens);
- var display = msgObject.get('tags.display-name');
- if ( display && display.length )
- FFZ.capitalization[from_user] = [display.trim(), Date.now()];
+ var display = msgObject.get('tags.display-name');
+ if ( display && display.length )
+ FFZ.capitalization[from_user] = [display.trim(), Date.now()];
- if ( ! from_me ) {
- tokens = this.tokenize_mentions(tokens);
- for(var i=0; i < tokens.length; i++) {
- var token = tokens[i];
- if ( token.type === 'mention' && ! token.isOwnMessage ) {
- msgObject.set('ffz_has_mention', true);
- break;
- }
- }
- }
+ if ( ! from_me ) {
+ tokens = this.tokenize_mentions(tokens);
+ for(var i=0; i < tokens.length; i++) {
+ var token = tokens[i];
+ if ( token.type === 'mention' && ! token.isOwnMessage ) {
+ msgObject.set('ffz_has_mention', true);
+ break;
+ }
+ }
+ }
- msgObject.set('cachedTokens', tokens);
- return tokens;
+ msgObject.set('cachedTokens', tokens);
+ return tokens;
}
@@ -554,14 +554,14 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification, del
if ( msgObject.cachedTokens )
return msgObject.cachedTokens;
- var msg = msgObject.message,
- room_id = msgObject.room,
- from_user = msgObject.from,
- user = this.get_user(),
- from_me = user && from_user === user.login,
+ var msg = msgObject.message,
+ room_id = msgObject.room,
+ from_user = msgObject.from,
+ user = this.get_user(),
+ from_me = user && from_user === user.login,
tags = msgObject.tags || {},
- emotes = tags.emotes,
- tokens = [msg];
+ emotes = tags.emotes,
+ tokens = [msg];
// Standard Tokenization
if ( tags.bits && bits_helpers && bits_helpers.tokenizeBits )
@@ -628,13 +628,13 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification, del
for(var i=0; i < tokens.length; i++) {
var token = tokens[i],
- is_mention = token.type === "mention";
+ is_mention = token.type === "mention";
- if ( ! is_mention || token.isOwnMessage )
- continue;
+ if ( ! is_mention || token.isOwnMessage )
+ continue;
// We have a mention!
- msgObject.ffz_has_mention = true;
+ msgObject.ffz_has_mention = true;
// If we have chat tabs/rows, update the status.
if ( room_id && ! this.has_bttv && this._chatv ) {
@@ -979,79 +979,79 @@ FFZ.prototype.tokenize_ctags = function(tokens, tags_only) {
// ---------------------
FFZ.prototype.tokenize_emotes = function(user, room, tokens, do_report) {
- "use strict";
+ "use strict";
- var sets = this.getEmotes(user, room),
- emotes = {},
- emote,
+ var sets = this.getEmotes(user, room),
+ emotes = {},
+ emote,
- new_tokens = [];
+ new_tokens = [];
- if ( ! tokens || ! tokens.length || ! sets || ! sets.length )
- return tokens;
+ if ( ! tokens || ! tokens.length || ! sets || ! sets.length )
+ return tokens;
- // Build an object with all of our emotes.
- for(var i=0; i < sets.length; i++) {
- var emote_set = this.emote_sets[sets[i]];
- if ( emote_set && emote_set.emoticons )
- for(var emote_id in emote_set.emoticons) {
- emote = emote_set.emoticons[emote_id];
- if ( ! emotes.hasOwnProperty(emote.name) )
- emotes[emote.name] = emote;
- }
- }
+ // Build an object with all of our emotes.
+ for(var i=0; i < sets.length; i++) {
+ var emote_set = this.emote_sets[sets[i]];
+ if ( emote_set && emote_set.emoticons )
+ for(var emote_id in emote_set.emoticons) {
+ emote = emote_set.emoticons[emote_id];
+ if ( ! emotes.hasOwnProperty(emote.name) )
+ emotes[emote.name] = emote;
+ }
+ }
- if ( typeof tokens === "string" )
- tokens = [tokens];
+ if ( typeof tokens === "string" )
+ tokens = [tokens];
- for(var i=0, l=tokens.length; i < l; i++) {
- var token = tokens[i];
- if ( ! token )
- continue;
+ for(var i=0, l=tokens.length; i < l; i++) {
+ var token = tokens[i];
+ if ( ! token )
+ continue;
- if ( typeof token !== "string" )
- if ( token.type === "text" )
- token = token.text;
- else {
- new_tokens.push(token);
- continue;
- }
+ if ( typeof token !== "string" )
+ if ( token.type === "text" )
+ token = token.text;
+ else {
+ new_tokens.push(token);
+ continue;
+ }
- // Split the token!
- var segments = token.split(' '),
- text = [], segment;
+ // Split the token!
+ var segments = token.split(' '),
+ text = [], segment;
- for(var x=0,y=segments.length; x < y; x++) {
- segment = segments[x];
- if ( emotes.hasOwnProperty(segment) ) {
- emote = emotes[segment];
+ for(var x=0,y=segments.length; x < y; x++) {
+ segment = segments[x];
+ if ( emotes.hasOwnProperty(segment) ) {
+ emote = emotes[segment];
- if ( text.length ) {
- // We have pending text. Join it together, with an extra space
- // on the end for good measure.
- new_tokens.push({type: "text", text: text.join(' ') + ' '});
- text = []
- }
+ if ( text.length ) {
+ // We have pending text. Join it together, with an extra space
+ // on the end for good measure.
+ new_tokens.push({type: "text", text: text.join(' ') + ' '});
+ text = []
+ }
- // Push this emote to the tokens.
- new_tokens.push(emote.token);
+ // Push this emote to the tokens.
+ new_tokens.push(emote.token);
- if ( do_report && room )
- this.add_usage(room, emote);
+ if ( do_report && room )
+ this.add_usage(room, emote);
- // Finally, push an empty string to text so that this emote gets spaced.
- text.push('');
+ // Finally, push an empty string to text so that this emote gets spaced.
+ text.push('');
- } else
- text.push(segment);
- }
+ } else
+ text.push(segment);
+ }
- // Add any left over text from this segment.
- if ( text.length > 1 || (text.length === 1 && text[0] !== '') )
- new_tokens.push({type: "text", text: text.join(' ')});
- }
+ // Add any left over text from this segment.
+ if ( text.length > 1 || (text.length === 1 && text[0] !== '') )
+ new_tokens.push({type: "text", text: text.join(' ')});
+ }
- return new_tokens;
+ return new_tokens;
}
@@ -1060,54 +1060,54 @@ FFZ.prototype.tokenize_emotes = function(user, room, tokens, do_report) {
// ---------------------
FFZ.prototype.tokenize_emoji = function(tokens) {
- "use strict";
- if ( ! tokens || ! tokens.length || ! this.emoji_data )
- return tokens;
+ "use strict";
+ if ( ! tokens || ! tokens.length || ! this.emoji_data )
+ return tokens;
- if ( typeof tokens === "string" )
- tokens = [tokens];
+ if ( typeof tokens === "string" )
+ tokens = [tokens];
- var new_tokens = [];
+ var new_tokens = [];
- for(var i=0, l=tokens.length; i < l; i++) {
- var token = tokens[i];
- if ( ! token )
- continue;
+ for(var i=0, l=tokens.length; i < l; i++) {
+ var token = tokens[i];
+ if ( ! token )
+ continue;
- if ( typeof token !== "string" )
- if ( token.type === "text" )
- token = token.text;
- else {
- new_tokens.push(token);
- continue;
- }
+ if ( typeof token !== "string" )
+ if ( token.type === "text" )
+ token = token.text;
+ else {
+ new_tokens.push(token);
+ continue;
+ }
- var segments = token.split(constants.EMOJI_REGEX),
- text = null;
+ var segments = token.split(constants.EMOJI_REGEX),
+ text = null;
- while(segments.length) {
- text = (text || '') + segments.shift();
+ while(segments.length) {
+ text = (text || '') + segments.shift();
- if ( segments.length ) {
- var match = segments.shift(),
- eid = utils.emoji_to_codepoint(match),
- data = this.emoji_data[eid];
+ if ( segments.length ) {
+ var match = segments.shift(),
+ eid = utils.emoji_to_codepoint(match),
+ data = this.emoji_data[eid];
- if ( data ) {
- if ( text && text.length )
- new_tokens.push({type: "text", text: text});
- new_tokens.push(data.token);
- text = null;
- } else
- text = (text || '') + match;
- }
- }
+ if ( data ) {
+ if ( text && text.length )
+ new_tokens.push({type: "text", text: text});
+ new_tokens.push(data.token);
+ text = null;
+ } else
+ text = (text || '') + match;
+ }
+ }
- if ( text && text.length )
- new_tokens.push({type: "text", text: text});
- }
+ if ( text && text.length )
+ new_tokens.push({type: "text", text: text});
+ }
- return new_tokens;
+ return new_tokens;
}
@@ -1152,8 +1152,8 @@ FFZ.prototype.tokenize_mentions = function(tokens) {
for(var i=0; i < tokens.length; i++) {
var token = tokens[i];
- if ( token.type === "text" )
- token = token.text;
+ if ( token.type === "text" )
+ token = token.text;
if ( ! _.isString(token) || ! token.match(regex) ) {
new_tokens.push(token);
@@ -1163,10 +1163,10 @@ FFZ.prototype.tokenize_mentions = function(tokens) {
token = token.replace(regex, function(all, prefix, match) {
new_tokens.push(prefix);
new_tokens.push({
- type: "mention",
- length: match.length,
- user: match,
- isOwnMessage: false,
+ type: "mention",
+ length: match.length,
+ user: match,
+ isOwnMessage: false,
});
return "";
@@ -1188,7 +1188,7 @@ FFZ.prototype._deleted_link_click = function(e) {
if ( ! this.classList.contains("deleted-link") )
return true;
- // Stop from Navigating
+ // Stop from Navigating
e.preventDefault();
// Get the URL
@@ -1198,7 +1198,7 @@ FFZ.prototype._deleted_link_click = function(e) {
// Delete Old Stuff
this.classList.remove('deleted-link');
- this.classList.remove('warn-link');
+ this.classList.remove('warn-link');
// Set up the Link
this.href = link;
@@ -1206,7 +1206,7 @@ FFZ.prototype._deleted_link_click = function(e) {
this.textContent = text;
// Refresh tipsy.
- jQuery(this).trigger('mouseout').trigger('mouseover');
+ jQuery(this).trigger('mouseout').trigger('mouseover');
}
diff --git a/src/ui/about_page.js b/src/ui/about_page.js
index 5d146816..cbbdec0d 100644
--- a/src/ui/about_page.js
+++ b/src/ui/about_page.js
@@ -1,13 +1,13 @@
var FFZ = window.FrankerFaceZ,
constants = require("../constants"),
- utils = require("../utils"),
- createElement = utils.createElement,
+ utils = require("../utils"),
+ createElement = utils.createElement,
- NICE_DESCRIPTION = {
- "cluster": null,
- "manifest_cluster": null,
- "user_ip": null
- };
+ NICE_DESCRIPTION = {
+ "cluster": null,
+ "manifest_cluster": null,
+ "user_ip": null
+ };
// -------------------
@@ -53,430 +53,430 @@ FFZ.ws_commands.update_news = function(version) {
// -------------------
var include_html = function(heading_text, filename, callback) {
- return function(view, container) {
- var heading = createElement('div', 'chat-menu-content center');
- heading.innerHTML = '
Default: 60",
- this.settings.notification_timeout,
- function(new_val) {
- if ( new_val === null || new_val === undefined )
- return;
+ var f = this;
+ utils.prompt(
+ "Notification Timeout",
+ "Please enter the time you'd like notifications to be displayed before automatically closing, in seconds.