mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-31 15:08:31 +00:00
3.5.84 to 3.5.100. Most importantly, started using new Ember stuff. -view-registry instead of Ember.View.views, and such. Finally added UI for managing pinned channels. Use HTTPS for the API and socket servers. Don't immediately unload chat rooms. Smarter chat tab behavior. Added /card command for opening mod cards. Other stuff.
This commit is contained in:
parent
c167a8b626
commit
800553c602
28 changed files with 1016 additions and 525 deletions
|
@ -1,7 +1,4 @@
|
|||
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*['"]([^'"]+)['"][^}]+(?:}|$)/,
|
||||
GROUP_CHAT = /^_([^_]+)_\d+$/,
|
||||
HOSTED_SUB = / subscribed to /,
|
||||
constants = require('../constants'),
|
||||
utils = require('../utils'),
|
||||
|
@ -58,6 +55,35 @@ FFZ.prototype.setup_room = function() {
|
|||
this.get("model.tmiRoom").sendMessage("/timeout " + e.user + " 1");
|
||||
this.get("model").clearMessages(e.user);
|
||||
}
|
||||
|
||||
RC._actions.showModOverlay = function(e) {
|
||||
var Channel = App.__container__.resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
var chan = Channel.find({id: e.sender});
|
||||
|
||||
// Don't try loading the channel if it's already loaded. Don't make mod cards
|
||||
// refresh the channel page when you click the broadcaster, basically.
|
||||
if ( ! chan.get('isLoaded') )
|
||||
chan.load();
|
||||
|
||||
this.set("showModerationCard", true);
|
||||
|
||||
// We pass in renderBottom and renderRight, which we use to reposition the window
|
||||
// after we know how big it actually is.
|
||||
this.set("moderationCardInfo", {
|
||||
user: chan,
|
||||
renderTop: e.top,
|
||||
renderLeft: e.left,
|
||||
renderBottom: e.bottom,
|
||||
renderRight: e.right,
|
||||
isIgnored: this.get("tmiSession").isIgnored(e.sender),
|
||||
isChannelOwner: this.get("controllers.login.userData.login") === e.sender,
|
||||
profileHref: Twitch.uri.profile(e.sender),
|
||||
isModeratorOrHigher: this.get("model.isModeratorOrHigher")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.log("Hooking the Ember Room model.");
|
||||
|
@ -90,11 +116,12 @@ FFZ.prototype.setup_room = function() {
|
|||
} catch(err) { }
|
||||
|
||||
// Modify all existing Room views.
|
||||
for(var key in Ember.View.views) {
|
||||
if ( ! Ember.View.views.hasOwnProperty(key) )
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
||||
var view = Ember.View.views[key];
|
||||
var view = views[key];
|
||||
if ( !(view instanceof RoomView) )
|
||||
continue;
|
||||
|
||||
|
@ -834,7 +861,7 @@ FFZ.prototype._insert_history = function(room_id, data, from_server) {
|
|||
|
||||
FFZ.prototype.load_room = function(room_id, callback, tries) {
|
||||
var f = this;
|
||||
jQuery.getJSON(((tries||0)%2 === 0 ? constants.API_SERVER : constants.API_SERVER_2) + "v1/room/" + room_id)
|
||||
jQuery.getJSON(constants.API_SERVER + "v1/room/" + room_id)
|
||||
.done(function(data) {
|
||||
if ( data.sets ) {
|
||||
for(var key in data.sets)
|
||||
|
@ -935,6 +962,28 @@ FFZ.prototype._modify_room = function(room) {
|
|||
}
|
||||
},
|
||||
|
||||
ffzScheduleDestroy: function() {
|
||||
if ( this._ffz_destroy_timer )
|
||||
return;
|
||||
|
||||
var t = this;
|
||||
this._ffz_destroy_timer = setTimeout(function() {
|
||||
t._ffz_destroy_timer = null;
|
||||
t.ffzCheckDestroy();
|
||||
}, 5000);
|
||||
},
|
||||
|
||||
ffzCheckDestroy: function() {
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
user = f.get_user(),
|
||||
room_id = this.get('id');
|
||||
|
||||
if ( (Chat && Chat.get('currentChannelRoom') === this) || (user && user.login === room_id) || (f._chatv && f._chatv._ffz_host === room_id) || (f.settings.pinned_rooms && f.settings.pinned_rooms.indexOf(room_id) !== -1) )
|
||||
return;
|
||||
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
ffzUpdateStatus: function() {
|
||||
if ( f._roomv )
|
||||
f._roomv.ffzUpdateStatus();
|
||||
|
@ -1089,7 +1138,14 @@ FFZ.prototype._modify_room = function(room) {
|
|||
this.get("messages").pushObject(msg);
|
||||
this.trimMessages();
|
||||
|
||||
"admin" === msg.style || ("whisper" === msg.style && ! this.ffz_whisper_room ) || this.incrementProperty("unreadCount", 1);
|
||||
if ( msg.style !== "admin" && msg.style !== "whisper" ) {
|
||||
if ( msg.ffz_has_mention ) {
|
||||
this.ffz_last_mention = Date.now();
|
||||
}
|
||||
|
||||
this.ffz_last_activity = Date.now();
|
||||
this.incrementProperty("unreadCount", 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1102,9 +1158,6 @@ FFZ.prototype._modify_room = function(room) {
|
|||
if ( this._ffz_pending_flush )
|
||||
return;
|
||||
|
||||
/*if ( this._ffz_pending_flush )
|
||||
clearTimeout(this._ffz_pending_flush);*/
|
||||
|
||||
if ( this.ffzPending && this.ffzPending.length ) {
|
||||
// We need either the amount of chat delay past the first message, if chat_delay is on, or the
|
||||
// amount of time from the last batch.
|
||||
|
@ -1258,10 +1311,9 @@ FFZ.prototype._modify_room = function(room) {
|
|||
},
|
||||
|
||||
send: function(text, ignore_history) {
|
||||
if ( f.settings.group_tabs && f.settings.whisper_room && this.ffz_whisper_room )
|
||||
return;
|
||||
|
||||
try {
|
||||
this.ffz_last_input = Date.now();
|
||||
|
||||
if ( text && ! ignore_history ) {
|
||||
// Command History
|
||||
var mru = this.get('mru_list'),
|
||||
|
@ -1294,16 +1346,13 @@ FFZ.prototype._modify_room = function(room) {
|
|||
},
|
||||
|
||||
ffzUpdateUnread: function() {
|
||||
if ( f.settings.group_tabs ) {
|
||||
var Chat = App.__container__.lookup('controller:chat');
|
||||
if ( Chat && Chat.get('currentRoom') === this )
|
||||
this.resetUnreadCount();
|
||||
else if ( f._chatv )
|
||||
f._chatv.ffzTabUnread(this.get('id'));
|
||||
}
|
||||
var Chat = App.__container__.lookup('controller:chat');
|
||||
if ( Chat && Chat.get('currentRoom') === this )
|
||||
this.resetUnreadCount();
|
||||
else if ( f._chatv )
|
||||
f._chatv.ffzUpdateUnread(this.get('id'));
|
||||
}.observes('unreadCount'),
|
||||
|
||||
|
||||
ffzInitChatterCount: function() {
|
||||
if ( ! this.tmiRoom )
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue