diff --git a/dark.css b/dark.css
index e538228b..4c699932 100644
--- a/dark.css
+++ b/dark.css
@@ -206,12 +206,18 @@
.ffz-dark input.text,
.ffz-dark input.string,
.ffz-dark textarea,
+.ffz-dark select,
+.ffz-dark option,
.ffz-dark .directory_header #custom_filter input {
background-color: rgba(255,255,255,0.05);
border-color: rgba(255,255,255,0.1);
color: #fff;
}
+.ffz-dark option {
+ background-color: #191919;
+}
+
/* Other stuff */
diff --git a/image-proxy.html b/image-proxy.html
new file mode 100644
index 00000000..a0af78c8
--- /dev/null
+++ b/image-proxy.html
@@ -0,0 +1,38 @@
+
+
+
\ No newline at end of file
diff --git a/script.js b/script.js
index 254642d3..716aba50 100644
--- a/script.js
+++ b/script.js
@@ -368,7 +368,642 @@ FFZ.prototype._legacy_parse_badges = function(data, slot, badge_id) {
this.log('Added "' + title + '" badge to ' + utils.number_commas(count) + " users.");
}
-},{"./constants":3,"./utils":32}],2:[function(require,module,exports){
+},{"./constants":4,"./utils":33}],2:[function(require,module,exports){
+var FFZ = window.FrankerFaceZ,
+
+ hue2rgb = function(p, q, t) {
+ if ( t < 0 ) t += 1;
+ if ( t > 1 ) t -= 1;
+ if ( t < 1/6 )
+ return p + (q-p) * 6 * t;
+ if ( t < 1/2 )
+ return q;
+ if ( t < 2/3 )
+ return p + (q-p) * (2/3 - t) * 6;
+ return p;
+ };
+
+
+// ---------------------
+// Settings
+// ---------------------
+
+FFZ.settings_info.fix_color = {
+ type: "select",
+ options: {
+ '-1': "Disabled",
+ 0: "Default Colors",
+ 1: "Luv Adjustment",
+ 2: "HSL Adjustment (Depreciated)",
+ 3: "HSV Adjustment (Depreciated)",
+ 4: "RGB Adjustment (Depreciated)"
+ },
+ value: '1',
+
+ category: "Chat Appearance",
+ no_bttv: true,
+
+ name: "Username Colors - Brightness",
+ help: "Ensure that username colors contrast with the background enough to be readable.",
+
+ process_value: function(val) {
+ // Load legacy setting.
+ if ( val === false )
+ return '0';
+ else if ( val === true )
+ return '1';
+ return val;
+ },
+
+ on_update: function(val) {
+ document.body.classList.toggle("ffz-chat-colors", !this.has_bttv && val !== '-1');
+ document.body.classList.toggle("ffz-chat-colors-gray", !this.has_bttv && (val === '-1'));
+
+ if ( ! this.has_bttv && val !== '-1' )
+ this._rebuild_colors();
+ }
+ };
+
+
+FFZ.settings_info.color_blind = {
+ type: "select",
+ options: {
+ 0: "Disabled",
+ protanope: "Protanope",
+ deuteranope: "Deuteranope",
+ tritanope: "Tritanope"
+ },
+ value: '0',
+
+ category: "Chat Appearance",
+ no_bttv: true,
+
+ name: "Username Colors - Color Blindness",
+ help: "Adjust username colors in an attempt to make them more distinct for people with color blindness.",
+
+ on_update: function(val) {
+ if ( ! this.has_bttv && this.settings.fix_color !== '-1' )
+ this._rebuild_colors();
+ }
+ };
+
+
+// --------------------
+// Initialization
+// --------------------
+
+FFZ.prototype.setup_colors = function() {
+ this.log("Preparing color-alteration style element.");
+
+ this._colors = {};
+
+ var s = this._color_style = document.createElement('style');
+ s.id = 'ffz-style-username-colors';
+ s.type = 'text/css';
+ document.head.appendChild(s);
+}
+
+
+// -----------------------
+// Color Handling Classes
+// -----------------------
+
+FFZ.Color = {};
+
+FFZ.Color.CVDMatrix = {
+ protanope: [ // reds are greatly reduced (1% men)
+ 0.0, 2.02344, -2.52581,
+ 0.0, 1.0, 0.0,
+ 0.0, 0.0, 1.0
+ ],
+ deuteranope: [ // greens are greatly reduced (1% men)
+ 1.0, 0.0, 0.0,
+ 0.494207, 0.0, 1.24827,
+ 0.0, 0.0, 1.0
+ ],
+ tritanope: [ // blues are greatly reduced (0.003% population)
+ 1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+ -0.395913, 0.801109, 0.0
+ ]
+}
+
+
+var RGBColor = FFZ.Color.RGB = function(r, g, b) {
+ this.r = r||0; this.g = g||0; this.b = b||0;
+};
+
+var HSVColor = FFZ.Color.HSV = function(h, s, v) {
+ this.h = h||0; this.s = s||0; this.v = v||0;
+};
+
+var HSLColor = FFZ.Color.HSL = function(h, s, l) {
+ this.h = h||0; this.s = s||0; this.l = l||0;
+};
+
+var XYZColor = FFZ.Color.XYZ = function(x, y, z) {
+ this.x = x||0; this.y = y||0; this.z = z||0;
+};
+
+var LUVColor = FFZ.Color.LUV = function(l, u, v) {
+ this.l = l||0; this.u = u||0; this.v = v||0;
+};
+
+
+// RGB Colors
+
+RGBColor.prototype.eq = function(rgb) {
+ return rgb.r === this.r && rgb.g === this.g && rgb.b === this.b;
+}
+
+RGBColor.fromHex = function(code) {
+ var raw = parseInt(code.charAt(0) === '#' ? code.substr(1) : code, 16);
+ return new RGBColor(
+ (raw >> 16), // Red
+ (raw >> 8 & 0x00FF), // Green
+ (raw & 0x0000FF) // Blue
+ )
+}
+
+RGBColor.fromHSV = function(h, s, v) {
+ var r, g, b,
+
+ i = Math.floor(h * 6),
+ f = h * 6 - i,
+ p = v * (1 - s),
+ q = v * (1 - f * s),
+ t = v * (1 - (1 - f) * s);
+
+ switch(i % 6) {
+ case 0: r = v, g = t, b = p; break;
+ case 1: r = q, g = v, b = p; break;
+ case 2: r = p, g = v, b = t; break;
+ case 3: r = p, g = q, b = v; break;
+ case 4: r = t, g = p, b = v; break;
+ case 5: r = v, g = p, b = q;
+ }
+
+ return new RGBColor(
+ 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))
+ );
+}
+
+RGBColor.fromXYZ = function(x, y, z) {
+ var R = 3.240479 * x - 1.537150 * y - 0.498535 * z,
+ G = -0.969256 * x + 1.875992 * y + 0.041556 * z,
+ B = 0.055648 * x - 0.204043 * y + 1.057311 * z;
+
+ // Make sure we end up in a real color space
+ return new RGBColor(
+ Math.max(0, Math.min(255, 255 * XYZColor.channelConverter(R))),
+ Math.max(0, Math.min(255, 255 * XYZColor.channelConverter(G))),
+ Math.max(0, Math.min(255, 255 * XYZColor.channelConverter(B)))
+ );
+}
+
+RGBColor.fromHSL = function(h, s, l) {
+ if ( s === 0 ) {
+ var v = Math.round(Math.min(Math.max(0, 255*l), 255));
+ return new RGBColor(v, v, v);
+ }
+
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s,
+ p = 2 * l - q;
+
+ return new RGBColor(
+ 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))
+ );
+}
+
+RGBColor.prototype.toHSV = function() { return HSVColor.fromRGB(this.r, this.g, this.b); }
+RGBColor.prototype.toHSL = function() { return HSLColor.fromRGB(this.r, this.g, this.b); }
+RGBColor.prototype.toCSS = function() { return "rgb(" + Math.round(this.r) + "," + Math.round(this.g) + "," + Math.round(this.b) + ")"; }
+RGBColor.prototype.toXYZ = function() { return XYZColor.fromRGB(this.r, this.g, this.b); }
+RGBColor.prototype.toLUV = function() { return this.toXYZ().toLUV(); }
+
+
+RGBColor.prototype.luminance = function() {
+ var rgb = [this.r / 255, this.g / 255, this.b / 255];
+ for (var i =0, l = rgb.length; i < l; i++) {
+ if (rgb[i] <= 0.03928) {
+ rgb[i] = rgb[i] / 12.92;
+ } else {
+ rgb[i] = Math.pow( ((rgb[i]+0.055)/1.055), 2.4 );
+ }
+ }
+ return (0.2126 * rgb[0]) + (0.7152 * rgb[1]) + (0.0722 * rgb[2]);
+}
+
+
+RGBColor.prototype.brighten = function(amount) {
+ amount = typeof amount === "number" ? amount : 1;
+ amount = Math.round(255 * (amount / 100));
+
+ return new RGBColor(
+ 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))
+ );
+}
+
+
+RGBColor.prototype.daltonize = function(type, amount) {
+ amount = typeof amount === "number" ? amount : 1.0;
+ var cvd;
+ if ( typeof type === "string" ) {
+ if ( FFZ.Color.CVDMatrix.hasOwnProperty(type) )
+ cvd = FFZ.Color.CVDMatrix[type];
+ else
+ throw "Invalid CVD matrix.";
+ } else
+ cvd = type;
+
+ var cvd_a = cvd[0], cvd_b = cvd[1], cvd_c = cvd[2],
+ cvd_d = cvd[3], cvd_e = cvd[4], cvd_f = cvd[5],
+ cvd_g = cvd[6], cvd_h = cvd[7], cvd_i = cvd[8],
+
+ L, M, S, l, m, s, R, G, B, RR, GG, BB;
+
+ // RGB to LMS matrix conversion
+ L = (17.8824 * this.r) + (43.5161 * this.g) + (4.11935 * this.b);
+ M = (3.45565 * this.r) + (27.1554 * this.g) + (3.86714 * this.b);
+ S = (0.0299566 * this.r) + (0.184309 * this.g) + (1.46709 * this.b);
+ // Simulate color blindness
+ l = (cvd_a * L) + (cvd_b * M) + (cvd_c * S);
+ m = (cvd_d * L) + (cvd_e * M) + (cvd_f * S);
+ s = (cvd_g * L) + (cvd_h * M) + (cvd_i * S);
+ // LMS to RGB matrix conversion
+ R = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s);
+ G = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s);
+ B = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s);
+ // Isolate invisible colors to color vision deficiency (calculate error matrix)
+ R = this.r - R;
+ G = this.g - G;
+ B = this.b - B;
+ // Shift colors towards visible spectrum (apply error modifications)
+ RR = (0.0 * R) + (0.0 * G) + (0.0 * B);
+ GG = (0.7 * R) + (1.0 * G) + (0.0 * B);
+ BB = (0.7 * R) + (0.0 * G) + (1.0 * B);
+ // Add compensation to original values
+ R = Math.min(Math.max(0, RR + this.r), 255);
+ G = Math.min(Math.max(0, GG + this.g), 255);
+ B = Math.min(Math.max(0, BB + this.b), 255);
+
+ return new RGBColor(R, G, B);
+}
+
+RGBColor.prototype._r = function(r) { return new RGBColor(r, this.g, this.b); }
+RGBColor.prototype._g = function(g) { return new RGBColor(this.r, g, this.b); }
+RGBColor.prototype._b = function(b) { return new RGBColor(this.r, this.g, b); }
+
+
+// HSL Colors
+
+HSLColor.prototype.eq = function(hsl) {
+ return hsl.h === this.h && hsl.s === this.s && hsl.l === this.l;
+}
+
+HSLColor.fromRGB = function(r, g, b) {
+ r /= 255; g /= 255; b /= 255;
+
+ var max = Math.max(r,g,b),
+ min = Math.min(r,g,b),
+
+ h, s, l = Math.min(Math.max(0, (max+min) / 2), 1),
+ d = Math.min(Math.max(0, max - min), 1);
+
+ if ( d === 0 )
+ h = s = 0;
+ else {
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ switch(max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ }
+ h /= 6;
+ }
+
+ return new HSLColor(h, s, l);
+}
+
+HSLColor.prototype.toRGB = function() { return RGBColor.fromHSL(this.h, this.s, this.l); }
+HSLColor.prototype.toCSS = function() { return "hsl(" + Math.round(this.h*360) + "," + Math.round(this.s*100) + "%," + Math.round(this.l*100) + "%)"; }
+HSLColor.prototype.toHSV = function() { return RGBColor.fromHSL(this.h, this.s, this.l).toHSV(); }
+HSLColor.prototype.toXYZ = function() { return RGBColor.fromHSL(this.h, this.s, this.l).toXYZ(); }
+HSLColor.prototype.toLUV = function() { return RGBColor.fromHSL(this.h, this.s, this.l).toLUV(); }
+
+
+HSLColor.prototype._h = function(h) { return new HSLColor(h, this.s, this.l); }
+HSLColor.prototype._s = function(s) { return new HSLColor(this.h, s, this.l); }
+HSLColor.prototype._l = function(l) { return new HSLColor(this.h, this.s, l); }
+
+
+// HSV Colors
+
+HSVColor.prototype.eq = function(hsv) { return hsv.h === this.h && hsv.s === this.s && hsv.v === this.v; }
+
+HSVColor.fromRGB = function(r, g, b) {
+ r /= 255; g /= 255; b /= 255;
+
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b),
+ d = Math.min(Math.max(0, max - min), 1),
+
+ h,
+ s = max === 0 ? 0 : d / max,
+ v = max;
+
+ if ( d === 0 )
+ h = 0;
+ else {
+ switch(max) {
+ case r:
+ h = (g - b) / d + (g < b ? 6 : 0);
+ break;
+ case g:
+ h = (b - r) / d + 2;
+ break;
+ case b:
+ h = (r - g) / d + 4;
+ }
+ h /= 6;
+ }
+
+ return new HSVColor(h, s, v);
+}
+
+
+HSVColor.prototype.toRGB = function() { return RGBColor.fromHSV(this.h, this.s, this.v); }
+HSVColor.prototype.toHSL = function() { return RGBColor.fromHSV(this.h, this.s, this.v).toHSL(); }
+HSVColor.prototype.toXYZ = function() { return RGBColor.fromHSV(this.h, this.s, this.v).toXYZ(); }
+HSVColor.prototype.toLUV = function() { return RGBColor.fromHSV(this.h, this.s, this.v).toLUV(); }
+
+
+HSVColor.prototype._h = function(h) { return new HSVColor(h, this.s, this.v); }
+HSVColor.prototype._s = function(s) { return new HSVColor(this.h, s, this.v); }
+HSVColor.prototype._v = function(v) { return new HSVColor(this.h, this.s, v); }
+
+
+// XYZ Colors
+
+RGBColor.channelConverter = function (channel) {
+ // http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html
+ // This converts rgb 8bit to rgb linear, lazy because the other algorithm is really really dumb
+ return Math.pow(channel, 2.2);
+
+ // CSS Colors Level 4 says 0.03928, Bruce Lindbloom who cared to write all algos says 0.04045, used bruce because whynawt
+ return (channel <= 0.04045) ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
+};
+
+XYZColor.channelConverter = function (channel) {
+ // Using lazy conversion in the other direction as well
+ return Math.pow(channel, 1/2.2);
+
+ // I'm honestly not sure about 0.0031308, I've only seen it referenced on Bruce Lindbloom's site
+ return (channel <= 0.0031308) ? channel * 12.92 : Math.pow(1.055 * channel, 1/2.4) - 0.055;
+};
+
+
+XYZColor.prototype.eq = function(xyz) { return xyz.x === this.x && xyz.y === this.y && xyz.z === this.z; }
+
+XYZColor.fromRGB = function(r, g, b) {
+ var R = RGBColor.channelConverter(r / 255),
+ G = RGBColor.channelConverter(g / 255),
+ B = RGBColor.channelConverter(b / 255);
+
+ return new XYZColor(
+ 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
+ );
+}
+
+XYZColor.fromLUV = function(l, u, v) {
+ var deltaGammaFactor = 1 / (XYZColor.WHITE.x + 15 * XYZColor.WHITE.y + 3 * XYZColor.WHITE.z);
+ var uDeltaGamma = 4 * XYZColor.WHITE.x * deltaGammaFactor;
+ var vDeltagamma = 9 * XYZColor.WHITE.y * deltaGammaFactor;
+
+ // XYZColor.EPSILON * XYZColor.KAPPA = 8
+ var Y = (l > 8) ? Math.pow((l + 16) / 116, 3) : l / XYZColor.KAPPA;
+
+ var a = 1/3 * (((52 * l) / (u + 13 * l * uDeltaGamma)) - 1);
+ var b = -5 * Y;
+ var c = -1/3;
+ var d = Y * (((39 * l) / (v + 13 * l * vDeltagamma)) - 5);
+
+ var X = (d - b) / (a - c);
+ var Z = X * a + b;
+
+ return new XYZColor(X, Y, Z);
+}
+
+
+XYZColor.prototype.toRGB = function() { return RGBColor.fromXYZ(this.x, this.y, this.z); }
+XYZColor.prototype.toLUV = function() { return LUVColor.fromXYZ(this.x, this.y, this.z); }
+XYZColor.prototype.toHSL = function() { return RGBColor.fromXYZ(this.x, this.y, this.z).toHSL(); }
+XYZColor.prototype.toHSV = function() { return RGBColor.fromXYZ(this.x, this.y, this.z).toHSV(); }
+
+
+XYZColor.prototype._x = function(x) { return new XYZColor(x, this.y, this.z); }
+XYZColor.prototype._y = function(y) { return new XYZColor(this.x, y, this.z); }
+XYZColor.prototype._z = function(z) { return new XYZColor(this.x, this.y, z); }
+
+
+// LUV Colors
+
+XYZColor.EPSILON = Math.pow(6 / 29, 3);
+XYZColor.KAPPA = Math.pow(29 / 3, 3);
+XYZColor.WHITE = (new RGBColor(255, 255, 255)).toXYZ();
+
+
+LUVColor.prototype.eq = function(luv) { return luv.l === this.l && luv.u === this.u && luv.v === this.v; }
+
+LUVColor.fromXYZ = function(X, Y, Z) {
+ var deltaGammaFactor = 1 / (XYZColor.WHITE.x + 15 * XYZColor.WHITE.y + 3 * XYZColor.WHITE.z);
+ var uDeltaGamma = 4 * XYZColor.WHITE.x * deltaGammaFactor;
+ var vDeltagamma = 9 * XYZColor.WHITE.y * deltaGammaFactor;
+
+ var yGamma = Y / XYZColor.WHITE.y;
+ var deltaDivider = (X + 15 * Y + 3 * Z);
+
+ if (deltaDivider === 0) {
+ deltaDivider = 1;
+ }
+
+ var deltaFactor = 1 / deltaDivider;
+
+ var uDelta = 4 * X * deltaFactor;
+ var vDelta = 9 * Y * deltaFactor;
+
+ var L = (yGamma > XYZColor.EPSILON) ? 116 * Math.pow(yGamma, 1/3) - 16 : XYZColor.KAPPA * yGamma;
+ var u = 13 * L * (uDelta - uDeltaGamma);
+ var v = 13 * L * (vDelta - vDeltagamma);
+
+ return new LUVColor(L, u, v);
+}
+
+
+LUVColor.prototype.toXYZ = function() { return XYZColor.fromLUV(this.l, this.u, this.v); }
+LUVColor.prototype.toRGB = function() { return XYZColor.fromLUV(this.l, this.u, this.v).toRGB(); }
+LUVColor.prototype.toHSL = function() { return XYZColor.fromLUV(this.l, this.u, this.v).toHSL(); }
+LUVColor.prototype.toHSV = function() { return XYZColor.fromLUV(this.l, this.u, this.v).toHSV(); }
+
+
+LUVColor.prototype._l = function(l) { return new LUVColor(l, this.u, this.v); }
+LUVColor.prototype._u = function(u) { return new LUVColor(this.l, u, this.v); }
+LUVColor.prototype._v = function(v) { return new LUVColor(this.l, this.u, v); }
+
+
+// Required Colors
+
+var REQUIRED_CONTRAST = 4.5,
+
+ REQUIRED_BRIGHT = new XYZColor(0, (REQUIRED_CONTRAST * (new RGBColor(35,35,35).toXYZ().y + 0.05) - 0.05), 0).toLUV().l,
+ REQUIRED_DARK = new XYZColor(0, ((new RGBColor(217,217,217).toXYZ().y + 0.05) / REQUIRED_CONTRAST - 0.05), 0).toLUV().l;
+
+
+// --------------------
+// Rebuild Colors
+// --------------------
+
+FFZ.prototype._rebuild_colors = function() {
+ if ( ! this._color_style || this.has_bttv )
+ return;
+
+ this._color_style.innerHTML = '';
+ var colors = Object.keys(this._colors);
+ this._colors = {};
+ for(var i=0, l=colors.length; i 0.3 ) {
+ var s = 127, nc = rgb;
+ while(s--) {
+ nc = nc.brighten(-1);
+ if ( nc.luminance() <= 0.3 )
+ break;
+ }
+
+ matched = true;
+ light_color = nc.toCSS();
+ }
+
+ if ( lum < 0.15 ) {
+ var s = 127, nc = rgb;
+ while(s--) {
+ nc = nc.brighten();
+ if ( nc.luminance() >= 0.15 )
+ break;
+ }
+
+ matched = true;
+ dark_color = nc.toCSS();
+ }
+ }
+
+
+ // Color Processing - HSL
+ if ( this.settings.fix_color === '2' ) {
+ var hsl = rgb.toHSL();
+
+ matched = true;
+ light_color = hsl._l(Math.min(Math.max(0, 0.7 * hsl.l), 1)).toCSS();
+ dark_color = hsl._l(Math.min(Math.max(0, 0.3 + (0.7 * hsl.l)), 1)).toCSS();
+ }
+
+
+ // Color Processing - HSV
+ if ( this.settings.fix_color === '3' ) {
+ var hsv = rgb.toHSV();
+ matched = true;
+
+ if ( hsv.s === 0 ) {
+ // Black and White
+ light_color = hsv._v(Math.min(Math.max(0.5, 0.5 * hsv.v), 1)).toRGB().toCSS();
+ dark_color = hsv._v(Math.min(Math.max(0.5, 0.5 + (0.5 * hsv.v)), 1)).toRGB().toCSS();
+
+ } else {
+ light_color = RGBColor.fromHSV(hsv.h, Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.s)), 1), Math.min(0.7, hsv.v)).toCSS();
+ dark_color = RGBColor.fromHSV(hsv.h, Math.min(0.7, hsv.s), Math.min(Math.max(0.7, 0.7 + (0.3 * hsv.v)), 1)).toCSS();
+ }
+ }
+
+ // Color Processing - LUV
+ if ( this.settings.fix_color === '1' ) {
+ var luv = rgb.toLUV();
+
+ if ( luv.l > REQUIRED_DARK ) {
+ matched = true;
+ light_color = luv._l(REQUIRED_DARK).toRGB().toCSS();
+ }
+
+ if ( luv.l < REQUIRED_BRIGHT ) {
+ matched = true;
+ dark_color = luv._l(REQUIRED_BRIGHT).toRGB().toCSS();
+ }
+ }
+
+ // Output
+ if ( ! matched )
+ return;
+
+ var output = '';
+
+ if ( light_color !== clr )
+ output += 'body.ffz-chat-colors .chat-line ' + rule + ' { color: ' + light_color + ' !important; }';
+
+ if ( dark_color !== light_color ) {
+ output += 'body.ffz-chat-colors .theatre .chat-container .chat-line ' + rule +
+ ', body.ffz-chat-colors .ember-chat-container.dark .chat-line ' + rule +
+ ', body.ffz-chat-colors .ember-chat-container.force-dark .chat-line ' + rule +
+ ', body.ffz-chat-colors .chat-container.dark .chat-line ' + rule +
+ ', body.ffz-chat-colors .chat-container.force-dark .chat-line ' + rule + ' { color: ' + dark_color + ' !important; }';
+ }
+
+ this._color_style.innerHTML += output;
+}
+},{}],3:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
@@ -450,7 +1085,7 @@ FFZ.ffz_commands.massmod.help = "Usage: /ffz massmod \nBroadcas
}*/
-},{}],3:[function(require,module,exports){
+},{}],4:[function(require,module,exports){
var SVGPATH = '',
DEBUG = localStorage.ffzDebugMode == "true" && document.body.classList.contains('ffz-dev'),
SERVER = DEBUG ? "//localhost:8000/" : "//cdn.frankerfacez.com/";
@@ -520,7 +1155,7 @@ module.exports = {
STAR: '',
CLOSE: ''
}
-},{}],4:[function(require,module,exports){
+},{}],5:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
@@ -560,7 +1195,7 @@ FFZ.ffz_commands.developer_mode = function(room, args) {
FFZ.ffz_commands.developer_mode.help = "Usage: /ffz developer_mode \nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN.";
-},{}],5:[function(require,module,exports){
+},{}],6:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require('../utils'),
constants = require('../constants');
@@ -1027,6 +1662,7 @@ FFZ.prototype._modify_cindex = function(view) {
FFZ.settings_info.chatter_count = {
type: "boolean",
value: false,
+ no_mobile: true,
category: "Channel Metadata",
@@ -1050,6 +1686,7 @@ FFZ.settings_info.chatter_count = {
FFZ.settings_info.channel_views = {
type: "boolean",
value: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Channel Views",
@@ -1063,6 +1700,7 @@ FFZ.settings_info.channel_views = {
FFZ.settings_info.hosted_channels = {
type: "boolean",
value: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Channel Hosting",
@@ -1089,6 +1727,7 @@ FFZ.settings_info.hosted_channels = {
FFZ.settings_info.stream_host_button = {
type: "boolean",
value: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Host This Channel Button",
@@ -1103,6 +1742,7 @@ FFZ.settings_info.stream_host_button = {
FFZ.settings_info.stream_uptime = {
type: "boolean",
value: false,
+ no_mobile: true,
category: "Channel Metadata",
name: "Stream Uptime",
@@ -1118,6 +1758,7 @@ FFZ.settings_info.stream_title = {
type: "boolean",
value: true,
no_bttv: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Title Links",
@@ -1127,7 +1768,7 @@ FFZ.settings_info.stream_title = {
this._cindex.ffzFixTitle();
}
};
-},{"../constants":3,"../utils":32}],6:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],7:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require("../utils"),
constants = require("../constants"),
@@ -1472,7 +2113,7 @@ FFZ.prototype._modify_chat_input = function(component) {
}.property("ffz_emoticons", "ffz_chatters", "isSuggestionsTriggeredWithTab")*/
});
}
-},{"../constants":3,"../utils":32}],7:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],8:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require('../utils'),
constants = require('../constants');
@@ -1488,6 +2129,7 @@ FFZ.settings_info.swap_sidebars = {
value: false,
category: "Appearance",
+ no_mobile: true,
no_bttv: true,
name: "Swap Sidebar Positions",
@@ -1505,6 +2147,7 @@ FFZ.settings_info.minimal_chat = {
value: false,
category: "Chat Appearance",
+
name: "Minimalistic Chat",
help: "Hide all of the chat user interface, only showing messages and an input box.",
@@ -2370,7 +3013,7 @@ FFZ.chat_commands.part = function(room, args) {
else
return "You are not in " + room_id + ".";
}
-},{"../constants":3,"../utils":32}],8:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],9:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require("../utils"),
constants = require("../constants"),
@@ -2378,15 +3021,6 @@ var FFZ = window.FrankerFaceZ,
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 + "*"),
- quote_attr = function(attr) {
- return (attr + '')
- .replace(/&/g, "&")
- .replace(/'/g, "'")
- .replace(/"/g, """)
- .replace(//g, ">");
- },
-
TWITCH_BASE = "http://static-cdn.jtvnw.net/emoticons/v1/",
SRCSETS = {};
@@ -2396,6 +3030,36 @@ var FFZ = window.FrankerFaceZ,
var out = SRCSETS[id] = TWITCH_BASE + id + "/1.0 1x, " + TWITCH_BASE + id + "/2.0 2x, " + TWITCH_BASE + id + "/3.0 4x";
return out;
},
+
+
+ LINK_SPLIT = /^(?:(https?):\/\/)?(?:(.*?)@)?([^\/:]+)(?::(\d+))?(.*?)(?:\?(.*?))?(?:\#(.*?))?$/,
+ YOUTUBE_CHECK = /^(?:https?:\/\/)?(?:m\.|www\.)?youtu(?:be\.com|\.be)\/(?:v\/|watch\/|.*?(?:embed|watch).*?v=)?([a-zA-Z0-9\-_]+)$/,
+ IMGUR_PATH = /^\/(?:gallery\/)?[A-Za-z0-9]+(?:\.(?:png|jpg|jpeg|gif|gifv|bmp))?$/,
+ IMAGE_EXT = /\.(?:png|jpg|jpeg|gif|bmp)$/i,
+ IMAGE_DOMAINS = [],
+
+ is_image = function(href, any_domain) {
+ var match = href.match(LINK_SPLIT);
+ if ( ! match )
+ return;
+
+ var domain = match[3].toLowerCase(), port = match[4],
+ path = match[5];
+
+ // Don't allow non-standard ports.
+ if ( port && port !== '80' && port !== '443' )
+ return false;
+
+ // imgur-specific checks.
+ if ( domain === 'i.imgur.com' || domain === 'imgur.com' || domain === 'www.imgur.com' || domain === 'm.imgur.com' )
+ return IMGUR_PATH.test(path);
+
+ return any_domain ? IMAGE_EXT.test(path) : IMAGE_DOMAINS.indexOf(domain) !== -1;
+ }
+
+ image_iframe = function(href, extra_class) {
+ return '';
+ },
data_to_tooltip = function(data) {
@@ -2459,7 +3123,8 @@ var FFZ = window.FrankerFaceZ,
return link_data.tooltip;
if ( link_data.type == "youtube" ) {
- tooltip = "YouTube: " + utils.sanitize(link_data.title) + "";
+ tooltip = this.settings.link_image_hover ? image_iframe(link_data.full || href, 'ffz-yt-thumb') : '';
+ tooltip += "YouTube: " + utils.sanitize(link_data.title) + "";
tooltip += "Channel: " + utils.sanitize(link_data.channel) + " | " + utils.time_to_string(link_data.duration) + " ";
tooltip += utils.number_commas(link_data.views||0) + " Views | 👍 " + utils.number_commas(link_data.likes||0) + " 👎 " + utils.number_commas(link_data.dislikes||0);
@@ -2499,7 +3164,8 @@ var FFZ = window.FrankerFaceZ,
} else if ( link_data.type == "reputation" ) {
- tooltip = '' + utils.sanitize(link_data.full.toLowerCase()) + '';
+ tooltip = (this.settings.link_image_hover && is_image(link_data.full || href, this.settings.image_hover_all_domains)) ? image_iframe(link_data.full || href) : '';
+ tooltip += '' + utils.sanitize(link_data.full.toLowerCase()) + '';
if ( link_data.trust < 50 || link_data.safety < 50 || (link_data.tags && link_data.tags.length > 0) ) {
tooltip += "";
var had_extra = false;
@@ -2517,8 +3183,10 @@ var FFZ = window.FrankerFaceZ,
}
- } else if ( link_data.full )
- tooltip = '' + utils.sanitize(link_data.full.toLowerCase()) + '';
+ } else if ( link_data.full ) {
+ tooltip = (this.settings.link_image_hover && is_image(link_data.full || href, this.settings.image_hover_all_domains)) ? image_iframe(link_data.full || href) : '';
+ tooltip += '' + utils.sanitize(link_data.full.toLowerCase()) + '';
+ }
if ( ! tooltip )
tooltip = '' + utils.sanitize(href.toLowerCase()) + '';
@@ -2734,32 +3402,44 @@ FFZ.settings_info.keywords = {
};
-FFZ.settings_info.fix_color = {
- type: "boolean",
- value: true,
-
- category: "Chat Appearance",
- no_bttv: true,
-
- name: "Adjust Username Colors",
- help: "Ensure that username colors contrast with the background enough to be readable.",
-
- on_update: function(val) { document.body.classList.toggle("ffz-chat-colors", !this.has_bttv && val); }
- };
-
-
FFZ.settings_info.link_info = {
type: "boolean",
value: true,
- category: "Chat Appearance",
+ category: "Chat Tooltips",
no_bttv: true,
- name: "Link Tooltips Beta",
+ name: "Link Information Beta",
help: "Check links against known bad websites, unshorten URLs, and show YouTube info."
};
+FFZ.settings_info.link_image_hover = {
+ type: "boolean",
+ value: false,
+
+ category: "Chat Tooltips",
+ no_bttv: true,
+ no_mobile: true,
+
+ name: "Image Preview",
+ help: "Display image thumbnails for links to Imgur and YouTube."
+ };
+
+
+FFZ.settings_info.image_hover_all_domains = {
+ type: "boolean",
+ value: false,
+
+ category: "Chat Tooltips",
+ no_bttv: true,
+ no_mobile: true,
+
+ name: "Image Preview - All Domains",
+ help: "Requires Image Preview. Attempt to show an image preview for any URL ending in the appropriate extension. Warning: This may be used to leak your IP address to malicious users."
+ };
+
+
FFZ.settings_info.legacy_badges = {
type: "boolean",
value: false,
@@ -2788,18 +3468,35 @@ FFZ.settings_info.chat_rows = {
FFZ.settings_info.chat_separators = {
- type: "boolean",
- value: false,
+ type: "select",
+ options: {
+ 0: "Disabled",
+ 1: "Basic Line (1px solid)",
+ 2: "3D Line (2px groove)"
+ },
+ value: '0',
category: "Chat Appearance",
no_bttv: true,
+
+ process_value: function(val) {
+ if ( val === false )
+ return '0';
+ else if ( val === true )
+ return '1';
+ return val;
+ },
name: "Chat Line Separators",
help: "Display thin lines between chat messages for further visual separation.",
- on_update: function(val) { document.body.classList.toggle("ffz-chat-separator", !this.has_bttv && val); }
+ on_update: function(val) {
+ document.body.classList.toggle("ffz-chat-separator", !this.has_bttv && val !== '0');
+ document.body.classList.toggle("ffz-chat-separator-3d", !this.has_bttv && val === '2');
+ }
};
+
FFZ.settings_info.chat_padding = {
type: "boolean",
value: false,
@@ -2868,6 +3565,52 @@ FFZ.settings_info.chat_font_size = {
}
utils.update_css(this._chat_style, "chat_font_size", css);
+ FFZ.settings_info.chat_ts_size.on_update.bind(this)(this.settings.chat_ts_size);
+ }
+ };
+
+
+FFZ.settings_info.chat_ts_size = {
+ type: "button",
+ value: null,
+
+ category: "Chat Appearance",
+ no_bttv: true,
+
+ name: "Timestamp Font Size",
+ help: "Make the chat timestamp font bigger or smaller.",
+
+ method: function() {
+ var old_val = this.settings.chat_ts_size;
+
+ if ( old_val === null )
+ old_val = this.settings.chat_font_size;
+
+ var new_val = prompt("Chat Timestamp Font Size\n\nPlease enter a new size for the chat timestamp font. The default is to match the regular chat font size.", old_val);
+
+ if ( new_val === null || new_val === undefined )
+ return;
+
+ var parsed = parseInt(new_val);
+ if ( parsed === NaN || parsed < 1 )
+ parsed = null;
+
+ this.settings.set("chat_ts_size", parsed);
+ },
+
+ on_update: function(val) {
+ if ( this.has_bttv || ! this._chat_style )
+ return;
+
+ var css;
+ if ( val === null )
+ css = "";
+ else {
+ var lh = Math.max(20, Math.round((20/12)*val), Math.round((20/12)*this.settings.chat_font_size));
+ css = ".ember-chat .chat-messages .timestamp { font-size: " + val + "px !important; line-height: " + lh + "px !important; }";
+ }
+
+ utils.update_css(this._chat_style, "chat_ts_font_size", css);
}
};
@@ -2891,26 +3634,22 @@ FFZ.prototype.setup_line = function() {
// Initial calculation.
FFZ.settings_info.chat_font_size.on_update.bind(this)(this.settings.chat_font_size);
-
+
// Chat Enhancements
- document.body.classList.toggle("ffz-chat-colors", !this.has_bttv && this.settings.fix_color);
+ document.body.classList.toggle("ffz-chat-colors", !this.has_bttv && this.settings.fix_color !== '-1');
+ document.body.classList.toggle("ffz-chat-colors-gray", !this.has_bttv && this.settings.fix_color === '-1');
+
document.body.classList.toggle("ffz-legacy-badges", this.settings.legacy_badges);
document.body.classList.toggle('ffz-chat-background', !this.has_bttv && this.settings.chat_rows);
- document.body.classList.toggle("ffz-chat-separator", !this.has_bttv && this.settings.chat_separators);
+ document.body.classList.toggle("ffz-chat-separator", !this.has_bttv && this.settings.chat_separators !== '0');
+ document.body.classList.toggle("ffz-chat-separator-3d", !this.has_bttv && this.settings.chat_separators === '2');
document.body.classList.toggle("ffz-chat-padding", !this.has_bttv && this.settings.chat_padding);
document.body.classList.toggle("ffz-chat-purge-icon", !this.has_bttv && this.settings.line_purge_icon);
document.body.classList.toggle("ffz-high-contrast-chat", !this.has_bttv && this.settings.high_contrast_chat);
- this._colors = {};
this._last_row = {};
- s = this._fix_color_style = document.createElement('style');
- s.id = "ffz-style-username-colors";
- s.type = 'text/css';
- document.head.appendChild(s);
-
-
// Emoticon Data
this._twitch_emotes = {};
this._link_data = {};
@@ -3030,13 +3769,8 @@ FFZ.prototype._modify_line = function(component) {
var el = this.get('element'),
user = this.get('msgObject.from'),
room = this.get('msgObject.room') || App.__container__.lookup('controller:chat').get('currentRoom.id'),
- color = this.get('msgObject.color'),
row_type = this.get('msgObject.ffz_alternate');
- // Color Processing
- if ( color )
- f._handle_color(color);
-
// Row Alternation
if ( row_type === undefined ) {
row_type = f._last_row[room] = f._last_row.hasOwnProperty(room) ? !f._last_row[room] : false;
@@ -3106,7 +3840,7 @@ FFZ.prototype._modify_line = function(component) {
// Link Tooltips
- if ( f.settings.link_info ) {
+ if ( f.settings.link_info || f.settings.link_image_hover ) {
var links = el.querySelectorAll("span.message a");
for(var i=0; i < links.length; i++) {
var link = links[i],
@@ -3119,18 +3853,26 @@ FFZ.prototype._modify_line = function(component) {
}
// Check the cache.
- var link_data = f._link_data[href];
- if ( link_data ) {
- if ( !deleted && typeof link_data != "boolean" )
- link.title = link_data.tooltip;
-
- if ( link_data.unsafe )
- link.classList.add('unsafe-link');
-
- } else if ( ! /^mailto:/.test(href) ) {
- f._link_data[href] = true;
- f.ws_send("get_link", href, load_link_data.bind(f, href));
+ if ( f.settings.link_info ) {
+ var link_data = f._link_data[href];
+ if ( link_data ) {
+ if ( !deleted && typeof link_data != "boolean" )
+ link.title = link_data.tooltip;
+
+ if ( link_data.unsafe )
+ link.classList.add('unsafe-link');
+
+ } else if ( ! /^mailto:/.test(href) ) {
+ f._link_data[href] = true;
+ f.ws_send("get_link", href, load_link_data.bind(f, href));
+ if ( ! deleted && f.settings.link_image_hover && is_image(href, f.settings.image_hover_all_domains) )
+ link.title = image_iframe(href);
+ }
}
+
+ // Now, Images
+ else if ( ! deleted && f.settings.link_image_hover && is_image(href, f.settings.image_hover_all_domains) )
+ link.title = image_iframe(href);
}
jQuery(links).tipsy({html:true});
@@ -3207,68 +3949,6 @@ FFZ.prototype._modify_line = function(component) {
}
-// ---------------------
-// Fix Name Colors
-// ---------------------
-
-FFZ.prototype._handle_color = function(color) {
- if ( ! color || this._colors[color] )
- return;
-
- this._colors[color] = true;
-
- // Parse the color.
- var raw = parseInt(color.substr(1), 16),
- rgb = [
- (raw >> 16),
- (raw >> 8 & 0x00FF),
- (raw & 0x0000FF)
- ],
-
- lum = utils.get_luminance(rgb),
-
- output = "",
- rule = 'span[style="color:' + color + '"]',
- matched = false;
-
- if ( lum > 0.3 ) {
- // Color Too Bright. We need a lum of 0.3 or less.
- matched = true;
-
- var s = 127,
- nc = rgb;
- while(s--) {
- nc = utils.darken(nc);
- if ( utils.get_luminance(nc) <= 0.3 )
- break;
- }
-
- output += '.ffz-chat-colors .ember-chat-container:not(.dark) .chat-line ' + rule + ', .ffz-chat-colors .chat-container:not(.dark) .chat-line ' + rule + ' { color: ' + utils.rgb_to_css(nc) + ' !important; }\n';
- } else
- output += '.ffz-chat-colors .ember-chat-container:not(.dark) .chat-line ' + rule + ', .ffz-chat-colors .chat-container:not(.dark) .chat-line ' + rule + ' { color: ' + color + ' !important; }\n';
-
- if ( lum < 0.15 ) {
- // Color Too Dark. We need a lum of 0.1 or more.
- matched = true;
-
- var s = 127,
- nc = rgb;
- while(s--) {
- nc = utils.brighten(nc);
- if ( utils.get_luminance(nc) >= 0.15 )
- break;
- }
-
- output += '.ffz-chat-colors .theatre .chat-container .chat-line ' + rule + ', .ffz-chat-colors .chat-container.dark .chat-line ' + rule + ', .ffz-chat-colors .ember-chat-container.dark .chat-line ' + rule + ' { color: ' + utils.rgb_to_css(nc) + ' !important; }\n';
- } else
- output += '.ffz-chat-colors .theatre .chat-container .chat-line ' + rule + ', .ffz-chat-colors .chat-container.dark .chat-line ' + rule + ', .ffz-chat-colors .ember-chat-container.dark .chat-line ' + rule + ' { color: ' + color + ' !important; }\n';
-
-
- if ( matched )
- this._fix_color_style.innerHTML += output;
-}
-
-
// ---------------------
// Capitalization
// ---------------------
@@ -3326,7 +4006,7 @@ FFZ.prototype._remove_banned = function(tokens) {
new_tokens.push(token.altText.replace(regex, "$1***"));
else if ( token.isLink && regex.test(token.href) )
new_tokens.push({
- mentionedUser: '<banned link>',
+ mentionedUser: '<banned link>',
own: true
});
else
@@ -3350,7 +4030,7 @@ FFZ.prototype._emoticonize = function(component, tokens) {
return this.tokenize_emotes(user_id, room_id, tokens);
}
-},{"../constants":3,"../utils":32}],9:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],10:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require("../utils"),
constants = require("../constants"),
@@ -3451,7 +4131,7 @@ FFZ.settings_info.mod_card_hotkeys = {
FFZ.settings_info.mod_card_info = {
type: "boolean",
- value: false,
+ value: true,
no_bttv: true,
category: "Chat Moderation",
@@ -4023,7 +4703,7 @@ FFZ.chat_commands.u = function(room, args) {
}
FFZ.chat_commands.u.enabled = function() { return this.settings.short_commands; }
-},{"../constants":3,"../utils":32}],10:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],11:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
CSS = /\.([\w\-_]+)\s*?\{content:\s*?"([^"]+)";\s*?background-image:\s*?url\("([^"]+)"\);\s*?height:\s*?(\d+)px;\s*?width:\s*?(\d+)px;\s*?margin:([^;}]+);?([^}]*)\}/mg,
MOD_CSS = /[^\n}]*\.badges\s+\.moderator\s*{\s*background-image:\s*url\(\s*['"]([^'"]+)['"][^}]+(?:}|$)/,
@@ -4031,6 +4711,9 @@ var FFZ = window.FrankerFaceZ,
constants = require('../constants'),
utils = require('../utils'),
+ // StrimBagZ Support
+ is_android = navigator.userAgent.indexOf('Android') !== -1,
+
moderator_css = function(room) {
if ( ! room.moderator_badge )
@@ -4156,6 +4839,15 @@ FFZ.prototype._modify_rview = function(view) {
this.ffz_frozen = false;
+ // Fix scrolling.
+ this._ffz_mouse_down = this.ffzMouseDown.bind(this);
+ if ( is_android )
+ // We don't unbind scroll because that messes with the scrollbar. ;_;
+ this._$chatMessagesScroller.bind('scroll', this._ffz_mouse_down);
+
+ this._$chatMessagesScroller.unbind('mousedown');
+ this._$chatMessagesScroller.bind('mousedown', this._ffz_mouse_down);
+
if ( f.settings.chat_hover_pause )
this.ffzEnableFreeze();
@@ -4283,12 +4975,9 @@ FFZ.prototype._modify_rview = function(view) {
this._ffz_mouse_move = this.ffzMouseMove.bind(this);
this._ffz_mouse_out = this.ffzMouseOut.bind(this);
- this._ffz_mouse_down = this.ffzMouseDown.bind(this);
-
- this._$chatMessagesScroller.unbind('mousedown');
- this._$chatMessagesScroller.bind('mousedown', this._ffz_mouse_down);
messages.addEventListener('mousemove', this._ffz_mouse_move);
+ messages.addEventListener('touchmove', this._ffz_mouse_move);
messages.addEventListener('mouseout', this._ffz_mouse_out);
document.addEventListener('mouseout', this._ffz_mouse_out);
},
@@ -4337,7 +5026,7 @@ FFZ.prototype._modify_rview = function(view) {
ffzMouseDown: function(event) {
var t = this._$chatMessagesScroller;
- if ( ! this.ffz_frozen && t && t[0] && (event.which > 0 || "mousedown" === event.type || "mousewheel" === event.type) ) {
+ if ( t && t[0] && (event.which > 0 || (!this.ffz_frozne && "mousedown" === event.type) || "mousewheel" === event.type || (is_android && "scroll" === event.type) ) ) {
var r = t[0].scrollHeight - t[0].scrollTop - t[0].offsetHeight;
this._setStuckToBottom(10 >= r);
}
@@ -4965,6 +5654,7 @@ FFZ.prototype._modify_room = function(room) {
if ( ! is_whisper )
msg.room = this.get('id');
+ // Tokenization
f.tokenize_chat_line(msg);
// Keep the history.
@@ -5000,11 +5690,17 @@ FFZ.prototype._modify_room = function(room) {
}
}
}
- } catch(err) {
- f.error("Room addMessage: " + err);
- }
+ } catch(err) { f.error("Room addMessage: " + err); }
- return this._super(msg);
+ var out = this._super(msg);
+
+ try {
+ // Color processing.
+ var color = msg.color;
+ if ( color )
+ f._handle_color(color);
+ } catch(err) { f.error("Room addMessage2: " + err); }
+ return out;
},
setHostMode: function(e) {
@@ -5256,7 +5952,7 @@ FFZ.prototype._modify_room = function(room) {
}.observes('tmiRoom')
});
}
-},{"../constants":3,"../utils":32}],11:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],12:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
@@ -5354,7 +6050,7 @@ FFZ.prototype._modify_viewers = function(controller) {
}.property("content.chatters")
});
}
-},{}],12:[function(require,module,exports){
+},{}],13:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
CSS = /\.([\w\-_]+)\s*?\{content:\s*?"([^"]+)";\s*?background-image:\s*?url\("([^"]+)"\);\s*?height:\s*?(\d+)px;\s*?width:\s*?(\d+)px;\s*?margin:([^;}]+);?([^}]*)\}/mg,
MOD_CSS = /[^\n}]*\.badges\s+\.moderator\s*{\s*background-image:\s*url\(\s*['"]([^'"]+)['"][^}]+(?:}|$)/,
@@ -5746,7 +6442,7 @@ FFZ.prototype._load_set_json = function(set_id, callback, data) {
if ( callback )
callback(true, data);
}
-},{"./constants":3,"./utils":32}],13:[function(require,module,exports){
+},{"./constants":4,"./utils":33}],14:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants'),
utils = require('../utils'),
@@ -5805,9 +6501,11 @@ FFZ.prototype.setup_bttv = function(delay) {
// Disable other features too.
document.body.classList.remove("ffz-chat-colors");
+ document.body.classList.remove("ffz-chat-colors-gray");
document.body.classList.remove("ffz-chat-background");
document.body.classList.remove("ffz-chat-padding");
document.body.classList.remove("ffz-chat-separator");
+ document.body.classList.remove("ffz-chat-separator-3d");
document.body.classList.remove("ffz-sidebar-swap");
document.body.classList.remove("ffz-transparent-badges");
document.body.classList.remove("ffz-high-contrast-chat");
@@ -6028,7 +6726,7 @@ FFZ.prototype.setup_bttv = function(delay) {
this.update_ui_link();
}
-},{"../constants":3,"../utils":32}],14:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],15:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
@@ -6104,7 +6802,7 @@ FFZ.prototype._emote_menu_enumerator = function() {
return emotes;
}
-},{}],15:[function(require,module,exports){
+},{}],16:[function(require,module,exports){
// Modify Array and others.
// require('./shims');
@@ -6128,7 +6826,7 @@ FFZ.get = function() { return FFZ.instance; }
// Version
var VER = FFZ.version_info = {
- major: 3, minor: 4, revision: 19,
+ major: 3, minor: 4, revision: 25,
toString: function() {
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
}
@@ -6214,7 +6912,7 @@ require('./ui/menu');
require('./settings');
require('./socket');
-
+require('./colors');
require('./emoticons');
require('./badges');
require('./tokenize');
@@ -6318,6 +7016,7 @@ FFZ.prototype.setup_normal = function(delay, no_socket) {
if ( ! no_socket )
this.ws_create();
+ this.setup_colors();
this.setup_emoticons();
this.setup_badges();
@@ -6352,9 +7051,11 @@ FFZ.prototype.setup_dashboard = function(delay) {
this.setup_dark();
this.ws_create();
+ this.setup_colors();
this.setup_emoticons();
this.setup_badges();
+ this.setup_tokenization();
this.setup_notifications();
this.setup_css();
@@ -6395,6 +7096,8 @@ FFZ.prototype.setup_ember = function(delay) {
//this.setup_piwik();
//this.setup_router();
+ this.setup_colors();
+ this.setup_tokenization();
this.setup_channel();
this.setup_room();
this.setup_line();
@@ -6443,7 +7146,7 @@ FFZ.prototype._on_window_message = function(e) {
var msg = e.data;
}
-},{"./badges":1,"./commands":2,"./debug":4,"./ember/channel":5,"./ember/chat-input":6,"./ember/chatview":7,"./ember/line":8,"./ember/moderation-card":9,"./ember/room":10,"./ember/viewers":11,"./emoticons":12,"./ext/betterttv":13,"./ext/emote_menu":14,"./featurefriday":16,"./settings":17,"./socket":18,"./tokenize":19,"./ui/about_page":20,"./ui/dark":21,"./ui/following":23,"./ui/following-count":22,"./ui/menu":24,"./ui/menu_button":25,"./ui/my_emotes":26,"./ui/notifications":27,"./ui/races":28,"./ui/styles":29,"./ui/sub_count":30,"./ui/viewer_count":31}],16:[function(require,module,exports){
+},{"./badges":1,"./colors":2,"./commands":3,"./debug":5,"./ember/channel":6,"./ember/chat-input":7,"./ember/chatview":8,"./ember/line":9,"./ember/moderation-card":10,"./ember/room":11,"./ember/viewers":12,"./emoticons":13,"./ext/betterttv":14,"./ext/emote_menu":15,"./featurefriday":17,"./settings":18,"./socket":19,"./tokenize":20,"./ui/about_page":21,"./ui/dark":22,"./ui/following":24,"./ui/following-count":23,"./ui/menu":25,"./ui/menu_button":26,"./ui/my_emotes":27,"./ui/notifications":28,"./ui/races":29,"./ui/styles":30,"./ui/sub_count":31,"./ui/viewer_count":32}],17:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('./constants');
@@ -6582,7 +7285,7 @@ FFZ.prototype._update_ff_name = function(name) {
if ( this.feature_friday )
this.feature_friday.display_name = name;
}
-},{"./constants":3}],17:[function(require,module,exports){
+},{"./constants":4}],18:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require("./constants");
@@ -6595,6 +7298,10 @@ var FFZ = window.FrankerFaceZ,
var val = ! this.settings.get(key);
this.settings.set(key, val);
swit.classList.toggle('active', val);
+ },
+
+ option_setting = function(select, key) {
+ this.settings.set(key, JSON.parse(select.options[select.selectedIndex].value));
};
@@ -6626,6 +7333,9 @@ FFZ.prototype.load_settings = function() {
}
}
+ if ( info.process_value )
+ val = info.process_value.bind(this)(val);
+
this.settings[key] = val;
}
@@ -6646,7 +7356,9 @@ FFZ.prototype.load_settings = function() {
FFZ.menu_pages.settings = {
render: function(view, container) {
var settings = {},
- categories = [];
+ categories = [],
+ is_android = navigator.userAgent.indexOf('Android') !== -1;
+
for(var key in FFZ.settings_info) {
if ( ! FFZ.settings_info.hasOwnProperty(key) )
continue;
@@ -6663,6 +7375,9 @@ FFZ.menu_pages.settings = {
if ( ! visible )
continue;
}
+
+ if ( is_android && info.no_mobile )
+ continue;
if ( ! cs ) {
categories.push(cat);
@@ -6724,8 +7439,8 @@ FFZ.menu_pages.settings = {
var a = a[1],
b = b[1],
- at = a.type,
- bt = b.type,
+ at = a.type === "button" ? 2 : 1,
+ bt = b.type === "button" ? 2 : 1,
an = a.name.toLowerCase(),
bn = b.name.toLowerCase();
@@ -6778,6 +7493,27 @@ FFZ.menu_pages.settings = {
swit.addEventListener("click", toggle_setting.bind(this, swit, key));
+ } else if ( info.type === "select" ) {
+ var select = document.createElement('select'),
+ label = document.createElement('span');
+
+ label.className = 'option-label';
+ label.innerHTML = info.name;
+
+ for(var ok in info.options) {
+ var op = document.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));
+
+ el.appendChild(label);
+ el.appendChild(select);
+
} else {
el.classList.add("option");
var link = document.createElement('a');
@@ -6910,7 +7646,7 @@ FFZ.prototype._setting_del = function(key) {
this.log('Error running updater for setting "' + key + '": ' + err);
}
}
-},{"./constants":3}],18:[function(require,module,exports){
+},{"./constants":4}],19:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
FFZ.prototype._ws_open = false;
@@ -7161,7 +7897,7 @@ FFZ.ws_commands.do_authorize = function(data) {
// Try again shortly.
setTimeout(FFZ.ws_commands.do_authorize.bind(this, data), 5000);
}
-},{}],19:[function(require,module,exports){
+},{}],20:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require("./utils"),
constants = require("./constants"),
@@ -7172,15 +7908,12 @@ var FFZ = window.FrankerFaceZ,
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
+ LINK = /(?:https?:\/\/)?(?:[-a-zA-Z0-9@:%_\+~#=]+\.)+[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#!?&//=]*)/g,
+
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 + "*");
-try {
- helpers = window.require && window.require("ember-twitch-chat/helpers/chat-line-helpers");
-} catch(err) { }
-
-
FFZ.SRC_IDS = {},
FFZ.src_to_id = function(src) {
if ( FFZ.SRC_IDS.hasOwnProperty(src) )
@@ -7198,7 +7931,7 @@ FFZ.src_to_id = function(src) {
// ---------------------
-// Time Format
+// Settings
// ---------------------
var ts = new Date(0).toLocaleTimeString().toUpperCase();
@@ -7215,20 +7948,73 @@ FFZ.settings_info.twenty_four_timestamps = {
};
-if ( helpers )
+FFZ.settings_info.show_deleted_links = {
+ type: "boolean",
+ value: false,
+
+ category: "Chat Moderation",
+ no_bttv: true,
+
+ name: "Show Deleted Links",
+ help: "Do not delete links based on room settings or link length."
+ };
+
+
+// ---------------------
+// Setup
+// ---------------------
+
+FFZ.prototype.setup_tokenization = function() {
+ helpers = window.require && window.require("ember-twitch-chat/helpers/chat-line-helpers");
+ if ( ! helpers )
+ return this.log("Unable to get chat helper functions.");
+
+ this.log("Hooking Ember chat line helpers.");
+
+ var f = this;
+
+ // Timestamp Display
helpers.getTime = function(e) {
+ if ( e === undefined || e === null )
+ return '?:??';
+
var hours = e.getHours(),
minutes = e.getMinutes();
-
- if ( hours > 12 && ! FFZ.get().settings.twenty_four_timestamps )
+
+ if ( hours > 12 && ! f.settings.twenty_four_timestamps )
hours -= 12;
- else if ( hours === 0 && ! FFZ.get().settings.twenty_four_timestamps )
+ else if ( hours === 0 && ! f.settings.twenty_four_timestamps )
hours = 12;
-
+
return hours + ':' + (minutes < 10 ? '0' : '') + minutes;
};
+ // Linkify Messages
+ helpers.linkifyMessage = function(tokens, delete_links) {
+ var show_deleted = f.settings.show_deleted_links;
+
+ return _.chain(tokens).map(function(token) {
+ if ( ! _.isString(token) )
+ return token;
+
+ var matches = token.match(LINK);
+ if ( ! matches || ! matches.length )
+ return [token];
+
+ return _.zip(
+ token.split(LINK),
+ _.map(matches, function(e) {
+ if ( ! show_deleted && (delete_links || e.length > 255) )
+ return {mentionedUser: '<' + (e.length > 255 ? 'long link' : 'deleted link') + '>', own: true}
+ return {isLink: true, href: e};
+ })
+ );
+ }).flatten().compact().value();
+ };
+}
+
+
// ---------------------
// Tokenization
// ---------------------
@@ -7237,6 +8023,8 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification) {
if ( msgObject.cachedTokens )
return msgObject.cachedTokens;
+ try {
+
var msg = msgObject.message,
user = this.get_user(),
room_id = msgObject.room,
@@ -7246,11 +8034,15 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification) {
tokens = [msg];
// Standard tokenization
- tokens = helpers.linkifyMessage(tokens);
- if ( user && user.login )
+ if ( helpers && helpers.linkifyMessage )
+ tokens = helpers.linkifyMessage(tokens);
+
+ if ( user && user.login && helpers && helpers.mentionizeMessage )
tokens = helpers.mentionizeMessage(tokens, user.login, from_me);
- tokens = helpers.emoticonizeMessage(tokens, emotes);
+ if ( helpers && helpers.emoticonizeMessage )
+ tokens = helpers.emoticonizeMessage(tokens, emotes);
+
if ( this.settings.replace_bad_emotes )
tokens = this.tokenize_replace_emotes(tokens);
@@ -7313,7 +8105,7 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification) {
msg,
"Twitch Chat Whisper",
"ffz_whisper_notice",
- 60000,
+ (this.settings.notification_timeout*1000),
function() {
window.focus();
}
@@ -7323,7 +8115,7 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification) {
msg,
"Twitch Chat Mention in " + room_name,
room_id,
- 60000,
+ (this.settings.notification_timeout*1000),
function() {
window.focus();
var cont = App.__container__.lookup('controller:chat');
@@ -7338,6 +8130,10 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification) {
}
msgObject.cachedTokens = tokens;
+ } catch(err) {
+ this.error("Tokenization Error: " + err);
+ }
+
return tokens;
}
@@ -7752,7 +8548,7 @@ FFZ.prototype._deleted_link_click = function(e) {
// Stop from Navigating
e.preventDefault();
}
-},{"./constants":3,"./utils":32}],20:[function(require,module,exports){
+},{"./constants":4,"./utils":33}],21:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require("../constants");
@@ -7856,7 +8652,7 @@ FFZ.menu_pages.about = {
container.appendChild(credits);
}
}
-},{"../constants":3}],21:[function(require,module,exports){
+},{"../constants":4}],22:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require("../constants");
@@ -7926,6 +8722,7 @@ FFZ.settings_info.hide_recent_past_broadcast = {
value: false,
//no_bttv: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Hide \"Watch Last Broadcast\"",
@@ -7970,7 +8767,7 @@ FFZ.prototype._load_dark_css = function() {
s.setAttribute('href', constants.SERVER + "script/dark.css?_=" + (constants.DEBUG ? Date.now() : FFZ.version_info));
document.head.appendChild(s);
}
-},{"../constants":3}],22:[function(require,module,exports){
+},{"../constants":4}],23:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require('../utils');
@@ -7981,6 +8778,7 @@ FFZ.settings_info.following_count = {
value: true,
no_bttv: true,
+ no_mobile: true,
category: "Appearance",
name: "Sidebar Following Count",
@@ -8126,7 +8924,7 @@ FFZ.prototype._draw_following_count = function(count) {
}
}
}
-},{"../utils":32}],23:[function(require,module,exports){
+},{"../utils":33}],24:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require('../utils');
@@ -8149,6 +8947,7 @@ FFZ.prototype.setup_following = function() {
FFZ.settings_info.follow_buttons = {
type: "boolean",
value: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "Relevant Follow Buttons",
@@ -8525,7 +9324,7 @@ FFZ.prototype._build_following_popup = function(container, channel_id, notificat
container.appendChild(popup);
return popup.querySelector('a.switch');
}
-},{"../utils":32}],24:[function(require,module,exports){
+},{"../utils":33}],25:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants'),
utils = require('../utils'),
@@ -8783,7 +9582,7 @@ FFZ.prototype.build_ui_popup = function(view) {
// Add the menu to the DOM.
this._popup = container;
- sub_container.style.maxHeight = Math.max(200, view.$().height() - 172) + "px";
+ sub_container.style.maxHeight = Math.max(200, view.$().height() - 472) + "px";
view.$('.chat-interface').append(container);
}
@@ -9073,7 +9872,7 @@ FFZ.prototype._add_emote = function(view, emote) {
else
room.set('messageToSend', text);
}
-},{"../constants":3,"../utils":32}],25:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],26:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants');
@@ -9120,7 +9919,7 @@ FFZ.prototype.update_ui_link = function(link) {
link.classList.toggle('dark', dark);
link.classList.toggle('blue', blue);
}
-},{"../constants":3}],26:[function(require,module,exports){
+},{"../constants":4}],27:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require("../constants"),
utils = require("../utils"),
@@ -9557,7 +10356,7 @@ FFZ.menu_pages.my_emotes = {
}
}
};
-},{"../constants":3,"../utils":32}],27:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],28:[function(require,module,exports){
var FFZ = window.FrankerFaceZ;
@@ -9581,6 +10380,7 @@ FFZ.settings_info.highlight_notifications = {
category: "Chat Filtering",
no_bttv: true,
+ no_mobile: true,
//visible: function() { return ! this.has_bttv },
name: "Highlight Notifications",
@@ -9611,6 +10411,33 @@ FFZ.settings_info.highlight_notifications = {
};
+FFZ.settings_info.notification_timeout = {
+ type: "button",
+ value: 60,
+
+ category: "Chat Filtering",
+ no_bttv: true,
+ no_mobile: true,
+
+ name: "Notification Timeout",
+ help: "Specify how long notifications should be displayed before automatically closing.",
+
+ method: function() {
+ var old_val = this.settings.notification_timeout,
+ new_val = prompt("Notification Timeout\n\nPlease enter the time you'd like notifications to be displayed before automatically closing, in seconds.\n\nDefault is: 60", old_val);
+
+ if ( new_val === null || new_val === undefined )
+ return;
+
+ var parsed = parseInt(new_val);
+ if ( parsed === NaN || parsed < 1 )
+ parsed = 60;
+
+ this.settings.set("notification_timeout", parsed);
+ }
+ };
+
+
// ---------------------
// Socket Commands
// ---------------------
@@ -9648,7 +10475,7 @@ FFZ.prototype.show_notification = function(message, title, tag, timeout, on_clic
if ( perm === "granted" ) {
title = title || "FrankerFaceZ";
- timeout = timeout || 10000;
+ timeout = timeout || (this.settings.notification_timeout*1000);
var options = {
lang: "en-US",
@@ -9707,7 +10534,7 @@ FFZ.prototype.show_message = function(message) {
closeWith: ["button"]
}).show();
}
-},{}],28:[function(require,module,exports){
+},{}],29:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
utils = require('../utils');
@@ -9729,6 +10556,7 @@ FFZ.prototype.setup_races = function() {
FFZ.settings_info.srl_races = {
type: "boolean",
value: true,
+ no_mobile: true,
category: "Channel Metadata",
name: "SRL Race Information",
@@ -10053,7 +10881,7 @@ FFZ.prototype._update_race = function(container, not_timer) {
}
}
}
-},{"../utils":32}],29:[function(require,module,exports){
+},{"../utils":33}],30:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants');
@@ -10078,7 +10906,7 @@ FFZ.prototype.setup_css = function() {
}
};
}
-},{"../constants":3}],30:[function(require,module,exports){
+},{"../constants":4}],31:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants'),
utils = require('../utils');
@@ -10181,7 +11009,7 @@ FFZ.prototype._update_subscribers = function() {
});;
}
-},{"../constants":3,"../utils":32}],31:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],32:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('../constants'),
utils = require('../utils');
@@ -10253,7 +11081,7 @@ FFZ.ws_commands.viewers = function(data) {
jQuery(view_count).tipsy(this.is_dashboard ? {"gravity":"s"} : undefined);
}
}
-},{"../constants":3,"../utils":32}],32:[function(require,module,exports){
+},{"../constants":4,"../utils":33}],33:[function(require,module,exports){
var FFZ = window.FrankerFaceZ,
constants = require('./constants');
@@ -10275,38 +11103,6 @@ var sanitize_cache = {},
return num + "th";
},
- brighten = function(rgb, amount) {
- amount = (amount === 0) ? 0 : (amount || 1);
- amount = Math.round(255 * -(amount / 100));
-
- var r = Math.max(0, Math.min(255, rgb[0] - amount)),
- g = Math.max(0, Math.min(255, rgb[1] - amount)),
- b = Math.max(0, Math.min(255, rgb[2] - amount));
-
- return [r,g,b];
- },
-
- rgb_to_css = function(rgb) {
- return "rgb(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ")";
- },
-
- darken = function(rgb, amount) {
- amount = (amount === 0) ? 0 : (amount || 1);
- return brighten(rgb, -amount);
- },
-
- get_luminance = function(rgb) {
- rgb = [rgb[0]/255, rgb[1]/255, rgb[2]/255];
- for (var i =0; i/g, ">");
+ },
date_string: function(date) {
return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
@@ -10572,4 +11372,4 @@ module.exports = {
return "" + count;
}
}
-},{"./constants":3}]},{},[15]);window.ffz = new FrankerFaceZ()}(window));
\ No newline at end of file
+},{"./constants":4}]},{},[16]);window.ffz = new FrankerFaceZ()}(window));
\ No newline at end of file
diff --git a/script.min.js b/script.min.js
index 74e2e06f..32d63cd3 100644
--- a/script.min.js
+++ b/script.min.js
@@ -1,7 +1,7 @@
-!function(e){!function t(e,s,o){function n(a,r){if(!s[a]){if(!e[a]){var d="function"==typeof require&&require;if(!r&&d)return d(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var u=s[a]={exports:{}};e[a][0].call(u.exports,function(t){var s=e[a][1][t];return n(s?s:t)},u,u.exports,t,e,s,o)}return s[a].exports}for(var i="function"==typeof require&&require,a=0;ae&&this._legacy_load_bots(e))})},s.prototype._legacy_load_donors=function(e){jQuery.ajax(o.SERVER+"script/donors.txt",{cache:!1,context:this}).done(function(e){this._legacy_parse_badges(e,1,1)}).fail(function(t){return 404!=t.status?(e=(e||0)+1,10>e?this._legacy_load_donors(e):void 0):void 0})},s.prototype._legacy_parse_badges=function(e,t,s){var o=this.badges[s].title,i=0;if(ds=null,null!=e)for(var a=e.trim().split(/\W+/),r=0;r50)return"Each user you unmod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=t.length;t.length;){var n=t.shift();e.room.tmiRoom.sendMessage("/unmod "+n)}return"Sent unmod command for "+o+" users."},t.ffz_commands.massunmod.help="Usage: /ffz massunmod \nBroadcaster only. Unmod all the users in the provided list.",t.ffz_commands.massmod=function(e,t){if(t=t.join(" ").trim(),!t.length)return"You must provide a list of users to mod.";t=t.split(/\W*,\W*/);var s=this.get_user();if(!s||!s.login==e.id)return"You must be the broadcaster to use massmod.";if(t.length>50)return"Each user you mod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=t.length;t.length;){var n=t.shift();e.room.tmiRoom.sendMessage("/mod "+n)}return"Sent mod command for "+o+" users."},t.ffz_commands.massmod.help="Usage: /ffz massmod \nBroadcaster only. Mod all the users in the provided list."},{}],3:[function(e,t){var s='',o="true"==localStorage.ffzDebugMode&&document.body.classList.contains("ffz-dev"),n=o?"//localhost:8000/":"//cdn.frankerfacez.com/";t.exports={DEBUG:o,SERVER:n,API_SERVER:"//api.frankerfacez.com/",API_SERVER_2:"//direct-api.frankerfacez.com/",KNOWN_CODES:{"#-?[\\\\/]":"#-/",":-?(?:7|L)":":-7","\\<\\;\\]":"<]","\\:-?(S|s)":":-S","\\:-?\\\\":":-\\","\\:\\>\\;":":>","B-?\\)":"B-)","\\:-?[z|Z|\\|]":":-Z","\\:-?\\)":":-)","\\:-?\\(":":-(","\\:-?(p|P)":":-P","\\;-?(p|P)":";-P","\\<\\;3":"<3","\\:-?[\\\\/]":":-/","\\;-?\\)":";-)","R-?\\)":"R-)","[o|O](_|\\.)[o|O]":"O.o","\\:-?D":":-D","\\:-?(o|O)":":-O","\\>\\;\\(":">(","Gr(a|e)yFace":"GrayFace"},EMOTE_REPLACEMENT_BASE:n+"script/replacements/",EMOTE_REPLACEMENTS:{15:"15-JKanStyle.png",16:"16-OptimizePrime.png",17:"17-StoneLightning.png",18:"18-TheRinger.png",19:"19-PazPazowitz.png",20:"20-EagleEye.png",21:"21-CougarHunt.png",22:"22-RedCoat.png",26:"26-JonCarnage.png",27:"27-PicoMause.png",30:"30-BCWarrior.png",33:"33-DansGame.png",36:"36-PJSalt.png"},EMOJI_REGEX:/((?:\ud83c\udde8\ud83c\uddf3|\ud83c\uddfa\ud83c\uddf8|\ud83c\uddf7\ud83c\uddfa|\ud83c\uddf0\ud83c\uddf7|\ud83c\uddef\ud83c\uddf5|\ud83c\uddee\ud83c\uddf9|\ud83c\uddec\ud83c\udde7|\ud83c\uddeb\ud83c\uddf7|\ud83c\uddea\ud83c\uddf8|\ud83c\udde9\ud83c\uddea|\u0039\ufe0f?\u20e3|\u0038\ufe0f?\u20e3|\u0037\ufe0f?\u20e3|\u0036\ufe0f?\u20e3|\u0035\ufe0f?\u20e3|\u0034\ufe0f?\u20e3|\u0033\ufe0f?\u20e3|\u0032\ufe0f?\u20e3|\u0031\ufe0f?\u20e3|\u0030\ufe0f?\u20e3|\u0023\ufe0f?\u20e3|\ud83d\udeb3|\ud83d\udeb1|\ud83d\udeb0|\ud83d\udeaf|\ud83d\udeae|\ud83d\udea6|\ud83d\udea3|\ud83d\udea1|\ud83d\udea0|\ud83d\ude9f|\ud83d\ude9e|\ud83d\ude9d|\ud83d\ude9c|\ud83d\ude9b|\ud83d\ude98|\ud83d\ude96|\ud83d\ude94|\ud83d\ude90|\ud83d\ude8e|\ud83d\ude8d|\ud83d\ude8b|\ud83d\ude8a|\ud83d\ude88|\ud83d\ude86|\ud83d\ude82|\ud83d\ude81|\ud83d\ude36|\ud83d\ude34|\ud83d\ude2f|\ud83d\ude2e|\ud83d\ude2c|\ud83d\ude27|\ud83d\ude26|\ud83d\ude1f|\ud83d\ude1b|\ud83d\ude19|\ud83d\ude17|\ud83d\ude15|\ud83d\ude11|\ud83d\ude10|\ud83d\ude0e|\ud83d\ude08|\ud83d\ude07|\ud83d\ude00|\ud83d\udd67|\ud83d\udd66|\ud83d\udd65|\ud83d\udd64|\ud83d\udd63|\ud83d\udd62|\ud83d\udd61|\ud83d\udd60|\ud83d\udd5f|\ud83d\udd5e|\ud83d\udd5d|\ud83d\udd5c|\ud83d\udd2d|\ud83d\udd2c|\ud83d\udd15|\ud83d\udd09|\ud83d\udd08|\ud83d\udd07|\ud83d\udd06|\ud83d\udd05|\ud83d\udd04|\ud83d\udd02|\ud83d\udd01|\ud83d\udd00|\ud83d\udcf5|\ud83d\udcef|\ud83d\udced|\ud83d\udcec|\ud83d\udcb7|\ud83d\udcb6|\ud83d\udcad|\ud83d\udc6d|\ud83d\udc6c|\ud83d\udc65|\ud83d\udc2a|\ud83d\udc16|\ud83d\udc15|\ud83d\udc13|\ud83d\udc10|\ud83d\udc0f|\ud83d\udc0b|\ud83d\udc0a|\ud83d\udc09|\ud83d\udc08|\ud83d\udc07|\ud83d\udc06|\ud83d\udc05|\ud83d\udc04|\ud83d\udc03|\ud83d\udc02|\ud83d\udc01|\ud83d\udc00|\ud83c\udfe4|\ud83c\udfc9|\ud83c\udfc7|\ud83c\udf7c|\ud83c\udf50|\ud83c\udf4b|\ud83c\udf33|\ud83c\udf32|\ud83c\udf1e|\ud83c\udf1d|\ud83c\udf1c|\ud83c\udf1a|\ud83c\udf18|\ud83c\udccf|\ud83c\udd70|\ud83c\udd71|\ud83c\udd7e|\ud83c\udd8e|\ud83c\udd91|\ud83c\udd92|\ud83c\udd93|\ud83c\udd94|\ud83c\udd95|\ud83c\udd96|\ud83c\udd97|\ud83c\udd98|\ud83c\udd99|\ud83c\udd9a|\ud83d\udc77|\ud83d\udec5|\ud83d\udec4|\ud83d\udec3|\ud83d\udec2|\ud83d\udec1|\ud83d\udebf|\ud83d\udeb8|\ud83d\udeb7|\ud83d\udeb5|\ud83c\ude01|\ud83c\ude02|\ud83c\ude32|\ud83c\ude33|\ud83c\ude34|\ud83c\ude35|\ud83c\ude36|\ud83c\ude37|\ud83c\ude38|\ud83c\ude39|\ud83c\ude3a|\ud83c\ude50|\ud83c\ude51|\ud83c\udf00|\ud83c\udf01|\ud83c\udf02|\ud83c\udf03|\ud83c\udf04|\ud83c\udf05|\ud83c\udf06|\ud83c\udf07|\ud83c\udf08|\ud83c\udf09|\ud83c\udf0a|\ud83c\udf0b|\ud83c\udf0c|\ud83c\udf0f|\ud83c\udf11|\ud83c\udf13|\ud83c\udf14|\ud83c\udf15|\ud83c\udf19|\ud83c\udf1b|\ud83c\udf1f|\ud83c\udf20|\ud83c\udf30|\ud83c\udf31|\ud83c\udf34|\ud83c\udf35|\ud83c\udf37|\ud83c\udf38|\ud83c\udf39|\ud83c\udf3a|\ud83c\udf3b|\ud83c\udf3c|\ud83c\udf3d|\ud83c\udf3e|\ud83c\udf3f|\ud83c\udf40|\ud83c\udf41|\ud83c\udf42|\ud83c\udf43|\ud83c\udf44|\ud83c\udf45|\ud83c\udf46|\ud83c\udf47|\ud83c\udf48|\ud83c\udf49|\ud83c\udf4a|\ud83c\udf4c|\ud83c\udf4d|\ud83c\udf4e|\ud83c\udf4f|\ud83c\udf51|\ud83c\udf52|\ud83c\udf53|\ud83c\udf54|\ud83c\udf55|\ud83c\udf56|\ud83c\udf57|\ud83c\udf58|\ud83c\udf59|\ud83c\udf5a|\ud83c\udf5b|\ud83c\udf5c|\ud83c\udf5d|\ud83c\udf5e|\ud83c\udf5f|\ud83c\udf60|\ud83c\udf61|\ud83c\udf62|\ud83c\udf63|\ud83c\udf64|\ud83c\udf65|\ud83c\udf66|\ud83c\udf67|\ud83c\udf68|\ud83c\udf69|\ud83c\udf6a|\ud83c\udf6b|\ud83c\udf6c|\ud83c\udf6d|\ud83c\udf6e|\ud83c\udf6f|\ud83c\udf70|\ud83c\udf71|\ud83c\udf72|\ud83c\udf73|\ud83c\udf74|\ud83c\udf75|\ud83c\udf76|\ud83c\udf77|\ud83c\udf78|\ud83c\udf79|\ud83c\udf7a|\ud83c\udf7b|\ud83c\udf80|\ud83c\udf81|\ud83c\udf82|\ud83c\udf83|\ud83c\udf84|\ud83c\udf85|\ud83c\udf86|\ud83c\udf87|\ud83c\udf88|\ud83c\udf89|\ud83c\udf8a|\ud83c\udf8b|\ud83c\udf8c|\ud83c\udf8d|\ud83c\udf8e|\ud83c\udf8f|\ud83c\udf90|\ud83c\udf91|\ud83c\udf92|\ud83c\udf93|\ud83c\udfa0|\ud83c\udfa1|\ud83c\udfa2|\ud83c\udfa3|\ud83c\udfa4|\ud83c\udfa5|\ud83c\udfa6|\ud83c\udfa7|\ud83c\udfa8|\ud83c\udfa9|\ud83c\udfaa|\ud83c\udfab|\ud83c\udfac|\ud83c\udfad|\ud83c\udfae|\ud83c\udfaf|\ud83c\udfb0|\ud83c\udfb1|\ud83c\udfb2|\ud83c\udfb3|\ud83c\udfb4|\ud83c\udfb5|\ud83c\udfb6|\ud83c\udfb7|\ud83c\udfb8|\ud83c\udfb9|\ud83c\udfba|\ud83c\udfbb|\ud83c\udfbc|\ud83c\udfbd|\ud83c\udfbe|\ud83c\udfbf|\ud83c\udfc0|\ud83c\udfc1|\ud83c\udfc2|\ud83c\udfc3|\ud83c\udfc4|\ud83c\udfc6|\ud83c\udfc8|\ud83c\udfca|\ud83c\udfe0|\ud83c\udfe1|\ud83c\udfe2|\ud83c\udfe3|\ud83c\udfe5|\ud83c\udfe6|\ud83c\udfe7|\ud83c\udfe8|\ud83c\udfe9|\ud83c\udfea|\ud83c\udfeb|\ud83c\udfec|\ud83c\udfed|\ud83c\udfee|\ud83c\udfef|\ud83c\udff0|\ud83d\udc0c|\ud83d\udc0d|\ud83d\udc0e|\ud83d\udc11|\ud83d\udc12|\ud83d\udc14|\ud83d\udc17|\ud83d\udc18|\ud83d\udc19|\ud83d\udc1a|\ud83d\udc1b|\ud83d\udc1c|\ud83d\udc1d|\ud83d\udc1e|\ud83d\udc1f|\ud83d\udc20|\ud83d\udc21|\ud83d\udc22|\ud83d\udc23|\ud83d\udc24|\ud83d\udc25|\ud83d\udc26|\ud83d\udc27|\ud83d\udc28|\ud83d\udc29|\ud83d\udc2b|\ud83d\udc2c|\ud83d\udc2d|\ud83d\udc2e|\ud83d\udc2f|\ud83d\udc30|\ud83d\udc31|\ud83d\udc32|\ud83d\udc33|\ud83d\udc34|\ud83d\udc35|\ud83d\udc36|\ud83d\udc37|\ud83d\udc38|\ud83d\udc39|\ud83d\udc3a|\ud83d\udc3b|\ud83d\udc3c|\ud83d\udc3d|\ud83d\udc3e|\ud83d\udc40|\ud83d\udc42|\ud83d\udc43|\ud83d\udc44|\ud83d\udc45|\ud83d\udc46|\ud83d\udc47|\ud83d\udc48|\ud83d\udc49|\ud83d\udc4a|\ud83d\udc4b|\ud83d\udc4c|\ud83d\udc4d|\ud83d\udc4e|\ud83d\udc4f|\ud83d\udc50|\ud83d\udc51|\ud83d\udc52|\ud83d\udc53|\ud83d\udc54|\ud83d\udc55|\ud83d\udc56|\ud83d\udc57|\ud83d\udc58|\ud83d\udc59|\ud83d\udc5a|\ud83d\udc5b|\ud83d\udc5c|\ud83d\udc5d|\ud83d\udc5e|\ud83d\udc5f|\ud83d\udc60|\ud83d\udc61|\ud83d\udc62|\ud83d\udc63|\ud83d\udc64|\ud83d\udc66|\ud83d\udc67|\ud83d\udc68|\ud83d\udc69|\ud83d\udc6a|\ud83d\udc6b|\ud83d\udc6e|\ud83d\udc6f|\ud83d\udc70|\ud83d\udc71|\ud83d\udc72|\ud83d\udc73|\ud83d\udc74|\ud83d\udc75|\ud83d\udc76|\ud83d\udeb4|\ud83d\udc78|\ud83d\udc79|\ud83d\udc7a|\ud83d\udc7b|\ud83d\udc7c|\ud83d\udc7d|\ud83d\udc7e|\ud83d\udc7f|\ud83d\udc80|\ud83d\udc81|\ud83d\udc82|\ud83d\udc83|\ud83d\udc84|\ud83d\udc85|\ud83d\udc86|\ud83d\udc87|\ud83d\udc88|\ud83d\udc89|\ud83d\udc8a|\ud83d\udc8b|\ud83d\udc8c|\ud83d\udc8d|\ud83d\udc8e|\ud83d\udc8f|\ud83d\udc90|\ud83d\udc91|\ud83d\udc92|\ud83d\udc93|\ud83d\udc94|\ud83d\udc95|\ud83d\udc96|\ud83d\udc97|\ud83d\udc98|\ud83d\udc99|\ud83d\udc9a|\ud83d\udc9b|\ud83d\udc9c|\ud83d\udc9d|\ud83d\udc9e|\ud83d\udc9f|\ud83d\udca0|\ud83d\udca1|\ud83d\udca2|\ud83d\udca3|\ud83d\udca4|\ud83d\udca5|\ud83d\udca6|\ud83d\udca7|\ud83d\udca8|\ud83d\udca9|\ud83d\udcaa|\ud83d\udcab|\ud83d\udcac|\ud83d\udcae|\ud83d\udcaf|\ud83d\udcb0|\ud83d\udcb1|\ud83d\udcb2|\ud83d\udcb3|\ud83d\udcb4|\ud83d\udcb5|\ud83d\udcb8|\ud83d\udcb9|\ud83d\udcba|\ud83d\udcbb|\ud83d\udcbc|\ud83d\udcbd|\ud83d\udcbe|\ud83d\udcbf|\ud83d\udcc0|\ud83d\udcc1|\ud83d\udcc2|\ud83d\udcc3|\ud83d\udcc4|\ud83d\udcc5|\ud83d\udcc6|\ud83d\udcc7|\ud83d\udcc8|\ud83d\udcc9|\ud83d\udcca|\ud83d\udccb|\ud83d\udccc|\ud83d\udccd|\ud83d\udcce|\ud83d\udccf|\ud83d\udcd0|\ud83d\udcd1|\ud83d\udcd2|\ud83d\udcd3|\ud83d\udcd4|\ud83d\udcd5|\ud83d\udcd6|\ud83d\udcd7|\ud83d\udcd8|\ud83d\udcd9|\ud83d\udcda|\ud83d\udcdb|\ud83d\udcdc|\ud83d\udcdd|\ud83d\udcde|\ud83d\udcdf|\ud83d\udce0|\ud83d\udce1|\ud83d\udce2|\ud83d\udce3|\ud83d\udce4|\ud83d\udce5|\ud83d\udce6|\ud83d\udce7|\ud83d\udce8|\ud83d\udce9|\ud83d\udcea|\ud83d\udceb|\ud83d\udcee|\ud83d\udcf0|\ud83d\udcf1|\ud83d\udcf2|\ud83d\udcf3|\ud83d\udcf4|\ud83d\udcf6|\ud83d\udcf7|\ud83d\udcf9|\ud83d\udcfa|\ud83d\udcfb|\ud83d\udcfc|\ud83d\udd03|\ud83d\udd0a|\ud83d\udd0b|\ud83d\udd0c|\ud83d\udd0d|\ud83d\udd0e|\ud83d\udd0f|\ud83d\udd10|\ud83d\udd11|\ud83d\udd12|\ud83d\udd13|\ud83d\udd14|\ud83d\udd16|\ud83d\udd17|\ud83d\udd18|\ud83d\udd19|\ud83d\udd1a|\ud83d\udd1b|\ud83d\udd1c|\ud83d\udd1d|\ud83d\udd1e|\ud83d\udd1f|\ud83d\udd20|\ud83d\udd21|\ud83d\udd22|\ud83d\udd23|\ud83d\udd24|\ud83d\udd25|\ud83d\udd26|\ud83d\udd27|\ud83d\udd28|\ud83d\udd29|\ud83d\udd2a|\ud83d\udd2b|\ud83d\udd2e|\ud83d\udd2f|\ud83d\udd30|\ud83d\udd31|\ud83d\udd32|\ud83d\udd33|\ud83d\udd34|\ud83d\udd35|\ud83d\udd36|\ud83d\udd37|\ud83d\udd38|\ud83d\udd39|\ud83d\udd3a|\ud83d\udd3b|\ud83d\udd3c|\ud83d\udd3d|\ud83d\udd50|\ud83d\udd51|\ud83d\udd52|\ud83d\udd53|\ud83d\udd54|\ud83d\udd55|\ud83d\udd56|\ud83d\udd57|\ud83d\udd58|\ud83d\udd59|\ud83d\udd5a|\ud83d\udd5b|\ud83d\uddfb|\ud83d\uddfc|\ud83d\uddfd|\ud83d\uddfe|\ud83d\uddff|\ud83d\ude01|\ud83d\ude02|\ud83d\ude03|\ud83d\ude04|\ud83d\ude05|\ud83d\ude06|\ud83d\ude09|\ud83d\ude0a|\ud83d\ude0b|\ud83d\ude0c|\ud83d\ude0d|\ud83d\ude0f|\ud83d\ude12|\ud83d\ude13|\ud83d\ude14|\ud83d\ude16|\ud83d\ude18|\ud83d\ude1a|\ud83d\ude1c|\ud83d\ude1d|\ud83d\ude1e|\ud83d\ude20|\ud83d\ude21|\ud83d\ude22|\ud83d\ude23|\ud83d\ude24|\ud83d\ude25|\ud83d\ude28|\ud83d\ude29|\ud83d\ude2a|\ud83d\ude2b|\ud83d\ude2d|\ud83d\ude30|\ud83d\ude31|\ud83d\ude32|\ud83d\ude33|\ud83d\ude35|\ud83d\ude37|\ud83d\ude38|\ud83d\ude39|\ud83d\ude3a|\ud83d\ude3b|\ud83d\ude3c|\ud83d\ude3d|\ud83d\ude3e|\ud83d\ude3f|\ud83d\ude40|\ud83d\ude45|\ud83d\ude46|\ud83d\ude47|\ud83d\ude48|\ud83d\ude49|\ud83d\ude4a|\ud83d\ude4b|\ud83d\ude4c|\ud83d\ude4d|\ud83d\ude4e|\ud83d\ude4f|\ud83d\ude80|\ud83d\ude83|\ud83d\ude84|\ud83d\ude85|\ud83d\ude87|\ud83d\ude89|\ud83d\ude8c|\ud83d\ude8f|\ud83d\ude91|\ud83d\ude92|\ud83d\ude93|\ud83d\ude95|\ud83d\ude97|\ud83d\ude99|\ud83d\ude9a|\ud83d\udea2|\ud83d\udea4|\ud83d\udea5|\ud83d\udea7|\ud83d\udea8|\ud83d\udea9|\ud83d\udeaa|\ud83d\udeab|\ud83d\udeac|\ud83d\udead|\ud83d\udeb2|\ud83d\udeb6|\ud83d\udeb9|\ud83d\udeba|\ud83d\udebb|\ud83d\udebc|\ud83d\udebd|\ud83d\udebe|\ud83d\udec0|\ud83c\udde6|\ud83c\udde7|\ud83c\udde8|\ud83c\udde9|\ud83c\uddea|\ud83c\uddeb|\ud83c\uddec|\ud83c\udded|\ud83c\uddee|\ud83c\uddef|\ud83c\uddf0|\ud83c\uddf1|\ud83c\uddf2|\ud83c\uddf3|\ud83c\uddf4|\ud83c\uddf5|\ud83c\uddf6|\ud83c\uddf7|\ud83c\uddf8|\ud83c\uddf9|\ud83c\uddfa|\ud83c\uddfb|\ud83c\uddfc|\ud83c\uddfd|\ud83c\uddfe|\ud83c\uddff|\ud83c\udf0d|\ud83c\udf0e|\ud83c\udf10|\ud83c\udf12|\ud83c\udf16|\ud83c\udf17|\ue50a|\u3030|\u27b0|\u2797|\u2796|\u2795|\u2755|\u2754|\u2753|\u274e|\u274c|\u2728|\u270b|\u270a|\u2705|\u26ce|\u23f3|\u23f0|\u23ec|\u23eb|\u23ea|\u23e9|\u2122|\u27bf|\u00a9|\u00ae)|(?:(?:\ud83c\udc04|\ud83c\udd7f|\ud83c\ude1a|\ud83c\ude2f|\u3299|\u303d|\u2b55|\u2b50|\u2b1c|\u2b1b|\u2b07|\u2b06|\u2b05|\u2935|\u2934|\u27a1|\u2764|\u2757|\u2747|\u2744|\u2734|\u2733|\u2716|\u2714|\u2712|\u270f|\u270c|\u2709|\u2708|\u2702|\u26fd|\u26fa|\u26f5|\u26f3|\u26f2|\u26ea|\u26d4|\u26c5|\u26c4|\u26be|\u26bd|\u26ab|\u26aa|\u26a1|\u26a0|\u2693|\u267f|\u267b|\u3297|\u2666|\u2665|\u2663|\u2660|\u2653|\u2652|\u2651|\u2650|\u264f|\u264e|\u264d|\u264c|\u264b|\u264a|\u2649|\u2648|\u263a|\u261d|\u2615|\u2614|\u2611|\u260e|\u2601|\u2600|\u25fe|\u25fd|\u25fc|\u25fb|\u25c0|\u25b6|\u25ab|\u25aa|\u24c2|\u231b|\u231a|\u21aa|\u21a9|\u2199|\u2198|\u2197|\u2196|\u2195|\u2194|\u2139|\u2049|\u203c|\u2668)([\uFE0E\uFE0F]?)))/g,SVGPATH:s,ZREKNARF:'",CHAT_BUTTON:'",ROOMS:'',CAMERA:'',INVITE:'',EYE:'',CLOCK:'',GEAR:'',HEART:'',EMOTE:'',STAR:'',CLOSE:''}},{}],4:[function(){var t=e.FrankerFaceZ;t.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){return this.settings.developer_mode||Date.now()-parseInt(localStorage.ffzLastDevMode||"0")<6048e5},category:"Debugging",name:"Developer Mode",help:"Load FrankerFaceZ from the local development server instead of the CDN. Please refresh after changing this setting.",on_update:function(){localStorage.ffzLastDevMode=Date.now()}},t.ffz_commands.developer_mode=function(e,t){var s,t=t&&t.length?t[0].toLowerCase():null;return"y"==t||"yes"==t||"true"==t||"on"==t?s=!0:("n"==t||"no"==t||"false"==t||"off"==t)&&(s=!1),void 0===s?"Developer Mode is currently "+(this.settings.developer_mode?"enabled.":"disabled."):(this.settings.set("developer_mode",s),"Developer Mode is now "+(s?"enabled":"disabled")+". Please refresh your browser.")},t.ffz_commands.developer_mode.help="Usage: /ffz developer_mode \nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN."},{}],5:[function(t){var s=e.FrankerFaceZ,o=t("../utils"),n=t("../constants");s.prototype.setup_channel=function(){this.log("Creating channel style element.");var e=this._channel_style=document.createElement("style");e.id="ffz-channel-css",document.head.appendChild(e),document.body.classList.toggle("ffz-hide-view-count",!this.settings.channel_views),this.log("Creating channel style element.");var e=this._channel_style=document.createElement("style");e.id="ffz-channel-css",document.head.appendChild(e),this.log("Hooking the Ember Channel Index view.");var t=App.__container__.resolve("view:channel/index"),o=this;if(t){this._modify_cindex(t);try{t.create().destroy()}catch(n){}for(var i in Ember.View.views)if(Ember.View.views.hasOwnProperty(i)){var a=Ember.View.views[i];a instanceof t&&(this.log("Manually updating Channel Index view.",a),this._modify_cindex(a),a.ffzInit())}this.log("Hooking the Ember Channel model."),t=App.__container__.resolve("model:channel"),t&&(t.reopen({ffz_host_target:void 0,setHostMode:function(e){return o.settings.hosted_channels?(this.set("ffz_host_target",e.target),this._super(e)):(this.set("ffz_host_target",void 0),this._super({target:void 0,delay:0}))}}),this.log("Hooking the Ember Channel controller."),t=App.__container__.lookup("controller:channel"),t&&t.reopen({ffzUpdateUptime:function(){o._cindex&&o._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateTitle:function(){var e=this.get("content.name"),t=this.get("content.display_name");t&&(s.capitalization[e]=[t,Date.now()]),o._cindex&&o._cindex.ffzFixTitle()}.observes("content.status","content.id"),ffzHostTarget:function(){var e=this.get("content.hostModeTarget"),t=e&&e.get("name"),n=e&&e.get("id"),i=e&&e.get("display_name");n!==o.__old_host_target&&(o.__old_host_target&&o.ws_send("unsub_channel",o.__old_host_target),n?(o.ws_send("sub_channel",n),o.__old_host_target=n):delete o.__old_host_target),i&&(s.capitalization[t]=[i,Date.now()]),o.settings.group_tabs&&o._chatv&&o._chatv.ffzRebuildTabs(),o.settings.follow_buttons&&o.rebuild_following_ui(),o.settings.srl_races&&o.rebuild_race_ui()}.observes("content.hostModeTarget")}))}},s.prototype._modify_cindex=function(e){var t=this;e.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(e){t.error("CIndex didInsertElement: "+e)}},willClearRender:function(){try{this.ffzTeardown()}catch(e){t.error("CIndex willClearRender: "+e)}return this._super()},ffzInit:function(){var e=this.get("controller.id"),s=this.get("element");t._cindex=this,t.ws_send("sub_channel",e),s.setAttribute("data-channel",e),s.classList.add("ffz-channel"),this.$(".theatre-button a").attr("title","Theater Mode (Alt+T)"),this.ffzFixTitle(),this.ffzUpdateUptime(),this.ffzUpdateChatters(),this.ffzUpdateHostButton();var o=this.get("element").querySelector(".svg-glyph_views:not(.ffz-svg)");o&&o.parentNode.classList.add("twitch-channel-views"),t.settings.follow_buttons&&t.rebuild_following_ui(),t.settings.srl_races&&t.rebuild_race_ui()},ffzFixTitle:function(){if(!t.has_bttv&&t.settings.stream_title){var e=this.get("controller.status"),s=this.get("controller.id");e=t.render_tokens(t.tokenize_line(s,s,e,!0)),this.$(".title span").each(function(t,s){var o=s.querySelectorAll("script");s.innerHTML=o.length?o[0].outerHTML+e+o[1].outerHTML:e})}},ffzUpdateHostButton:function(){var e=this.get("controller.id"),n=this.get("controller.hostModeTarget.id"),i=t.get_user(),a=i&&t.rooms&&t.rooms[i.login]&&t.rooms[i.login].room,r=a&&a.ffz_host_target,d=a&&a.ffz_hosts_left,u=this.get("element");if(this.set("ffz_host_updating",!1),e){var c=u&&u.querySelector(".stats-and-actions .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&t.settings.stream_host_button&&i&&i.login!==e){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!1));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=e===r?"Unhost":"Host",l.title=r?"You are now hosting "+o.sanitize(s.get_capitalization(r))+".":"You are not hosting any channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)}if(n){var c=u&&u.querySelector("#hostmode .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&t.settings.stream_host_button&&i&&i.login!==n){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!0));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=n===r?"Unhost":"Host",l.title=r?"You are currently hosting "+o.sanitize(s.get_capitalization(r))+". Click to "+(n===r?"unhost":"host")+" this channel.":"You are not currently hosting any channel. Click to host this channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)
-}},ffzClickHost:function(e,s){var o=e.get(s?"controller.hostModeTarget.id":"controller.id"),n=t.get_user(),i=n&&t.rooms&&t.rooms[n.login]&&t.rooms[n.login].room,a=i&&i.ffz_host_target;i&&!e.get("ffz_host_updating")&&(this.classList.add("disabled"),this.title="Updating...",e.set("ffz_host_updating",!0),i.send(a===o?"/unhost":"/host "+o))},ffzUpdateChatters:function(){var e=this.get("controller.id"),s=t.rooms&&t.rooms[e];if(!s||!t.settings.chatter_count){var i=this.get("element").querySelector("#ffz-chatter-display");return i&&i.parentElement.removeChild(i),i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentElement.removeChild(i))}var a=Object.keys(s.room.get("ffz_chatters")||{}).length,r=s.ffz_chatters||0,d=s.ffz_viewers||0,i=this.get("element").querySelector("#ffz-chatter-display span");if(!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-chatter-display",c.title="Currently in Chat",c.innerHTML=n.ROOMS+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-ffzchatter-display");l?u.insertBefore(c,l):u.appendChild(c),jQuery(c).tipsy()}if(i.innerHTML=o.number_commas(a),!r&&!d)return i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentNode.removeChild(i));if(i=this.get("element").querySelector("#ffz-ffzchatter-display span"),!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-ffzchatter-display",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=n.ZREKNARF+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-chatter-display");l?u.insertBefore(c,l.nextSibling):u.appendChild(c),jQuery(c).tipsy()}i.innerHTML=o.number_commas(d)+" ("+o.number_commas(r)+")"},ffzUpdateUptime:function(){if(this._ffz_update_uptime&&(clearTimeout(this._ffz_update_uptime),delete this._ffz_update_uptime),!t.settings.stream_uptime||!this.get("controller.isLiveAccordingToKraken")){var e=this.get("element").querySelector("#ffz-uptime-display");return void(e&&e.parentElement.removeChild(e))}this._ffz_update_uptime=setTimeout(this.ffzUpdateUptime.bind(this),1e3);var s=this.get("controller.content.stream.created_at");if(s&&(s=o.parse_date(s))){var i=Math.floor((Date.now()-s.getTime())/1e3);if(!(0>i)){var e=this.get("element").querySelector("#ffz-uptime-display span");if(!e){var a=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!a)return;var r=document.createElement("span");r.className="ffz stat",r.id="ffz-uptime-display",r.title="Stream Uptime (since "+s.toLocaleString()+")",r.innerHTML=n.CLOCK+" ",e=document.createElement("span"),r.appendChild(e);var d=a.querySelector(".live-count");if(d)a.insertBefore(r,d.nextSibling);else try{d=a.querySelector("script:nth-child(0n+2)"),a.insertBefore(r,d.nextSibling)}catch(u){a.insertBefore(r,a.childNodes[0])}jQuery(r).tipsy({html:!0})}e.innerHTML=o.time_to_string(i)}}},ffzTeardown:function(){var e=this.get("controller.id");e&&t.ws_send("unsub_channel",e),this.get("element").setAttribute("data-channel",""),t._cindex=void 0,this._ffz_update_uptime&&clearTimeout(this._ffz_update_uptime),o.update_css(t._channel_style,e,null)}})},s.settings_info.chatter_count={type:"boolean",value:!1,category:"Channel Metadata",name:"Chatter Count",help:"Display the current number of users connected to chat beneath the channel.",on_update:function(e){if(this._cindex&&this._cindex.ffzUpdateChatters(),e&&this.rooms)for(var t in this.rooms)this.rooms.hasOwnProperty(t)&&this.rooms[t].room&&this.rooms[t].room.ffzInitChatterCount()}},s.settings_info.channel_views={type:"boolean",value:!0,category:"Channel Metadata",name:"Channel Views",help:"Display the number of times the channel has been viewed beneath the stream.",on_update:function(e){document.body.classList.toggle("ffz-hide-view-count",!e)}},s.settings_info.hosted_channels={type:"boolean",value:!0,category:"Channel Metadata",name:"Channel Hosting",help:"Display other channels that have been featured by the current channel.",on_update:function(e){var t=document.querySelector("input.ffz-setting-hosted-channels");if(t&&(t.checked=e),this._cindex){var s=this._cindex.get("controller.model"),o=s&&this.rooms&&this.rooms[s.get("id")],n=o&&o.room&&o.room.get("ffz_host_target");s&&o&&s.setHostMode({target:n,delay:0})}}},s.settings_info.stream_host_button={type:"boolean",value:!0,category:"Channel Metadata",name:"Host This Channel Button",help:"Display a button underneath streams that make it easy to host them with your own channel.",on_update:function(){this._cindex&&this._cindex.ffzUpdateHostButton()}},s.settings_info.stream_uptime={type:"boolean",value:!1,category:"Channel Metadata",name:"Stream Uptime",help:"Display the stream uptime under a channel by the viewer count.",on_update:function(){this._cindex&&this._cindex.ffzUpdateUptime()}},s.settings_info.stream_title={type:"boolean",value:!0,no_bttv:!0,category:"Channel Metadata",name:"Title Links",help:"Make links in stream titles clickable.",on_update:function(){this._cindex&&this._cindex.ffzFixTitle()}}},{"../constants":3,"../utils":32}],6:[function(t){var s=e.FrankerFaceZ,o=(t("../utils"),t("../constants"),{BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,TWO:50,COLON:59,FAKE_COLON:186}),n=function(e){if("number"==typeof e.selectionStart)return e.selectionStart;if(!e.createTextRange)return-1;var t=document.selection.createRange(),s=e.createTextRange();return s.moveToBookmark(t.getBookmark()),s.moveStart("character",-e.value.length),s.text.length},i=function(e,t){if(e.setSelectionRange)e.setSelectionRange(t,t);else if(e.createTextRange){var s=e.createTextRange();s.move("character",-e.value.length),s.move("character",t),s.select()}};s.settings_info.input_quick_reply={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Reply to Whispers with /r",help:"Automatically replace /r at the start of the line with the command to whisper to the person you've whispered with most recently."},s.settings_info.input_mru={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Chat Input History",help:"Use the Up and Down arrows in chat to select previously sent chat messages."},s.settings_info.input_emoji={type:"boolean",value:!1,category:"Chat Input",no_bttv:!0,name:"Enter Emoji By Name",help:"Replace emoji that you type by name with the character. :+1: becomes 👍."},s.prototype.setup_chat_input=function(){this.log("Hooking the Ember Chat Input controller.");var e=App.__container__.resolve("component:twitch-chat-input");if(e&&(this._modify_chat_input(e),this._roomv))for(var t=0;t0&&Ember.run.next(function(){var e=d.get("textareaValue"),t=e.lastIndexOf(":",u-1);if(-1!==t&&-1!==u&&":"===e.charAt(u)){var s=e.substr(t+1,u-t-1),o=a.emoji_names[s],n=a.emoji_data[o];if(n){var r=e.substr(0,t)+n.raw;d.set("textareaValue",r+e.substr(u+1)),Ember.run.next(function(){i(d.get("chatTextArea"),r.length)})}}}))}return this._onKeyDown(t);case o.ENTER:s.shiftKey||s.shiftLeft||this.set("ffz_mru_index",-1);default:return this._onKeyDown(t)}},ffzCycleMRU:function(e,t){var s=n(this.get("chatTextArea"));if(t===s){var i=this.get("ffz_mru_index"),a=this._parentView.get("context.model.mru_list")||[];i=e===o.UP?(i+1)%(a.length+1):(i+a.length)%(a.length+1);var r=this.get("ffz_old_mru");(void 0===r||null===r)&&(r=this.get("textareaValue"),this.set("ffz_old_mru",r));var d=a[i];void 0===d&&(this.set("ffz_old_mru",void 0),d=r),this.set("ffz_mru_index",i),this.set("textareaValue",d)}},completeSuggestion:function(e){var t,o,n=this,a=this.get("textareaValue"),r=this.get("partialNameStartIndex");t=a.substring(0,r)+("/"===a.charAt(0)?e:s.get_capitalization(e)),o=a.substring(r+this.get("partialName").length),o||(t+=" "),this.set("textareaValue",t+o),this.set("isShowingSuggestions",!1),this.set("partialName",""),this.trackSuggestionsCompleted(),Ember.run.next(function(){i(n.get("chatTextArea"),t.length)})}})}},{"../constants":3,"../utils":32}],7:[function(t){var s=e.FrankerFaceZ,o=t("../utils"),n=t("../constants");s.settings_info.swap_sidebars={type:"boolean",value:!1,category:"Appearance",no_bttv:!0,name:"Swap Sidebar Positions",help:"Swap the positions of the left and right sidebars, placing chat on the left.",on_update:function(e){this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",e)}},s.settings_info.minimal_chat={type:"boolean",value:!1,category:"Chat Appearance",name:"Minimalistic Chat",help:"Hide all of the chat user interface, only showing messages and an input box.",on_update:function(e){if(document.body.classList.toggle("ffz-minimal-chat",e),this.settings.group_tabs&&this._chatv&&this._chatv._ffz_tabs){var t=this;setTimeout(function(){t._chatv&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px"),t._roomv&&t._roomv.get("stuckToBottom")&&t._roomv._scrollToBottom()},0)}this._chatv&&this._chatv.get("controller.showList")&&this._chatv.set("controller.showList",!1)}},s.settings_info.prevent_clear={type:"boolean",value:!1,no_bttv:!0,category:"Chat Filtering",name:"Show Deleted Messages",help:"Fade deleted messages instead of replacing them, and prevent chat from being cleared.",on_update:function(e){if(!this.has_bttv&&this.rooms)for(var t in this.rooms){var s=this.rooms[t],o=s&&s.room;o&&o.get("messages").forEach(function(t,s){e&&!t.ffz_deleted&&t.deleted?o.set("messages."+s+".deleted",!1):!t.ffz_deleted||e||t.deleted||o.set("messages."+s+".deleted",!0)})}}},s.settings_info.chat_history={type:"boolean",value:!0,visible:!1,category:"Chat Appearance",name:"Chat History Alpha",help:"Load previous chat messages when loading a chat room so you can see what people have been talking about. This currently only works in a handful of channels due to server capacity."},s.settings_info.group_tabs={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Chat Room Tabs Beta",help:"Enhanced UI for switching the current chat room and noticing new messages.",on_update:function(e){var t=!this.has_bttv&&e;this._chatv&&t!==this._group_tabs_state&&(t?this._chatv.ffzEnableTabs():this._chatv.ffzDisableTabs())}},s.settings_info.pinned_rooms={value:[],visible:!1},s.settings_info.visible_rooms={value:[],visible:!1},s.prototype.setup_chatview=function(){document.body.classList.toggle("ffz-minimal-chat",this.settings.minimal_chat),this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",this.settings.swap_sidebars),this.log("Hooking the Ember Chat controller.");var e=App.__container__.lookup("controller:chat"),t=this;e&&e.reopen({ffzUpdateChannels:function(){t._chatv&&(t._chatv.ffzRebuildMenu(),t.settings.group_tabs&&t._chatv.ffzRebuildTabs())}.observes("currentChannelRoom","connectedPrivateGroupRooms"),removeCurrentChannelRoom:function(){if(!t.settings.group_tabs||t.has_bttv)return this._super();var e=this.get("currentChannelRoom"),s=e&&e.get("id"),o=t.get_user();t.settings.pinned_rooms&&-1!==t.settings.pinned_rooms.indexOf(s)||(e===this.get("currentRoom")&&this.blurRoom(),e&&o&&o.login===s&&e.destroy()),this.set("currentChannelRoom",void 0)}}),this.log("Hooking the Ember Chat view.");var e=App.__container__.resolve("view:chat");this._modify_cview(e);try{e.create().destroy()}catch(s){}for(var o in Ember.View.views)if(Ember.View.views.hasOwnProperty(o)){var n=Ember.View.views[o];if(n instanceof e){this.log("Manually updating existing Chat view.",n);try{n.ffzInit()}catch(s){this.error("setup: build_ui_link: "+s)}}}this.log("Hooking the Ember Layout controller.");var i=App.__container__.lookup("controller:layout");if(i){i.reopen({ffzFixTabs:function(){t.settings.group_tabs&&t._chatv&&t._chatv._ffz_tabs&&setTimeout(function(){t._chatv&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("isRightColumnClosed")}),this.log("Hooking the Ember 'Right Column' controller. Seriously...");var a=App.__container__.lookup("controller:right-column");a&&a.reopen({ffzFixTabs:function(){t.settings.group_tabs&&t._chatv&&t._chatv._ffz_tabs&&setTimeout(function(){t._chatv&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("firstTabSelected")})}},s.prototype._modify_cview=function(e){var t=this;e.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(e){t.error("ChatView didInsertElement: "+e)}},willClearRender:function(){try{this.ffzTeardown()}catch(e){t.error("ChatView willClearRender: "+e)}this._super()},ffzInit:function(){t._chatv=this,this.$(".textarea-contain").append(t.build_ui_link(this)),!t.has_bttv&&t.settings.group_tabs&&this.ffzEnableTabs(),this.ffzRebuildMenu(),setTimeout(function(){t.settings.group_tabs&&t._chatv&&t._chatv._ffz_tabs&&t._chatv.$(".chat-room").css("top",t._chatv._ffz_tabs.offsetHeight+"px");var e=t._chatv.get("controller");e&&e.set("showList",!1)},1e3)},ffzTeardown:function(){t._chatv===this&&(t._chatv=null),this.$(".textarea-contain .ffz-ui-toggle").remove(),t.settings.group_tabs&&this.ffzDisableTabs()},ffzChangeRoom:Ember.observer("controller.currentRoom",function(){try{t.update_ui_link();var e,s=this.get("controller.currentRoom");if(s&&s.resetUnreadCount(),this._ffz_chan_table&&(e=jQuery(this._ffz_chan_table),e.children(".ffz-room-row").removeClass("active"),s&&e.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),this._ffz_group_table&&(e=jQuery(this._ffz_group_table),e.children(".ffz-room-row").removeClass("active"),s&&e.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),!t.has_bttv&&t.settings.group_tabs&&this._ffz_tabs){var o=jQuery(this._ffz_tabs);o.children(".ffz-chat-tab").removeClass("active"),s&&o.children('.ffz-chat-tab[data-room="'+s.get("id")+'"]').removeClass("tab-mentioned").removeClass("hidden").addClass("active").children("span").text("");var n=s&&s.get("canInvite");this._ffz_invite&&this._ffz_invite.classList.toggle("hidden",!n),this.set("controller.showInviteUser",n&&this.get("controller.showInviteUser")),this.$(".chat-room").css("top",this._ffz_tabs.offsetHeight+"px")}}catch(i){t.error("ChatView ffzUpdateLink: "+i)}}),ffzRebuildMenu:function(){return},ffzBuildRow:function(e,i,a,r){var d,u=document.createElement("tr"),c=document.createElement("td"),l=document.createElement("td"),h=document.createElement("td"),f=document.createElement("td"),_=i.get("isGroupRoom"),m=i===e.get("controller.currentRoom"),p=i.get("tmiRoom.displayName")||(_?i.get("tmiRoom.name"):s.get_capitalization(i.get("id"),function(e){t.log("Name for Row: "+e),l.innerHTML=o.sanitize(e)}));return l.className="ffz-room",l.innerHTML=o.sanitize(p),a?(c.innerHTML=n.CAMERA,c.title=l.title="Current Channel",c.className=l.className="tooltip"):r&&(c.innerHTML=n.EYE,c.title=l.title="Hosted Channel",c.className=l.className="tooltip"),h.className=f.className="ffz-row-switch",h.innerHTML='',f.innerHTML='',u.setAttribute("data-room",i.get("id")),u.className="ffz-room-row",u.classList.toggle("current-channel",a),u.classList.toggle("host-channel",r),u.classList.toggle("group-chat",_),u.classList.toggle("active",m),u.appendChild(c),u.appendChild(l),_?(d=document.createElement("a"),d.className="leave-chat tooltip",d.innerHTML=n.CLOSE,d.title="Leave Group",l.appendChild(d),d.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation&&e.stopPropagation(),confirm('Are you sure you want to leave the group room "'+p+'"?')&&i.get("isGroupRoom")&&i.del()})):(u.appendChild(h),d=h.querySelector("a.switch"),d.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation&&e.stopPropagation();var s=i.get("id"),o=-1!==t.settings.pinned_rooms.indexOf(s);o?t._leave_room(s):t._join_room(s),this.classList.toggle("active",!o)})),u.appendChild(f),d=f.querySelector("a.switch"),d.addEventListener("click",function(s){s.preventDefault(),s.stopPropagation&&s.stopPropagation();var o=i.get("id"),n=t.settings.visible_rooms,a=-1!==n.indexOf(o);a?n.removeObject(o):n.push(o),t.settings.set("visible_rooms",n),this.classList.toggle("active",!a),e.ffzRebuildTabs()}),u.addEventListener("click",function(){var t=e.get("controller");t.focusRoom(i),t.set("showList",!1)}),u},ffzEnableTabs:function(){if(!t.has_bttv&&t.settings.group_tabs){this.$(".chat-header").addClass("hidden");var e=this._ffz_tabs=document.createElement("div");e.id="ffz-group-tabs",this.$(".chat-header").after(e),this.ffzRebuildTabs()}},ffzRebuildTabs:function(){if(!t.has_bttv&&t.settings.group_tabs){var e=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs");if(e){e.innerHTML="";var s=document.createElement("a"),o=this;s.className="button glyph-only tooltip",s.title="Chat Room Management",s.innerHTML=n.ROOMS,s.addEventListener("click",function(){var e=o.get("controller");e&&e.set("showList",!e.get("showList"))}),e.appendChild(s),s=document.createElement("a"),s.className="button glyph-only tooltip invite",s.title="Invite a User",s.innerHTML=n.INVITE,s.addEventListener("click",function(){var e=o.get("controller");e&&e.set("showInviteUser",e.get("currentRoom.canInvite")&&!e.get("showInviteUser"))}),s.classList.toggle("hidden",!this.get("controller.currentRoom.canInvite")),o._ffz_invite=s,e.appendChild(s);var i,a=this.get("controller.currentChannelRoom");a&&(i=this.ffzBuildTab(o,a,!0),i&&e.appendChild(i));var r=App.__container__.lookup("controller:channel"),d=App.__container__.resolve("model:room");if(target=r&&r.get("hostModeTarget"),target&&d){var u=target.get("id");this._ffz_host!==u&&(-1===t.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),this._ffz_host=u,this._ffz_host_room=d.findOne(u))}else this._ffz_host&&(-1===t.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room);this._ffz_host_room&&(i=o.ffzBuildTab(o,this._ffz_host_room,!1,!0),i&&e.appendChild(i));for(var c=0;c"+u+""})),a?(l=n.CAMERA,c.title="Current Channel"):r?(l=n.EYE,c.title="Hosted Channel"):c.title=f?"Group Chat":"Pinned Channel",c.innerHTML=l+o.sanitize(d)+""+u+"",c.addEventListener("click",function(){var t=e.get("controller");t.focusRoom(i),t.set("showList",!1)}),c},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),delete this._ffz_tabs,delete this._ffz_invite),this._ffz_host&&(-1===t.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},s.prototype.connect_extra_chat=function(){var e=this.get_user();if(e&&e.login&&(!this.rooms[e.login]||this.rooms[e.login].room)){var t=App.__container__.resolve("model:room");t&&t.findOne(e.login)}if(!this.has_bttv){for(var s=0;s1)return"Join Usage: /join ";var s=t[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._join_room(s)?"Joining "+s+". You will always connect to this channel's chat unless you later /part from it.":"You have already joined "+s+'. Please use "/part '+s+'" to leave it.'},s.chat_commands.part=function(e,t){if(!t||!t.length||t.length>1)return"Part Usage: /part ";var s=t[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._leave_room(s)?"Leaving "+s+".":this.rooms[s]?"You do not have "+s+" pinned and you cannot leave the current channel or hosted channels via /part.":"You are not in "+s+"."}},{"../constants":3,"../utils":32}],8:[function(t){var s=e.FrankerFaceZ,o=t("../utils"),n=t("../constants"),i="[\\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]",a=new RegExp(i+"*,"+i+"*"),r=function(e){return(e+"").replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(//g,">")},d="http://static-cdn.jtvnw.net/emoticons/v1/",u={};build_srcset=function(e){if(u[e])return u[e];var t=u[e]=d+e+"/1.0 1x, "+d+e+"/2.0 2x, "+d+e+"/3.0 4x";return t},data_to_tooltip=function(e){var t=e.set,s=e.set_type,o=e.owner;return void 0===s&&(s="Channel"),t?(("--twitch-turbo--"==t||"turbo"==t)&&(t="Twitch Turbo",s=null),"Emoticon: "+e.code+"\n"+(s?s+": ":"")+t+(o?"\nBy: "+o.display_name:"")):e.code},build_tooltip=function(e){{var t=this._twitch_emotes[e];t?t.set:null}return t?"string"==typeof t?t:t.tooltip?t.tooltip:t.tooltip=data_to_tooltip(t):"???"},load_emote_data=function(e,t,s,o){if(s){t&&(o.code=t),this._twitch_emotes[e]=o;for(var n=build_tooltip.bind(this)(e),i=document.querySelectorAll('img[emote-id="'+e+'"]'),a=0;aYouTube: "+o.sanitize(s.title)+"",t+="Channel: "+o.sanitize(s.channel)+" | "+o.time_to_string(s.duration)+" ",t+=o.number_commas(s.views||0)+" Views | 👍 "+o.number_commas(s.likes||0)+" 👎 "+o.number_commas(s.dislikes||0);else if("strawpoll"==s.type){t="Strawpoll: "+o.sanitize(s.title)+"
";for(var n in s.items){{var i=s.items[n];Math.floor(i/s.total*100)}t+='
'+o.sanitize(n)+'
'+o.number_commas(i)+"
"}t+="
Total: "+o.number_commas(s.total);var a=o.parse_date(s.fetched);if(a){var r=Math.floor((a.getTime()-Date.now())/1e3);r>60&&(t+=" Data was cached "+o.time_to_string(r)+" ago.")}}else if("twitch"==s.type){t="Twitch: "+o.sanitize(s.display_name)+"";var d=o.parse_date(s.since);d&&(t+="Member Since: "+o.date_string(d)+" "),t+="Views: "+o.number_commas(s.views)+" | Followers: "+o.number_commas(s.followers)+""}else if("twitch_vod"==s.type)t="Twitch "+("highlight"==s.broadcast_type?"Highlight":"Broadcast")+": "+o.sanitize(s.title)+"",t+="By: "+o.sanitize(s.display_name)+(s.game?" | Playing: "+o.sanitize(s.game):" | Not Playing")+" ",t+="Views: "+o.number_commas(s.views)+" | "+o.time_to_string(s.length);else if("twitter"==s.type)t="Tweet By: "+o.sanitize(s.user)+"",t+=o.sanitize(s.tweet);else if("reputation"==s.type){if(t=''+o.sanitize(s.full.toLowerCase())+"",s.trust<50||s.safety<50||s.tags&&s.tags.length>0){t+="";var u=!1;(s.trust<50||s.safety<50)&&(s.unsafe=!0,t+="Potentially Unsafe Link ",t+="Trust: "+s.trust+"% | Child Safety: "+s.safety+"%",u=!0),s.tags&&s.tags.length>0&&(t+=(u?" ":"")+"Tags: "+s.tags.join(", ")),t+=" Data Source: WOT"}}else s.full&&(t=''+o.sanitize(s.full.toLowerCase())+"");return t||(t=''+o.sanitize(e.toLowerCase())+""),s.tooltip=t,t},load_link_data=function(e,t,s){if(t){this._link_data[e]=s,s.unsafe=!1;var o,n=build_link_tooltip.bind(this)(e),i="/"==e.charAt(e.length-1)?e.substr(0,e.length-1):null;if(o=document.querySelectorAll(i?'span.message a[href="'+e+'"], span.message a[href="'+i+'"], span.message a[data-url="'+e+'"], span.message a[data-url="'+i+'"]':'span.message a[href="'+e+'"], span.message a[data-url="'+e+'"]'),this.settings.link_info)for(var a=0;ae&&(e=10),this.settings.set("scrollback_length",e);
-var t=App.__container__.lookup("controller:chat"),s=t&&t.get("currentRoom.id");for(var o in this.rooms){var n=this.rooms[o];n.room.set("messageBufferSize",e+(this._roomv&&!this._roomv.get("stuckToBottom")&&s===o?150:0))}}}},s.settings_info.banned_words={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Banned Words",help:"Set a list of words that will be locally removed from chat messages.",method:function(){var e=this.settings.banned_words.join(", "),t=prompt("Banned Words\n\nPlease enter a comma-separated list of words that you would like to be removed from chat messages.",e);if(null!==t&&void 0!==t){t=t.trim().split(a);for(var s=[],o=0;oBeta",help:"Check links against known bad websites, unshorten URLs, and show YouTube info."},s.settings_info.legacy_badges={type:"boolean",value:!1,category:"Chat Appearance",name:"Legacy Badges",help:"Display the old, pre-vector chat badges from Twitch.",on_update:function(e){document.body.classList.toggle("ffz-legacy-badges",e)}},s.settings_info.chat_rows={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Backgrounds",help:"Display alternating background colors for lines in chat.",on_update:function(e){document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&e)}},s.settings_info.chat_separators={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Separators",help:"Display thin lines between chat messages for further visual separation.",on_update:function(e){document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&e)}},s.settings_info.chat_padding={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Reduced Chat Line Padding",help:"Reduce the amount of padding around chat messages to fit more on-screen at once.",on_update:function(e){document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&e)}},s.settings_info.high_contrast_chat={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"High Contrast",help:"Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",on_update:function(e){document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&e)}},s.settings_info.chat_font_size={type:"button",value:12,category:"Chat Appearance",no_bttv:!0,name:"Font Size",help:"Make the chat font bigger or smaller.",method:function(){var e=this.settings.chat_font_size,t=prompt("Chat Font Size\n\nPlease enter a new size for the chat font. The default is 12.",e);if(null!==t&&void 0!==t){var s=parseInt(t);(0/0===s||1>s)&&(s=12),this.settings.set("chat_font_size",s)}},on_update:function(e){if(!this.has_bttv&&this._chat_style){var t;if(12===e)t="";else{var s=Math.max(20,Math.round(20/12*e)),n=Math.floor((s-20)/2);t=".ember-chat .chat-messages .chat-line { font-size: "+e+"px !important; line-height: "+s+"px !important; }",n&&(t+=".ember-chat .chat-messages .chat-line .mod-icons, .ember-chat .chat-messages .chat-line .badges { padding-top: "+n+"px; }")}o.update_css(this._chat_style,"chat_font_size",t)}}},s.prototype.setup_line=function(){jQuery(document.body).on("mouseleave",".tipsy",function(){this.parentElement.removeChild(this)});var e=this._chat_style=document.createElement("style");e.id="ffz-style-chat",e.type="text/css",document.head.appendChild(e),s.settings_info.chat_font_size.on_update.bind(this)(this.settings.chat_font_size),document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&this.settings.fix_color),document.body.classList.toggle("ffz-legacy-badges",this.settings.legacy_badges),document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&this.settings.chat_rows),document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&this.settings.chat_separators),document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&this.settings.chat_padding),document.body.classList.toggle("ffz-chat-purge-icon",!this.has_bttv&&this.settings.line_purge_icon),document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&this.settings.high_contrast_chat),this._colors={},this._last_row={},e=this._fix_color_style=document.createElement("style"),e.id="ffz-style-username-colors",e.type="text/css",document.head.appendChild(e),this._twitch_emotes={},this._link_data={},this.log("Hooking the Ember Whisper Line component.");var t=App.__container__.resolve("component:whisper-line");t&&this._modify_line(t),this.log("Hooking the Ember Message Line component.");var o=App.__container__.resolve("component:message-line");o&&this._modify_line(o);var n=this.get_user();n&&n.name&&(s.capitalization[n.login]=[n.name,Date.now()])},s.prototype._modify_line=function(e){var t=this;e.reopen({tokenizedMessage:function(){var e=this.get("msgObject.cachedTokens");if(e)return e;e=this._super();try{var o=performance.now(),n=t.get_user(),i=n&&this.get("msgObject.from")===n.login;e=t._remove_banned(e),e=t._emoticonize(this,e),t.settings.parse_emoji&&(e=t.tokenize_emoji(e));var a=this.get("msgObject.tags.display-name");a&&a.length&&(s.capitalization[this.get("msgObject.from")]=[a.trim(),Date.now()]),i||(e=t.tokenize_mentions(e));for(var r=0;r5&&t.log("Tokenizing Message Took Too Long - "+(u-o)+"ms",e,!1,!0)}catch(c){try{t.error("LineController tokenizedMessage: "+c)}catch(c){}}return this.set("msgObject.cachedTokens",e),e}.property("msgObject.message","isChannelLinksDisabled","currentUserNick","msgObject.from","msgObject.tags.emotes"),ffzUpdated:Ember.observer("msgObject.ffz_deleted","msgObject.ffz_old_messages",function(){this.rerender()}),willClearRender:function(){try{}catch(e){t.error("LineView willClearRender: "+e)}this._super()},click:function(e){if(e.target&&e.target.classList.contains("mod-icon")&&(jQuery(e.target).trigger("mouseout"),e.target.classList.contains("purge"))){var s=this.get("msgObject.from"),o=this.get("msgObject.room"),n=o&&t.rooms[o]&&t.rooms[o].room;return void(n&&(n.send("/timeout "+s+" 1"),n.clearMessages(s)))}return this._super(e)},didInsertElement:function(){this._super();try{var e=performance.now(),i=this.get("element"),a=this.get("msgObject.from"),r=this.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),d=this.get("msgObject.color"),u=this.get("msgObject.ffz_alternate");d&&t._handle_color(d),void 0===u&&(u=t._last_row[r]=t._last_row.hasOwnProperty(r)?!t._last_row[r]:!1,this.set("msgObject.ffz_alternate",u)),i.classList.toggle("ffz-alternate",u||!1),i.classList.toggle("ffz-deleted",t.settings.prevent_clear&&this.get("msgObject.ffz_deleted")||!1),i.setAttribute("data-room",r),i.setAttribute("data-sender",a),i.setAttribute("data-deleted",this.get("msgObject.deleted")||!1);var c=this.get("msgObject.ffz_old_messages");if(c&&c.length){var l=document.createElement("div");l.className="button primary float-right",l.innerHTML="Show "+o.number_commas(c.length)+" Old",l.addEventListener("click",t._show_deleted.bind(t,r)),i.classList.add("clearfix"),i.classList.add("ffz-has-deleted"),this.$(".message").append(l)}if(this.get("isBroadcaster")&&!this.get("controller.parentController.model.isStaff")&&!this.get("controller.parentController.model.isAdmin")||this.get("isModeratorOrHigher")&&!(this.get("controller.parentController.model.isBroadcaster")||this.get("controller.parentController.model.isStaff")||this.get("controller.parentController.model.isAdmin"))){var h=i.querySelector("span.mod-icons");h&&h.classList.add("hidden")}var f=i.querySelector("span.mod-icons a.mod-icon.timeout");if(f){var _=document.createElement("a");_.className="mod-icon float-left tooltip purge",_.innerHTML="Purge",_.title="Purge User (Timeout 1s)",_.href="#",f.title="Timeout User (10m)",f.parentElement.insertBefore(_,f.nextSibling)}t.render_badge(this),this.get("msgObject.ffz_has_mention")&&i.classList.add("ffz-mentioned");for(var m=i.querySelectorAll("span.message a.deleted-link"),p=0;p5&&t.log("Line Took Too Long - "+A+"ms",i.innerHTML,!1,!0)}catch(M){try{t.error("LineView didInsertElement: "+M)}catch(M){}}}})},s.prototype._handle_color=function(e){if(e&&!this._colors[e]){this._colors[e]=!0;var t=parseInt(e.substr(1),16),s=[t>>16,t>>8&255,255&t],n=o.get_luminance(s),i="",a='span[style="color:'+e+'"]',r=!1;if(n>.3){r=!0;for(var d=127,u=s;d--&&(u=o.darken(u),!(o.get_luminance(u)<=.3)););i+=".ffz-chat-colors .ember-chat-container:not(.dark) .chat-line "+a+", .ffz-chat-colors .chat-container:not(.dark) .chat-line "+a+" { color: "+o.rgb_to_css(u)+" !important; }\n"}else i+=".ffz-chat-colors .ember-chat-container:not(.dark) .chat-line "+a+", .ffz-chat-colors .chat-container:not(.dark) .chat-line "+a+" { color: "+e+" !important; }\n";if(.15>n){r=!0;for(var d=127,u=s;d--&&(u=o.brighten(u),!(o.get_luminance(u)>=.15)););i+=".ffz-chat-colors .theatre .chat-container .chat-line "+a+", .ffz-chat-colors .chat-container.dark .chat-line "+a+", .ffz-chat-colors .ember-chat-container.dark .chat-line "+a+" { color: "+o.rgb_to_css(u)+" !important; }\n"}else i+=".ffz-chat-colors .theatre .chat-container .chat-line "+a+", .ffz-chat-colors .chat-container.dark .chat-line "+a+", .ffz-chat-colors .ember-chat-container.dark .chat-line "+a+" { color: "+e+" !important; }\n";r&&(this._fix_color_style.innerHTML+=i)}},s.capitalization={},s._cap_fetching=0,s.get_capitalization=function(e,t){if(!e)return e;if(e=e.toLowerCase(),"jtv"==e||"twitchnotify"==e)return e;var o=s.capitalization[e];return o&&Date.now()-o[1]<36e5?o[0]:(s._cap_fetching<25&&(s._cap_fetching++,s.get().ws_send("get_display_name",e,function(o,n){var i=o?n:e;s.capitalization[e]=[i,Date.now()],s._cap_fetching--,"function"==typeof t&&t(i)})),o?o[0]:e)},s.prototype._remove_banned=function(e){var t=this.settings.banned_words;if(!t||!t.length)return e;"string"==typeof e&&(e=[e]);for(var o=s._words_to_regex(t),n=[],i=0;i<banned link>',own:!0}:a)}return n},s.prototype._emoticonize=function(e,t){var s=e.get("msgObject.room"),o=e.get("msgObject.from");return this.tokenize_emotes(o,s,t)}},{"../constants":3,"../utils":32}],9:[function(t){var s,o=e.FrankerFaceZ,n=t("../utils"),i=t("../constants"),a={ESC:27,P:80,B:66,T:84,U:85},r='',d='',u={},c=function(e){if(1===e)return"Purge";if(u[e])return u[e];var t,s,o,n,i;t=Math.floor(e/604800),i=e%604800,s=Math.floor(i/86400),i%=86400,o=Math.floor(i/3600),i%=3600,n=Math.floor(i/60),i%=60;var a=u[e]=(t?t+"w":"")+(s||t&&(o||n||i)?s+"d":"")+(o||(t||s)&&(n||i)?o+"h":"")+(n||(t||s||o)&&i?n+"m":"")+(i?i+"s":"");return a};try{s=e.require&&e.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(l){}o.settings_info.chat_hover_pause={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Pause Chat Scrolling on Mouse Hover",help:"Automatically prevent the chat from scrolling when moving the mouse over it to prevent moderation mistakes and link mis-clicks.",on_update:function(e){this._roomv&&(e?this._roomv.ffzEnableFreeze():this._roomv.ffzDisableFreeze())}},o.settings_info.short_commands={type:"boolean",value:!0,no_bttv:!0,category:"Chat Moderation",name:"Short Moderation Commands",help:"Use /t, /b, and /u in chat in place of /timeout, /ban, /unban for quicker moderation, and use /p for 1 second timeouts."},o.settings_info.mod_card_hotkeys={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Hotkeys",help:"With a moderation card selected, press B to ban the user, T to time them out for 10 minutes, P to time them out for 1 second, or U to unban them. ESC closes the card."},o.settings_info.mod_card_info={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Additional Information",help:"Display a channel's follower count, view count, and account age on moderation cards."},o.settings_info.mod_card_history={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card History",help:"Display a few of the user's previously sent messages on moderation cards.",on_update:function(e){if(!e&&this.rooms)for(var t in this.rooms){var s=this.rooms[t];s&&(s.user_history=void 0)}}},o.settings_info.mod_card_buttons={type:"button",value:[],category:"Chat Moderation",no_bttv:!0,name:"Moderation Card Additional Buttons",help:"Add additional buttons to moderation cards for running chat commands on those users.",method:function(){for(var e="",t=0;t0&&s.push(i)}this.settings.set("mod_card_durations",s)}}},o.prototype.setup_mod_card=function(){this.log("Modifying Mousetrap stopCallback so we can catch ESC.");var t=Mousetrap.stopCallback;Mousetrap.stopCallback=function(e,s,o){return s.classList.contains("no-mousetrap")?!0:t(e,s,o)},Mousetrap.bind("up up down down left right left right b a enter",function(){var e=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");e&&e.classList.toggle("ffz-flip")}),this.log("Hooking the Ember Moderation Card view.");var o=App.__container__.resolve("component:moderation-card"),u=this;o.reopen({ffzForceRedraw:function(){this.rerender()}.observes("cardInfo.isModeratorOrHigher","cardInfo.user"),ffzRebuildInfo:function(){var e=this.get("element"),t=e&&e.querySelector(".info");if(t){var s=''+i.EYE+" "+n.number_commas(this.get("cardInfo.user.views")||0)+"",o=n.parse_date(this.get("cardInfo.user.created_at")||""),a=this.get("cardInfo.user.ffz_followers");if("number"==typeof a)s+=''+i.HEART+" "+n.number_commas(a||0)+"";else if(void 0===a){var r=this;this.set("cardInfo.user.ffz_followers",!1),Twitch.api.get("channels/"+this.get("cardInfo.user.id")+"/follows",{limit:1}).done(function(e){r.set("cardInfo.user.ffz_followers",e._total),r.ffzRebuildInfo()}).fail(function(){r.set("cardInfo.user.ffz_followers",void 0)})}if(o){var d=Math.floor((Date.now()-o.getTime())/1e3);d>0&&(s+=''+i.CLOCK+" "+n.human_time(d,10)+"")}t.innerHTML=s}}.observes("cardInfo.user.views"),didInsertElement:function(){this._super(),e._card=this;try{if(u.has_bttv)return;var t,o=this.get("element"),i=this.get("controller");if(o.classList.add("ffz-moderation-card"),u.settings.mod_card_info){var l=document.createElement("div"),h=o.querySelector("h3.name");h&&(o.classList.add("ffz-has-info"),l.className="info channel-stats",h.parentElement.insertBefore(l,h.nextSibling),this.ffzRebuildInfo())}if(u.settings.mod_card_buttons&&u.settings.mod_card_buttons.length){t=document.createElement("div"),t.className="extra-interface interface clearfix";for(var f={},m=function(e){var t=i.get("cardInfo.user.id"),s=App.__container__.lookup("controller:chat"),o=s&&s.get("currentRoom");o&&o.send(e.replace(/{user}/g,t))},p=function(e){var t=document.createElement("button"),s=e.split(" ",1)[0],o=f[s]>1?e.split(" ",f[s]):[s];return/^[!~./]/.test(o[0])&&(o[0]=o[0].substr(1)),o=_.map(o,function(e){return e.capitalize()}).join(" "),t.className="button",t.innerHTML=n.sanitize(o),t.title=n.sanitize(e.replace(/{user}/g,i.get("cardInfo.user.id")||"{user}")),jQuery(t).tipsy(),t.addEventListener("click",m.bind(this,e)),t},f={},g=0;g button.message-button");if(L){L.innerHTML="W",L.classList.add("glyph-only"),L.classList.add("message"),L.title="Whisper User",jQuery(L).tipsy();var F=document.createElement("button");F.className="message-button button glyph-only message",F.innerHTML=r,F.title="Message User",jQuery(F).tipsy(),F.addEventListener("click",function(){e.open("http://www.twitch.tv/message/compose?to="+i.get("cardInfo.user.id"))}),L.parentElement.insertBefore(F,L.nextSibling)}if(u.settings.mod_card_history){var S=App.__container__.lookup("controller:chat"),A=S&&S.get("currentRoom"),M=A&&u.rooms&&u.rooms[A.get("id")],R=M&&M.user_history&&M.user_history[i.get("cardInfo.user.id")];if(R&&R.length){var O=document.createElement("ul"),I=!1;O.className="interface clearfix chat-history";for(var g=0;g'+s.getTime(t.date)+" ":"")+''+("action"===t.style?"*"+t.from+" ":"")+u.render_tokens(t.cachedTokens)+"";for(var D=B.querySelectorAll("a.deleted-link"),j=0;jN.bottom){var P=H.bottom-N.bottom;H.top-P>N.top&&(o.style.top=H.top-P+"px")}this.$().draggable({start:function(){o.focus()}}),o.focus()}catch(U){try{u.error("ModerationCardView didInsertElement: "+U)}catch(U){}}}})},o.chat_commands.purge=function(e,t){if(!t||!t.length)return"Purge Usage: /p username [more usernames separated by spaces]";if(t.length>10)return"Please only purge up to 10 users at once.";for(var s=0;s10)return"Please only ban up to 10 users at once.";for(var s=0;s10)return"Please only unban up to 10 users at once.";for(var s=0;s750&&this.ffzUnfreeze()}},ffzUnfreeze:function(){this.ffz_frozen=!1,this._ffz_last_move=0,this.ffzUnwarnPaused(),this.get("stuckToBottom")&&this._scrollToBottom()},ffzMouseDown:function(e){var t=this._$chatMessagesScroller;if(!this.ffz_frozen&&t&&t[0]&&(e.which>0||"mousedown"===e.type||"mousewheel"===e.type)){var s=t[0].scrollHeight-t[0].scrollTop-t[0].offsetHeight;this._setStuckToBottom(10>=s)
-}},ffzMouseOut:function(){this._ffz_outside=!0;var e=this;setTimeout(function(){e._ffz_outside&&e.ffzUnfreeze()},25)},ffzMouseMove:function(e){this._ffz_last_move=Date.now(),this._ffz_outside=!1,(e.screenX!==this._ffz_last_screenx||e.screenY!==this._ffz_last_screeny)&&(this._ffz_last_screenx=e.screenX,this._ffz_last_screeny=e.screenY,this.ffz_frozen||(this.ffz_frozen=!0,this.get("stuckToBottom")&&(this.set("controller.model.messageBufferSize",t.settings.scrollback_length+150),this.ffzWarnPaused())))},_scrollToBottom:_.throttle(function(){var e=this,t=this._$chatMessagesScroller;Ember.run.next(function(){setTimeout(function(){!e.ffz_frozen&&t&&t.length&&(t.scrollTop(t[0].scrollHeight),e._setStuckToBottom(!0))})})},200),_setStuckToBottom:function(e){this.set("stuckToBottom",e),this.get("controller.model")&&this.set("controller.model.messageBufferSize",t.settings.scrollback_length+(e?0:150)),e||this.ffzUnfreeze()},ffzWarnPaused:function(){var e=this.get("element"),t=e&&e.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");if(e){if(!t){t=document.createElement("div"),t.className="more-messages-indicator ffz-freeze-indicator",t.innerHTML="(Chat Paused Due to Mouse Movement)";var s=e.querySelector(".chat-interface");if(!s)return;s.insertBefore(t,s.childNodes[0])}t.classList.remove("hidden")}},ffzUnwarnPaused:function(){var e=this.get("element"),t=e&&e.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");t&&t.classList.add("hidden")}})},s.chat_commands={},s.ffz_commands={},s.prototype.room_message=function(e,t){var s=t.split("\n");if(this.has_bttv)for(var o=0;o300,f=t.length,_=o.get("messages.0.ffz_alternate")||!1;h&&(_=!_);for(var f=t.length;f--;){var m=t[f];if("string"==typeof m.date&&(m.date=n.parse_date(m.date)),m.ffz_alternate=_=!_,m.room||(m.room=e),m.color||(m.color=m.tags&&m.tags.color?m.tags.color:a&&m.from?a.getColor(m.from.toLowerCase()):"#755000"),!m.labels||!m.labels.length){var p=m.labels=[];if(m.tags)if(m.tags.turbo&&p.push("turbo"),m.tags.subscriber&&p.push("subscriber"),m.from===e)p.push("owner");else{var g=m.tags["user-type"];("mod"===g||"staff"===g||"admin"===g||"global_mod"===g)&&p.push(g)}}if(m.style||("jtv"===m.from?m.style="admin":"twitchnotify"===m.from&&(m.style="notification")),m.cachedTokens&&m.cachedTokens.length||this.tokenize_chat_line(m,!0),o.shouldShowMessage(m)){if(!(i.lengthv&&(m.ffz_old_messages=m.ffz_old_messages.slice(m.ffz_old_messages.length-v))}i.unshiftObject(m),r+=1}}if(h){var m={ffz_alternate:!_,color:"#755000",date:new Date,from:"frankerfacez_admin",style:"admin",message:"(Last message is "+n.human_time(l)+" old.)",room:e};if(this.tokenize_chat_line(m),o.shouldShowMessage(m))for(i.insertAt(r,m);i.length>o.get("messageBufferSize");)i.removeAt(0)}}},s.prototype.load_room=function(e,t,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/room/"+e).done(function(s){if(s.sets)for(var o in s.sets)s.sets.hasOwnProperty(o)&&n._load_set_json(o,void 0,s.sets[o]);n._load_room_json(e,t,s)}).fail(function(o){return 404==o.status?"function"==typeof t&&t(!1):(s=(s||0)+1,10>s?n.load_room(e,t,s):"function"==typeof t&&t(!1))})},s.prototype._load_room_json=function(e,t,s){if(!s||!s.room)return"function"==typeof t&&t(!1);s=s.room,this.rooms[e]&&(s.room=this.rooms[e].room);for(var o in this.rooms[e])"room"!==o&&this.rooms[e].hasOwnProperty(o)&&!s.hasOwnProperty(o)&&(s[o]=this.rooms[e][o]);s.needs_history=this.rooms[e]&&this.rooms[e].needs_history||!1,this.rooms[e]=s,(s.css||s.moderator_badge)&&n.update_css(this._room_style,e,i(s)+(s.css||"")),this.emote_sets.hasOwnProperty(s.set)?-1===this.emote_sets[s.set].users.indexOf(e)&&this.emote_sets[s.set].users.push(e):this.load_set(s.set,function(t,s){-1===s.users.indexOf(e)&&s.users.push(e)}),this.update_ui_link(),t&&t(!0,s)},s.prototype._modify_room=function(t){var s=this;t.reopen({subsOnlyMode:!1,r9kMode:!1,slowWaiting:!1,slowValue:0,mru_list:[],updateWait:function(e,t){var o=this.get("slowWait")||0;this.set("slowWait",e),1>o&&e>0?(this._ffz_wait_timer&&clearTimeout(this._ffz_wait_timer),this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3),s._roomv&&s._roomv.ffzUpdateStatus()):(o>0&&1>e||t)&&(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus())},ffzUpdateWait:function(){this._ffz_wait_timer=void 0;var e=this.get("slowWait")||0;1>e||(this.set("slowWait",--e),e>0?this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3):(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus()))},ffzUpdateStatus:function(){s._roomv&&s._roomv.ffzUpdateStatus()}.observes("r9kMode","subsOnlyMode","slowMode","slowValue","ffz_banned"),init:function(){this._super();try{s.add_room(this.id,this),this.set("ffz_chatters",{})}catch(e){s.error("add_room: "+e)}},willDestroy:function(){this._super();try{s.remove_room(this.id)}catch(e){s.error("remove_room: "+e)}},clearMessages:function(e){var t=this;if(e){if(this.get("messages").forEach(function(o,n){o.from===e&&(t.set("messages."+n+".ffz_deleted",!0),s.settings.prevent_clear||t.set("messages."+n+".deleted",!0))}),s.settings.mod_card_history){var o=s.rooms&&s.rooms[t.get("id")],n=o&&o.user_history&&o.user_history[e];if(null!==n&&void 0!==n){var i=!1,a=n.length>0?n[n.length-1]:null;if(i=null!==a&&a.is_delete,!i)for(n.push({from:"jtv",is_delete:!0,style:"admin",cachedTokens:["User has been timed out."],date:new Date});n.length>20;)n.shift()}}}else if(s.settings.prevent_clear)this.addTmiMessage("A moderator's attempt to clear chat was ignored.");else{var r=t.get("messages");t.set("messages",[]),t.addMessage({style:"admin",message:i18n("Chat was cleared by a moderator"),ffz_old_messages:r})}},pushMessage:function(e){if(this.shouldShowMessage(e)){var t,s,o,n=this.get("messageBufferSize");for(this.get("messages").pushObject(e),t=this.get("messages.length"),s=t-n,o=0;s>o;o++)this.get("messages").removeAt(0);"admin"===e.style||"whisper"===e.style&&!this.ffz_whisper_room||this.incrementProperty("unreadCount",1)}},addMessage:function(e){try{if(e){var t="whisper"===e.style;if(s.settings.group_tabs&&s.settings.whisper_room&&(t&&!this.ffz_whisper_room||!t&&this.ffz_whisper_room))return;if(t||(e.room=this.get("id")),s.tokenize_chat_line(e),!t&&e.from&&"jtv"!==e.from&&"twitchnotify"!==e.from&&s.settings.mod_card_history){var o=s.rooms&&s.rooms[e.room];if(o){var n=(o.user_history=o.user_history||{},o.user_history[e.from]=o.user_history[e.from]||[]);for(n.push({from:e.tags&&e.tags["display-name"]||e.from,cachedTokens:e.cachedTokens,style:e.style,date:e.date});n.length>20;)n.shift()}}if(!t){var i=s.get_user();if(i&&i.login===e.from){var a=this.get("ffz_banned");this.set("ffz_banned",!1),this.get("isModeratorOrHigher")||!this.get("slowMode")?this.updateWait(0,a):this.get("slowMode")&&this.updateWait(this.get("slowValue"))}}}}catch(r){s.error("Room addMessage: "+r)}return this._super(e)},setHostMode:function(e){this.set("ffz_host_target",e&&e.hostTarget||null);var t=s.get_user();t&&s._cindex&&this.get("id")===t.login&&s._cindex.ffzUpdateHostButton();var o=App.__container__.lookup("controller:chat");if(o&&o.get("currentChannelRoom")===this)return this._super(e)},send:function(e){if(!(s.settings.group_tabs&&s.settings.whisper_room&&this.ffz_whisper_room)){try{if(e){var t=this.get("mru_list"),o=t.indexOf(e);-1!==o?t.splice(o,1):t.length>20&&t.pop(),t.unshift(e)}var n=e.split(" ",1)[0].toLowerCase();if("/ffz"===n)return this.set("messageToSend",""),void s.run_ffz_command(e.substr(5),this.get("id"));if("/"===n.charAt(0)&&s.run_command(e,this.get("id")))return void this.set("messageToSend","")}catch(i){s.error("send: "+i)}return this._super(e)}},ffzUpdateUnread:function(){if(s.settings.group_tabs){var e=App.__container__.lookup("controller:chat");e&&e.get("currentRoom")===this?this.resetUnreadCount():s._chatv&&s._chatv.ffzTabUnread(this.get("id"))}}.observes("unreadCount"),ffzInitChatterCount:function(){if(this.tmiRoom){var e=this;this.tmiRoom.list().done(function(t){var s={};t=t.data.chatters;for(var o=0;o0),t.set("slowValue",e.slow),t.get("slowMode")||t.updateWait(0)),e.hasOwnProperty("r9k")&&t.set("r9kMode",e.r9k),e.hasOwnProperty("subs-only")&&t.set("subsOnlyMode",e["subs-only"]))}),e._roomConn._connection.off("message",e._roomConn._onIrcMessage,e._roomConn),e._roomConn._onIrcMessage=function(e){if(e.target==this.ircChannel)switch(e.command){case"JOIN":this._session&&this._session.nickname===e.sender?this._onIrcJoin(e):s.settings.chatter_count&&t.ffzUpdateChatters(e.sender);break;case"PART":this._session&&this._session.nickname===e.sender?(this._resetActiveState(),this._connection._exitedRoomConn(),this._trigger("exited")):s.settings.chatter_count&&t.ffzUpdateChatters(null,e.sender)}},e._roomConn._connection.on("message",e._roomConn._onIrcMessage,e._roomConn),this.set("ffz_is_patched",!0)}}.observes("tmiRoom")})}},{"../constants":3,"../utils":32}],11:[function(){var t=e.FrankerFaceZ;t.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");var e=App.__container__.resolve("controller:viewers");this._modify_viewers(e)},t.prototype._modify_viewers=function(e){var s=this;e.reopen({lines:function(){var e=this._super();try{var o=[],n={},i=null,a=App.__container__.lookup("controller:channel"),r=this.get("parentController.model.id"),d=a&&a.get("id");if(d){var u=a.get("display_name");u&&(t.capitalization[d]=[u,Date.now()])}r!=d&&(d=null);for(var c=0;ct?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))};s.prototype.setup_emoticons=function(){this.log("Preparing emoticon system."),this.emoji_data={},this.emoji_names={},this.emote_sets={},this.global_sets=[],this.default_sets=[],this._last_emote_id=0,this.emote_usage={},this.log("Creating emoticon style element.");var e=this._emote_style=document.createElement("style");e.id="ffz-emoticon-css",document.head.appendChild(e),this.log("Loading global emote sets."),this.load_global_sets(),this.log("Loading emoji data."),this.load_emoji_data(),this.log("Watching Twitch emoticon parser to ensure it loads."),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)},s.prototype.add_usage=function(e,t,s){var o=this.emote_usage[t]=this.emote_usage[t]||{};o[e]=(o[e]||0)+(s||1),this._emote_report_scheduled||(this._emote_report_scheduled=setTimeout(this._report_emotes.bind(this),3e4))},s.prototype._report_emotes=function(){this._emote_report_scheduled&&delete this._emote_report_scheduled;var e=this.emote_usage;this.emote_usage={},this.ws_send("emoticon_uses",[e],function(){},!0)},s.prototype.check_twitch_emotes=function(){this._twitch_emote_check&&(clearTimeout(this._twitch_emote_check),delete this._twitch_emote_check);var e;if(this.rooms)for(var t in this.rooms)if(this.rooms.hasOwnProperty(t)){e=this.rooms[t];break}if(!e||!e.room||!e.room.tmiSession)return void(this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4));var s=e.room.tmiSession._emotesParser,o=Object.keys(s.emoticonRegexToIds).length;if(!(o>0)){var n=s.emoticonSetIds;s.emoticonSetIds="",s.updateEmoticons(n),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)}},s.prototype.getEmotes=function(e,t){var s=this.users&&this.users[e],o=this.rooms&&this.rooms[t];return _.union(s&&s.sets||[],o&&o.set&&[o.set]||[],o&&o.extra_sets||[],this.default_sets)},s.ws_commands.reload_set=function(e){this.emote_sets.hasOwnProperty(e)&&this.load_set(e)},s.ws_commands.load_set=function(e){this.load_set(e)},s.prototype._emote_tooltip=function(e){if(!e)return null;if(e._tooltip)return e._tooltip;var t=this.emote_sets[e.set_id],s=e.owner,o=t&&t.title||"Global";return e._tooltip="Emoticon: "+(e.hidden?"???":e.name)+"\nFFZ "+o+(s?"\nBy: "+s.display_name:""),e._tooltip},s.prototype.load_emoji_data=function(e,t){var s=this;jQuery.getJSON(o.SERVER+"emoji/emoji.json").done(function(t){var n={},i={};for(var a in t){var r=t[a];a=a.toLowerCase(),r.code=a,n[a]=r,i[r.short_name]=a,r.raw=_.map(r.code.split("-"),d).join(""),r.src=o.SERVER+"emoji/"+a+"-1x.png",r.srcSet=r.src+" 1x, "+o.SERVER+"emoji/"+a+"-2x.png 2x, "+o.SERVER+"emoji/"+a+"-4x.png 4x",r.token={srcSet:r.srcSet,emoticonSrc:r.src+'" data-ffz-emoji="'+a+'" height="18px',ffzEmoji:a,altText:r.raw}}s.emoji_data=n,s.emoji_names=i,s.log("Loaded data on "+Object.keys(n).length+" emoji."),"function"==typeof e&&e(!0,t)}).fail(function(o){return 404===o.status?"function"==typeof e&&e(!1):(t=(t||0)+1,50>t?s.load_emoji(e,t):"function"==typeof e&&e(!1))})},s.prototype.load_global_sets=function(e,t){var s=this;jQuery.getJSON(((t||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/global").done(function(e){s.default_sets=e.default_sets;var t=s.global_sets=[],o=e.sets||{};s.feature_friday&&s.feature_friday.set&&(-1===s.global_sets.indexOf(s.feature_friday.set)&&s.global_sets.push(s.feature_friday.set),-1===s.default_sets.indexOf(s.feature_friday.set)&&s.default_sets.push(s.feature_friday.set));for(var n in o)if(o.hasOwnProperty(n)){var i=o[n];t.push(n),s._load_set_json(n,void 0,i)}}).fail(function(o){return 404==o.status?"function"==typeof e&&e(!1):(t=t||0,t++,50>t?s.load_global_sets(e,t):"function"==typeof e&&e(!1))})},s.prototype.load_set=function(e,t,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/"+e).done(function(s){n._load_set_json(e,t,s&&s.set)}).fail(function(o){return 404==o.status?"function"==typeof t&&t(!1):(s=s||0,s++,10>s?n.load_set(e,t,s):"function"==typeof t&&t(!1))})},s.prototype.unload_set=function(e){var t=this.emote_sets[e];t&&(this.log("Unloading emoticons for set: "+e),n.update_css(this._emote_style,e,null),delete this.emote_sets[e])},s.prototype._load_set_json=function(e,t,s){if(!s)return"function"==typeof t&&t(!1);var o=this.emote_sets[e]&&this.emote_sets[e].users||[];this.emote_sets[e]=s,s.users=o,s.count=0;var i="",a=s.emoticons;s.emoticons={};for(var d=0;d=6e4?this.log("BetterTTV was not detected after 60 seconds."):setTimeout(this.find_bttv.bind(this,t,(s||0)+t),t))},s.prototype.setup_bttv=function(e){this.log("BetterTTV was detected after "+e+"ms. Hooking."),this.has_bttv=!0,document.body.classList.remove("ffz-dark"),this._dark_style&&(this._dark_style.parentElement.removeChild(this._dark_style),this._dark_style=void 0),this._chat_style&&(this._chat_style.parentElement.removeChild(this._chat_style),this._chat_style=void 0),this.settings.group_tabs&&this._chatv&&this._chatv.ffzDisableTabs(),this._roomv&&(this.settings.chat_hover_pause&&this._roomv.ffzDisableFreeze(),this.settings.room_status&&this._roomv.ffzUpdateStatus()),document.body.classList.remove("ffz-chat-colors"),document.body.classList.remove("ffz-chat-background"),document.body.classList.remove("ffz-chat-padding"),document.body.classList.remove("ffz-chat-separator"),document.body.classList.remove("ffz-sidebar-swap"),document.body.classList.remove("ffz-transparent-badges"),document.body.classList.remove("ffz-high-contrast-chat"),this.settings.following_count&&(this._schedule_following_count(),this._draw_following_count()),this.is_dashboard&&this._update_subscribers(),document.body.classList.add("ffz-bttv");var t=BetterTTV.chat.helpers.sendMessage,s=this;BetterTTV.chat.helpers.sendMessage=function(e){var o=e.split(" ",1)[0].toLowerCase();return"/ffz"!==o?t(e):void s.run_ffz_command(e.substr(5),BetterTTV.chat.store.currentRoom)};var i,a=BetterTTV.chat.handlers.onPrivmsg;BetterTTV.chat.handlers.onPrivmsg=function(e,t){i=e;var s=a(e,t);return i=null,s};var r=BetterTTV.chat.templates.privmsg;BetterTTV.chat.templates.privmsg=function(e,t,o,n,a){try{return s.bttv_badges(a),'
"}catch(t){return s.log("Error: ",t),d(e)}};var u,c=BetterTTV.chat.templates.message;BetterTTV.chat.templates.message=function(e,t,o,n){try{n=n||!1;var i=encodeURIComponent(t);if("jtv"!==e){u=e;var a=BetterTTV.chat.templates.emoticonize(t,o);u=null;for(var r=0;r'+t+""}catch(d){return s.log("Error: ",d),c(e,t,o,n)}};var l=BetterTTV.chat.templates.emoticonize;BetterTTV.chat.templates.emoticonize=function(e,t){var a=l(e,t),r=i||BetterTTV.getChannel(),d=r&&r.toLowerCase(),c=u&&u.toLowerCase(),h=s.getEmotes(c,d),t=[],f=s.get_user(),m=f&&f.login===c;if(_.each(h,function(e){var o=s.emote_sets[e];o&&_.each(o.emoticons,function(e){_.any(a,function(t){return _.isString(t)&&t.match(e.regex)})&&t.push(e)})}),t.length&&_.each(t,function(e){var t=s._emote_tooltip(e),o=[''],n=a;a=[];for(var i=0;i']:w+(z||""))}}}else a.push(v)}}return a},this.update_ui_link()}},{"../constants":3,"../utils":32}],14:[function(){var t=e.FrankerFaceZ;t.prototype.find_emote_menu=function(t,s){return this.has_emote_menu=!1,e.emoteMenu&&emoteMenu.registerEmoteGetter?this.setup_emote_menu(s||0):void(s>=6e4?this.log("Emote Menu for Twitch was not detected after 60 seconds."):setTimeout(this.find_emote_menu.bind(this,t,(s||0)+t),t))},t.prototype.setup_emote_menu=function(e){this.log("Emote Menu for Twitch was detected after "+e+"ms. Registering emote enumerator."),emoteMenu.registerEmoteGetter("FrankerFaceZ",this._emote_menu_enumerator.bind(this))},t.prototype._emote_menu_enumerator=function(){for(var e=this.get_user(),s=e?e.login:null,o=App.__container__.lookup("controller:chat"),n=o?o.get("currentRoom.id"):null,i=this.getEmotes(s,n),a=[],r=0;r=6e4?this.log('Twitch application not detected in "'+location.toString()+'". Aborting.'):setTimeout(this.initialize.bind(this,t,(s||0)+t),t)))},s.prototype.setup_normal=function(t,o){var n=e.performance&&performance.now?performance.now():Date.now();this.log("Found non-Ember Twitch after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;try{this.embed_in_dash=e.top!==e&&/\/[^\/]+\/dashboard/.test(e.top.location.pathname)&&!/bookmarks$/.test(e.top.location.pathname)}catch(i){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),o||this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_following_count(!1),this.setup_css(),this.setup_menu(),this.find_bttv(10);var a=e.performance&&performance.now?performance.now():Date.now(),r=a-n;this.log("Initialization complete in "+r+"ms")},s.prototype.is_dashboard=!1,s.prototype.setup_dashboard=function(t){var o=e.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch Dashboard after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!0,this.embed_in_dash=!1,this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_css(),this._update_subscribers(),this.setup_message_event(),this.find_bttv(10);var n=e.performance&&performance.now?performance.now():Date.now(),i=n-o;this.log("Initialization complete in "+i+"ms")},s.prototype.setup_ember=function(t){var o=e.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch application after "+(t||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;
-try{this.embed_in_dash=e.top!==e&&/\/[^\/]+\/dashboard/.test(e.top.location.pathname)&&!/bookmarks$/.test(e.top.location.pathname)}catch(n){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_channel(),this.setup_room(),this.setup_line(),this.setup_chatview(),this.setup_viewers(),this.setup_mod_card(),this.setup_chat_input(),this.setup_notifications(),this.setup_css(),this.setup_menu(),this.setup_my_emotes(),this.setup_following(),this.setup_following_count(!0),this.setup_races(),this.connect_extra_chat(),this.find_bttv(10),this.find_emote_menu(10),this.check_ff();var i=e.performance&&performance.now?performance.now():Date.now(),a=i-o;this.log("Initialization complete in "+a+"ms")},s.prototype.setup_message_event=function(){this.log("Listening for Window Messages."),e.addEventListener("message",this._on_window_message.bind(this),!1)},s.prototype._on_window_message=function(e){if(e.data&&e.data.from_ffz){e.data}}},{"./badges":1,"./commands":2,"./debug":4,"./ember/channel":5,"./ember/chat-input":6,"./ember/chatview":7,"./ember/line":8,"./ember/moderation-card":9,"./ember/room":10,"./ember/viewers":11,"./emoticons":12,"./ext/betterttv":13,"./ext/emote_menu":14,"./featurefriday":16,"./settings":17,"./socket":18,"./tokenize":19,"./ui/about_page":20,"./ui/dark":21,"./ui/following":23,"./ui/following-count":22,"./ui/menu":24,"./ui/menu_button":25,"./ui/my_emotes":26,"./ui/notifications":27,"./ui/races":28,"./ui/styles":29,"./ui/sub_count":30,"./ui/viewer_count":31}],16:[function(t){var s=e.FrankerFaceZ,o=t("./constants");s.prototype.feature_friday=null,s.prototype.check_ff=function(e){e||this.log("Checking for Feature Friday data..."),jQuery.ajax(o.SERVER+"script/event.json",{cache:!1,dataType:"json",context:this}).done(function(e){return this._load_ff(e)}).fail(function(t){return 404==t.status?this._load_ff(null):(e=e||0,e++,10>e?setTimeout(this.check_ff.bind(this,e),250):this._load_ff(null))})},s.ws_commands.reload_ff=function(){this.check_ff()},s.prototype._feature_friday_ui=function(e,t,s){if(this.feature_friday&&this.feature_friday.channel!=e){this._emotes_for_sets(t,s,[this.feature_friday.set],this.feature_friday.title,this.feature_friday.icon,"FrankerFaceZ");var o=App.__container__.lookup("controller:channel");if(!o||o.get("id")!=this.feature_friday.channel){var n=this.feature_friday,i=document.createElement("div"),a=document.createElement("a");i.className="chat-menu-content",i.style.textAlign="center";var r=n.display_name+(n.live?" is live now!":"");a.className="button primary",a.classList.toggle("live",n.live),a.classList.toggle("blue",this.has_bttv&&BetterTTV.settings.get("showBlueButtons")),a.href="http://www.twitch.tv/"+n.channel,a.title=r,a.target="_new",a.innerHTML=""+r+"",i.appendChild(a),t.appendChild(i)}}},s.prototype._load_ff=function(e){this.feature_friday&&(this.global_sets.removeObject(this.feature_friday.set),this.default_sets.removeObject(this.feature_friday.set),this.feature_friday=null,this.update_ui_link()),e&&e.set&&e.channel&&(this.feature_friday={set:e.set,channel:e.channel,live:!1,title:e.title||"Feature Friday",display_name:s.get_capitalization(e.channel,this._update_ff_name.bind(this))},this.global_sets.push(e.set),this.default_sets.push(e.set),this.load_set(e.set),this._update_ff_live())},s.prototype._update_ff_live=function(){if(this.feature_friday){var e=this;Twitch.api.get("streams/"+this.feature_friday.channel).done(function(t){e.feature_friday.live=null!=t.stream,e.update_ui_link()}).always(function(){e.feature_friday.timer=setTimeout(e._update_ff_live.bind(e),12e4)})}},s.prototype._update_ff_name=function(e){this.feature_friday&&(this.feature_friday.display_name=e)}},{"./constants":3}],17:[function(t){var s=e.FrankerFaceZ,o=t("./constants");make_ls=function(e){return"ffz_setting_"+e},toggle_setting=function(e,t){var s=!this.settings.get(t);this.settings.set(t,s),e.classList.toggle("active",s)},s.settings_info={},s.prototype.load_settings=function(){this.log("Loading settings."),this.settings={};for(var t in s.settings_info)if(s.settings_info.hasOwnProperty(t)){var o=s.settings_info[t],n=o.storage_key||make_ls(t),i=o.hasOwnProperty("value")?o.value:void 0;if(localStorage.hasOwnProperty(n))try{i=JSON.parse(localStorage.getItem(n))}catch(a){this.log('Error loading value for "'+t+'": '+a)}this.settings[t]=i}this.settings.get=this._setting_get.bind(this),this.settings.set=this._setting_set.bind(this),this.settings.del=this._setting_del.bind(this),e.addEventListener("storage",this._setting_update.bind(this),!1)},s.menu_pages.settings={render:function(e,t){var o={},n=[];for(var i in s.settings_info)if(s.settings_info.hasOwnProperty(i)){var a=s.settings_info[i],r=a.category||"Miscellaneous",d=o[r];if(void 0!==a.visible&&null!==a.visible){var u=a.visible;if("function"==typeof a.visible&&(u=a.visible.bind(this)()),!u)continue}d||(n.push(r),d=o[r]=[]),d.push([i,a])}n.sort(function(e,t){var e=e.toLowerCase(),t=t.toLowerCase();return"debugging"===e&&(e="zzz"+e),"debugging"===t&&(t="zzz"+t),t>e?-1:e>t?1:0});for(var c=this,l=this._ffz_settings_page||n[0],h=0;hs?-1:s>o?1:i>n?-1:n>i?1:0});for(var g=0;g<_.length;g++){var i=_[g][0],a=_[g][1],v=document.createElement("p"),b=this.settings.get(i);if(v.className="clearfix",this.has_bttv&&a.no_bttv){var y=document.createElement("span"),w=document.createElement("span");y.className="switch-label",y.innerHTML=a.name,w=document.createElement("span"),w.className="help",w.innerHTML="Disabled due to incompatibility with BetterTTV.",v.classList.add("disabled"),v.appendChild(y),v.appendChild(w)}else{if("boolean"==a.type){var z=document.createElement("a"),y=document.createElement("span");z.className="switch",z.classList.toggle("active",b),z.innerHTML="",y.className="switch-label",y.innerHTML=a.name,v.appendChild(z),v.appendChild(y),z.addEventListener("click",toggle_setting.bind(this,z,i))}else{v.classList.add("option");var k=document.createElement("a");k.innerHTML=a.name,k.href="#",v.appendChild(k),k.addEventListener("click",a.method.bind(this))}if(a.help){var w=document.createElement("span");w.className="help",w.innerHTML=a.help,v.appendChild(w)}}m.appendChild(v)}t.appendChild(m)}},name:"Settings",icon:o.GEAR,sort_order:99999,wide:!0},s.prototype._setting_update=function(t){if(t||(t=e.event),t.key&&"ffz_setting_"===t.key.substr(0,12)){var o=t.key,n=o.substr(12),i=void 0,a=s.settings_info[n];if(!a){for(n in s.settings_info)if(s.settings_info.hasOwnProperty(n)&&(a=s.settings_info[n],a.storage_key==o))break;if(a.storage_key!=o)return}this.log("Updated Setting: "+n);try{i=JSON.parse(t.newValue)}catch(r){this.log('Error loading new value for "'+n+'": '+r),i=a.value||void 0}if(this.settings[n]=i,a.on_update)try{a.on_update.bind(this)(i,!1)}catch(r){this.log('Error running updater for setting "'+n+'": '+r)}}},s.prototype._setting_get=function(e){return this.settings[e]},s.prototype._setting_set=function(e,t){var o=s.settings_info[e],n=o.storage_key||make_ls(e),i=JSON.stringify(t);if(this.settings[e]=t,localStorage.setItem(n,i),this.log('Changed Setting "'+e+'" to: '+i),o.on_update)try{o.on_update.bind(this)(t,!0)}catch(a){this.log('Error running updater for setting "'+e+'": '+a)}},s.prototype._setting_del=function(e){var t=s.settings_info[e],o=t.storage_key||make_ls(e),n=void 0;if(localStorage.hasOwnProperty(o)&&localStorage.removeItem(o),delete this.settings[e],t&&(n=this.settings[e]=t.hasOwnProperty("value")?t.value:void 0),t.on_update)try{t.on_update.bind(this)(n,!0)}catch(i){this.log('Error running updater for setting "'+e+'": '+i)}}},{"./constants":3}],18:[function(){var t=e.FrankerFaceZ;t.prototype._ws_open=!1,t.prototype._ws_delay=0,t.ws_commands={},t.ws_on_close=[],t.prototype.ws_create=function(){var s,o=this;this._ws_last_req=0,this._ws_callbacks={},this._ws_pending=this._ws_pending||[];try{s=this._ws_sock=new WebSocket("ws://catbag.frankerfacez.com/")}catch(n){return this._ws_exists=!1,this.log("Error Creating WebSocket: "+n)}this._ws_exists=!0,s.onopen=function(){o._ws_open=!0,o._ws_delay=0,o.log("Socket connected.");var s=e.RequestFileSystem||e.webkitRequestFileSystem;s?s(e.TEMPORARY,100,o.ws_send.bind(o,"hello",["ffz_"+t.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o)),o.log.bind(o,"Operating in Incognito Mode.")):o.ws_send("hello",["ffz_"+t.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o));var n=o.get_user();if(n&&o.ws_send("setuser",n.login),o.is_dashboard){var i=location.pathname.match(/\/([^\/]+)/);i&&(o.ws_send("sub",i[1]),o.ws_send("sub_channel",i[1]))}for(var a in o.rooms)o.rooms.hasOwnProperty(a)&&o.rooms[a]&&(o.ws_send("sub",a),o.rooms[a].needs_history&&(o.rooms[a].needs_history=!1,!o.has_bttv&&o.settings.chat_history&&o.ws_send("chat_history",[a,25],o._load_history.bind(o,a))));if(o._cindex){var r=o._cindex.get("controller.id"),d=o._cindex.get("controller.hostModeTarget.id");r&&o.ws_send("sub_channel",r),d&&o.ws_send("sub_channel",d)}var u=o._ws_pending;o._ws_pending=[];for(var c=0;c!-#%-\\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]";new RegExp(d+"*,"+d+"*")}try{s=e.require&&e.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(u){}o.SRC_IDS={},o.src_to_id=function(e){if(o.SRC_IDS.hasOwnProperty(e))return o.SRC_IDS[e];var t=/\/emoticons\/v1\/(\d+)\/1\.0/.exec(e),s=t?parseInt(t[1]):null;return 0/0===s&&(s=null),o.SRC_IDS[e]=s,s};var c=new Date(0).toLocaleTimeString().toUpperCase();o.settings_info.twenty_four_timestamps={type:"boolean",value:-1===c.lastIndexOf("PM")&&-1===c.lastIndexOf("AM"),category:"Chat Appearance",no_bttv:!0,name:"24hr Timestamps",help:"Display timestamps in chat in the 24 hour format rather than 12 hour."},s&&(s.getTime=function(e){var t=e.getHours(),s=e.getMinutes();return t>12&&!o.get().settings.twenty_four_timestamps?t-=12:0!==t||o.get().settings.twenty_four_timestamps||(t=12),t+":"+(10>s?"0":"")+s}),o.prototype.tokenize_chat_line=function(t,n){if(t.cachedTokens)return t.cachedTokens;var i=t.message,a=this.get_user(),r=t.room,d=a&&t.from===a.login,u=t.tags&&t.tags.emotes,c=[i];c=s.linkifyMessage(c),a&&a.login&&(c=s.mentionizeMessage(c,a.login,d)),c=s.emoticonizeMessage(c,u),this.settings.replace_bad_emotes&&(c=this.tokenize_replace_emotes(c)),c=this._remove_banned(c),c=this.tokenize_emotes(t.from,r,c,d),this.settings.parse_emoji&&(c=this.tokenize_emoji(c));var l=t.tags&&t.tags["display-name"];if(l&&l.length&&(o.capitalization[t.from]=[l.trim(),Date.now()]),!d){c=this.tokenize_mentions(c);for(var h=0;h'}if(e.isLink){if(!t&&void 0!==t)return e.href;var h=e.href;if(h.indexOf("@")>-1&&(-1===h.indexOf("/")||h.indexOf("@")'+h+"";var f=(h.match(/^https?:\/\//)?"":"http://")+h,l=s._link_data&&s._link_data[f]||{};return''+h+""}return e.mentionedUser?''+e.mentionedUser+"":n.sanitize(e.deletedLink?e.text:e)}).join("")},o.prototype.tokenize_replace_emotes=function(e){_.isString(e)&&(e=[e]);for(var t=0;t-1&&(-1===t.indexOf("/")||t.indexOf("@")0&&(n=!0)}var r=document.createElement("div"),d="";d+="
FrankerFaceZ
",d+='
new ways to woof
',r.className="chat-menu-content center",r.innerHTML=d,t.appendChild(r);var u=0,c=r.querySelector("h1");c&&c.addEventListener("click",function(){if(c.style.cursor="pointer",u++,u>=3){u=0;var e=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");e&&e.classList.toggle("ffz-flip")}setTimeout(function(){u=0,c.style.cursor=""},2e3)});var l=document.createElement("div"),h=document.createElement("a"),f="To use custom emoticons in "+(n?"this channel":"tons of channels")+", get FrankerFaceZ from http://www.frankerfacez.com";h.className="button primary",h.innerHTML="Advertise in Chat",h.addEventListener("click",this._add_emote.bind(this,e,f)),l.appendChild(h);var _=document.createElement("a");_.className="button ffz-donate",_.href="https://www.frankerfacez.com/donate",_.target="_new",_.innerHTML="Donate",l.appendChild(_),l.className="chat-menu-content center",t.appendChild(l);var m=document.createElement("div");d='
',m.className="chat-menu-content center",m.innerHTML=d;var p=!1;m.querySelector("#ffz-debug-logs").addEventListener("click",function(){p||(p=!0,i._pastebin(i._log_data.join("\n"),function(e){p=!1,e?prompt("Your FrankerFaceZ logs have been uploaded to the URL:",e):alert("There was an error uploading the FrankerFaceZ logs.")}))}),t.appendChild(m)}}},{"../constants":3}],21:[function(t){var s=e.FrankerFaceZ,o=t("../constants");s.settings_info.twitch_chat_dark={type:"boolean",value:!1,visible:!1},s.settings_info.dark_twitch={type:"boolean",value:!1,no_bttv:!0,category:"Appearance",name:"Dark Twitch",help:"Apply a dark background to channels and other related pages for easier viewing.",on_update:function(t){var s=document.querySelector("input.ffz-setting-dark-twitch");if(s&&(s.checked=t),!this.has_bttv){document.body.classList.toggle("ffz-dark",t);var o=e.App?App.__container__.lookup("controller:settings").get("model"):void 0;t?(this._load_dark_css(),o&&this.settings.set("twitch_chat_dark",o.get("darkMode")),o&&o.set("darkMode",!0)):o&&o.set("darkMode",this.settings.twitch_chat_dark)}}},s.settings_info.dark_no_blue={type:"boolean",value:!1,category:"Appearance",name:"Gray Chat (no blue)",help:"Make the dark theme for chat and a few other places on Twitch a bit darker and not at all blue.",on_update:function(e){document.body.classList.toggle("ffz-no-blue",e)}},s.settings_info.hide_recent_past_broadcast={type:"boolean",value:!1,category:"Channel Metadata",name:'Hide "Watch Last Broadcast"',help:'Hide the "Watch Last Broadcast" banner at the top of offline Twitch channels.',on_update:function(e){document.body.classList.toggle("ffz-hide-recent-past-broadcast",e)}},s.prototype.setup_dark=function(){document.body.classList.toggle("ffz-hide-recent-past-broadcast",this.settings.hide_recent_past_broadcast),document.body.classList.toggle("ffz-no-blue",this.settings.dark_no_blue),this.has_bttv||(document.body.classList.toggle("ffz-dark",this.settings.dark_twitch),this.settings.dark_twitch&&(e.App&&App.__container__.lookup("controller:settings").set("model.darkMode",!0),this._load_dark_css()))},s.prototype._load_dark_css=function(){if(!this._dark_style){this.log("Injecting FrankerFaceZ Dark Twitch CSS.");var e=this._dark_style=document.createElement("link");e.id="ffz-dark-css",e.setAttribute("rel","stylesheet"),e.setAttribute("href",o.SERVER+"script/dark.css?_="+(o.DEBUG?Date.now():s.version_info)),document.head.appendChild(e)}}},{"../constants":3}],22:[function(t){var s=e.FrankerFaceZ,o=t("../utils");s.settings_info.following_count={type:"boolean",value:!0,no_bttv:!0,category:"Appearance",name:"Sidebar Following Count",help:"Display the number of live channels you're following on the sidebar.",on_update:function(){this._schedule_following_count();var t=e.App&&App.__container__.resolve("model:stream"),s=t&&t.find("live");s?this._draw_following_count(s.get("total")||0):this._update_following_count()}},s.prototype.setup_following_count=function(t){if(this.settings.following_count&&this._schedule_following_count(),!t)return this._update_following_count();this.log("Connecting to Live Streams model.");var s=e.App&&App.__container__.resolve("model:stream");if(!s)return this.log("Unable to find Stream model.");var o=s.find("live"),n=this;if(!o)return this.log("Unable to find Live Streams collection.");o.addObserver("total",function(){n._draw_following_count(this.get("total"))}),o.load();var i=o.get("total");"number"==typeof i&&this._draw_following_count(i)},s.prototype._schedule_following_count=function(){return this.has_bttv||!this.settings.following_count?void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0)):void(this._following_count_timer||(this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4)))},s.prototype._update_following_count=function(){if(!this.settings.following_count)return void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0));this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4);var t=e.App&&App.__container__.resolve("model:stream"),s=t&&t.find("live"),o=this;s?s.load():Twitch.api.get("streams/followed",{limit:1,offset:0},{version:3}).done(function(e){o._draw_following_count(e._total)}).fail(function(){o._draw_following_count()})},s.prototype._draw_following_count=function(e){var t=document.querySelector('#small_nav ul.game_filters li[data-name="following"] a');if(t){var s=t.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",t.appendChild(s)),s.innerHTML=e?o.format_unread(e):"")}var n=document.querySelector('#large_nav #nav_personal li[data-name="following"] a');if(n){var s=n.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",n.appendChild(s)),s.innerHTML=e?o.format_unread(e):"")}var i=document.querySelector("#header_actions #header_following");if(i){var s=i.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",i.appendChild(s)),s.innerHTML=e?o.format_unread(e):"")}}},{"../utils":32}],23:[function(t){{var s=e.FrankerFaceZ;t("../utils")}s.prototype.setup_following=function(){this.log("Initializing following support."),this.follow_data={},this.follow_sets={}},s.settings_info.follow_buttons={type:"boolean",value:!0,category:"Channel Metadata",name:"Relevant Follow Buttons",help:"Display additional Follow buttons for channels relevant to the stream, such as people participating in co-operative gameplay.",on_update:function(){this.rebuild_following_ui()}},s.ffz_commands.following=function(e,t){t=t.join(" ").trim().split(/\s*,+\s*/),t.length&&""===t[0]&&t.shift(),t.length&&""===t[t.length-1]&&t.pop();var s=this.get_user(),o=this;return!s||s.login!==e.id&&"sirstendec"!==s.login&&"dansalvato"!==s.login?"You must be logged in as the broadcaster to use this command.":this.ws_send("update_follow_buttons",[e.id,t],function(t,s){return t?void(s?o.room_message(e,"The following buttons have been updated."):o.room_message(e,"The following buttons have been disabled.")):void o.room_message(e,"There was an error updating the following buttons.")})?void 0:"There was an error communicating with the server."},s.ws_on_close.push(function(){var t=e.App&&App.__container__.lookup("controller:channel"),s=t&&t.get("id"),o=t&&t.get("hostModeTarget.id"),n=!1;if(this.follow_sets={},t){for(var i in this.follow_data)if(delete this.follow_data[i],(i===s||i===o)&&(n=!0),this.rooms&&this.rooms[i]&&this.rooms[i].extra_sets){var a=this.rooms[i].extra_sets;delete this.rooms[i].extra_sets;for(var r=0;r span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d=300?"right":"left")+" dropmenu notify-menu js-notify",i='
You are following '+s.get_capitalization(t)+"
",i+='
',i+='',i+='Notify me when the broadcaster goes live',i+="
",n.innerHTML=i,e.appendChild(n),n.querySelector("a.switch"))}},{"../utils":32}],24:[function(t){var s=e.FrankerFaceZ,o=t("../constants"),n=t("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.prototype.setup_menu=function(){this.log("Installing mouse-up event to auto-close menus.");var t=this;jQuery(document).mouseup(function(e){var s,o=t._popup;o&&(o=jQuery(o),s=o.parent(),s.is(e.target)||0!==s.has(e.target).length||(o.remove(),delete t._popup,t._popup_kill&&t._popup_kill(),delete t._popup_kill))}),document.body.classList.toggle("ffz-menu-replace",this.settings.replace_twitch_menu),this.log("Hooking the Ember Chat Settings view.");var s=e.App&&App.__container__.resolve("view:settings");if(s){s.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(e){t.error("ChatSettings didInsertElement: "+e)}},willClearRender:function(){try{this.ffzTeardown()}catch(e){t.error("ChatSettings willClearRender: "+e)}this._super()},ffzInit:function(){var e=this,s=this.get("element"),o=s&&s.querySelector(".dropmenu");if(o){var n,i,a,r=document.createElement("div"),d=document.createElement("div");r.className="list-header",r.innerHTML="FrankerFaceZ",d.className="chat-menu-content",n=document.createElement("p"),n.className="no-bttv",i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-dark-twitch",i.checked=t.settings.dark_twitch,n.appendChild(i),n.appendChild(document.createTextNode("Dark Twitch")),d.appendChild(n),i.addEventListener("change",function(){t.settings.set("dark_twitch",this.checked)}),n=document.createElement("p"),i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-hosted-channels",i.checked=t.settings.hosted_channels,n.appendChild(i),n.appendChild(document.createTextNode("Channel Hosting")),d.appendChild(n),i.addEventListener("change",function(){t.settings.set("hosted_channels",this.checked)}),n=document.createElement("p"),a=document.createElement("a"),a.href="#",a.innerHTML="More Settings",n.appendChild(a),d.appendChild(n),a.addEventListener("click",function(s){return e.set("controller.model.hidden",!0),t._last_page="settings",t.build_ui_popup(t._chatv),s.stopPropagation(),!1}),o.appendChild(r),o.appendChild(d)}},ffzTeardown:function(){}});try{s.create().destroy()}catch(o){}for(var n in Ember.View.views)if(Ember.View.views.hasOwnProperty(n)){var i=Ember.View.views[n];if(i instanceof s){this.log("Manually updating existing Chat Settings view.",i);try{i.ffzInit()}catch(o){this.error("setup: ChatSettings ffzInit: "+o)}}}}},s.menu_pages={},s.prototype.build_ui_popup=function(e){var t=this._popup;if(t)return t.parentElement.removeChild(t),delete this._popup,this._popup_kill&&this._popup_kill(),void delete this._popup_kill;var n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("ul"),r=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1;n.className="emoticon-selector chat-menu ffz-ui-popup",i.className="emoticon-selector-box dropmenu",n.appendChild(i),n.classList.toggle("dark",r);var d=document.createElement("div");d.className="ffz-ui-menu-page",i.appendChild(d),a.className="menu clearfix",i.appendChild(a);var u=document.createElement("li");u.className="title",u.innerHTML=""+(o.DEBUG?"[DEV] ":"")+"FrankerFaceZ",a.appendChild(u);var c=[];for(var l in s.menu_pages)if(s.menu_pages.hasOwnProperty(l)){var h=s.menu_pages[l];try{if(!h||h.hasOwnProperty("visible")&&(!h.visible||"function"==typeof h.visible&&!h.visible.bind(this)(e)))continue}catch(f){this.error("menu_pages "+l+" visible: "+f);continue}c.push([h.sort_order||0,l,h])}c.sort(function(e,t){if(e[0]t[0])return-1;var s=e[1].toLowerCase(),o=t[1].toLowerCase();return o>s?1:s>o?-1:0});for(var _=0;_0,u&&!c&&!l){var p=this;u.addObserver("isLoaded",function(){setTimeout(function(){"channel"===t.getAttribute("data-page")&&(t.innerHTML="",s.menu_pages.channel.render.bind(p)(e,t))},0)}),u.load()}f.className="emoticon-grid",_.className="heading",h&&(_.style.backgroundImage='url("'+h+'")'),_.innerHTML='TwitchSubscriber Emoticons',f.appendChild(_);for(var g=d.get("emoticons")||[],v=0;v0&&t.appendChild(f),m>0&&!c){var k=document.createElement("div"),E=document.createElement("div"),C=document.createElement("span"),T=document.createElement("a");k.className="subscribe-message",E.className="non-subscriber-message",k.appendChild(E),C.className="unlock-text",C.innerHTML="Subscribe to unlock Emoticons",E.appendChild(C),T.className="action subscribe-button button primary",T.href=d.get("product_url"),T.innerHTML='Subscribe'+d.get("price")+"",E.appendChild(T),t.appendChild(k)}else if(m>0){var x=u.get("content");if(x=x.length>0?x[x.length-1]:void 0,x&&x.purchase_profile&&!x.purchase_profile.will_renew){var L=n.parse_date(x.access_end||"");k=document.createElement("div"),E=document.createElement("div"),C=document.createElement("span"),end_time=L?Math.floor((L.getTime()-Date.now())/1e3):null,k.className="subscribe-message",E.className="non-subscriber-message",k.appendChild(E),C.className="unlock-text",C.innerHTML="Subscription expires in "+n.time_to_string(end_time,!0,!0),E.appendChild(C),t.appendChild(k)}}}}var F=a&&a.extra_sets||[];this._emotes_for_sets(t,e,a&&a.set&&[a.set]||[],this.feature_friday||r||F.length?"Channel Emoticons":null,"http://cdn.frankerfacez.com/script/devicon.png","FrankerFaceZ");for(var v=0;vs?-1:s>o?1:0});for(var l=0;l0&&(i=!0)}t.classList.toggle("no-emotes",!i),t.classList.toggle("live",d),t.classList.toggle("dark",a),t.classList.toggle("blue",r)}}},{"../constants":3}],26:[function(t){var s=e.FrankerFaceZ,o=t("../constants"),n=t("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.settings_info.replace_twitch_menu={type:"boolean",value:!1,category:"Chat Input",name:"Replace Twitch Emoticon Menu",help:"Completely replace the default Twitch emoticon menu.",on_update:function(e){document.body.classList.toggle("ffz-menu-replace",e)}},s.settings_info.global_emotes_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Global Emotes in My Emotes",help:"Display the global Twitch emotes in the My Emoticons menu."},s.settings_info.emoji_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Emoji in My Emotes",help:"Display the supported emoji images in the My Emoticons menu."},s.settings_info.emote_menu_collapsed={value:[],visible:!1},s.prototype.setup_my_emotes=function(){if(this._twitch_set_to_channel={},this._twitch_badges={},localStorage.ffzTwitchSets)try{this._twitch_set_to_channel=JSON.parse(localStorage.ffzTwitchSets),this._twitch_badges=JSON.parse(localStorage.ffzTwitchBadges)}catch(e){}this._twitch_set_to_channel[0]="global",this._twitch_set_to_channel[33]="turbo_faces",this._twitch_set_to_channel[42]="turbo_faces",this._twitch_badges.global="//cdn.frankerfacez.com/script/twitch_logo.png",this._twitch_badges.turbo_faces=this._twitch_badges.turbo="//cdn.frankerfacez.com/script/turbo_badge.png"},s.menu_pages.my_emotes={name:"My Emoticons",icon:o.EMOTE,visible:function(e){var t=this.get_user(),s=e.get("controller.currentRoom.tmiSession"),o=t&&this.users[t.login]&&this.users[t.login].sets||[],n=(s&&s.getEmotes()||{emoticon_sets:{}}).emoticon_sets;return o.length||n&&Object.keys(n).length},render:function(e,t){var o=e.get("controller.currentRoom.tmiSession"),n=(o&&o.getEmotes()||{emoticon_sets:{}}).emoticon_sets,i=[];for(var a in n)n.hasOwnProperty(a)&&!this._twitch_set_to_channel.hasOwnProperty(a)&&i.push(a);if(!i.length)return s.menu_pages.my_emotes.draw_menu.bind(this)(e,t,n);var r=this,d=function(){if(i.length){i=[];var o={};for(var a in n)r._twitch_set_to_channel[a]&&(o[a]=n[a]);return s.menu_pages.my_emotes.draw_menu.bind(r)(e,t,o)}};this.ws_send("twitch_sets",i,function(o,a){if(i.length){if(i=[],o){for(var u in a)a.hasOwnProperty(u)&&(r._twitch_set_to_channel[u]=a[u]);return localStorage.ffzTwitchSets=JSON.stringify(r._twitch_set_to_channel),s.menu_pages.my_emotes.draw_menu.bind(r)(e,t,n)}d()}})?setTimeout(d,2e3):d()},toggle_section:function(e){var t=e.parentElement,s=t.getAttribute("data-set"),o=this.settings.emote_menu_collapsed,n=-1!==o.indexOf(s);n?o.removeObject(s):o.push(s),this.settings.set("emote_menu_collapsed",o),t.classList.toggle("collapsed",!n)},draw_emoji:function(e){var t=document.createElement("div"),n=document.createElement("div"),i=this;t.className="heading",t.innerHTML='FrankerFaceZEmoji',n.className="emoticon-grid collapsable",n.appendChild(t),n.setAttribute("data-set","emoji"),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("emoji")),t.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});var a=[];for(var r in this.emoji_data)a.push(this.emoji_data[r]);a.sort(function(e,t){var s=e.short_name.toLowerCase(),o=t.short_name.toLowerCase();return o>s?-1:s>o?1:e.rawt.raw?1:0});for(var d=0;dTwitch'+n.sanitize(e)}),d.className="heading",d.innerHTML='Twitch'+n.sanitize(r),this._twitch_badges[l])d.style.backgroundImage='url("'+this._twitch_badges[l]+'")';else{var c=this;Twitch.api.get("chat/"+l+"/badges",null,{version:3}).done(function(e){e.subscriber&&e.subscriber.image&&(c._twitch_badges[l]=e.subscriber.image,localStorage.ffzTwitchBadges=JSON.stringify(c._twitch_badges),d.style.backgroundImage='url("'+e.subscriber.image+'")')})}u.className="emoticon-grid collapsable",u.appendChild(d),u.setAttribute("data-set","twitch-"+t),u.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("twitch-"+t)),d.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(c)(this)}),a.sort(function(e,t){var s=e.code.toLowerCase(),o=t.code.toLowerCase();return o>s?-1:s>o?1:e.idt.id?1:0});for(var h=0;hFrankerFaceZ'+t.title,o.style.backgroundImage='url("'+(t.icon||"//cdn.frankerfacez.com/script/devicon.png")+'")',n.className="emoticon-grid collapsable",n.appendChild(o),n.setAttribute("data-set","ffz-"+t.id),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("ffz-"+t.id)),o.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});for(var r in t.emoticons)t.emoticons.hasOwnProperty(r)&&!t.emoticons[r].hidden&&a.push(t.emoticons[r]);a.sort(function(e,t){var s=e.name.toLowerCase(),o=t.name.toLowerCase();return o>s?-1:s>o?1:e.idt.id?1:0});for(var d=0;ds?-1:s>o?1:0});for(var u=0;uSpeedRunsLive races under channels.',on_update:function(){this.rebuild_race_ui()}},s.ws_on_close.push(function(){var t=e.App&&App.__container__.lookup("controller:channel"),s=t&&t.get("id"),o=t&&t.get("hostModeTarget.id"),n=!1;if(t){for(var i in this.srl_races)delete this.srl_races[i],(i===s||i===o)&&(n=!0);n&&this.rebuild_race_ui()}}),s.ws_commands.srl_race=function(e){var t=App.__container__.lookup("controller:channel"),s=t&&t.get("id"),o=t&&t.get("hostModeTarget.id"),n=!1;this.srl_races=this.srl_races||{};for(var i=0;i',r.addEventListener("click",this._build_race_popup.bind(this,a,t)),a.appendChild(r),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}if(s){var o=this.srl_races&&this.srl_races[s],n=this._cindex.get("element"),i=n&&n.querySelector("#hostmode .channel-actions"),a=i&&i.querySelector("#ffz-ui-race");if(i&&this.settings.srl_races&&o){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",s);var r=document.createElement("span");r.className="button drop action",r.title="SpeedRunsLive Race",r.innerHTML='',r.addEventListener("click",this._build_race_popup.bind(this,a,s)),a.appendChild(r),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}}},s.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),delete this._race_timer),delete this._race_game,delete this._race_goal},s.prototype._build_race_popup=function(e,t){var o=this._popup;if((!o||(o.parentElement.removeChild(o),delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill,"ffz-race-popup"!==o.id||o.getAttribute("data-channel")!==t))&&e){var n=e.querySelector(".button"),i=n.offsetLeft+n.offsetWidth,a=this.srl_races[t],o=document.createElement("div"),r="";o.id="ffz-race-popup",o.setAttribute("data-channel",t),o.className=(i>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=o;var d="http://kadgar.net/live",u=!1;for(var c in a.entrants){var l=a.entrants[c].state;a.entrants.hasOwnProperty(c)&&a.entrants[c].channel&&("racing"==l||"entered"==l)&&(d+="/"+a.entrants[c].channel,u=!0)}var h=document.querySelector(".app-main.theatre")?document.body.clientHeight-300:e.parentElement.offsetTop-175,f=App.__container__.lookup("controller:channel"),_=f?f.get("display_name"):s.get_capitalization(t),m=encodeURIComponent("I'm watching "+_+" race "+a.goal+" in "+a.game+" on SpeedRunsLive!");r='
Goal: "+E}u?_?l.innerHTML="Done":(l.innerHTML=o.time_to_string(u),this._race_timer=setTimeout(this._update_race.bind(this,e),1e3)):l.innerHTML="Entry Open"}}}},{"../utils":32}],29:[function(t){var s=e.FrankerFaceZ,o=t("../constants");s.prototype.setup_css=function(){this.log("Injecting main FrankerFaceZ CSS.");var e=this._main_style=document.createElement("link");e.id="ffz-ui-css",e.setAttribute("rel","stylesheet"),e.setAttribute("href",o.SERVER+"script/style.css?_="+(o.DEBUG?Date.now():s.version_info)),document.head.appendChild(e),jQuery.noty.themes.ffzTheme={name:"ffzTheme",style:function(){this.$bar.removeClass().addClass("noty_bar").addClass("ffz-noty").addClass(this.options.type)},callback:{onShow:function(){},onClose:function(){}}}}},{"../constants":3}],30:[function(t){{var s=e.FrankerFaceZ,o=t("../constants");t("../utils")}s.prototype._update_subscribers=function(){this._update_subscribers_timer&&(clearTimeout(this._update_subscribers_timer),delete this._update_subscribers_timer),this._update_subscribers_timer=setTimeout(this._update_subscribers.bind(this),6e4);var e=this.get_user(),t=this,s=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,n=this.is_dashboard&&s&&s[1];
-if(this.has_bttv||!n||n!==e.login){var i=document.querySelector("#ffz-sub-display");return void(i&&i.parentElement.removeChild(i))}jQuery.ajax({url:"/broadcast/dashboard/partnership"}).done(function(e){try{var s,i=document.createElement("span");i.innerHTML=e,s=i.querySelector("#dash_main");var a=s&&s.textContent.match(/([\d,\.]+) total active subscribers/),r=a&&a[1];if(!r){var d=document.querySelector("#ffz-sub-display");return d&&d.parentElement.removeChild(d),void(t._update_subscribers_timer&&(clearTimeout(t._update_subscribers_timer),delete t._update_subscribers_timer))}var d=document.querySelector("#ffz-sub-display span");if(!d){var u=document.querySelector(t.is_dashboard?"#stats":"#channel .stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-sub-display",c.title="Active Channel Subscribers",c.innerHTML=o.STAR+" ",d=document.createElement("span"),c.appendChild(d),Twitch.api.get("chat/"+n+"/badges",null,{version:3}).done(function(e){e.subscriber&&e.subscriber.image&&(c.innerHTML="",c.appendChild(d),c.style.backgroundImage='url("'+e.subscriber.image+'")',c.style.backgroundRepeat="no-repeat",c.style.paddingLeft="23px",c.style.backgroundPosition="0 50%")}),u.appendChild(c),jQuery(c).tipsy(t.is_dashboard?{gravity:"s"}:void 0)}d.innerHTML=r}catch(l){t.error("_update_subscribers: "+l)}}).fail(function(){var e=document.querySelector("#ffz-sub-display");e&&e.parentElement.removeChild(e)})}},{"../constants":3,"../utils":32}],31:[function(t){var s=e.FrankerFaceZ,o=t("../constants"),n=t("../utils");s.ws_commands.chatters=function(t){{var s=t[0],o=t[1],n=e.App&&App.__container__.lookup("controller:channel"),i=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0;this.is_dashboard?i&&i[1]:n&&n.get&&n.get("id")}if(!this.is_dashboard){var a=this.rooms&&this.rooms[s];return void(a&&(a.ffz_chatters=o,this._cindex&&this._cindex.ffzUpdateChatters()))}this._dash_chatters=o},s.ws_commands.viewers=function(t){var s=t[0],i=t[1],a=e.App&&App.__container__.lookup("controller:channel"),r=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,d=this.is_dashboard?r&&r[1]:a&&a.get&&a.get("id");if(!this.is_dashboard){var u=this.rooms&&this.rooms[s];return void(u&&(u.ffz_viewers=i,this._cindex&&this._cindex.ffzUpdateChatters()))}if(this._dash_viewers=i,this.settings.chatter_count&&d===s){var c=document.querySelector("#ffz-ffzchatter-display"),l=o.ZREKNARF+" "+n.number_commas(i)+("number"==typeof this._dash_chatters?" ("+n.number_commas(this._dash_chatters)+")":"");if(c)c.innerHTML=l;else{var h=document.querySelector("#stats");if(!h)return;c=document.createElement("span"),c.id="ffz-ffzchatter-display",c.className="ffz stat",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=l,h.appendChild(c),jQuery(c).tipsy(this.is_dashboard?{gravity:"s"}:void 0)}}}},{"../constants":3,"../utils":32}],32:[function(t,s){var o=(e.FrankerFaceZ,t("./constants"),{}),n=document.createElement("span"),i=function(e,t,s){return s=s||"s",t=t||"",1===e?t:s},a=function(e){return 1==e?"1st":2==e?"2nd":3==e?"3rd":null==e?"---":e+"th"},r=function(e,t){t=0===t?0:t||1,t=Math.round(255*-(t/100));var s=Math.max(0,Math.min(255,e[0]-t)),o=Math.max(0,Math.min(255,e[1]-t)),n=Math.max(0,Math.min(255,e[2]-t));return[s,o,n]},d=function(e){return"rgb("+e[0]+", "+e[1]+", "+e[2]+")"},u=function(e,t){return t=0===t?0:t||1,r(e,-t)},c=function(e){e=[e[0]/255,e[1]/255,e[2]/255];for(var t=0;t=0?t.trailing=e.substr(i+2):i=e.length;var a=e.substr(n+1,i-n-1).split(" ");return t.command=a[0],a.length>1&&(t.params=a.slice(1)),t},_={":":";",s:" ",r:"\r",n:"\n","\\":"\\"},m=function(e){for(var t="",s=0;s=55296&&56319>=n?i=n:o.push(n.toString(16));var r=v[e]=v[e]||{},d=r[t]=o.join("-");return d};s.exports={update_css:function(e,t,s){var o=e.innerHTML,n="/*BEGIN "+t+"*/",i="/*END "+t+"*/",a=o.indexOf(n),r=o.indexOf(i),d=-1!==a&&-1!==r&&r>a;(d||s)&&(d&&(o=o.substr(0,a)+o.substr(r+i.length)),s&&(o+=n+s+i),e.innerHTML=o)},splitIRCMessage:f,parseIRCTags:g,emoji_to_codepoint:b,get_luminance:c,brighten:r,darken:u,rgb_to_css:d,parse_date:h,number_commas:function(e){var t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},place_string:a,placement:function(e){return"forfeit"==e.state?"Forfeit":"dq"==e.state?"DQed":e.place?a(e.place):""},sanitize:function(e){var t=o[e];return t||(n.textContent=e,t=o[e]=n.innerHTML,n.innerHTML=""),t},date_string:function(e){return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()},pluralize:i,human_time:function(e,t){t=t||1,e=Math.floor(e);var s=Math.floor(e*t/31536e3)/t;if(s>=1)return s+" year"+i(s);var o=Math.floor((e%=31536e3)/86400);if(o>=1)return o+" day"+i(o);var n=Math.floor((e%=86400)/3600);if(n>=1)return n+" hour"+i(n);var a=Math.floor((e%=3600)/60);if(a>=1)return a+" minute"+i(a);var r=e%60;return r>=1?r+" second"+i(r):"less than a second"},time_to_string:function(e,t,s,o){var n=e%60,i=Math.floor(e/60),a=Math.floor(i/60),r="";if(i%=60,t){if(r=Math.floor(a/24),a%=24,s&&r>0)return r+" days";r=r>0?r+" days, ":""}return r+(!o||r||a?(10>a?"0":"")+a+":":"")+(10>i?"0":"")+i+":"+(10>n?"0":"")+n},format_unread:function(e){return 1>e?"":e>=99?"99+":""+e}}},{"./constants":3}]},{},[15]),e.ffz=new FrankerFaceZ}(window);
\ No newline at end of file
+!function(t){!function e(t,s,o){function n(a,r){if(!s[a]){if(!t[a]){var d="function"==typeof require&&require;if(!r&&d)return d(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return n(s?s:e)},u,u.exports,e,t,s,o)}return s[a].exports}for(var i="function"==typeof require&&require,a=0;at&&this._legacy_load_bots(t))})},s.prototype._legacy_load_donors=function(t){jQuery.ajax(o.SERVER+"script/donors.txt",{cache:!1,context:this}).done(function(t){this._legacy_parse_badges(t,1,1)}).fail(function(e){return 404!=e.status?(t=(t||0)+1,10>t?this._legacy_load_donors(t):void 0):void 0})},s.prototype._legacy_parse_badges=function(t,e,s){var o=this.badges[s].title,i=0;if(ds=null,null!=t)for(var a=t.trim().split(/\W+/),r=0;rs&&(s+=1),s>1&&(s-=1),1/6>s?t+6*(e-t)*s:.5>s?e:2/3>s?t+(e-t)*(2/3-s)*6:t};e.settings_info.fix_color={type:"select",options:{"-1":"Disabled",0:"Default Colors",1:"Luv Adjustment",2:"HSL Adjustment (Depreciated)",3:"HSV Adjustment (Depreciated)",4:"RGB Adjustment (Depreciated)"},value:"1",category:"Chat Appearance",no_bttv:!0,name:"Username Colors - Brightness",help:"Ensure that username colors contrast with the background enough to be readable.",process_value:function(t){return t===!1?"0":t===!0?"1":t},on_update:function(t){document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&"-1"!==t),document.body.classList.toggle("ffz-chat-colors-gray",!this.has_bttv&&"-1"===t),this.has_bttv||"-1"===t||this._rebuild_colors()}},e.settings_info.color_blind={type:"select",options:{0:"Disabled",protanope:"Protanope",deuteranope:"Deuteranope",tritanope:"Tritanope"},value:"0",category:"Chat Appearance",no_bttv:!0,name:"Username Colors - Color Blindness",help:"Adjust username colors in an attempt to make them more distinct for people with color blindness.",on_update:function(){this.has_bttv||"-1"===this.settings.fix_color||this._rebuild_colors()}},e.prototype.setup_colors=function(){this.log("Preparing color-alteration style element."),this._colors={};var t=this._color_style=document.createElement("style");t.id="ffz-style-username-colors",t.type="text/css",document.head.appendChild(t)},e.Color={},e.Color.CVDMatrix={protanope:[0,2.02344,-2.52581,0,1,0,0,0,1],deuteranope:[1,0,0,.494207,0,1.24827,0,0,1],tritanope:[1,0,0,0,1,0,-.395913,.801109,0]};var o=e.Color.RGB=function(t,e,s){this.r=t||0,this.g=e||0,this.b=s||0},n=e.Color.HSV=function(t,e,s){this.h=t||0,this.s=e||0,this.v=s||0},i=e.Color.HSL=function(t,e,s){this.h=t||0,this.s=e||0,this.l=s||0},a=e.Color.XYZ=function(t,e,s){this.x=t||0,this.y=e||0,this.z=s||0},r=e.Color.LUV=function(t,e,s){this.l=t||0,this.u=e||0,this.v=s||0};o.prototype.eq=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},o.fromHex=function(t){var e=parseInt("#"===t.charAt(0)?t.substr(1):t,16);return new o(e>>16,e>>8&255,255&e)},o.fromHSV=function(t,e,s){var n,i,a,r=Math.floor(6*t),d=6*t-r,u=s*(1-e),c=s*(1-d*e),l=s*(1-(1-d)*e);switch(r%6){case 0:n=s,i=l,a=u;break;case 1:n=c,i=s,a=u;break;case 2:n=u,i=s,a=l;break;case 3:n=u,i=c,a=s;break;case 4:n=l,i=u,a=s;break;case 5:n=s,i=u,a=c}return new o(Math.round(Math.min(Math.max(0,255*n),255)),Math.round(Math.min(Math.max(0,255*i),255)),Math.round(Math.min(Math.max(0,255*a),255)))},o.fromXYZ=function(t,e,s){var n=3.240479*t-1.53715*e-.498535*s,i=-.969256*t+1.875992*e+.041556*s,r=.055648*t-.204043*e+1.057311*s;return new o(Math.max(0,Math.min(255,255*a.channelConverter(n))),Math.max(0,Math.min(255,255*a.channelConverter(i))),Math.max(0,Math.min(255,255*a.channelConverter(r))))},o.fromHSL=function(t,e,n){if(0===e){var i=Math.round(Math.min(Math.max(0,255*n),255));return new o(i,i,i)}var a=.5>n?n*(1+e):n+e-n*e,r=2*n-a;return new o(Math.round(Math.min(Math.max(0,255*s(r,a,t+1/3)),255)),Math.round(Math.min(Math.max(0,255*s(r,a,t)),255)),Math.round(Math.min(Math.max(0,255*s(r,a,t-1/3)),255)))},o.prototype.toHSV=function(){return n.fromRGB(this.r,this.g,this.b)},o.prototype.toHSL=function(){return i.fromRGB(this.r,this.g,this.b)},o.prototype.toCSS=function(){return"rgb("+Math.round(this.r)+","+Math.round(this.g)+","+Math.round(this.b)+")"},o.prototype.toXYZ=function(){return a.fromRGB(this.r,this.g,this.b)},o.prototype.toLUV=function(){return this.toXYZ().toLUV()},o.prototype.luminance=function(){for(var t=[this.r/255,this.g/255,this.b/255],e=0,s=t.length;s>e;e++)t[e]=t[e]<=.03928?t[e]/12.92:Math.pow((t[e]+.055)/1.055,2.4);return.2126*t[0]+.7152*t[1]+.0722*t[2]},o.prototype.brighten=function(t){return t="number"==typeof t?t:1,t=Math.round(255*(t/100)),new o(Math.max(0,Math.min(255,this.r+t)),Math.max(0,Math.min(255,this.g+t)),Math.max(0,Math.min(255,this.b+t)))},o.prototype.daltonize=function(t,s){s="number"==typeof s?s:1;var n;if("string"==typeof t){if(!e.Color.CVDMatrix.hasOwnProperty(t))throw"Invalid CVD matrix.";n=e.Color.CVDMatrix[t]}else n=t;var i,a,r,d,u,c,l,h,f,_,m,p,g=n[0],v=n[1],b=n[2],y=n[3],w=n[4],z=n[5],k=n[6],C=n[7],E=n[8];return i=17.8824*this.r+43.5161*this.g+4.11935*this.b,a=3.45565*this.r+27.1554*this.g+3.86714*this.b,r=.0299566*this.r+.184309*this.g+1.46709*this.b,d=g*i+v*a+b*r,u=y*i+w*a+z*r,c=k*i+C*a+E*r,l=.0809444479*d+-.130504409*u+.116721066*c,h=-.0102485335*d+.0540193266*u+-.113614708*c,f=-.000365296938*d+-.00412161469*u+.693511405*c,l=this.r-l,h=this.g-h,f=this.b-f,_=0*l+0*h+0*f,m=.7*l+1*h+0*f,p=.7*l+0*h+1*f,l=Math.min(Math.max(0,_+this.r),255),h=Math.min(Math.max(0,m+this.g),255),f=Math.min(Math.max(0,p+this.b),255),new o(l,h,f)},o.prototype._r=function(t){return new o(t,this.g,this.b)},o.prototype._g=function(t){return new o(this.r,t,this.b)},o.prototype._b=function(t){return new o(this.r,this.g,t)},i.prototype.eq=function(t){return t.h===this.h&&t.s===this.s&&t.l===this.l},i.fromRGB=function(t,e,s){t/=255,e/=255,s/=255;var o,n,a=Math.max(t,e,s),r=Math.min(t,e,s),d=Math.min(Math.max(0,(a+r)/2),1),u=Math.min(Math.max(0,a-r),1);if(0===u)o=n=0;else{switch(n=d>.5?u/(2-a-r):u/(a+r),a){case t:o=(e-s)/u+(s>e?6:0);break;case e:o=(s-t)/u+2;break;case s:o=(t-e)/u+4}o/=6}return new i(o,n,d)},i.prototype.toRGB=function(){return o.fromHSL(this.h,this.s,this.l)},i.prototype.toCSS=function(){return"hsl("+Math.round(360*this.h)+","+Math.round(100*this.s)+"%,"+Math.round(100*this.l)+"%)"},i.prototype.toHSV=function(){return o.fromHSL(this.h,this.s,this.l).toHSV()},i.prototype.toXYZ=function(){return o.fromHSL(this.h,this.s,this.l).toXYZ()},i.prototype.toLUV=function(){return o.fromHSL(this.h,this.s,this.l).toLUV()},i.prototype._h=function(t){return new i(t,this.s,this.l)},i.prototype._s=function(t){return new i(this.h,t,this.l)},i.prototype._l=function(t){return new i(this.h,this.s,t)},n.prototype.eq=function(t){return t.h===this.h&&t.s===this.s&&t.v===this.v},n.fromRGB=function(t,e,s){t/=255,e/=255,s/=255;var o,i=Math.max(t,e,s),a=Math.min(t,e,s),r=Math.min(Math.max(0,i-a),1),d=0===i?0:r/i,u=i;if(0===r)o=0;else{switch(i){case t:o=(e-s)/r+(s>e?6:0);break;case e:o=(s-t)/r+2;break;case s:o=(t-e)/r+4}o/=6}return new n(o,d,u)},n.prototype.toRGB=function(){return o.fromHSV(this.h,this.s,this.v)},n.prototype.toHSL=function(){return o.fromHSV(this.h,this.s,this.v).toHSL()},n.prototype.toXYZ=function(){return o.fromHSV(this.h,this.s,this.v).toXYZ()},n.prototype.toLUV=function(){return o.fromHSV(this.h,this.s,this.v).toLUV()},n.prototype._h=function(t){return new n(t,this.s,this.v)},n.prototype._s=function(t){return new n(this.h,t,this.v)},n.prototype._v=function(t){return new n(this.h,this.s,t)},o.channelConverter=function(t){return Math.pow(t,2.2)},a.channelConverter=function(t){return Math.pow(t,1/2.2)},a.prototype.eq=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},a.fromRGB=function(t,e,s){var n=o.channelConverter(t/255),i=o.channelConverter(e/255),r=o.channelConverter(s/255);return new a(.412453*n+.35758*i+.180423*r,.212671*n+.71516*i+.072169*r,.019334*n+.119193*i+.950227*r)},a.fromLUV=function(t,e,s){var o=1/(a.WHITE.x+15*a.WHITE.y+3*a.WHITE.z),n=4*a.WHITE.x*o,i=9*a.WHITE.y*o,r=t>8?Math.pow((t+16)/116,3):t/a.KAPPA,d=1/3*(52*t/(e+13*t*n)-1),u=-5*r,c=-1/3,l=r*(39*t/(s+13*t*i)-5),h=(l-u)/(d-c),f=h*d+u;return new a(h,r,f)},a.prototype.toRGB=function(){return o.fromXYZ(this.x,this.y,this.z)},a.prototype.toLUV=function(){return r.fromXYZ(this.x,this.y,this.z)},a.prototype.toHSL=function(){return o.fromXYZ(this.x,this.y,this.z).toHSL()},a.prototype.toHSV=function(){return o.fromXYZ(this.x,this.y,this.z).toHSV()},a.prototype._x=function(t){return new a(t,this.y,this.z)},a.prototype._y=function(t){return new a(this.x,t,this.z)},a.prototype._z=function(t){return new a(this.x,this.y,t)},a.EPSILON=Math.pow(6/29,3),a.KAPPA=Math.pow(29/3,3),a.WHITE=new o(255,255,255).toXYZ(),r.prototype.eq=function(t){return t.l===this.l&&t.u===this.u&&t.v===this.v},r.fromXYZ=function(t,e,s){var o=1/(a.WHITE.x+15*a.WHITE.y+3*a.WHITE.z),n=4*a.WHITE.x*o,i=9*a.WHITE.y*o,d=e/a.WHITE.y,u=t+15*e+3*s;0===u&&(u=1);var c=1/u,l=4*t*c,h=9*e*c,f=d>a.EPSILON?116*Math.pow(d,1/3)-16:a.KAPPA*d,_=13*f*(l-n),m=13*f*(h-i);return new r(f,_,m)},r.prototype.toXYZ=function(){return a.fromLUV(this.l,this.u,this.v)},r.prototype.toRGB=function(){return a.fromLUV(this.l,this.u,this.v).toRGB()},r.prototype.toHSL=function(){return a.fromLUV(this.l,this.u,this.v).toHSL()},r.prototype.toHSV=function(){return a.fromLUV(this.l,this.u,this.v).toHSV()},r.prototype._l=function(t){return new r(t,this.u,this.v)},r.prototype._u=function(t){return new r(this.l,t,this.v)},r.prototype._v=function(t){return new r(this.l,this.u,t)};var d=4.5,u=new a(0,d*(new o(35,35,35).toXYZ().y+.05)-.05,0).toLUV().l,c=new a(0,(new o(217,217,217).toXYZ().y+.05)/d-.05,0).toLUV().l;e.prototype._rebuild_colors=function(){if(this._color_style&&!this.has_bttv){this._color_style.innerHTML="";var t=Object.keys(this._colors);this._colors={};for(var e=0,s=t.length;s>e;e++)this._handle_color(t[e])}},e.prototype._handle_color=function(t){if(t&&!this._colors.hasOwnProperty(t)){this._colors[t]=!0;var e=o.fromHex(t),s=t,n=t,i=t,a=!1,r='span[style="color:'+t+'"]';if("0"!==this.settings.color_blind){var d=e.daltonize(this.settings.color_blind);e.eq(d)||(e=d,s=n=i=e.toCSS(),a=!0)}if("4"===this.settings.fix_color){var l=e.luminance();if(l>.3){for(var h=127,f=e;h--&&(f=f.brighten(-1),!(f.luminance()<=.3)););a=!0,n=f.toCSS()}if(.15>l){for(var h=127,f=e;h--&&(f=f.brighten(),!(f.luminance()>=.15)););a=!0,i=f.toCSS()}}if("2"===this.settings.fix_color){var _=e.toHSL();a=!0,n=_._l(Math.min(Math.max(0,.7*_.l),1)).toCSS(),i=_._l(Math.min(Math.max(0,.3+.7*_.l),1)).toCSS()}if("3"===this.settings.fix_color){var m=e.toHSV();a=!0,0===m.s?(n=m._v(Math.min(Math.max(.5,.5*m.v),1)).toRGB().toCSS(),i=m._v(Math.min(Math.max(.5,.5+.5*m.v),1)).toRGB().toCSS()):(n=o.fromHSV(m.h,Math.min(Math.max(.7,.7+.3*m.s),1),Math.min(.7,m.v)).toCSS(),i=o.fromHSV(m.h,Math.min(.7,m.s),Math.min(Math.max(.7,.7+.3*m.v),1)).toCSS())}if("1"===this.settings.fix_color){var p=e.toLUV();p.l>c&&(a=!0,n=p._l(c).toRGB().toCSS()),p.l50)return"Each user you unmod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=e.length;e.length;){var n=e.shift();t.room.tmiRoom.sendMessage("/unmod "+n)}return"Sent unmod command for "+o+" users."},e.ffz_commands.massunmod.help="Usage: /ffz massunmod \nBroadcaster only. Unmod all the users in the provided list.",e.ffz_commands.massmod=function(t,e){if(e=e.join(" ").trim(),!e.length)return"You must provide a list of users to mod.";e=e.split(/\W*,\W*/);var s=this.get_user();if(!s||!s.login==t.id)return"You must be the broadcaster to use massmod.";if(e.length>50)return"Each user you mod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=e.length;e.length;){var n=e.shift();t.room.tmiRoom.sendMessage("/mod "+n)}return"Sent mod command for "+o+" users."},e.ffz_commands.massmod.help="Usage: /ffz massmod \nBroadcaster only. Mod all the users in the provided list."},{}],4:[function(t,e){var s='',o="true"==localStorage.ffzDebugMode&&document.body.classList.contains("ffz-dev"),n=o?"//localhost:8000/":"//cdn.frankerfacez.com/";e.exports={DEBUG:o,SERVER:n,API_SERVER:"//api.frankerfacez.com/",API_SERVER_2:"//direct-api.frankerfacez.com/",KNOWN_CODES:{"#-?[\\\\/]":"#-/",":-?(?:7|L)":":-7","\\<\\;\\]":"<]","\\:-?(S|s)":":-S","\\:-?\\\\":":-\\","\\:\\>\\;":":>","B-?\\)":"B-)","\\:-?[z|Z|\\|]":":-Z","\\:-?\\)":":-)","\\:-?\\(":":-(","\\:-?(p|P)":":-P","\\;-?(p|P)":";-P","\\<\\;3":"<3","\\:-?[\\\\/]":":-/","\\;-?\\)":";-)","R-?\\)":"R-)","[o|O](_|\\.)[o|O]":"O.o","\\:-?D":":-D","\\:-?(o|O)":":-O","\\>\\;\\(":">(","Gr(a|e)yFace":"GrayFace"},EMOTE_REPLACEMENT_BASE:n+"script/replacements/",EMOTE_REPLACEMENTS:{15:"15-JKanStyle.png",16:"16-OptimizePrime.png",17:"17-StoneLightning.png",18:"18-TheRinger.png",19:"19-PazPazowitz.png",20:"20-EagleEye.png",21:"21-CougarHunt.png",22:"22-RedCoat.png",26:"26-JonCarnage.png",27:"27-PicoMause.png",30:"30-BCWarrior.png",33:"33-DansGame.png",36:"36-PJSalt.png"},EMOJI_REGEX:/((?:\ud83c\udde8\ud83c\uddf3|\ud83c\uddfa\ud83c\uddf8|\ud83c\uddf7\ud83c\uddfa|\ud83c\uddf0\ud83c\uddf7|\ud83c\uddef\ud83c\uddf5|\ud83c\uddee\ud83c\uddf9|\ud83c\uddec\ud83c\udde7|\ud83c\uddeb\ud83c\uddf7|\ud83c\uddea\ud83c\uddf8|\ud83c\udde9\ud83c\uddea|\u0039\ufe0f?\u20e3|\u0038\ufe0f?\u20e3|\u0037\ufe0f?\u20e3|\u0036\ufe0f?\u20e3|\u0035\ufe0f?\u20e3|\u0034\ufe0f?\u20e3|\u0033\ufe0f?\u20e3|\u0032\ufe0f?\u20e3|\u0031\ufe0f?\u20e3|\u0030\ufe0f?\u20e3|\u0023\ufe0f?\u20e3|\ud83d\udeb3|\ud83d\udeb1|\ud83d\udeb0|\ud83d\udeaf|\ud83d\udeae|\ud83d\udea6|\ud83d\udea3|\ud83d\udea1|\ud83d\udea0|\ud83d\ude9f|\ud83d\ude9e|\ud83d\ude9d|\ud83d\ude9c|\ud83d\ude9b|\ud83d\ude98|\ud83d\ude96|\ud83d\ude94|\ud83d\ude90|\ud83d\ude8e|\ud83d\ude8d|\ud83d\ude8b|\ud83d\ude8a|\ud83d\ude88|\ud83d\ude86|\ud83d\ude82|\ud83d\ude81|\ud83d\ude36|\ud83d\ude34|\ud83d\ude2f|\ud83d\ude2e|\ud83d\ude2c|\ud83d\ude27|\ud83d\ude26|\ud83d\ude1f|\ud83d\ude1b|\ud83d\ude19|\ud83d\ude17|\ud83d\ude15|\ud83d\ude11|\ud83d\ude10|\ud83d\ude0e|\ud83d\ude08|\ud83d\ude07|\ud83d\ude00|\ud83d\udd67|\ud83d\udd66|\ud83d\udd65|\ud83d\udd64|\ud83d\udd63|\ud83d\udd62|\ud83d\udd61|\ud83d\udd60|\ud83d\udd5f|\ud83d\udd5e|\ud83d\udd5d|\ud83d\udd5c|\ud83d\udd2d|\ud83d\udd2c|\ud83d\udd15|\ud83d\udd09|\ud83d\udd08|\ud83d\udd07|\ud83d\udd06|\ud83d\udd05|\ud83d\udd04|\ud83d\udd02|\ud83d\udd01|\ud83d\udd00|\ud83d\udcf5|\ud83d\udcef|\ud83d\udced|\ud83d\udcec|\ud83d\udcb7|\ud83d\udcb6|\ud83d\udcad|\ud83d\udc6d|\ud83d\udc6c|\ud83d\udc65|\ud83d\udc2a|\ud83d\udc16|\ud83d\udc15|\ud83d\udc13|\ud83d\udc10|\ud83d\udc0f|\ud83d\udc0b|\ud83d\udc0a|\ud83d\udc09|\ud83d\udc08|\ud83d\udc07|\ud83d\udc06|\ud83d\udc05|\ud83d\udc04|\ud83d\udc03|\ud83d\udc02|\ud83d\udc01|\ud83d\udc00|\ud83c\udfe4|\ud83c\udfc9|\ud83c\udfc7|\ud83c\udf7c|\ud83c\udf50|\ud83c\udf4b|\ud83c\udf33|\ud83c\udf32|\ud83c\udf1e|\ud83c\udf1d|\ud83c\udf1c|\ud83c\udf1a|\ud83c\udf18|\ud83c\udccf|\ud83c\udd70|\ud83c\udd71|\ud83c\udd7e|\ud83c\udd8e|\ud83c\udd91|\ud83c\udd92|\ud83c\udd93|\ud83c\udd94|\ud83c\udd95|\ud83c\udd96|\ud83c\udd97|\ud83c\udd98|\ud83c\udd99|\ud83c\udd9a|\ud83d\udc77|\ud83d\udec5|\ud83d\udec4|\ud83d\udec3|\ud83d\udec2|\ud83d\udec1|\ud83d\udebf|\ud83d\udeb8|\ud83d\udeb7|\ud83d\udeb5|\ud83c\ude01|\ud83c\ude02|\ud83c\ude32|\ud83c\ude33|\ud83c\ude34|\ud83c\ude35|\ud83c\ude36|\ud83c\ude37|\ud83c\ude38|\ud83c\ude39|\ud83c\ude3a|\ud83c\ude50|\ud83c\ude51|\ud83c\udf00|\ud83c\udf01|\ud83c\udf02|\ud83c\udf03|\ud83c\udf04|\ud83c\udf05|\ud83c\udf06|\ud83c\udf07|\ud83c\udf08|\ud83c\udf09|\ud83c\udf0a|\ud83c\udf0b|\ud83c\udf0c|\ud83c\udf0f|\ud83c\udf11|\ud83c\udf13|\ud83c\udf14|\ud83c\udf15|\ud83c\udf19|\ud83c\udf1b|\ud83c\udf1f|\ud83c\udf20|\ud83c\udf30|\ud83c\udf31|\ud83c\udf34|\ud83c\udf35|\ud83c\udf37|\ud83c\udf38|\ud83c\udf39|\ud83c\udf3a|\ud83c\udf3b|\ud83c\udf3c|\ud83c\udf3d|\ud83c\udf3e|\ud83c\udf3f|\ud83c\udf40|\ud83c\udf41|\ud83c\udf42|\ud83c\udf43|\ud83c\udf44|\ud83c\udf45|\ud83c\udf46|\ud83c\udf47|\ud83c\udf48|\ud83c\udf49|\ud83c\udf4a|\ud83c\udf4c|\ud83c\udf4d|\ud83c\udf4e|\ud83c\udf4f|\ud83c\udf51|\ud83c\udf52|\ud83c\udf53|\ud83c\udf54|\ud83c\udf55|\ud83c\udf56|\ud83c\udf57|\ud83c\udf58|\ud83c\udf59|\ud83c\udf5a|\ud83c\udf5b|\ud83c\udf5c|\ud83c\udf5d|\ud83c\udf5e|\ud83c\udf5f|\ud83c\udf60|\ud83c\udf61|\ud83c\udf62|\ud83c\udf63|\ud83c\udf64|\ud83c\udf65|\ud83c\udf66|\ud83c\udf67|\ud83c\udf68|\ud83c\udf69|\ud83c\udf6a|\ud83c\udf6b|\ud83c\udf6c|\ud83c\udf6d|\ud83c\udf6e|\ud83c\udf6f|\ud83c\udf70|\ud83c\udf71|\ud83c\udf72|\ud83c\udf73|\ud83c\udf74|\ud83c\udf75|\ud83c\udf76|\ud83c\udf77|\ud83c\udf78|\ud83c\udf79|\ud83c\udf7a|\ud83c\udf7b|\ud83c\udf80|\ud83c\udf81|\ud83c\udf82|\ud83c\udf83|\ud83c\udf84|\ud83c\udf85|\ud83c\udf86|\ud83c\udf87|\ud83c\udf88|\ud83c\udf89|\ud83c\udf8a|\ud83c\udf8b|\ud83c\udf8c|\ud83c\udf8d|\ud83c\udf8e|\ud83c\udf8f|\ud83c\udf90|\ud83c\udf91|\ud83c\udf92|\ud83c\udf93|\ud83c\udfa0|\ud83c\udfa1|\ud83c\udfa2|\ud83c\udfa3|\ud83c\udfa4|\ud83c\udfa5|\ud83c\udfa6|\ud83c\udfa7|\ud83c\udfa8|\ud83c\udfa9|\ud83c\udfaa|\ud83c\udfab|\ud83c\udfac|\ud83c\udfad|\ud83c\udfae|\ud83c\udfaf|\ud83c\udfb0|\ud83c\udfb1|\ud83c\udfb2|\ud83c\udfb3|\ud83c\udfb4|\ud83c\udfb5|\ud83c\udfb6|\ud83c\udfb7|\ud83c\udfb8|\ud83c\udfb9|\ud83c\udfba|\ud83c\udfbb|\ud83c\udfbc|\ud83c\udfbd|\ud83c\udfbe|\ud83c\udfbf|\ud83c\udfc0|\ud83c\udfc1|\ud83c\udfc2|\ud83c\udfc3|\ud83c\udfc4|\ud83c\udfc6|\ud83c\udfc8|\ud83c\udfca|\ud83c\udfe0|\ud83c\udfe1|\ud83c\udfe2|\ud83c\udfe3|\ud83c\udfe5|\ud83c\udfe6|\ud83c\udfe7|\ud83c\udfe8|\ud83c\udfe9|\ud83c\udfea|\ud83c\udfeb|\ud83c\udfec|\ud83c\udfed|\ud83c\udfee|\ud83c\udfef|\ud83c\udff0|\ud83d\udc0c|\ud83d\udc0d|\ud83d\udc0e|\ud83d\udc11|\ud83d\udc12|\ud83d\udc14|\ud83d\udc17|\ud83d\udc18|\ud83d\udc19|\ud83d\udc1a|\ud83d\udc1b|\ud83d\udc1c|\ud83d\udc1d|\ud83d\udc1e|\ud83d\udc1f|\ud83d\udc20|\ud83d\udc21|\ud83d\udc22|\ud83d\udc23|\ud83d\udc24|\ud83d\udc25|\ud83d\udc26|\ud83d\udc27|\ud83d\udc28|\ud83d\udc29|\ud83d\udc2b|\ud83d\udc2c|\ud83d\udc2d|\ud83d\udc2e|\ud83d\udc2f|\ud83d\udc30|\ud83d\udc31|\ud83d\udc32|\ud83d\udc33|\ud83d\udc34|\ud83d\udc35|\ud83d\udc36|\ud83d\udc37|\ud83d\udc38|\ud83d\udc39|\ud83d\udc3a|\ud83d\udc3b|\ud83d\udc3c|\ud83d\udc3d|\ud83d\udc3e|\ud83d\udc40|\ud83d\udc42|\ud83d\udc43|\ud83d\udc44|\ud83d\udc45|\ud83d\udc46|\ud83d\udc47|\ud83d\udc48|\ud83d\udc49|\ud83d\udc4a|\ud83d\udc4b|\ud83d\udc4c|\ud83d\udc4d|\ud83d\udc4e|\ud83d\udc4f|\ud83d\udc50|\ud83d\udc51|\ud83d\udc52|\ud83d\udc53|\ud83d\udc54|\ud83d\udc55|\ud83d\udc56|\ud83d\udc57|\ud83d\udc58|\ud83d\udc59|\ud83d\udc5a|\ud83d\udc5b|\ud83d\udc5c|\ud83d\udc5d|\ud83d\udc5e|\ud83d\udc5f|\ud83d\udc60|\ud83d\udc61|\ud83d\udc62|\ud83d\udc63|\ud83d\udc64|\ud83d\udc66|\ud83d\udc67|\ud83d\udc68|\ud83d\udc69|\ud83d\udc6a|\ud83d\udc6b|\ud83d\udc6e|\ud83d\udc6f|\ud83d\udc70|\ud83d\udc71|\ud83d\udc72|\ud83d\udc73|\ud83d\udc74|\ud83d\udc75|\ud83d\udc76|\ud83d\udeb4|\ud83d\udc78|\ud83d\udc79|\ud83d\udc7a|\ud83d\udc7b|\ud83d\udc7c|\ud83d\udc7d|\ud83d\udc7e|\ud83d\udc7f|\ud83d\udc80|\ud83d\udc81|\ud83d\udc82|\ud83d\udc83|\ud83d\udc84|\ud83d\udc85|\ud83d\udc86|\ud83d\udc87|\ud83d\udc88|\ud83d\udc89|\ud83d\udc8a|\ud83d\udc8b|\ud83d\udc8c|\ud83d\udc8d|\ud83d\udc8e|\ud83d\udc8f|\ud83d\udc90|\ud83d\udc91|\ud83d\udc92|\ud83d\udc93|\ud83d\udc94|\ud83d\udc95|\ud83d\udc96|\ud83d\udc97|\ud83d\udc98|\ud83d\udc99|\ud83d\udc9a|\ud83d\udc9b|\ud83d\udc9c|\ud83d\udc9d|\ud83d\udc9e|\ud83d\udc9f|\ud83d\udca0|\ud83d\udca1|\ud83d\udca2|\ud83d\udca3|\ud83d\udca4|\ud83d\udca5|\ud83d\udca6|\ud83d\udca7|\ud83d\udca8|\ud83d\udca9|\ud83d\udcaa|\ud83d\udcab|\ud83d\udcac|\ud83d\udcae|\ud83d\udcaf|\ud83d\udcb0|\ud83d\udcb1|\ud83d\udcb2|\ud83d\udcb3|\ud83d\udcb4|\ud83d\udcb5|\ud83d\udcb8|\ud83d\udcb9|\ud83d\udcba|\ud83d\udcbb|\ud83d\udcbc|\ud83d\udcbd|\ud83d\udcbe|\ud83d\udcbf|\ud83d\udcc0|\ud83d\udcc1|\ud83d\udcc2|\ud83d\udcc3|\ud83d\udcc4|\ud83d\udcc5|\ud83d\udcc6|\ud83d\udcc7|\ud83d\udcc8|\ud83d\udcc9|\ud83d\udcca|\ud83d\udccb|\ud83d\udccc|\ud83d\udccd|\ud83d\udcce|\ud83d\udccf|\ud83d\udcd0|\ud83d\udcd1|\ud83d\udcd2|\ud83d\udcd3|\ud83d\udcd4|\ud83d\udcd5|\ud83d\udcd6|\ud83d\udcd7|\ud83d\udcd8|\ud83d\udcd9|\ud83d\udcda|\ud83d\udcdb|\ud83d\udcdc|\ud83d\udcdd|\ud83d\udcde|\ud83d\udcdf|\ud83d\udce0|\ud83d\udce1|\ud83d\udce2|\ud83d\udce3|\ud83d\udce4|\ud83d\udce5|\ud83d\udce6|\ud83d\udce7|\ud83d\udce8|\ud83d\udce9|\ud83d\udcea|\ud83d\udceb|\ud83d\udcee|\ud83d\udcf0|\ud83d\udcf1|\ud83d\udcf2|\ud83d\udcf3|\ud83d\udcf4|\ud83d\udcf6|\ud83d\udcf7|\ud83d\udcf9|\ud83d\udcfa|\ud83d\udcfb|\ud83d\udcfc|\ud83d\udd03|\ud83d\udd0a|\ud83d\udd0b|\ud83d\udd0c|\ud83d\udd0d|\ud83d\udd0e|\ud83d\udd0f|\ud83d\udd10|\ud83d\udd11|\ud83d\udd12|\ud83d\udd13|\ud83d\udd14|\ud83d\udd16|\ud83d\udd17|\ud83d\udd18|\ud83d\udd19|\ud83d\udd1a|\ud83d\udd1b|\ud83d\udd1c|\ud83d\udd1d|\ud83d\udd1e|\ud83d\udd1f|\ud83d\udd20|\ud83d\udd21|\ud83d\udd22|\ud83d\udd23|\ud83d\udd24|\ud83d\udd25|\ud83d\udd26|\ud83d\udd27|\ud83d\udd28|\ud83d\udd29|\ud83d\udd2a|\ud83d\udd2b|\ud83d\udd2e|\ud83d\udd2f|\ud83d\udd30|\ud83d\udd31|\ud83d\udd32|\ud83d\udd33|\ud83d\udd34|\ud83d\udd35|\ud83d\udd36|\ud83d\udd37|\ud83d\udd38|\ud83d\udd39|\ud83d\udd3a|\ud83d\udd3b|\ud83d\udd3c|\ud83d\udd3d|\ud83d\udd50|\ud83d\udd51|\ud83d\udd52|\ud83d\udd53|\ud83d\udd54|\ud83d\udd55|\ud83d\udd56|\ud83d\udd57|\ud83d\udd58|\ud83d\udd59|\ud83d\udd5a|\ud83d\udd5b|\ud83d\uddfb|\ud83d\uddfc|\ud83d\uddfd|\ud83d\uddfe|\ud83d\uddff|\ud83d\ude01|\ud83d\ude02|\ud83d\ude03|\ud83d\ude04|\ud83d\ude05|\ud83d\ude06|\ud83d\ude09|\ud83d\ude0a|\ud83d\ude0b|\ud83d\ude0c|\ud83d\ude0d|\ud83d\ude0f|\ud83d\ude12|\ud83d\ude13|\ud83d\ude14|\ud83d\ude16|\ud83d\ude18|\ud83d\ude1a|\ud83d\ude1c|\ud83d\ude1d|\ud83d\ude1e|\ud83d\ude20|\ud83d\ude21|\ud83d\ude22|\ud83d\ude23|\ud83d\ude24|\ud83d\ude25|\ud83d\ude28|\ud83d\ude29|\ud83d\ude2a|\ud83d\ude2b|\ud83d\ude2d|\ud83d\ude30|\ud83d\ude31|\ud83d\ude32|\ud83d\ude33|\ud83d\ude35|\ud83d\ude37|\ud83d\ude38|\ud83d\ude39|\ud83d\ude3a|\ud83d\ude3b|\ud83d\ude3c|\ud83d\ude3d|\ud83d\ude3e|\ud83d\ude3f|\ud83d\ude40|\ud83d\ude45|\ud83d\ude46|\ud83d\ude47|\ud83d\ude48|\ud83d\ude49|\ud83d\ude4a|\ud83d\ude4b|\ud83d\ude4c|\ud83d\ude4d|\ud83d\ude4e|\ud83d\ude4f|\ud83d\ude80|\ud83d\ude83|\ud83d\ude84|\ud83d\ude85|\ud83d\ude87|\ud83d\ude89|\ud83d\ude8c|\ud83d\ude8f|\ud83d\ude91|\ud83d\ude92|\ud83d\ude93|\ud83d\ude95|\ud83d\ude97|\ud83d\ude99|\ud83d\ude9a|\ud83d\udea2|\ud83d\udea4|\ud83d\udea5|\ud83d\udea7|\ud83d\udea8|\ud83d\udea9|\ud83d\udeaa|\ud83d\udeab|\ud83d\udeac|\ud83d\udead|\ud83d\udeb2|\ud83d\udeb6|\ud83d\udeb9|\ud83d\udeba|\ud83d\udebb|\ud83d\udebc|\ud83d\udebd|\ud83d\udebe|\ud83d\udec0|\ud83c\udde6|\ud83c\udde7|\ud83c\udde8|\ud83c\udde9|\ud83c\uddea|\ud83c\uddeb|\ud83c\uddec|\ud83c\udded|\ud83c\uddee|\ud83c\uddef|\ud83c\uddf0|\ud83c\uddf1|\ud83c\uddf2|\ud83c\uddf3|\ud83c\uddf4|\ud83c\uddf5|\ud83c\uddf6|\ud83c\uddf7|\ud83c\uddf8|\ud83c\uddf9|\ud83c\uddfa|\ud83c\uddfb|\ud83c\uddfc|\ud83c\uddfd|\ud83c\uddfe|\ud83c\uddff|\ud83c\udf0d|\ud83c\udf0e|\ud83c\udf10|\ud83c\udf12|\ud83c\udf16|\ud83c\udf17|\ue50a|\u3030|\u27b0|\u2797|\u2796|\u2795|\u2755|\u2754|\u2753|\u274e|\u274c|\u2728|\u270b|\u270a|\u2705|\u26ce|\u23f3|\u23f0|\u23ec|\u23eb|\u23ea|\u23e9|\u2122|\u27bf|\u00a9|\u00ae)|(?:(?:\ud83c\udc04|\ud83c\udd7f|\ud83c\ude1a|\ud83c\ude2f|\u3299|\u303d|\u2b55|\u2b50|\u2b1c|\u2b1b|\u2b07|\u2b06|\u2b05|\u2935|\u2934|\u27a1|\u2764|\u2757|\u2747|\u2744|\u2734|\u2733|\u2716|\u2714|\u2712|\u270f|\u270c|\u2709|\u2708|\u2702|\u26fd|\u26fa|\u26f5|\u26f3|\u26f2|\u26ea|\u26d4|\u26c5|\u26c4|\u26be|\u26bd|\u26ab|\u26aa|\u26a1|\u26a0|\u2693|\u267f|\u267b|\u3297|\u2666|\u2665|\u2663|\u2660|\u2653|\u2652|\u2651|\u2650|\u264f|\u264e|\u264d|\u264c|\u264b|\u264a|\u2649|\u2648|\u263a|\u261d|\u2615|\u2614|\u2611|\u260e|\u2601|\u2600|\u25fe|\u25fd|\u25fc|\u25fb|\u25c0|\u25b6|\u25ab|\u25aa|\u24c2|\u231b|\u231a|\u21aa|\u21a9|\u2199|\u2198|\u2197|\u2196|\u2195|\u2194|\u2139|\u2049|\u203c|\u2668)([\uFE0E\uFE0F]?)))/g,SVGPATH:s,ZREKNARF:'",CHAT_BUTTON:'",ROOMS:'',CAMERA:'',INVITE:'',EYE:'',CLOCK:'',GEAR:'',HEART:'',EMOTE:'',STAR:'',CLOSE:''}
+},{}],5:[function(){var e=t.FrankerFaceZ;e.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){return this.settings.developer_mode||Date.now()-parseInt(localStorage.ffzLastDevMode||"0")<6048e5},category:"Debugging",name:"Developer Mode",help:"Load FrankerFaceZ from the local development server instead of the CDN. Please refresh after changing this setting.",on_update:function(){localStorage.ffzLastDevMode=Date.now()}},e.ffz_commands.developer_mode=function(t,e){var s,e=e&&e.length?e[0].toLowerCase():null;return"y"==e||"yes"==e||"true"==e||"on"==e?s=!0:("n"==e||"no"==e||"false"==e||"off"==e)&&(s=!1),void 0===s?"Developer Mode is currently "+(this.settings.developer_mode?"enabled.":"disabled."):(this.settings.set("developer_mode",s),"Developer Mode is now "+(s?"enabled":"disabled")+". Please refresh your browser.")},e.ffz_commands.developer_mode.help="Usage: /ffz developer_mode \nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN."},{}],6:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants");s.prototype.setup_channel=function(){this.log("Creating channel style element.");var t=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),document.body.classList.toggle("ffz-hide-view-count",!this.settings.channel_views),this.log("Creating channel style element.");var t=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),this.log("Hooking the Ember Channel Index view.");var e=App.__container__.resolve("view:channel/index"),o=this;if(e){this._modify_cindex(e);try{e.create().destroy()}catch(n){}for(var i in Ember.View.views)if(Ember.View.views.hasOwnProperty(i)){var a=Ember.View.views[i];a instanceof e&&(this.log("Manually updating Channel Index view.",a),this._modify_cindex(a),a.ffzInit())}this.log("Hooking the Ember Channel model."),e=App.__container__.resolve("model:channel"),e&&(e.reopen({ffz_host_target:void 0,setHostMode:function(t){return o.settings.hosted_channels?(this.set("ffz_host_target",t.target),this._super(t)):(this.set("ffz_host_target",void 0),this._super({target:void 0,delay:0}))}}),this.log("Hooking the Ember Channel controller."),e=App.__container__.lookup("controller:channel"),e&&e.reopen({ffzUpdateUptime:function(){o._cindex&&o._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateTitle:function(){var t=this.get("content.name"),e=this.get("content.display_name");e&&(s.capitalization[t]=[e,Date.now()]),o._cindex&&o._cindex.ffzFixTitle()}.observes("content.status","content.id"),ffzHostTarget:function(){var t=this.get("content.hostModeTarget"),e=t&&t.get("name"),n=t&&t.get("id"),i=t&&t.get("display_name");n!==o.__old_host_target&&(o.__old_host_target&&o.ws_send("unsub_channel",o.__old_host_target),n?(o.ws_send("sub_channel",n),o.__old_host_target=n):delete o.__old_host_target),i&&(s.capitalization[e]=[i,Date.now()]),o.settings.group_tabs&&o._chatv&&o._chatv.ffzRebuildTabs(),o.settings.follow_buttons&&o.rebuild_following_ui(),o.settings.srl_races&&o.rebuild_race_ui()}.observes("content.hostModeTarget")}))}},s.prototype._modify_cindex=function(t){var e=this;t.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("CIndex didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("CIndex willClearRender: "+t)}return this._super()},ffzInit:function(){var t=this.get("controller.id"),s=this.get("element");e._cindex=this,e.ws_send("sub_channel",t),s.setAttribute("data-channel",t),s.classList.add("ffz-channel"),this.$(".theatre-button a").attr("title","Theater Mode (Alt+T)"),this.ffzFixTitle(),this.ffzUpdateUptime(),this.ffzUpdateChatters(),this.ffzUpdateHostButton();var o=this.get("element").querySelector(".svg-glyph_views:not(.ffz-svg)");o&&o.parentNode.classList.add("twitch-channel-views"),e.settings.follow_buttons&&e.rebuild_following_ui(),e.settings.srl_races&&e.rebuild_race_ui()},ffzFixTitle:function(){if(!e.has_bttv&&e.settings.stream_title){var t=this.get("controller.status"),s=this.get("controller.id");t=e.render_tokens(e.tokenize_line(s,s,t,!0)),this.$(".title span").each(function(e,s){var o=s.querySelectorAll("script");s.innerHTML=o.length?o[0].outerHTML+t+o[1].outerHTML:t})}},ffzUpdateHostButton:function(){var t=this.get("controller.id"),n=this.get("controller.hostModeTarget.id"),i=e.get_user(),a=i&&e.rooms&&e.rooms[i.login]&&e.rooms[i.login].room,r=a&&a.ffz_host_target,d=a&&a.ffz_hosts_left,u=this.get("element");if(this.set("ffz_host_updating",!1),t){var c=u&&u.querySelector(".stats-and-actions .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&e.settings.stream_host_button&&i&&i.login!==t){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!1));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=t===r?"Unhost":"Host",l.title=r?"You are now hosting "+o.sanitize(s.get_capitalization(r))+".":"You are not hosting any channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)}if(n){var c=u&&u.querySelector("#hostmode .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&e.settings.stream_host_button&&i&&i.login!==n){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!0));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=n===r?"Unhost":"Host",l.title=r?"You are currently hosting "+o.sanitize(s.get_capitalization(r))+". Click to "+(n===r?"unhost":"host")+" this channel.":"You are not currently hosting any channel. Click to host this channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)}},ffzClickHost:function(t,s){var o=t.get(s?"controller.hostModeTarget.id":"controller.id"),n=e.get_user(),i=n&&e.rooms&&e.rooms[n.login]&&e.rooms[n.login].room,a=i&&i.ffz_host_target;i&&!t.get("ffz_host_updating")&&(this.classList.add("disabled"),this.title="Updating...",t.set("ffz_host_updating",!0),i.send(a===o?"/unhost":"/host "+o))},ffzUpdateChatters:function(){var t=this.get("controller.id"),s=e.rooms&&e.rooms[t];if(!s||!e.settings.chatter_count){var i=this.get("element").querySelector("#ffz-chatter-display");return i&&i.parentElement.removeChild(i),i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentElement.removeChild(i))}var a=Object.keys(s.room.get("ffz_chatters")||{}).length,r=s.ffz_chatters||0,d=s.ffz_viewers||0,i=this.get("element").querySelector("#ffz-chatter-display span");if(!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-chatter-display",c.title="Currently in Chat",c.innerHTML=n.ROOMS+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-ffzchatter-display");l?u.insertBefore(c,l):u.appendChild(c),jQuery(c).tipsy()}if(i.innerHTML=o.number_commas(a),!r&&!d)return i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentNode.removeChild(i));if(i=this.get("element").querySelector("#ffz-ffzchatter-display span"),!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-ffzchatter-display",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=n.ZREKNARF+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-chatter-display");l?u.insertBefore(c,l.nextSibling):u.appendChild(c),jQuery(c).tipsy()}i.innerHTML=o.number_commas(d)+" ("+o.number_commas(r)+")"},ffzUpdateUptime:function(){if(this._ffz_update_uptime&&(clearTimeout(this._ffz_update_uptime),delete this._ffz_update_uptime),!e.settings.stream_uptime||!this.get("controller.isLiveAccordingToKraken")){var t=this.get("element").querySelector("#ffz-uptime-display");return void(t&&t.parentElement.removeChild(t))}this._ffz_update_uptime=setTimeout(this.ffzUpdateUptime.bind(this),1e3);var s=this.get("controller.content.stream.created_at");if(s&&(s=o.parse_date(s))){var i=Math.floor((Date.now()-s.getTime())/1e3);if(!(0>i)){var t=this.get("element").querySelector("#ffz-uptime-display span");if(!t){var a=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!a)return;var r=document.createElement("span");r.className="ffz stat",r.id="ffz-uptime-display",r.title="Stream Uptime (since "+s.toLocaleString()+")",r.innerHTML=n.CLOCK+" ",t=document.createElement("span"),r.appendChild(t);var d=a.querySelector(".live-count");if(d)a.insertBefore(r,d.nextSibling);else try{d=a.querySelector("script:nth-child(0n+2)"),a.insertBefore(r,d.nextSibling)}catch(u){a.insertBefore(r,a.childNodes[0])}jQuery(r).tipsy({html:!0})}t.innerHTML=o.time_to_string(i)}}},ffzTeardown:function(){var t=this.get("controller.id");t&&e.ws_send("unsub_channel",t),this.get("element").setAttribute("data-channel",""),e._cindex=void 0,this._ffz_update_uptime&&clearTimeout(this._ffz_update_uptime),o.update_css(e._channel_style,t,null)}})},s.settings_info.chatter_count={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:"Chatter Count",help:"Display the current number of users connected to chat beneath the channel.",on_update:function(t){if(this._cindex&&this._cindex.ffzUpdateChatters(),t&&this.rooms)for(var e in this.rooms)this.rooms.hasOwnProperty(e)&&this.rooms[e].room&&this.rooms[e].room.ffzInitChatterCount()}},s.settings_info.channel_views={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Channel Views",help:"Display the number of times the channel has been viewed beneath the stream.",on_update:function(t){document.body.classList.toggle("ffz-hide-view-count",!t)}},s.settings_info.hosted_channels={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Channel Hosting",help:"Display other channels that have been featured by the current channel.",on_update:function(t){var e=document.querySelector("input.ffz-setting-hosted-channels");if(e&&(e.checked=t),this._cindex){var s=this._cindex.get("controller.model"),o=s&&this.rooms&&this.rooms[s.get("id")],n=o&&o.room&&o.room.get("ffz_host_target");s&&o&&s.setHostMode({target:n,delay:0})}}},s.settings_info.stream_host_button={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Host This Channel Button",help:"Display a button underneath streams that make it easy to host them with your own channel.",on_update:function(){this._cindex&&this._cindex.ffzUpdateHostButton()}},s.settings_info.stream_uptime={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:"Stream Uptime",help:"Display the stream uptime under a channel by the viewer count.",on_update:function(){this._cindex&&this._cindex.ffzUpdateUptime()}},s.settings_info.stream_title={type:"boolean",value:!0,no_bttv:!0,no_mobile:!0,category:"Channel Metadata",name:"Title Links",help:"Make links in stream titles clickable.",on_update:function(){this._cindex&&this._cindex.ffzFixTitle()}}},{"../constants":4,"../utils":33}],7:[function(e){var s=t.FrankerFaceZ,o=(e("../utils"),e("../constants"),{BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,TWO:50,COLON:59,FAKE_COLON:186}),n=function(t){if("number"==typeof t.selectionStart)return t.selectionStart;if(!t.createTextRange)return-1;var e=document.selection.createRange(),s=t.createTextRange();return s.moveToBookmark(e.getBookmark()),s.moveStart("character",-t.value.length),s.text.length},i=function(t,e){if(t.setSelectionRange)t.setSelectionRange(e,e);else if(t.createTextRange){var s=t.createTextRange();s.move("character",-t.value.length),s.move("character",e),s.select()}};s.settings_info.input_quick_reply={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Reply to Whispers with /r",help:"Automatically replace /r at the start of the line with the command to whisper to the person you've whispered with most recently."},s.settings_info.input_mru={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Chat Input History",help:"Use the Up and Down arrows in chat to select previously sent chat messages."},s.settings_info.input_emoji={type:"boolean",value:!1,category:"Chat Input",no_bttv:!0,name:"Enter Emoji By Name",help:"Replace emoji that you type by name with the character. :+1: becomes 👍."},s.prototype.setup_chat_input=function(){this.log("Hooking the Ember Chat Input controller.");var t=App.__container__.resolve("component:twitch-chat-input");if(t&&(this._modify_chat_input(t),this._roomv))for(var e=0;e0&&Ember.run.next(function(){var t=d.get("textareaValue"),e=t.lastIndexOf(":",u-1);if(-1!==e&&-1!==u&&":"===t.charAt(u)){var s=t.substr(e+1,u-e-1),o=a.emoji_names[s],n=a.emoji_data[o];if(n){var r=t.substr(0,e)+n.raw;d.set("textareaValue",r+t.substr(u+1)),Ember.run.next(function(){i(d.get("chatTextArea"),r.length)})}}}))}return this._onKeyDown(e);case o.ENTER:s.shiftKey||s.shiftLeft||this.set("ffz_mru_index",-1);default:return this._onKeyDown(e)}},ffzCycleMRU:function(t,e){var s=n(this.get("chatTextArea"));if(e===s){var i=this.get("ffz_mru_index"),a=this._parentView.get("context.model.mru_list")||[];i=t===o.UP?(i+1)%(a.length+1):(i+a.length)%(a.length+1);var r=this.get("ffz_old_mru");(void 0===r||null===r)&&(r=this.get("textareaValue"),this.set("ffz_old_mru",r));var d=a[i];void 0===d&&(this.set("ffz_old_mru",void 0),d=r),this.set("ffz_mru_index",i),this.set("textareaValue",d)}},completeSuggestion:function(t){var e,o,n=this,a=this.get("textareaValue"),r=this.get("partialNameStartIndex");e=a.substring(0,r)+("/"===a.charAt(0)?t:s.get_capitalization(t)),o=a.substring(r+this.get("partialName").length),o||(e+=" "),this.set("textareaValue",e+o),this.set("isShowingSuggestions",!1),this.set("partialName",""),this.trackSuggestionsCompleted(),Ember.run.next(function(){i(n.get("chatTextArea"),e.length)})}})}},{"../constants":4,"../utils":33}],8:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants");s.settings_info.swap_sidebars={type:"boolean",value:!1,category:"Appearance",no_mobile:!0,no_bttv:!0,name:"Swap Sidebar Positions",help:"Swap the positions of the left and right sidebars, placing chat on the left.",on_update:function(t){this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",t)}},s.settings_info.minimal_chat={type:"boolean",value:!1,category:"Chat Appearance",name:"Minimalistic Chat",help:"Hide all of the chat user interface, only showing messages and an input box.",on_update:function(t){if(document.body.classList.toggle("ffz-minimal-chat",t),this.settings.group_tabs&&this._chatv&&this._chatv._ffz_tabs){var e=this;setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px"),e._roomv&&e._roomv.get("stuckToBottom")&&e._roomv._scrollToBottom()},0)}this._chatv&&this._chatv.get("controller.showList")&&this._chatv.set("controller.showList",!1)}},s.settings_info.prevent_clear={type:"boolean",value:!1,no_bttv:!0,category:"Chat Filtering",name:"Show Deleted Messages",help:"Fade deleted messages instead of replacing them, and prevent chat from being cleared.",on_update:function(t){if(!this.has_bttv&&this.rooms)for(var e in this.rooms){var s=this.rooms[e],o=s&&s.room;o&&o.get("messages").forEach(function(e,s){t&&!e.ffz_deleted&&e.deleted?o.set("messages."+s+".deleted",!1):!e.ffz_deleted||t||e.deleted||o.set("messages."+s+".deleted",!0)})}}},s.settings_info.chat_history={type:"boolean",value:!0,visible:!1,category:"Chat Appearance",name:"Chat History Alpha",help:"Load previous chat messages when loading a chat room so you can see what people have been talking about. This currently only works in a handful of channels due to server capacity."},s.settings_info.group_tabs={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Chat Room Tabs Beta",help:"Enhanced UI for switching the current chat room and noticing new messages.",on_update:function(t){var e=!this.has_bttv&&t;this._chatv&&e!==this._group_tabs_state&&(e?this._chatv.ffzEnableTabs():this._chatv.ffzDisableTabs())}},s.settings_info.pinned_rooms={value:[],visible:!1},s.settings_info.visible_rooms={value:[],visible:!1},s.prototype.setup_chatview=function(){document.body.classList.toggle("ffz-minimal-chat",this.settings.minimal_chat),this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",this.settings.swap_sidebars),this.log("Hooking the Ember Chat controller.");var t=App.__container__.lookup("controller:chat"),e=this;t&&t.reopen({ffzUpdateChannels:function(){e._chatv&&(e._chatv.ffzRebuildMenu(),e.settings.group_tabs&&e._chatv.ffzRebuildTabs())}.observes("currentChannelRoom","connectedPrivateGroupRooms"),removeCurrentChannelRoom:function(){if(!e.settings.group_tabs||e.has_bttv)return this._super();var t=this.get("currentChannelRoom"),s=t&&t.get("id"),o=e.get_user();e.settings.pinned_rooms&&-1!==e.settings.pinned_rooms.indexOf(s)||(t===this.get("currentRoom")&&this.blurRoom(),t&&o&&o.login===s&&t.destroy()),this.set("currentChannelRoom",void 0)}}),this.log("Hooking the Ember Chat view.");var t=App.__container__.resolve("view:chat");this._modify_cview(t);try{t.create().destroy()}catch(s){}for(var o in Ember.View.views)if(Ember.View.views.hasOwnProperty(o)){var n=Ember.View.views[o];if(n instanceof t){this.log("Manually updating existing Chat view.",n);try{n.ffzInit()}catch(s){this.error("setup: build_ui_link: "+s)}}}this.log("Hooking the Ember Layout controller.");var i=App.__container__.lookup("controller:layout");if(i){i.reopen({ffzFixTabs:function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("isRightColumnClosed")}),this.log("Hooking the Ember 'Right Column' controller. Seriously...");var a=App.__container__.lookup("controller:right-column");a&&a.reopen({ffzFixTabs:function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("firstTabSelected")})}},s.prototype._modify_cview=function(t){var e=this;t.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("ChatView didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("ChatView willClearRender: "+t)}this._super()},ffzInit:function(){e._chatv=this,this.$(".textarea-contain").append(e.build_ui_link(this)),!e.has_bttv&&e.settings.group_tabs&&this.ffzEnableTabs(),this.ffzRebuildMenu(),setTimeout(function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px");var t=e._chatv.get("controller");t&&t.set("showList",!1)},1e3)},ffzTeardown:function(){e._chatv===this&&(e._chatv=null),this.$(".textarea-contain .ffz-ui-toggle").remove(),e.settings.group_tabs&&this.ffzDisableTabs()},ffzChangeRoom:Ember.observer("controller.currentRoom",function(){try{e.update_ui_link();var t,s=this.get("controller.currentRoom");if(s&&s.resetUnreadCount(),this._ffz_chan_table&&(t=jQuery(this._ffz_chan_table),t.children(".ffz-room-row").removeClass("active"),s&&t.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),this._ffz_group_table&&(t=jQuery(this._ffz_group_table),t.children(".ffz-room-row").removeClass("active"),s&&t.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),!e.has_bttv&&e.settings.group_tabs&&this._ffz_tabs){var o=jQuery(this._ffz_tabs);o.children(".ffz-chat-tab").removeClass("active"),s&&o.children('.ffz-chat-tab[data-room="'+s.get("id")+'"]').removeClass("tab-mentioned").removeClass("hidden").addClass("active").children("span").text("");var n=s&&s.get("canInvite");this._ffz_invite&&this._ffz_invite.classList.toggle("hidden",!n),this.set("controller.showInviteUser",n&&this.get("controller.showInviteUser")),this.$(".chat-room").css("top",this._ffz_tabs.offsetHeight+"px")}}catch(i){e.error("ChatView ffzUpdateLink: "+i)}}),ffzRebuildMenu:function(){return},ffzBuildRow:function(t,i,a,r){var d,u=document.createElement("tr"),c=document.createElement("td"),l=document.createElement("td"),h=document.createElement("td"),f=document.createElement("td"),_=i.get("isGroupRoom"),m=i===t.get("controller.currentRoom"),p=i.get("tmiRoom.displayName")||(_?i.get("tmiRoom.name"):s.get_capitalization(i.get("id"),function(t){e.log("Name for Row: "+t),l.innerHTML=o.sanitize(t)}));return l.className="ffz-room",l.innerHTML=o.sanitize(p),a?(c.innerHTML=n.CAMERA,c.title=l.title="Current Channel",c.className=l.className="tooltip"):r&&(c.innerHTML=n.EYE,c.title=l.title="Hosted Channel",c.className=l.className="tooltip"),h.className=f.className="ffz-row-switch",h.innerHTML='',f.innerHTML='',u.setAttribute("data-room",i.get("id")),u.className="ffz-room-row",u.classList.toggle("current-channel",a),u.classList.toggle("host-channel",r),u.classList.toggle("group-chat",_),u.classList.toggle("active",m),u.appendChild(c),u.appendChild(l),_?(d=document.createElement("a"),d.className="leave-chat tooltip",d.innerHTML=n.CLOSE,d.title="Leave Group",l.appendChild(d),d.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation&&t.stopPropagation(),confirm('Are you sure you want to leave the group room "'+p+'"?')&&i.get("isGroupRoom")&&i.del()})):(u.appendChild(h),d=h.querySelector("a.switch"),d.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation&&t.stopPropagation();var s=i.get("id"),o=-1!==e.settings.pinned_rooms.indexOf(s);o?e._leave_room(s):e._join_room(s),this.classList.toggle("active",!o)})),u.appendChild(f),d=f.querySelector("a.switch"),d.addEventListener("click",function(s){s.preventDefault(),s.stopPropagation&&s.stopPropagation();var o=i.get("id"),n=e.settings.visible_rooms,a=-1!==n.indexOf(o);a?n.removeObject(o):n.push(o),e.settings.set("visible_rooms",n),this.classList.toggle("active",!a),t.ffzRebuildTabs()}),u.addEventListener("click",function(){var e=t.get("controller");e.focusRoom(i),e.set("showList",!1)}),u},ffzEnableTabs:function(){if(!e.has_bttv&&e.settings.group_tabs){this.$(".chat-header").addClass("hidden");var t=this._ffz_tabs=document.createElement("div");t.id="ffz-group-tabs",this.$(".chat-header").after(t),this.ffzRebuildTabs()}},ffzRebuildTabs:function(){if(!e.has_bttv&&e.settings.group_tabs){var t=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs");if(t){t.innerHTML="";var s=document.createElement("a"),o=this;s.className="button glyph-only tooltip",s.title="Chat Room Management",s.innerHTML=n.ROOMS,s.addEventListener("click",function(){var t=o.get("controller");t&&t.set("showList",!t.get("showList"))}),t.appendChild(s),s=document.createElement("a"),s.className="button glyph-only tooltip invite",s.title="Invite a User",s.innerHTML=n.INVITE,s.addEventListener("click",function(){var t=o.get("controller");t&&t.set("showInviteUser",t.get("currentRoom.canInvite")&&!t.get("showInviteUser"))}),s.classList.toggle("hidden",!this.get("controller.currentRoom.canInvite")),o._ffz_invite=s,t.appendChild(s);var i,a=this.get("controller.currentChannelRoom");a&&(i=this.ffzBuildTab(o,a,!0),i&&t.appendChild(i));var r=App.__container__.lookup("controller:channel"),d=App.__container__.resolve("model:room");if(target=r&&r.get("hostModeTarget"),target&&d){var u=target.get("id");this._ffz_host!==u&&(-1===e.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),this._ffz_host=u,this._ffz_host_room=d.findOne(u))}else this._ffz_host&&(-1===e.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room);this._ffz_host_room&&(i=o.ffzBuildTab(o,this._ffz_host_room,!1,!0),i&&t.appendChild(i));for(var c=0;c"+u+""})),a?(l=n.CAMERA,c.title="Current Channel"):r?(l=n.EYE,c.title="Hosted Channel"):c.title=f?"Group Chat":"Pinned Channel",c.innerHTML=l+o.sanitize(d)+""+u+"",c.addEventListener("click",function(){var e=t.get("controller");e.focusRoom(i),e.set("showList",!1)}),c},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),delete this._ffz_tabs,delete this._ffz_invite),this._ffz_host&&(-1===e.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),delete this._ffz_host,delete this._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},s.prototype.connect_extra_chat=function(){var t=this.get_user();if(t&&t.login&&(!this.rooms[t.login]||this.rooms[t.login].room)){var e=App.__container__.resolve("model:room");e&&e.findOne(t.login)}if(!this.has_bttv){for(var s=0;s1)return"Join Usage: /join ";var s=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._join_room(s)?"Joining "+s+". You will always connect to this channel's chat unless you later /part from it.":"You have already joined "+s+'. Please use "/part '+s+'" to leave it.'},s.chat_commands.part=function(t,e){if(!e||!e.length||e.length>1)return"Part Usage: /part ";var s=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._leave_room(s)?"Leaving "+s+".":this.rooms[s]?"You do not have "+s+" pinned and you cannot leave the current channel or hosted channels via /part.":"You are not in "+s+"."}},{"../constants":4,"../utils":33}],9:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants"),i="[\\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]",a=new RegExp(i+"*,"+i+"*"),r="http://static-cdn.jtvnw.net/emoticons/v1/",d={};
+build_srcset=function(t){if(d[t])return d[t];var e=d[t]=r+t+"/1.0 1x, "+r+t+"/2.0 2x, "+r+t+"/3.0 4x";return e},LINK_SPLIT=/^(?:(https?):\/\/)?(?:(.*?)@)?([^\/:]+)(?::(\d+))?(.*?)(?:\?(.*?))?(?:\#(.*?))?$/,YOUTUBE_CHECK=/^(?:https?:\/\/)?(?:m\.|www\.)?youtu(?:be\.com|\.be)\/(?:v\/|watch\/|.*?(?:embed|watch).*?v=)?([a-zA-Z0-9\-_]+)$/,IMGUR_PATH=/^\/(?:gallery\/)?[A-Za-z0-9]+(?:\.(?:png|jpg|jpeg|gif|gifv|bmp))?$/,IMAGE_EXT=/\.(?:png|jpg|jpeg|gif|bmp)$/i,IMAGE_DOMAINS=[],is_image=function(t,e){var s=t.match(LINK_SPLIT);if(s){var o=s[3].toLowerCase(),n=s[4],i=s[5];return n&&"80"!==n&&"443"!==n?!1:"i.imgur.com"===o||"imgur.com"===o||"www.imgur.com"===o||"m.imgur.com"===o?IMGUR_PATH.test(i):e?IMAGE_EXT.test(i):-1!==IMAGE_DOMAINS.indexOf(o)}},image_iframe=function(t,e){return''},data_to_tooltip=function(t){var e=t.set,s=t.set_type,o=t.owner;return void 0===s&&(s="Channel"),e?(("--twitch-turbo--"==e||"turbo"==e)&&(e="Twitch Turbo",s=null),"Emoticon: "+t.code+"\n"+(s?s+": ":"")+e+(o?"\nBy: "+o.display_name:"")):t.code},build_tooltip=function(t){{var e=this._twitch_emotes[t];e?e.set:null}return e?"string"==typeof e?e:e.tooltip?e.tooltip:e.tooltip=data_to_tooltip(e):"???"},load_emote_data=function(t,e,s,o){if(s){e&&(o.code=e),this._twitch_emotes[t]=o;for(var n=build_tooltip.bind(this)(t),i=document.querySelectorAll('img[emote-id="'+t+'"]'),a=0;aYouTube: "+o.sanitize(s.title)+"",e+="Channel: "+o.sanitize(s.channel)+" | "+o.time_to_string(s.duration)+" ",e+=o.number_commas(s.views||0)+" Views | 👍 "+o.number_commas(s.likes||0)+" 👎 "+o.number_commas(s.dislikes||0);else if("strawpoll"==s.type){e="Strawpoll: "+o.sanitize(s.title)+"
";for(var n in s.items){{var i=s.items[n];Math.floor(i/s.total*100)}e+='
'+o.sanitize(n)+'
'+o.number_commas(i)+"
"}e+="
Total: "+o.number_commas(s.total);var a=o.parse_date(s.fetched);if(a){var r=Math.floor((a.getTime()-Date.now())/1e3);r>60&&(e+=" Data was cached "+o.time_to_string(r)+" ago.")}}else if("twitch"==s.type){e="Twitch: "+o.sanitize(s.display_name)+"";var d=o.parse_date(s.since);d&&(e+="Member Since: "+o.date_string(d)+" "),e+="Views: "+o.number_commas(s.views)+" | Followers: "+o.number_commas(s.followers)+""}else if("twitch_vod"==s.type)e="Twitch "+("highlight"==s.broadcast_type?"Highlight":"Broadcast")+": "+o.sanitize(s.title)+"",e+="By: "+o.sanitize(s.display_name)+(s.game?" | Playing: "+o.sanitize(s.game):" | Not Playing")+" ",e+="Views: "+o.number_commas(s.views)+" | "+o.time_to_string(s.length);else if("twitter"==s.type)e="Tweet By: "+o.sanitize(s.user)+"",e+=o.sanitize(s.tweet);else if("reputation"==s.type){if(e=this.settings.link_image_hover&&is_image(s.full||t,this.settings.image_hover_all_domains)?image_iframe(s.full||t):"",e+=''+o.sanitize(s.full.toLowerCase())+"",s.trust<50||s.safety<50||s.tags&&s.tags.length>0){e+="";var u=!1;(s.trust<50||s.safety<50)&&(s.unsafe=!0,e+="Potentially Unsafe Link ",e+="Trust: "+s.trust+"% | Child Safety: "+s.safety+"%",u=!0),s.tags&&s.tags.length>0&&(e+=(u?" ":"")+"Tags: "+s.tags.join(", ")),e+=" Data Source: WOT"}}else s.full&&(e=this.settings.link_image_hover&&is_image(s.full||t,this.settings.image_hover_all_domains)?image_iframe(s.full||t):"",e+=''+o.sanitize(s.full.toLowerCase())+"");return e||(e=''+o.sanitize(t.toLowerCase())+""),s.tooltip=e,e},load_link_data=function(t,e,s){if(e){this._link_data[t]=s,s.unsafe=!1;var o,n=build_link_tooltip.bind(this)(t),i="/"==t.charAt(t.length-1)?t.substr(0,t.length-1):null;if(o=document.querySelectorAll(i?'span.message a[href="'+t+'"], span.message a[href="'+i+'"], span.message a[data-url="'+t+'"], span.message a[data-url="'+i+'"]':'span.message a[href="'+t+'"], span.message a[data-url="'+t+'"]'),this.settings.link_info)for(var a=0;at&&(t=10),this.settings.set("scrollback_length",t);var e=App.__container__.lookup("controller:chat"),s=e&&e.get("currentRoom.id");for(var o in this.rooms){var n=this.rooms[o];n.room.set("messageBufferSize",t+(this._roomv&&!this._roomv.get("stuckToBottom")&&s===o?150:0))}}}},s.settings_info.banned_words={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Banned Words",help:"Set a list of words that will be locally removed from chat messages.",method:function(){var t=this.settings.banned_words.join(", "),e=prompt("Banned Words\n\nPlease enter a comma-separated list of words that you would like to be removed from chat messages.",t);if(null!==e&&void 0!==e){e=e.trim().split(a);for(var s=[],o=0;oBeta",help:"Check links against known bad websites, unshorten URLs, and show YouTube info."},s.settings_info.link_image_hover={type:"boolean",value:!1,category:"Chat Tooltips",no_bttv:!0,no_mobile:!0,name:"Image Preview",help:"Display image thumbnails for links to Imgur and YouTube."},s.settings_info.image_hover_all_domains={type:"boolean",value:!1,category:"Chat Tooltips",no_bttv:!0,no_mobile:!0,name:"Image Preview - All Domains",help:"Requires Image Preview. Attempt to show an image preview for any URL ending in the appropriate extension. Warning: This may be used to leak your IP address to malicious users."},s.settings_info.legacy_badges={type:"boolean",value:!1,category:"Chat Appearance",name:"Legacy Badges",help:"Display the old, pre-vector chat badges from Twitch.",on_update:function(t){document.body.classList.toggle("ffz-legacy-badges",t)}},s.settings_info.chat_rows={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Backgrounds",help:"Display alternating background colors for lines in chat.",on_update:function(t){document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&t)}},s.settings_info.chat_separators={type:"select",options:{0:"Disabled",1:"Basic Line (1px solid)",2:"3D Line (2px groove)"},value:"0",category:"Chat Appearance",no_bttv:!0,process_value:function(t){return t===!1?"0":t===!0?"1":t},name:"Chat Line Separators",help:"Display thin lines between chat messages for further visual separation.",on_update:function(t){document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&"0"!==t),document.body.classList.toggle("ffz-chat-separator-3d",!this.has_bttv&&"2"===t)}},s.settings_info.chat_padding={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Reduced Chat Line Padding",help:"Reduce the amount of padding around chat messages to fit more on-screen at once.",on_update:function(t){document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&t)}},s.settings_info.high_contrast_chat={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"High Contrast",help:"Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",on_update:function(t){document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&t)}},s.settings_info.chat_font_size={type:"button",value:12,category:"Chat Appearance",no_bttv:!0,name:"Font Size",help:"Make the chat font bigger or smaller.",method:function(){var t=this.settings.chat_font_size,e=prompt("Chat Font Size\n\nPlease enter a new size for the chat font. The default is 12.",t);if(null!==e&&void 0!==e){var s=parseInt(e);(0/0===s||1>s)&&(s=12),this.settings.set("chat_font_size",s)}},on_update:function(t){if(!this.has_bttv&&this._chat_style){var e;if(12===t)e="";else{var n=Math.max(20,Math.round(20/12*t)),i=Math.floor((n-20)/2);e=".ember-chat .chat-messages .chat-line { font-size: "+t+"px !important; line-height: "+n+"px !important; }",i&&(e+=".ember-chat .chat-messages .chat-line .mod-icons, .ember-chat .chat-messages .chat-line .badges { padding-top: "+i+"px; }")}o.update_css(this._chat_style,"chat_font_size",e),s.settings_info.chat_ts_size.on_update.bind(this)(this.settings.chat_ts_size)}}},s.settings_info.chat_ts_size={type:"button",value:null,category:"Chat Appearance",no_bttv:!0,name:"Timestamp Font Size",help:"Make the chat timestamp font bigger or smaller.",method:function(){var t=this.settings.chat_ts_size;null===t&&(t=this.settings.chat_font_size);var e=prompt("Chat Timestamp Font Size\n\nPlease enter a new size for the chat timestamp font. The default is to match the regular chat font size.",t);if(null!==e&&void 0!==e){var s=parseInt(e);(0/0===s||1>s)&&(s=null),this.settings.set("chat_ts_size",s)}},on_update:function(t){if(!this.has_bttv&&this._chat_style){var e;if(null===t)e="";else{var s=Math.max(20,Math.round(20/12*t),Math.round(20/12*this.settings.chat_font_size));e=".ember-chat .chat-messages .timestamp { font-size: "+t+"px !important; line-height: "+s+"px !important; }"}o.update_css(this._chat_style,"chat_ts_font_size",e)}}},s.prototype.setup_line=function(){jQuery(document.body).on("mouseleave",".tipsy",function(){this.parentElement.removeChild(this)});var t=this._chat_style=document.createElement("style");t.id="ffz-style-chat",t.type="text/css",document.head.appendChild(t),s.settings_info.chat_font_size.on_update.bind(this)(this.settings.chat_font_size),document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&"-1"!==this.settings.fix_color),document.body.classList.toggle("ffz-chat-colors-gray",!this.has_bttv&&"-1"===this.settings.fix_color),document.body.classList.toggle("ffz-legacy-badges",this.settings.legacy_badges),document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&this.settings.chat_rows),document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&"0"!==this.settings.chat_separators),document.body.classList.toggle("ffz-chat-separator-3d",!this.has_bttv&&"2"===this.settings.chat_separators),document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&this.settings.chat_padding),document.body.classList.toggle("ffz-chat-purge-icon",!this.has_bttv&&this.settings.line_purge_icon),document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&this.settings.high_contrast_chat),this._last_row={},this._twitch_emotes={},this._link_data={},this.log("Hooking the Ember Whisper Line component.");var e=App.__container__.resolve("component:whisper-line");e&&this._modify_line(e),this.log("Hooking the Ember Message Line component.");var o=App.__container__.resolve("component:message-line");o&&this._modify_line(o);var n=this.get_user();n&&n.name&&(s.capitalization[n.login]=[n.name,Date.now()])},s.prototype._modify_line=function(t){var e=this;t.reopen({tokenizedMessage:function(){var t=this.get("msgObject.cachedTokens");if(t)return t;t=this._super();try{var o=performance.now(),n=e.get_user(),i=n&&this.get("msgObject.from")===n.login;t=e._remove_banned(t),t=e._emoticonize(this,t),e.settings.parse_emoji&&(t=e.tokenize_emoji(t));var a=this.get("msgObject.tags.display-name");a&&a.length&&(s.capitalization[this.get("msgObject.from")]=[a.trim(),Date.now()]),i||(t=e.tokenize_mentions(t));for(var r=0;r5&&e.log("Tokenizing Message Took Too Long - "+(u-o)+"ms",t,!1,!0)}catch(c){try{e.error("LineController tokenizedMessage: "+c)}catch(c){}}return this.set("msgObject.cachedTokens",t),t}.property("msgObject.message","isChannelLinksDisabled","currentUserNick","msgObject.from","msgObject.tags.emotes"),ffzUpdated:Ember.observer("msgObject.ffz_deleted","msgObject.ffz_old_messages",function(){this.rerender()}),willClearRender:function(){try{}catch(t){e.error("LineView willClearRender: "+t)}this._super()},click:function(t){if(t.target&&t.target.classList.contains("mod-icon")&&(jQuery(t.target).trigger("mouseout"),t.target.classList.contains("purge"))){var s=this.get("msgObject.from"),o=this.get("msgObject.room"),n=o&&e.rooms[o]&&e.rooms[o].room;return void(n&&(n.send("/timeout "+s+" 1"),n.clearMessages(s)))}return this._super(t)},didInsertElement:function(){this._super();try{var t=performance.now(),i=this.get("element"),a=this.get("msgObject.from"),r=this.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),d=this.get("msgObject.ffz_alternate");void 0===d&&(d=e._last_row[r]=e._last_row.hasOwnProperty(r)?!e._last_row[r]:!1,this.set("msgObject.ffz_alternate",d)),i.classList.toggle("ffz-alternate",d||!1),i.classList.toggle("ffz-deleted",e.settings.prevent_clear&&this.get("msgObject.ffz_deleted")||!1),i.setAttribute("data-room",r),i.setAttribute("data-sender",a),i.setAttribute("data-deleted",this.get("msgObject.deleted")||!1);var u=this.get("msgObject.ffz_old_messages");if(u&&u.length){var c=document.createElement("div");c.className="button primary float-right",c.innerHTML="Show "+o.number_commas(u.length)+" Old",c.addEventListener("click",e._show_deleted.bind(e,r)),i.classList.add("clearfix"),i.classList.add("ffz-has-deleted"),this.$(".message").append(c)}if(this.get("isBroadcaster")&&!this.get("controller.parentController.model.isStaff")&&!this.get("controller.parentController.model.isAdmin")||this.get("isModeratorOrHigher")&&!(this.get("controller.parentController.model.isBroadcaster")||this.get("controller.parentController.model.isStaff")||this.get("controller.parentController.model.isAdmin"))){var l=i.querySelector("span.mod-icons");l&&l.classList.add("hidden")}var h=i.querySelector("span.mod-icons a.mod-icon.timeout");if(h){var f=document.createElement("a");f.className="mod-icon float-left tooltip purge",f.innerHTML="Purge",f.title="Purge User (Timeout 1s)",f.href="#",h.title="Timeout User (10m)",h.parentElement.insertBefore(f,h.nextSibling)}e.render_badge(this),this.get("msgObject.ffz_has_mention")&&i.classList.add("ffz-mentioned");for(var _=i.querySelectorAll("span.message a.deleted-link"),m=0;m<_.length;m++)_[m].addEventListener("click",e._deleted_link_click);if(e.settings.link_info||e.settings.link_image_hover){for(var p=i.querySelectorAll("span.message a"),m=0;m5&&e.log("Line Took Too Long - "+M+"ms",i.innerHTML,!1,!0)}catch(A){try{e.error("LineView didInsertElement: "+A)}catch(A){}}}})},s.capitalization={},s._cap_fetching=0,s.get_capitalization=function(t,e){if(!t)return t;if(t=t.toLowerCase(),"jtv"==t||"twitchnotify"==t)return t;var o=s.capitalization[t];return o&&Date.now()-o[1]<36e5?o[0]:(s._cap_fetching<25&&(s._cap_fetching++,s.get().ws_send("get_display_name",t,function(o,n){var i=o?n:t;s.capitalization[t]=[i,Date.now()],s._cap_fetching--,"function"==typeof e&&e(i)})),o?o[0]:t)},s.prototype._remove_banned=function(t){var e=this.settings.banned_words;if(!e||!e.length)return t;"string"==typeof t&&(t=[t]);for(var n=s._words_to_regex(e),i=[],a=0;a<banned link>',own:!0}:r)}return i},s.prototype._emoticonize=function(t,e){var s=t.get("msgObject.room"),o=t.get("msgObject.from");return this.tokenize_emotes(o,s,e)}},{"../constants":4,"../utils":33}],10:[function(e){var s,o=t.FrankerFaceZ,n=e("../utils"),i=e("../constants"),a={ESC:27,P:80,B:66,T:84,U:85},r='',d='',u={},c=function(t){if(1===t)return"Purge";if(u[t])return u[t];var e,s,o,n,i;e=Math.floor(t/604800),i=t%604800,s=Math.floor(i/86400),i%=86400,o=Math.floor(i/3600),i%=3600,n=Math.floor(i/60),i%=60;var a=u[t]=(e?e+"w":"")+(s||e&&(o||n||i)?s+"d":"")+(o||(e||s)&&(n||i)?o+"h":"")+(n||(e||s||o)&&i?n+"m":"")+(i?i+"s":"");return a};try{s=t.require&&t.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(l){}o.settings_info.chat_hover_pause={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Pause Chat Scrolling on Mouse Hover",help:"Automatically prevent the chat from scrolling when moving the mouse over it to prevent moderation mistakes and link mis-clicks.",on_update:function(t){this._roomv&&(t?this._roomv.ffzEnableFreeze():this._roomv.ffzDisableFreeze())}},o.settings_info.short_commands={type:"boolean",value:!0,no_bttv:!0,category:"Chat Moderation",name:"Short Moderation Commands",help:"Use /t, /b, and /u in chat in place of /timeout, /ban, /unban for quicker moderation, and use /p for 1 second timeouts."},o.settings_info.mod_card_hotkeys={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Hotkeys",help:"With a moderation card selected, press B to ban the user, T to time them out for 10 minutes, P to time them out for 1 second, or U to unban them. ESC closes the card."},o.settings_info.mod_card_info={type:"boolean",value:!0,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Additional Information",help:"Display a channel's follower count, view count, and account age on moderation cards."},o.settings_info.mod_card_history={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card History",help:"Display a few of the user's previously sent messages on moderation cards.",on_update:function(t){if(!t&&this.rooms)for(var e in this.rooms){var s=this.rooms[e];s&&(s.user_history=void 0)}}},o.settings_info.mod_card_buttons={type:"button",value:[],category:"Chat Moderation",no_bttv:!0,name:"Moderation Card Additional Buttons",help:"Add additional buttons to moderation cards for running chat commands on those users.",method:function(){for(var t="",e=0;e0&&s.push(i)}this.settings.set("mod_card_durations",s)}}},o.prototype.setup_mod_card=function(){this.log("Modifying Mousetrap stopCallback so we can catch ESC.");var e=Mousetrap.stopCallback;Mousetrap.stopCallback=function(t,s,o){return s.classList.contains("no-mousetrap")?!0:e(t,s,o)},Mousetrap.bind("up up down down left right left right b a enter",function(){var t=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");t&&t.classList.toggle("ffz-flip")}),this.log("Hooking the Ember Moderation Card view.");var o=App.__container__.resolve("component:moderation-card"),u=this;o.reopen({ffzForceRedraw:function(){this.rerender()}.observes("cardInfo.isModeratorOrHigher","cardInfo.user"),ffzRebuildInfo:function(){var t=this.get("element"),e=t&&t.querySelector(".info");if(e){var s=''+i.EYE+" "+n.number_commas(this.get("cardInfo.user.views")||0)+"",o=n.parse_date(this.get("cardInfo.user.created_at")||""),a=this.get("cardInfo.user.ffz_followers");if("number"==typeof a)s+=''+i.HEART+" "+n.number_commas(a||0)+"";else if(void 0===a){var r=this;this.set("cardInfo.user.ffz_followers",!1),Twitch.api.get("channels/"+this.get("cardInfo.user.id")+"/follows",{limit:1}).done(function(t){r.set("cardInfo.user.ffz_followers",t._total),r.ffzRebuildInfo()}).fail(function(){r.set("cardInfo.user.ffz_followers",void 0)})}if(o){var d=Math.floor((Date.now()-o.getTime())/1e3);d>0&&(s+=''+i.CLOCK+" "+n.human_time(d,10)+"")}e.innerHTML=s}}.observes("cardInfo.user.views"),didInsertElement:function(){this._super(),t._card=this;try{if(u.has_bttv)return;var e,o=this.get("element"),i=this.get("controller");if(o.classList.add("ffz-moderation-card"),u.settings.mod_card_info){var l=document.createElement("div"),h=o.querySelector("h3.name");h&&(o.classList.add("ffz-has-info"),l.className="info channel-stats",h.parentElement.insertBefore(l,h.nextSibling),this.ffzRebuildInfo())}if(u.settings.mod_card_buttons&&u.settings.mod_card_buttons.length){e=document.createElement("div"),e.className="extra-interface interface clearfix";for(var f={},m=function(t){var e=i.get("cardInfo.user.id"),s=App.__container__.lookup("controller:chat"),o=s&&s.get("currentRoom");o&&o.send(t.replace(/{user}/g,e))},p=function(t){var e=document.createElement("button"),s=t.split(" ",1)[0],o=f[s]>1?t.split(" ",f[s]):[s];return/^[!~./]/.test(o[0])&&(o[0]=o[0].substr(1)),o=_.map(o,function(t){return t.capitalize()}).join(" "),e.className="button",e.innerHTML=n.sanitize(o),e.title=n.sanitize(t.replace(/{user}/g,i.get("cardInfo.user.id")||"{user}")),jQuery(e).tipsy(),e.addEventListener("click",m.bind(this,t)),e},f={},g=0;g button.message-button");if(L){L.innerHTML="W",L.classList.add("glyph-only"),L.classList.add("message"),L.title="Whisper User",jQuery(L).tipsy();var S=document.createElement("button");S.className="message-button button glyph-only message",S.innerHTML=r,S.title="Message User",jQuery(S).tipsy(),S.addEventListener("click",function(){t.open("http://www.twitch.tv/message/compose?to="+i.get("cardInfo.user.id"))}),L.parentElement.insertBefore(S,L.nextSibling)}if(u.settings.mod_card_history){var M=App.__container__.lookup("controller:chat"),A=M&&M.get("currentRoom"),F=A&&u.rooms&&u.rooms[A.get("id")],R=F&&F.user_history&&F.user_history[i.get("cardInfo.user.id")];if(R&&R.length){var I=document.createElement("ul"),H=!1;I.className="interface clearfix chat-history";for(var g=0;g'+s.getTime(e.date)+" ":"")+''+("action"===e.style?"*"+e.from+" ":"")+u.render_tokens(e.cachedTokens)+"";for(var B=O.querySelectorAll("a.deleted-link"),D=0;DN.bottom){var P=j.bottom-N.bottom;j.top-P>N.top&&(o.style.top=j.top-P+"px")}this.$().draggable({start:function(){o.focus()}}),o.focus()}catch(U){try{u.error("ModerationCardView didInsertElement: "+U)}catch(U){}}}})},o.chat_commands.purge=function(t,e){if(!e||!e.length)return"Purge Usage: /p username [more usernames separated by spaces]";if(e.length>10)return"Please only purge up to 10 users at once.";for(var s=0;s10)return"Please only ban up to 10 users at once.";for(var s=0;s10)return"Please only unban up to 10 users at once.";for(var s=0;s750&&this.ffzUnfreeze()}},ffzUnfreeze:function(){this.ffz_frozen=!1,this._ffz_last_move=0,this.ffzUnwarnPaused(),this.get("stuckToBottom")&&this._scrollToBottom()},ffzMouseDown:function(t){var e=this._$chatMessagesScroller;if(e&&e[0]&&(t.which>0||!this.ffz_frozne&&"mousedown"===t.type||"mousewheel"===t.type||i&&"scroll"===t.type)){var s=e[0].scrollHeight-e[0].scrollTop-e[0].offsetHeight;this._setStuckToBottom(10>=s)}},ffzMouseOut:function(){this._ffz_outside=!0;var t=this;setTimeout(function(){t._ffz_outside&&t.ffzUnfreeze()},25)},ffzMouseMove:function(t){this._ffz_last_move=Date.now(),this._ffz_outside=!1,(t.screenX!==this._ffz_last_screenx||t.screenY!==this._ffz_last_screeny)&&(this._ffz_last_screenx=t.screenX,this._ffz_last_screeny=t.screenY,this.ffz_frozen||(this.ffz_frozen=!0,this.get("stuckToBottom")&&(this.set("controller.model.messageBufferSize",e.settings.scrollback_length+150),this.ffzWarnPaused())))},_scrollToBottom:_.throttle(function(){var t=this,e=this._$chatMessagesScroller;Ember.run.next(function(){setTimeout(function(){!t.ffz_frozen&&e&&e.length&&(e.scrollTop(e[0].scrollHeight),t._setStuckToBottom(!0))})})},200),_setStuckToBottom:function(t){this.set("stuckToBottom",t),this.get("controller.model")&&this.set("controller.model.messageBufferSize",e.settings.scrollback_length+(t?0:150)),t||this.ffzUnfreeze()},ffzWarnPaused:function(){var t=this.get("element"),e=t&&t.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");if(t){if(!e){e=document.createElement("div"),e.className="more-messages-indicator ffz-freeze-indicator",e.innerHTML="(Chat Paused Due to Mouse Movement)";var s=t.querySelector(".chat-interface");if(!s)return;s.insertBefore(e,s.childNodes[0])}e.classList.remove("hidden")}},ffzUnwarnPaused:function(){var t=this.get("element"),e=t&&t.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");e&&e.classList.add("hidden")}})},s.chat_commands={},s.ffz_commands={},s.prototype.room_message=function(t,e){var s=e.split("\n");if(this.has_bttv)for(var o=0;o300,f=e.length,_=o.get("messages.0.ffz_alternate")||!1;h&&(_=!_);for(var f=e.length;f--;){var m=e[f];if("string"==typeof m.date&&(m.date=n.parse_date(m.date)),m.ffz_alternate=_=!_,m.room||(m.room=t),m.color||(m.color=m.tags&&m.tags.color?m.tags.color:a&&m.from?a.getColor(m.from.toLowerCase()):"#755000"),!m.labels||!m.labels.length){var p=m.labels=[];if(m.tags)if(m.tags.turbo&&p.push("turbo"),m.tags.subscriber&&p.push("subscriber"),m.from===t)p.push("owner");else{var g=m.tags["user-type"];("mod"===g||"staff"===g||"admin"===g||"global_mod"===g)&&p.push(g)}}if(m.style||("jtv"===m.from?m.style="admin":"twitchnotify"===m.from&&(m.style="notification")),m.cachedTokens&&m.cachedTokens.length||this.tokenize_chat_line(m,!0),o.shouldShowMessage(m)){if(!(i.lengthv&&(m.ffz_old_messages=m.ffz_old_messages.slice(m.ffz_old_messages.length-v))}i.unshiftObject(m),r+=1}}if(h){var m={ffz_alternate:!_,color:"#755000",date:new Date,from:"frankerfacez_admin",style:"admin",message:"(Last message is "+n.human_time(l)+" old.)",room:t};if(this.tokenize_chat_line(m),o.shouldShowMessage(m))for(i.insertAt(r,m);i.length>o.get("messageBufferSize");)i.removeAt(0)}}},s.prototype.load_room=function(t,e,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/room/"+t).done(function(s){if(s.sets)for(var o in s.sets)s.sets.hasOwnProperty(o)&&n._load_set_json(o,void 0,s.sets[o]);n._load_room_json(t,e,s)}).fail(function(o){return 404==o.status?"function"==typeof e&&e(!1):(s=(s||0)+1,10>s?n.load_room(t,e,s):"function"==typeof e&&e(!1))})},s.prototype._load_room_json=function(t,e,s){if(!s||!s.room)return"function"==typeof e&&e(!1);s=s.room,this.rooms[t]&&(s.room=this.rooms[t].room);for(var o in this.rooms[t])"room"!==o&&this.rooms[t].hasOwnProperty(o)&&!s.hasOwnProperty(o)&&(s[o]=this.rooms[t][o]);s.needs_history=this.rooms[t]&&this.rooms[t].needs_history||!1,this.rooms[t]=s,(s.css||s.moderator_badge)&&n.update_css(this._room_style,t,a(s)+(s.css||"")),this.emote_sets.hasOwnProperty(s.set)?-1===this.emote_sets[s.set].users.indexOf(t)&&this.emote_sets[s.set].users.push(t):this.load_set(s.set,function(e,s){-1===s.users.indexOf(t)&&s.users.push(t)}),this.update_ui_link(),e&&e(!0,s)},s.prototype._modify_room=function(e){var s=this;e.reopen({subsOnlyMode:!1,r9kMode:!1,slowWaiting:!1,slowValue:0,mru_list:[],updateWait:function(t,e){var o=this.get("slowWait")||0;this.set("slowWait",t),1>o&&t>0?(this._ffz_wait_timer&&clearTimeout(this._ffz_wait_timer),this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3),s._roomv&&s._roomv.ffzUpdateStatus()):(o>0&&1>t||e)&&(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus())},ffzUpdateWait:function(){this._ffz_wait_timer=void 0;var t=this.get("slowWait")||0;1>t||(this.set("slowWait",--t),t>0?this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3):(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus()))},ffzUpdateStatus:function(){s._roomv&&s._roomv.ffzUpdateStatus()}.observes("r9kMode","subsOnlyMode","slowMode","slowValue","ffz_banned"),init:function(){this._super();try{s.add_room(this.id,this),this.set("ffz_chatters",{})}catch(t){s.error("add_room: "+t)}},willDestroy:function(){this._super();try{s.remove_room(this.id)}catch(t){s.error("remove_room: "+t)}},clearMessages:function(t){var e=this;if(t){if(this.get("messages").forEach(function(o,n){o.from===t&&(e.set("messages."+n+".ffz_deleted",!0),s.settings.prevent_clear||e.set("messages."+n+".deleted",!0))}),s.settings.mod_card_history){var o=s.rooms&&s.rooms[e.get("id")],n=o&&o.user_history&&o.user_history[t];if(null!==n&&void 0!==n){var i=!1,a=n.length>0?n[n.length-1]:null;if(i=null!==a&&a.is_delete,!i)for(n.push({from:"jtv",is_delete:!0,style:"admin",cachedTokens:["User has been timed out."],date:new Date});n.length>20;)n.shift()}}}else if(s.settings.prevent_clear)this.addTmiMessage("A moderator's attempt to clear chat was ignored.");else{var r=e.get("messages");e.set("messages",[]),e.addMessage({style:"admin",message:i18n("Chat was cleared by a moderator"),ffz_old_messages:r})}},pushMessage:function(t){if(this.shouldShowMessage(t)){var e,s,o,n=this.get("messageBufferSize");for(this.get("messages").pushObject(t),e=this.get("messages.length"),s=e-n,o=0;s>o;o++)this.get("messages").removeAt(0);"admin"===t.style||"whisper"===t.style&&!this.ffz_whisper_room||this.incrementProperty("unreadCount",1)}},addMessage:function(t){try{if(t){var e="whisper"===t.style;if(s.settings.group_tabs&&s.settings.whisper_room&&(e&&!this.ffz_whisper_room||!e&&this.ffz_whisper_room))return;if(e||(t.room=this.get("id")),s.tokenize_chat_line(t),!e&&t.from&&"jtv"!==t.from&&"twitchnotify"!==t.from&&s.settings.mod_card_history){var o=s.rooms&&s.rooms[t.room];if(o){var n=(o.user_history=o.user_history||{},o.user_history[t.from]=o.user_history[t.from]||[]);for(n.push({from:t.tags&&t.tags["display-name"]||t.from,cachedTokens:t.cachedTokens,style:t.style,date:t.date});n.length>20;)n.shift()}}if(!e){var i=s.get_user();if(i&&i.login===t.from){var a=this.get("ffz_banned");this.set("ffz_banned",!1),this.get("isModeratorOrHigher")||!this.get("slowMode")?this.updateWait(0,a):this.get("slowMode")&&this.updateWait(this.get("slowValue"))}}}}catch(r){s.error("Room addMessage: "+r)}var d=this._super(t);try{var u=t.color;u&&s._handle_color(u)}catch(r){s.error("Room addMessage2: "+r)}return d},setHostMode:function(t){this.set("ffz_host_target",t&&t.hostTarget||null);var e=s.get_user();e&&s._cindex&&this.get("id")===e.login&&s._cindex.ffzUpdateHostButton();var o=App.__container__.lookup("controller:chat");if(o&&o.get("currentChannelRoom")===this)return this._super(t)},send:function(t){if(!(s.settings.group_tabs&&s.settings.whisper_room&&this.ffz_whisper_room)){try{if(t){var e=this.get("mru_list"),o=e.indexOf(t);-1!==o?e.splice(o,1):e.length>20&&e.pop(),e.unshift(t)}var n=t.split(" ",1)[0].toLowerCase();if("/ffz"===n)return this.set("messageToSend",""),void s.run_ffz_command(t.substr(5),this.get("id"));if("/"===n.charAt(0)&&s.run_command(t,this.get("id")))return void this.set("messageToSend","")}catch(i){s.error("send: "+i)}return this._super(t)}},ffzUpdateUnread:function(){if(s.settings.group_tabs){var t=App.__container__.lookup("controller:chat");t&&t.get("currentRoom")===this?this.resetUnreadCount():s._chatv&&s._chatv.ffzTabUnread(this.get("id"))}}.observes("unreadCount"),ffzInitChatterCount:function(){if(this.tmiRoom){var t=this;this.tmiRoom.list().done(function(e){var s={};e=e.data.chatters;for(var o=0;o0),e.set("slowValue",t.slow),e.get("slowMode")||e.updateWait(0)),t.hasOwnProperty("r9k")&&e.set("r9kMode",t.r9k),t.hasOwnProperty("subs-only")&&e.set("subsOnlyMode",t["subs-only"]))}),t._roomConn._connection.off("message",t._roomConn._onIrcMessage,t._roomConn),t._roomConn._onIrcMessage=function(t){if(t.target==this.ircChannel)switch(t.command){case"JOIN":this._session&&this._session.nickname===t.sender?this._onIrcJoin(t):s.settings.chatter_count&&e.ffzUpdateChatters(t.sender);break;case"PART":this._session&&this._session.nickname===t.sender?(this._resetActiveState(),this._connection._exitedRoomConn(),this._trigger("exited")):s.settings.chatter_count&&e.ffzUpdateChatters(null,t.sender)}},t._roomConn._connection.on("message",t._roomConn._onIrcMessage,t._roomConn),this.set("ffz_is_patched",!0)}}.observes("tmiRoom")})}},{"../constants":4,"../utils":33}],12:[function(){var e=t.FrankerFaceZ;e.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");var t=App.__container__.resolve("controller:viewers");this._modify_viewers(t)},e.prototype._modify_viewers=function(t){var s=this;t.reopen({lines:function(){var t=this._super();try{var o=[],n={},i=null,a=App.__container__.lookup("controller:channel"),r=this.get("parentController.model.id"),d=a&&a.get("id");if(d){var u=a.get("display_name");u&&(e.capitalization[d]=[u,Date.now()])}r!=d&&(d=null);for(var c=0;ce?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))};s.prototype.setup_emoticons=function(){this.log("Preparing emoticon system."),this.emoji_data={},this.emoji_names={},this.emote_sets={},this.global_sets=[],this.default_sets=[],this._last_emote_id=0,this.emote_usage={},this.log("Creating emoticon style element.");var t=this._emote_style=document.createElement("style");t.id="ffz-emoticon-css",document.head.appendChild(t),this.log("Loading global emote sets."),this.load_global_sets(),this.log("Loading emoji data."),this.load_emoji_data(),this.log("Watching Twitch emoticon parser to ensure it loads."),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)},s.prototype.add_usage=function(t,e,s){var o=this.emote_usage[e]=this.emote_usage[e]||{};o[t]=(o[t]||0)+(s||1),this._emote_report_scheduled||(this._emote_report_scheduled=setTimeout(this._report_emotes.bind(this),3e4))},s.prototype._report_emotes=function(){this._emote_report_scheduled&&delete this._emote_report_scheduled;var t=this.emote_usage;this.emote_usage={},this.ws_send("emoticon_uses",[t],function(){},!0)},s.prototype.check_twitch_emotes=function(){this._twitch_emote_check&&(clearTimeout(this._twitch_emote_check),delete this._twitch_emote_check);var t;if(this.rooms)for(var e in this.rooms)if(this.rooms.hasOwnProperty(e)){t=this.rooms[e];break}if(!t||!t.room||!t.room.tmiSession)return void(this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4));var s=t.room.tmiSession._emotesParser,o=Object.keys(s.emoticonRegexToIds).length;if(!(o>0)){var n=s.emoticonSetIds;s.emoticonSetIds="",s.updateEmoticons(n),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)}},s.prototype.getEmotes=function(t,e){var s=this.users&&this.users[t],o=this.rooms&&this.rooms[e];return _.union(s&&s.sets||[],o&&o.set&&[o.set]||[],o&&o.extra_sets||[],this.default_sets)},s.ws_commands.reload_set=function(t){this.emote_sets.hasOwnProperty(t)&&this.load_set(t)},s.ws_commands.load_set=function(t){this.load_set(t)},s.prototype._emote_tooltip=function(t){if(!t)return null;if(t._tooltip)return t._tooltip;var e=this.emote_sets[t.set_id],s=t.owner,o=e&&e.title||"Global";return t._tooltip="Emoticon: "+(t.hidden?"???":t.name)+"\nFFZ "+o+(s?"\nBy: "+s.display_name:""),t._tooltip},s.prototype.load_emoji_data=function(t,e){var s=this;jQuery.getJSON(o.SERVER+"emoji/emoji.json").done(function(e){var n={},i={};for(var a in e){var r=e[a];a=a.toLowerCase(),r.code=a,n[a]=r,i[r.short_name]=a,r.raw=_.map(r.code.split("-"),d).join(""),r.src=o.SERVER+"emoji/"+a+"-1x.png",r.srcSet=r.src+" 1x, "+o.SERVER+"emoji/"+a+"-2x.png 2x, "+o.SERVER+"emoji/"+a+"-4x.png 4x",r.token={srcSet:r.srcSet,emoticonSrc:r.src+'" data-ffz-emoji="'+a+'" height="18px',ffzEmoji:a,altText:r.raw}}s.emoji_data=n,s.emoji_names=i,s.log("Loaded data on "+Object.keys(n).length+" emoji."),"function"==typeof t&&t(!0,e)}).fail(function(o){return 404===o.status?"function"==typeof t&&t(!1):(e=(e||0)+1,50>e?s.load_emoji(t,e):"function"==typeof t&&t(!1))})},s.prototype.load_global_sets=function(t,e){var s=this;jQuery.getJSON(((e||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/global").done(function(t){s.default_sets=t.default_sets;var e=s.global_sets=[],o=t.sets||{};s.feature_friday&&s.feature_friday.set&&(-1===s.global_sets.indexOf(s.feature_friday.set)&&s.global_sets.push(s.feature_friday.set),-1===s.default_sets.indexOf(s.feature_friday.set)&&s.default_sets.push(s.feature_friday.set));for(var n in o)if(o.hasOwnProperty(n)){var i=o[n];e.push(n),s._load_set_json(n,void 0,i)}}).fail(function(o){return 404==o.status?"function"==typeof t&&t(!1):(e=e||0,e++,50>e?s.load_global_sets(t,e):"function"==typeof t&&t(!1))})},s.prototype.load_set=function(t,e,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/"+t).done(function(s){n._load_set_json(t,e,s&&s.set)}).fail(function(o){return 404==o.status?"function"==typeof e&&e(!1):(s=s||0,s++,10>s?n.load_set(t,e,s):"function"==typeof e&&e(!1))})},s.prototype.unload_set=function(t){var e=this.emote_sets[t];e&&(this.log("Unloading emoticons for set: "+t),n.update_css(this._emote_style,t,null),delete this.emote_sets[t])},s.prototype._load_set_json=function(t,e,s){if(!s)return"function"==typeof e&&e(!1);var o=this.emote_sets[t]&&this.emote_sets[t].users||[];this.emote_sets[t]=s,s.users=o,s.count=0;var i="",a=s.emoticons;s.emoticons={};for(var d=0;d=6e4?this.log("BetterTTV was not detected after 60 seconds."):setTimeout(this.find_bttv.bind(this,e,(s||0)+e),e))},s.prototype.setup_bttv=function(t){this.log("BetterTTV was detected after "+t+"ms. Hooking."),this.has_bttv=!0,document.body.classList.remove("ffz-dark"),this._dark_style&&(this._dark_style.parentElement.removeChild(this._dark_style),this._dark_style=void 0),this._chat_style&&(this._chat_style.parentElement.removeChild(this._chat_style),this._chat_style=void 0),this.settings.group_tabs&&this._chatv&&this._chatv.ffzDisableTabs(),this._roomv&&(this.settings.chat_hover_pause&&this._roomv.ffzDisableFreeze(),this.settings.room_status&&this._roomv.ffzUpdateStatus()),document.body.classList.remove("ffz-chat-colors"),document.body.classList.remove("ffz-chat-colors-gray"),document.body.classList.remove("ffz-chat-background"),document.body.classList.remove("ffz-chat-padding"),document.body.classList.remove("ffz-chat-separator"),document.body.classList.remove("ffz-chat-separator-3d"),document.body.classList.remove("ffz-sidebar-swap"),document.body.classList.remove("ffz-transparent-badges"),document.body.classList.remove("ffz-high-contrast-chat"),this.settings.following_count&&(this._schedule_following_count(),this._draw_following_count()),this.is_dashboard&&this._update_subscribers(),document.body.classList.add("ffz-bttv");var e=BetterTTV.chat.helpers.sendMessage,s=this;BetterTTV.chat.helpers.sendMessage=function(t){var o=t.split(" ",1)[0].toLowerCase();return"/ffz"!==o?e(t):void s.run_ffz_command(t.substr(5),BetterTTV.chat.store.currentRoom)};var i,a=BetterTTV.chat.handlers.onPrivmsg;BetterTTV.chat.handlers.onPrivmsg=function(t,e){i=t;var s=a(t,e);return i=null,s};var r=BetterTTV.chat.templates.privmsg;BetterTTV.chat.templates.privmsg=function(t,e,o,n,a){try{return s.bttv_badges(a),'
"}catch(e){return s.log("Error: ",e),d(t)}};var u,c=BetterTTV.chat.templates.message;BetterTTV.chat.templates.message=function(t,e,o,n){try{n=n||!1;var i=encodeURIComponent(e);if("jtv"!==t){u=t;var a=BetterTTV.chat.templates.emoticonize(e,o);
+u=null;for(var r=0;r'+e+""}catch(d){return s.log("Error: ",d),c(t,e,o,n)}};var l=BetterTTV.chat.templates.emoticonize;BetterTTV.chat.templates.emoticonize=function(t,e){var a=l(t,e),r=i||BetterTTV.getChannel(),d=r&&r.toLowerCase(),c=u&&u.toLowerCase(),h=s.getEmotes(c,d),e=[],f=s.get_user(),m=f&&f.login===c;if(_.each(h,function(t){var o=s.emote_sets[t];o&&_.each(o.emoticons,function(t){_.any(a,function(e){return _.isString(e)&&e.match(t.regex)})&&e.push(t)})}),e.length&&_.each(e,function(t){var e=s._emote_tooltip(t),o=[''],n=a;a=[];for(var i=0;i']:w+(z||""))}}}else a.push(v)}}return a},this.update_ui_link()}},{"../constants":4,"../utils":33}],15:[function(){var e=t.FrankerFaceZ;e.prototype.find_emote_menu=function(e,s){return this.has_emote_menu=!1,t.emoteMenu&&emoteMenu.registerEmoteGetter?this.setup_emote_menu(s||0):void(s>=6e4?this.log("Emote Menu for Twitch was not detected after 60 seconds."):setTimeout(this.find_emote_menu.bind(this,e,(s||0)+e),e))},e.prototype.setup_emote_menu=function(t){this.log("Emote Menu for Twitch was detected after "+t+"ms. Registering emote enumerator."),emoteMenu.registerEmoteGetter("FrankerFaceZ",this._emote_menu_enumerator.bind(this))},e.prototype._emote_menu_enumerator=function(){for(var t=this.get_user(),s=t?t.login:null,o=App.__container__.lookup("controller:chat"),n=o?o.get("currentRoom.id"):null,i=this.getEmotes(s,n),a=[],r=0;r=6e4?this.log('Twitch application not detected in "'+location.toString()+'". Aborting.'):setTimeout(this.initialize.bind(this,e,(s||0)+e),e)))},s.prototype.setup_normal=function(e,o){var n=t.performance&&performance.now?performance.now():Date.now();this.log("Found non-Ember Twitch after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;try{this.embed_in_dash=t.top!==t&&/\/[^\/]+\/dashboard/.test(t.top.location.pathname)&&!/bookmarks$/.test(t.top.location.pathname)}catch(i){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),o||this.ws_create(),this.setup_colors(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_following_count(!1),this.setup_css(),this.setup_menu(),this.find_bttv(10);var a=t.performance&&performance.now?performance.now():Date.now(),r=a-n;this.log("Initialization complete in "+r+"ms")},s.prototype.is_dashboard=!1,s.prototype.setup_dashboard=function(e){var o=t.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch Dashboard after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!0,this.embed_in_dash=!1,this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_colors(),this.setup_emoticons(),this.setup_badges(),this.setup_tokenization(),this.setup_notifications(),this.setup_css(),this._update_subscribers(),this.setup_message_event(),this.find_bttv(10);var n=t.performance&&performance.now?performance.now():Date.now(),i=n-o;this.log("Initialization complete in "+i+"ms")},s.prototype.setup_ember=function(e){var o=t.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch application after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;try{this.embed_in_dash=t.top!==t&&/\/[^\/]+\/dashboard/.test(t.top.location.pathname)&&!/bookmarks$/.test(t.top.location.pathname)}catch(n){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_colors(),this.setup_tokenization(),this.setup_channel(),this.setup_room(),this.setup_line(),this.setup_chatview(),this.setup_viewers(),this.setup_mod_card(),this.setup_chat_input(),this.setup_notifications(),this.setup_css(),this.setup_menu(),this.setup_my_emotes(),this.setup_following(),this.setup_following_count(!0),this.setup_races(),this.connect_extra_chat(),this.find_bttv(10),this.find_emote_menu(10),this.check_ff();var i=t.performance&&performance.now?performance.now():Date.now(),a=i-o;this.log("Initialization complete in "+a+"ms")},s.prototype.setup_message_event=function(){this.log("Listening for Window Messages."),t.addEventListener("message",this._on_window_message.bind(this),!1)},s.prototype._on_window_message=function(t){if(t.data&&t.data.from_ffz){t.data}}},{"./badges":1,"./colors":2,"./commands":3,"./debug":5,"./ember/channel":6,"./ember/chat-input":7,"./ember/chatview":8,"./ember/line":9,"./ember/moderation-card":10,"./ember/room":11,"./ember/viewers":12,"./emoticons":13,"./ext/betterttv":14,"./ext/emote_menu":15,"./featurefriday":17,"./settings":18,"./socket":19,"./tokenize":20,"./ui/about_page":21,"./ui/dark":22,"./ui/following":24,"./ui/following-count":23,"./ui/menu":25,"./ui/menu_button":26,"./ui/my_emotes":27,"./ui/notifications":28,"./ui/races":29,"./ui/styles":30,"./ui/sub_count":31,"./ui/viewer_count":32}],17:[function(e){var s=t.FrankerFaceZ,o=e("./constants");s.prototype.feature_friday=null,s.prototype.check_ff=function(t){t||this.log("Checking for Feature Friday data..."),jQuery.ajax(o.SERVER+"script/event.json",{cache:!1,dataType:"json",context:this}).done(function(t){return this._load_ff(t)}).fail(function(e){return 404==e.status?this._load_ff(null):(t=t||0,t++,10>t?setTimeout(this.check_ff.bind(this,t),250):this._load_ff(null))})},s.ws_commands.reload_ff=function(){this.check_ff()},s.prototype._feature_friday_ui=function(t,e,s){if(this.feature_friday&&this.feature_friday.channel!=t){this._emotes_for_sets(e,s,[this.feature_friday.set],this.feature_friday.title,this.feature_friday.icon,"FrankerFaceZ");var o=App.__container__.lookup("controller:channel");if(!o||o.get("id")!=this.feature_friday.channel){var n=this.feature_friday,i=document.createElement("div"),a=document.createElement("a");i.className="chat-menu-content",i.style.textAlign="center";var r=n.display_name+(n.live?" is live now!":"");a.className="button primary",a.classList.toggle("live",n.live),a.classList.toggle("blue",this.has_bttv&&BetterTTV.settings.get("showBlueButtons")),a.href="http://www.twitch.tv/"+n.channel,a.title=r,a.target="_new",a.innerHTML=""+r+"",i.appendChild(a),e.appendChild(i)}}},s.prototype._load_ff=function(t){this.feature_friday&&(this.global_sets.removeObject(this.feature_friday.set),this.default_sets.removeObject(this.feature_friday.set),this.feature_friday=null,this.update_ui_link()),t&&t.set&&t.channel&&(this.feature_friday={set:t.set,channel:t.channel,live:!1,title:t.title||"Feature Friday",display_name:s.get_capitalization(t.channel,this._update_ff_name.bind(this))},this.global_sets.push(t.set),this.default_sets.push(t.set),this.load_set(t.set),this._update_ff_live())},s.prototype._update_ff_live=function(){if(this.feature_friday){var t=this;Twitch.api.get("streams/"+this.feature_friday.channel).done(function(e){t.feature_friday.live=null!=e.stream,t.update_ui_link()}).always(function(){t.feature_friday.timer=setTimeout(t._update_ff_live.bind(t),12e4)})}},s.prototype._update_ff_name=function(t){this.feature_friday&&(this.feature_friday.display_name=t)}},{"./constants":4}],18:[function(e){var s=t.FrankerFaceZ,o=e("./constants");make_ls=function(t){return"ffz_setting_"+t},toggle_setting=function(t,e){var s=!this.settings.get(e);this.settings.set(e,s),t.classList.toggle("active",s)},option_setting=function(t,e){this.settings.set(e,JSON.parse(t.options[t.selectedIndex].value))},s.settings_info={},s.prototype.load_settings=function(){this.log("Loading settings."),this.settings={};for(var e in s.settings_info)if(s.settings_info.hasOwnProperty(e)){var o=s.settings_info[e],n=o.storage_key||make_ls(e),i=o.hasOwnProperty("value")?o.value:void 0;if(localStorage.hasOwnProperty(n))try{i=JSON.parse(localStorage.getItem(n))}catch(a){this.log('Error loading value for "'+e+'": '+a)}o.process_value&&(i=o.process_value.bind(this)(i)),this.settings[e]=i}this.settings.get=this._setting_get.bind(this),this.settings.set=this._setting_set.bind(this),this.settings.del=this._setting_del.bind(this),t.addEventListener("storage",this._setting_update.bind(this),!1)},s.menu_pages.settings={render:function(t,e){var o={},n=[],i=-1!==navigator.userAgent.indexOf("Android");for(var a in s.settings_info)if(s.settings_info.hasOwnProperty(a)){var r=s.settings_info[a],d=r.category||"Miscellaneous",u=o[d];if(void 0!==r.visible&&null!==r.visible){var c=r.visible;if("function"==typeof r.visible&&(c=r.visible.bind(this)()),!c)continue}i&&r.no_mobile||(u||(n.push(d),u=o[d]=[]),u.push([a,r]))}n.sort(function(t,e){var t=t.toLowerCase(),e=e.toLowerCase();return"debugging"===t&&(t="zzz"+t),"debugging"===e&&(e="zzz"+e),e>t?-1:t>e?1:0});for(var l=this,h=this._ffz_settings_page||n[0],f=0;fs?-1:s>o?1:i>n?-1:n>i?1:0});for(var v=0;v",w.className="switch-label",w.innerHTML=r.name,b.appendChild(k),b.appendChild(w),k.addEventListener("click",toggle_setting.bind(this,k,a))}else if("select"===r.type){var C=document.createElement("select"),w=document.createElement("span");w.className="option-label",w.innerHTML=r.name;for(var E in r.options){var T=document.createElement("option");T.value=JSON.stringify(E),y===E&&T.setAttribute("selected",!0),T.innerHTML=r.options[E],C.appendChild(T)}C.addEventListener("change",option_setting.bind(this,C,a)),b.appendChild(w),b.appendChild(C)}else{b.classList.add("option");var x=document.createElement("a");x.innerHTML=r.name,x.href="#",b.appendChild(x),x.addEventListener("click",r.method.bind(this))}if(r.help){var z=document.createElement("span");z.className="help",z.innerHTML=r.help,b.appendChild(z)}}p.appendChild(b)}e.appendChild(p)}},name:"Settings",icon:o.GEAR,sort_order:99999,wide:!0},s.prototype._setting_update=function(e){if(e||(e=t.event),e.key&&"ffz_setting_"===e.key.substr(0,12)){var o=e.key,n=o.substr(12),i=void 0,a=s.settings_info[n];if(!a){for(n in s.settings_info)if(s.settings_info.hasOwnProperty(n)&&(a=s.settings_info[n],a.storage_key==o))break;if(a.storage_key!=o)return}this.log("Updated Setting: "+n);try{i=JSON.parse(e.newValue)}catch(r){this.log('Error loading new value for "'+n+'": '+r),i=a.value||void 0}if(this.settings[n]=i,a.on_update)try{a.on_update.bind(this)(i,!1)}catch(r){this.log('Error running updater for setting "'+n+'": '+r)}}},s.prototype._setting_get=function(t){return this.settings[t]},s.prototype._setting_set=function(t,e){var o=s.settings_info[t],n=o.storage_key||make_ls(t),i=JSON.stringify(e);if(this.settings[t]=e,localStorage.setItem(n,i),this.log('Changed Setting "'+t+'" to: '+i),o.on_update)try{o.on_update.bind(this)(e,!0)}catch(a){this.log('Error running updater for setting "'+t+'": '+a)}},s.prototype._setting_del=function(t){var e=s.settings_info[t],o=e.storage_key||make_ls(t),n=void 0;if(localStorage.hasOwnProperty(o)&&localStorage.removeItem(o),delete this.settings[t],e&&(n=this.settings[t]=e.hasOwnProperty("value")?e.value:void 0),e.on_update)try{e.on_update.bind(this)(n,!0)}catch(i){this.log('Error running updater for setting "'+t+'": '+i)}}},{"./constants":4}],19:[function(){var e=t.FrankerFaceZ;e.prototype._ws_open=!1,e.prototype._ws_delay=0,e.ws_commands={},e.ws_on_close=[],e.prototype.ws_create=function(){var s,o=this;this._ws_last_req=0,this._ws_callbacks={},this._ws_pending=this._ws_pending||[];try{s=this._ws_sock=new WebSocket("ws://catbag.frankerfacez.com/")}catch(n){return this._ws_exists=!1,this.log("Error Creating WebSocket: "+n)}this._ws_exists=!0,s.onopen=function(){o._ws_open=!0,o._ws_delay=0,o.log("Socket connected.");var s=t.RequestFileSystem||t.webkitRequestFileSystem;s?s(t.TEMPORARY,100,o.ws_send.bind(o,"hello",["ffz_"+e.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o)),o.log.bind(o,"Operating in Incognito Mode.")):o.ws_send("hello",["ffz_"+e.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o));var n=o.get_user();if(n&&o.ws_send("setuser",n.login),o.is_dashboard){var i=location.pathname.match(/\/([^\/]+)/);i&&(o.ws_send("sub",i[1]),o.ws_send("sub_channel",i[1]))}for(var a in o.rooms)o.rooms.hasOwnProperty(a)&&o.rooms[a]&&(o.ws_send("sub",a),o.rooms[a].needs_history&&(o.rooms[a].needs_history=!1,!o.has_bttv&&o.settings.chat_history&&o.ws_send("chat_history",[a,25],o._load_history.bind(o,a))));if(o._cindex){var r=o._cindex.get("controller.id"),d=o._cindex.get("controller.hostModeTarget.id");r&&o.ws_send("sub_channel",r),d&&o.ws_send("sub_channel",d)}var u=o._ws_pending;o._ws_pending=[];for(var c=0;c!-#%-\\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]";new RegExp(u+"*,"+u+"*")}o.SRC_IDS={},o.src_to_id=function(t){if(o.SRC_IDS.hasOwnProperty(t))return o.SRC_IDS[t];var e=/\/emoticons\/v1\/(\d+)\/1\.0/.exec(t),s=e?parseInt(e[1]):null;return 0/0===s&&(s=null),o.SRC_IDS[t]=s,s};var c=new Date(0).toLocaleTimeString().toUpperCase();o.settings_info.twenty_four_timestamps={type:"boolean",value:-1===c.lastIndexOf("PM")&&-1===c.lastIndexOf("AM"),category:"Chat Appearance",no_bttv:!0,name:"24hr Timestamps",help:"Display timestamps in chat in the 24 hour format rather than 12 hour."},o.settings_info.show_deleted_links={type:"boolean",value:!1,category:"Chat Moderation",no_bttv:!0,name:"Show Deleted Links",help:"Do not delete links based on room settings or link length."},o.prototype.setup_tokenization=function(){if(s=t.require&&t.require("ember-twitch-chat/helpers/chat-line-helpers"),!s)return this.log("Unable to get chat helper functions.");this.log("Hooking Ember chat line helpers.");var e=this;s.getTime=function(t){if(void 0===t||null===t)return"?:??";var s=t.getHours(),o=t.getMinutes();return s>12&&!e.settings.twenty_four_timestamps?s-=12:0!==s||e.settings.twenty_four_timestamps||(s=12),s+":"+(10>o?"0":"")+o},s.linkifyMessage=function(t,s){var o=e.settings.show_deleted_links;return _.chain(t).map(function(t){if(!_.isString(t))return t;var e=t.match(d);return e&&e.length?_.zip(t.split(d),_.map(e,function(t){return!o&&(s||t.length>255)?{mentionedUser:'<'+(t.length>255?"long link":"deleted link")+'>',own:!0}:{isLink:!0,href:t}})):[t]}).flatten().compact().value()}},o.prototype.tokenize_chat_line=function(e,n){if(e.cachedTokens)return e.cachedTokens;try{var i=e.message,a=this.get_user(),r=e.room,d=a&&e.from===a.login,u=e.tags&&e.tags.emotes,c=[i];s&&s.linkifyMessage&&(c=s.linkifyMessage(c)),a&&a.login&&s&&s.mentionizeMessage&&(c=s.mentionizeMessage(c,a.login,d)),s&&s.emoticonizeMessage&&(c=s.emoticonizeMessage(c,u)),this.settings.replace_bad_emotes&&(c=this.tokenize_replace_emotes(c)),c=this._remove_banned(c),c=this.tokenize_emotes(e.from,r,c,d),this.settings.parse_emoji&&(c=this.tokenize_emoji(c));var l=e.tags&&e.tags["display-name"];if(l&&l.length&&(o.capitalization[e.from]=[l.trim(),Date.now()]),!d){c=this.tokenize_mentions(c);for(var h=0;h'}if(t.isLink){if(!e&&void 0!==e)return t.href;var h=t.href;if(h.indexOf("@")>-1&&(-1===h.indexOf("/")||h.indexOf("@")'+h+"";var f=(h.match(/^https?:\/\//)?"":"http://")+h,l=s._link_data&&s._link_data[f]||{};return''+h+""}return t.mentionedUser?''+t.mentionedUser+"":n.sanitize(t.deletedLink?t.text:t)}).join("")},o.prototype.tokenize_replace_emotes=function(t){_.isString(t)&&(t=[t]);for(var e=0;e-1&&(-1===e.indexOf("/")||e.indexOf("@")0&&(n=!0)}var r=document.createElement("div"),d="";d+="
FrankerFaceZ
",d+='
new ways to woof
',r.className="chat-menu-content center",r.innerHTML=d,e.appendChild(r);var u=0,c=r.querySelector("h1");c&&c.addEventListener("click",function(){if(c.style.cursor="pointer",u++,u>=3){u=0;var t=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");t&&t.classList.toggle("ffz-flip")}setTimeout(function(){u=0,c.style.cursor=""},2e3)});var l=document.createElement("div"),h=document.createElement("a"),f="To use custom emoticons in "+(n?"this channel":"tons of channels")+", get FrankerFaceZ from http://www.frankerfacez.com";
+h.className="button primary",h.innerHTML="Advertise in Chat",h.addEventListener("click",this._add_emote.bind(this,t,f)),l.appendChild(h);var _=document.createElement("a");_.className="button ffz-donate",_.href="https://www.frankerfacez.com/donate",_.target="_new",_.innerHTML="Donate",l.appendChild(_),l.className="chat-menu-content center",e.appendChild(l);var m=document.createElement("div");d='
',m.className="chat-menu-content center",m.innerHTML=d;var p=!1;m.querySelector("#ffz-debug-logs").addEventListener("click",function(){p||(p=!0,i._pastebin(i._log_data.join("\n"),function(t){p=!1,t?prompt("Your FrankerFaceZ logs have been uploaded to the URL:",t):alert("There was an error uploading the FrankerFaceZ logs.")}))}),e.appendChild(m)}}},{"../constants":4}],22:[function(e){var s=t.FrankerFaceZ,o=e("../constants");s.settings_info.twitch_chat_dark={type:"boolean",value:!1,visible:!1},s.settings_info.dark_twitch={type:"boolean",value:!1,no_bttv:!0,category:"Appearance",name:"Dark Twitch",help:"Apply a dark background to channels and other related pages for easier viewing.",on_update:function(e){var s=document.querySelector("input.ffz-setting-dark-twitch");if(s&&(s.checked=e),!this.has_bttv){document.body.classList.toggle("ffz-dark",e);var o=t.App?App.__container__.lookup("controller:settings").get("model"):void 0;e?(this._load_dark_css(),o&&this.settings.set("twitch_chat_dark",o.get("darkMode")),o&&o.set("darkMode",!0)):o&&o.set("darkMode",this.settings.twitch_chat_dark)}}},s.settings_info.dark_no_blue={type:"boolean",value:!1,category:"Appearance",name:"Gray Chat (no blue)",help:"Make the dark theme for chat and a few other places on Twitch a bit darker and not at all blue.",on_update:function(t){document.body.classList.toggle("ffz-no-blue",t)}},s.settings_info.hide_recent_past_broadcast={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:'Hide "Watch Last Broadcast"',help:'Hide the "Watch Last Broadcast" banner at the top of offline Twitch channels.',on_update:function(t){document.body.classList.toggle("ffz-hide-recent-past-broadcast",t)}},s.prototype.setup_dark=function(){document.body.classList.toggle("ffz-hide-recent-past-broadcast",this.settings.hide_recent_past_broadcast),document.body.classList.toggle("ffz-no-blue",this.settings.dark_no_blue),this.has_bttv||(document.body.classList.toggle("ffz-dark",this.settings.dark_twitch),this.settings.dark_twitch&&(t.App&&App.__container__.lookup("controller:settings").set("model.darkMode",!0),this._load_dark_css()))},s.prototype._load_dark_css=function(){if(!this._dark_style){this.log("Injecting FrankerFaceZ Dark Twitch CSS.");var t=this._dark_style=document.createElement("link");t.id="ffz-dark-css",t.setAttribute("rel","stylesheet"),t.setAttribute("href",o.SERVER+"script/dark.css?_="+(o.DEBUG?Date.now():s.version_info)),document.head.appendChild(t)}}},{"../constants":4}],23:[function(e){var s=t.FrankerFaceZ,o=e("../utils");s.settings_info.following_count={type:"boolean",value:!0,no_bttv:!0,no_mobile:!0,category:"Appearance",name:"Sidebar Following Count",help:"Display the number of live channels you're following on the sidebar.",on_update:function(){this._schedule_following_count();var e=t.App&&App.__container__.resolve("model:stream"),s=e&&e.find("live");s?this._draw_following_count(s.get("total")||0):this._update_following_count()}},s.prototype.setup_following_count=function(e){if(this.settings.following_count&&this._schedule_following_count(),!e)return this._update_following_count();this.log("Connecting to Live Streams model.");var s=t.App&&App.__container__.resolve("model:stream");if(!s)return this.log("Unable to find Stream model.");var o=s.find("live"),n=this;if(!o)return this.log("Unable to find Live Streams collection.");o.addObserver("total",function(){n._draw_following_count(this.get("total"))}),o.load();var i=o.get("total");"number"==typeof i&&this._draw_following_count(i)},s.prototype._schedule_following_count=function(){return this.has_bttv||!this.settings.following_count?void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0)):void(this._following_count_timer||(this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4)))},s.prototype._update_following_count=function(){if(!this.settings.following_count)return void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0));this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4);var e=t.App&&App.__container__.resolve("model:stream"),s=e&&e.find("live"),o=this;s?s.load():Twitch.api.get("streams/followed",{limit:1,offset:0},{version:3}).done(function(t){o._draw_following_count(t._total)}).fail(function(){o._draw_following_count()})},s.prototype._draw_following_count=function(t){var e=document.querySelector('#small_nav ul.game_filters li[data-name="following"] a');if(e){var s=e.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",e.appendChild(s)),s.innerHTML=t?o.format_unread(t):"")}var n=document.querySelector('#large_nav #nav_personal li[data-name="following"] a');if(n){var s=n.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",n.appendChild(s)),s.innerHTML=t?o.format_unread(t):"")}var i=document.querySelector("#header_actions #header_following");if(i){var s=i.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",i.appendChild(s)),s.innerHTML=t?o.format_unread(t):"")}}},{"../utils":33}],24:[function(e){{var s=t.FrankerFaceZ;e("../utils")}s.prototype.setup_following=function(){this.log("Initializing following support."),this.follow_data={},this.follow_sets={}},s.settings_info.follow_buttons={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Relevant Follow Buttons",help:"Display additional Follow buttons for channels relevant to the stream, such as people participating in co-operative gameplay.",on_update:function(){this.rebuild_following_ui()}},s.ffz_commands.following=function(t,e){e=e.join(" ").trim().split(/\s*,+\s*/),e.length&&""===e[0]&&e.shift(),e.length&&""===e[e.length-1]&&e.pop();var s=this.get_user(),o=this;return!s||s.login!==t.id&&"sirstendec"!==s.login&&"dansalvato"!==s.login?"You must be logged in as the broadcaster to use this command.":this.ws_send("update_follow_buttons",[t.id,e],function(e,s){return e?void(s?o.room_message(t,"The following buttons have been updated."):o.room_message(t,"The following buttons have been disabled.")):void o.room_message(t,"There was an error updating the following buttons.")})?void 0:"There was an error communicating with the server."},s.ws_on_close.push(function(){var e=t.App&&App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;if(this.follow_sets={},e){for(var i in this.follow_data)if(delete this.follow_data[i],(i===s||i===o)&&(n=!0),this.rooms&&this.rooms[i]&&this.rooms[i].extra_sets){var a=this.rooms[i].extra_sets;delete this.rooms[i].extra_sets;for(var r=0;r span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d=300?"right":"left")+" dropmenu notify-menu js-notify",i='
You are following '+s.get_capitalization(e)+"
",i+='
',i+='',i+='Notify me when the broadcaster goes live',i+="
",n.innerHTML=i,t.appendChild(n),n.querySelector("a.switch"))}},{"../utils":33}],25:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.prototype.setup_menu=function(){this.log("Installing mouse-up event to auto-close menus.");var e=this;jQuery(document).mouseup(function(t){var s,o=e._popup;o&&(o=jQuery(o),s=o.parent(),s.is(t.target)||0!==s.has(t.target).length||(o.remove(),delete e._popup,e._popup_kill&&e._popup_kill(),delete e._popup_kill))}),document.body.classList.toggle("ffz-menu-replace",this.settings.replace_twitch_menu),this.log("Hooking the Ember Chat Settings view.");var s=t.App&&App.__container__.resolve("view:settings");if(s){s.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("ChatSettings didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("ChatSettings willClearRender: "+t)}this._super()},ffzInit:function(){var t=this,s=this.get("element"),o=s&&s.querySelector(".dropmenu");if(o){var n,i,a,r=document.createElement("div"),d=document.createElement("div");r.className="list-header",r.innerHTML="FrankerFaceZ",d.className="chat-menu-content",n=document.createElement("p"),n.className="no-bttv",i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-dark-twitch",i.checked=e.settings.dark_twitch,n.appendChild(i),n.appendChild(document.createTextNode("Dark Twitch")),d.appendChild(n),i.addEventListener("change",function(){e.settings.set("dark_twitch",this.checked)}),n=document.createElement("p"),i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-hosted-channels",i.checked=e.settings.hosted_channels,n.appendChild(i),n.appendChild(document.createTextNode("Channel Hosting")),d.appendChild(n),i.addEventListener("change",function(){e.settings.set("hosted_channels",this.checked)}),n=document.createElement("p"),a=document.createElement("a"),a.href="#",a.innerHTML="More Settings",n.appendChild(a),d.appendChild(n),a.addEventListener("click",function(s){return t.set("controller.model.hidden",!0),e._last_page="settings",e.build_ui_popup(e._chatv),s.stopPropagation(),!1}),o.appendChild(r),o.appendChild(d)}},ffzTeardown:function(){}});try{s.create().destroy()}catch(o){}for(var n in Ember.View.views)if(Ember.View.views.hasOwnProperty(n)){var i=Ember.View.views[n];if(i instanceof s){this.log("Manually updating existing Chat Settings view.",i);try{i.ffzInit()}catch(o){this.error("setup: ChatSettings ffzInit: "+o)}}}}},s.menu_pages={},s.prototype.build_ui_popup=function(t){var e=this._popup;if(e)return e.parentElement.removeChild(e),delete this._popup,this._popup_kill&&this._popup_kill(),void delete this._popup_kill;var n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("ul"),r=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1;n.className="emoticon-selector chat-menu ffz-ui-popup",i.className="emoticon-selector-box dropmenu",n.appendChild(i),n.classList.toggle("dark",r);var d=document.createElement("div");d.className="ffz-ui-menu-page",i.appendChild(d),a.className="menu clearfix",i.appendChild(a);var u=document.createElement("li");u.className="title",u.innerHTML=""+(o.DEBUG?"[DEV] ":"")+"FrankerFaceZ",a.appendChild(u);var c=[];for(var l in s.menu_pages)if(s.menu_pages.hasOwnProperty(l)){var h=s.menu_pages[l];try{if(!h||h.hasOwnProperty("visible")&&(!h.visible||"function"==typeof h.visible&&!h.visible.bind(this)(t)))continue}catch(f){this.error("menu_pages "+l+" visible: "+f);continue}c.push([h.sort_order||0,l,h])}c.sort(function(t,e){if(t[0]e[0])return-1;var s=t[1].toLowerCase(),o=e[1].toLowerCase();return o>s?1:s>o?-1:0});for(var _=0;_0,u&&!c&&!l){var p=this;u.addObserver("isLoaded",function(){setTimeout(function(){"channel"===e.getAttribute("data-page")&&(e.innerHTML="",s.menu_pages.channel.render.bind(p)(t,e))},0)}),u.load()}f.className="emoticon-grid",_.className="heading",h&&(_.style.backgroundImage='url("'+h+'")'),_.innerHTML='TwitchSubscriber Emoticons',f.appendChild(_);for(var g=d.get("emoticons")||[],v=0;v0&&e.appendChild(f),m>0&&!c){var k=document.createElement("div"),C=document.createElement("div"),E=document.createElement("span"),T=document.createElement("a");k.className="subscribe-message",C.className="non-subscriber-message",k.appendChild(C),E.className="unlock-text",E.innerHTML="Subscribe to unlock Emoticons",C.appendChild(E),T.className="action subscribe-button button primary",T.href=d.get("product_url"),T.innerHTML='Subscribe'+d.get("price")+"",C.appendChild(T),e.appendChild(k)}else if(m>0){var x=u.get("content");if(x=x.length>0?x[x.length-1]:void 0,x&&x.purchase_profile&&!x.purchase_profile.will_renew){var L=n.parse_date(x.access_end||"");k=document.createElement("div"),C=document.createElement("div"),E=document.createElement("span"),end_time=L?Math.floor((L.getTime()-Date.now())/1e3):null,k.className="subscribe-message",C.className="non-subscriber-message",k.appendChild(C),E.className="unlock-text",E.innerHTML="Subscription expires in "+n.time_to_string(end_time,!0,!0),C.appendChild(E),e.appendChild(k)}}}}var S=a&&a.extra_sets||[];this._emotes_for_sets(e,t,a&&a.set&&[a.set]||[],this.feature_friday||r||S.length?"Channel Emoticons":null,"http://cdn.frankerfacez.com/script/devicon.png","FrankerFaceZ");for(var v=0;vs?-1:s>o?1:0});for(var l=0;l0&&(i=!0)}e.classList.toggle("no-emotes",!i),e.classList.toggle("live",d),e.classList.toggle("dark",a),e.classList.toggle("blue",r)}}},{"../constants":4}],27:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.settings_info.replace_twitch_menu={type:"boolean",value:!1,category:"Chat Input",name:"Replace Twitch Emoticon Menu",help:"Completely replace the default Twitch emoticon menu.",on_update:function(t){document.body.classList.toggle("ffz-menu-replace",t)}},s.settings_info.global_emotes_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Global Emotes in My Emotes",help:"Display the global Twitch emotes in the My Emoticons menu."},s.settings_info.emoji_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Emoji in My Emotes",help:"Display the supported emoji images in the My Emoticons menu."},s.settings_info.emote_menu_collapsed={value:[],visible:!1},s.prototype.setup_my_emotes=function(){if(this._twitch_set_to_channel={},this._twitch_badges={},localStorage.ffzTwitchSets)try{this._twitch_set_to_channel=JSON.parse(localStorage.ffzTwitchSets),this._twitch_badges=JSON.parse(localStorage.ffzTwitchBadges)}catch(t){}this._twitch_set_to_channel[0]="global",this._twitch_set_to_channel[33]="turbo_faces",this._twitch_set_to_channel[42]="turbo_faces",this._twitch_badges.global="//cdn.frankerfacez.com/script/twitch_logo.png",this._twitch_badges.turbo_faces=this._twitch_badges.turbo="//cdn.frankerfacez.com/script/turbo_badge.png"},s.menu_pages.my_emotes={name:"My Emoticons",icon:o.EMOTE,visible:function(t){var e=this.get_user(),s=t.get("controller.currentRoom.tmiSession"),o=e&&this.users[e.login]&&this.users[e.login].sets||[],n=(s&&s.getEmotes()||{emoticon_sets:{}}).emoticon_sets;return o.length||n&&Object.keys(n).length},render:function(t,e){var o=t.get("controller.currentRoom.tmiSession"),n=(o&&o.getEmotes()||{emoticon_sets:{}}).emoticon_sets,i=[];for(var a in n)n.hasOwnProperty(a)&&!this._twitch_set_to_channel.hasOwnProperty(a)&&i.push(a);if(!i.length)return s.menu_pages.my_emotes.draw_menu.bind(this)(t,e,n);var r=this,d=function(){if(i.length){i=[];var o={};for(var a in n)r._twitch_set_to_channel[a]&&(o[a]=n[a]);return s.menu_pages.my_emotes.draw_menu.bind(r)(t,e,o)}};this.ws_send("twitch_sets",i,function(o,a){if(i.length){if(i=[],o){for(var u in a)a.hasOwnProperty(u)&&(r._twitch_set_to_channel[u]=a[u]);return localStorage.ffzTwitchSets=JSON.stringify(r._twitch_set_to_channel),s.menu_pages.my_emotes.draw_menu.bind(r)(t,e,n)}d()}})?setTimeout(d,2e3):d()},toggle_section:function(t){var e=t.parentElement,s=e.getAttribute("data-set"),o=this.settings.emote_menu_collapsed,n=-1!==o.indexOf(s);n?o.removeObject(s):o.push(s),this.settings.set("emote_menu_collapsed",o),e.classList.toggle("collapsed",!n)},draw_emoji:function(t){var e=document.createElement("div"),n=document.createElement("div"),i=this;e.className="heading",e.innerHTML='FrankerFaceZEmoji',n.className="emoticon-grid collapsable",n.appendChild(e),n.setAttribute("data-set","emoji"),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("emoji")),e.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});var a=[];for(var r in this.emoji_data)a.push(this.emoji_data[r]);a.sort(function(t,e){var s=t.short_name.toLowerCase(),o=e.short_name.toLowerCase();return o>s?-1:s>o?1:t.rawe.raw?1:0});for(var d=0;dTwitch'+n.sanitize(t)}),d.className="heading",d.innerHTML='Twitch'+n.sanitize(r),this._twitch_badges[l])d.style.backgroundImage='url("'+this._twitch_badges[l]+'")';else{var c=this;Twitch.api.get("chat/"+l+"/badges",null,{version:3}).done(function(t){t.subscriber&&t.subscriber.image&&(c._twitch_badges[l]=t.subscriber.image,localStorage.ffzTwitchBadges=JSON.stringify(c._twitch_badges),d.style.backgroundImage='url("'+t.subscriber.image+'")')})}u.className="emoticon-grid collapsable",u.appendChild(d),u.setAttribute("data-set","twitch-"+e),u.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("twitch-"+e)),d.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(c)(this)}),a.sort(function(t,e){var s=t.code.toLowerCase(),o=e.code.toLowerCase();return o>s?-1:s>o?1:t.ide.id?1:0});for(var h=0;hFrankerFaceZ'+e.title,o.style.backgroundImage='url("'+(e.icon||"//cdn.frankerfacez.com/script/devicon.png")+'")',n.className="emoticon-grid collapsable",n.appendChild(o),n.setAttribute("data-set","ffz-"+e.id),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("ffz-"+e.id)),o.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});for(var r in e.emoticons)e.emoticons.hasOwnProperty(r)&&!e.emoticons[r].hidden&&a.push(e.emoticons[r]);a.sort(function(t,e){var s=t.name.toLowerCase(),o=e.name.toLowerCase();return o>s?-1:s>o?1:t.ide.id?1:0});for(var d=0;ds?-1:s>o?1:0});for(var u=0;us)&&(s=60),this.settings.set("notification_timeout",s)}}},e.ws_commands.message=function(t){this.show_message(t)},e._notifications={},e._last_notification=0,e.prototype.clear_notifications=function(){for(var t in e._notifications){var s=e._notifications[t];if(s)try{s.close()}catch(o){}}e._notifications={},e._last_notification=0},e.prototype.show_notification=function(t,s,o,n,i,a){var r=Notification.permission;if("denied "===r)return!1;if("granted"===r){s=s||"FrankerFaceZ",n=n||1e3*this.settings.notification_timeout;var d={lang:"en-US",dir:"ltr",body:t,tag:o||"FrankerFaceZ",icon:"http://cdn.frankerfacez.com/icon32.png"},u=this,c=new Notification(s,d),l=e._last_notification++;return e._notifications[l]=c,c.addEventListener("click",function(){delete e._notifications[l],i&&i.bind(u)()}),c.addEventListener("close",function(){delete e._notifications[l],a&&a.bind(u)()}),void("number"==typeof n&&c.addEventListener("show",function(){setTimeout(function(){delete e._notifications[l],c.close()},n)}))}var u=this;Notification.requestPermission(function(){u.show_notification(t,s,o)})},e.prototype.show_message=function(e){t.noty({text:e,theme:"ffzTheme",layout:"bottomCenter",closeWith:["button"]}).show()}},{}],29:[function(e){var s=t.FrankerFaceZ,o=e("../utils");s.prototype.setup_races=function(){this.log("Initializing race support."),this.srl_races={}},s.settings_info.srl_races={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"SRL Race Information",help:'Display information about SpeedRunsLive races under channels.',on_update:function(){this.rebuild_race_ui()}},s.ws_on_close.push(function(){var e=t.App&&App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;if(e){for(var i in this.srl_races)delete this.srl_races[i],(i===s||i===o)&&(n=!0);n&&this.rebuild_race_ui()}}),s.ws_commands.srl_race=function(t){var e=App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;this.srl_races=this.srl_races||{};for(var i=0;i',r.addEventListener("click",this._build_race_popup.bind(this,a,e)),a.appendChild(r),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}if(s){var o=this.srl_races&&this.srl_races[s],n=this._cindex.get("element"),i=n&&n.querySelector("#hostmode .channel-actions"),a=i&&i.querySelector("#ffz-ui-race");if(i&&this.settings.srl_races&&o){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",s);var r=document.createElement("span");r.className="button drop action",r.title="SpeedRunsLive Race",r.innerHTML='',r.addEventListener("click",this._build_race_popup.bind(this,a,s)),a.appendChild(r),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}}},s.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),delete this._race_timer),delete this._race_game,delete this._race_goal},s.prototype._build_race_popup=function(t,e){var o=this._popup;if((!o||(o.parentElement.removeChild(o),delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill,"ffz-race-popup"!==o.id||o.getAttribute("data-channel")!==e))&&t){var n=t.querySelector(".button"),i=n.offsetLeft+n.offsetWidth,a=this.srl_races[e],o=document.createElement("div"),r="";o.id="ffz-race-popup",o.setAttribute("data-channel",e),o.className=(i>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=o;var d="http://kadgar.net/live",u=!1;for(var c in a.entrants){var l=a.entrants[c].state;a.entrants.hasOwnProperty(c)&&a.entrants[c].channel&&("racing"==l||"entered"==l)&&(d+="/"+a.entrants[c].channel,u=!0)}var h=document.querySelector(".app-main.theatre")?document.body.clientHeight-300:t.parentElement.offsetTop-175,f=App.__container__.lookup("controller:channel"),_=f?f.get("display_name"):s.get_capitalization(e),m=encodeURIComponent("I'm watching "+_+" race "+a.goal+" in "+a.game+" on SpeedRunsLive!");r='