mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-28 05:15:54 +00:00
3.5.134. Replaced Ember lookups with a utility function to make things easier in the future.
This commit is contained in:
parent
d55af32b4e
commit
ee1380f95d
29 changed files with 144 additions and 315 deletions
|
@ -132,8 +132,8 @@ FFZ.prototype.setup_colors = function() {
|
|||
this._update_colors();
|
||||
|
||||
// Events for rebuilding colors.
|
||||
var Layout = window.App && App.__container__.lookup('controller:layout'),
|
||||
Settings = window.App && App.__container__.lookup('controller:settings');
|
||||
var Layout = utils.ember_lookup('controller:layout'),
|
||||
Settings = utils.ember_lookup('controller:settings');
|
||||
|
||||
if ( Layout )
|
||||
Layout.addObserver("isTheatreMode", this._update_colors.bind(this, true));
|
||||
|
@ -656,8 +656,8 @@ FFZ.prototype._rebuild_colors = function() {
|
|||
|
||||
FFZ.prototype._update_colors = function(darkness_only) {
|
||||
// Update the lines. ALL of them.
|
||||
var Layout = window.App && App.__container__.lookup('controller:layout'),
|
||||
Settings = window.App && App.__container__.lookup('controller:settings'),
|
||||
var Layout = utils.ember_lookup('controller:layout'),
|
||||
Settings = utils.ember_lookup('controller:settings'),
|
||||
|
||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
||||
cr_dark = this.settings.dark_twitch || (Layout && Layout.get('isTheatreMode'));
|
||||
|
|
|
@ -24,7 +24,7 @@ FFZ.prototype.setup_channel = function() {
|
|||
document.head.appendChild(s);
|
||||
|
||||
this.log("Hooking the Ember Channel Index view.");
|
||||
var Channel = App.__container__.resolve('view:channel/index'),
|
||||
var Channel = utils.ember_resolve('view:channel/index'),
|
||||
f = this;
|
||||
|
||||
if ( ! Channel )
|
||||
|
@ -38,7 +38,7 @@ FFZ.prototype.setup_channel = function() {
|
|||
} catch(err) { }
|
||||
|
||||
// Update Existing
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
@ -54,7 +54,7 @@ FFZ.prototype.setup_channel = function() {
|
|||
|
||||
|
||||
this.log("Hooking the Ember Channel model.");
|
||||
Channel = App.__container__.resolve('model:channel');
|
||||
Channel = utils.ember_resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
|
@ -75,7 +75,7 @@ FFZ.prototype.setup_channel = function() {
|
|||
|
||||
this.log("Hooking the Ember Channel controller.");
|
||||
|
||||
Channel = App.__container__.lookup('controller:channel');
|
||||
Channel = utils.ember_lookup('controller:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
|
@ -241,7 +241,7 @@ FFZ.prototype._modify_cindex = function(view) {
|
|||
f.rebuild_race_ui();
|
||||
|
||||
if ( f.settings.auto_theater ) {
|
||||
var Layout = App.__container__.lookup('controller:layout');
|
||||
var Layout = utils.ember_lookup('controller:layout');
|
||||
if ( Layout )
|
||||
Layout.set('isTheatreMode', true);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ FFZ.settings_info.input_emoji = {
|
|||
|
||||
FFZ.prototype.setup_chat_input = function() {
|
||||
this.log("Hooking the Ember Chat Input component.");
|
||||
var Input = App.__container__.resolve('component:twitch-chat-input'),
|
||||
var Input = utils.ember_resolve('component:twitch-chat-input'),
|
||||
f = this;
|
||||
|
||||
if ( ! Input )
|
||||
|
@ -99,7 +99,7 @@ FFZ.prototype.setup_chat_input = function() {
|
|||
|
||||
this._modify_chat_input(Input);
|
||||
|
||||
var views = this._roomv && this._roomv._viewRegistry || window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = this._roomv && this._roomv._viewRegistry || utils.ember_views();
|
||||
for(var key in views) {
|
||||
var v = views[key];
|
||||
if ( v instanceof Input ) {
|
||||
|
|
|
@ -336,7 +336,7 @@ FFZ.prototype.refresh_chat = function() {
|
|||
return;
|
||||
|
||||
// There are chat-lines in the DOM and they aren't chat replay.
|
||||
var controller = App.__container__.lookup('controller:chat');
|
||||
var controller = utils.ember_lookup('controller:chat');
|
||||
if ( ! controller )
|
||||
return;
|
||||
|
||||
|
@ -351,7 +351,7 @@ FFZ.prototype.setup_chatview = function() {
|
|||
|
||||
this.log("Hooking the Ember Chat controller.");
|
||||
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
f = this;
|
||||
|
||||
if ( Chat ) {
|
||||
|
@ -442,7 +442,7 @@ FFZ.prototype.setup_chatview = function() {
|
|||
|
||||
this.log("Hooking the Ember Chat view.");
|
||||
|
||||
var Chat = App.__container__.resolve('view:chat');
|
||||
var Chat = utils.ember_resolve('view:chat');
|
||||
this._modify_cview(Chat);
|
||||
|
||||
// For some reason, this doesn't work unless we create an instance of the
|
||||
|
@ -452,7 +452,7 @@ FFZ.prototype.setup_chatview = function() {
|
|||
} catch(err) { }
|
||||
|
||||
// Modify all existing Chat views.
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main');
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
@ -470,24 +470,6 @@ FFZ.prototype.setup_chatview = function() {
|
|||
this.error("setup: build_ui_link: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
/*this.log("Hooking the Ember chat-right-column Component.");
|
||||
var Column = App.__container__.resolve('component:')
|
||||
|
||||
/*this.log("Hooking the Ember 'Right Column' controller. Seriously...");
|
||||
var Column = App.__container__.lookup('controller:right-column');
|
||||
if ( ! Column )
|
||||
return;
|
||||
|
||||
Column.reopen({
|
||||
ffzFixTabs: function() {
|
||||
if ( f.settings.group_tabs && f._chatv && f._chatv._ffz_tabs ) {
|
||||
setTimeout(function() {
|
||||
f._chatv && f._chatv.$('.chat-room').css('top', f._chatv._ffz_tabs.offsetHeight + "px");
|
||||
},0);
|
||||
}
|
||||
}.observes("firstTabSelected")
|
||||
});*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -685,8 +667,8 @@ FFZ.prototype._modify_cview = function(view) {
|
|||
},
|
||||
|
||||
ffzUpdateHost: function() {
|
||||
var Channel = App.__container__.lookup('controller:channel'),
|
||||
Room = App.__container__.resolve('model:room'),
|
||||
var Channel = utils.ember_lookup('controller:channel'),
|
||||
Room = utils.ember_resolve('model:room'),
|
||||
target = Room && Channel && Channel.get('hostModeTarget'),
|
||||
|
||||
updated = false;
|
||||
|
@ -1224,7 +1206,7 @@ FFZ.prototype.connect_extra_chat = function() {
|
|||
if ( user && user.login ) {
|
||||
// Make sure we're in the user's room.
|
||||
if ( ! this.rooms[user.login] || this.rooms[user.login].room ) {
|
||||
var Room = App.__container__.resolve('model:room');
|
||||
var Room = utils.ember_resolve('model:room');
|
||||
Room && Room.findOne(user.login);
|
||||
}
|
||||
}
|
||||
|
@ -1249,7 +1231,7 @@ FFZ.prototype.connect_extra_chat = function() {
|
|||
|
||||
|
||||
FFZ.prototype.disconnect_extra_chat = function() {
|
||||
var Chat = window.App && App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
current_channel_id = Chat && Chat.get('currentChannelRoom.id'),
|
||||
current_id = Chat && Chat.get('currentRoom.id'),
|
||||
user = this.get_user();
|
||||
|
@ -1284,7 +1266,7 @@ FFZ.prototype._join_room = function(room_id, no_rebuild) {
|
|||
// Make sure we're not already there.
|
||||
if ( ! this.rooms[room_id] || ! this.rooms[room_id].room ) {
|
||||
// Okay, fine. Get it.
|
||||
var Room = App.__container__.resolve('model:room');
|
||||
var Room = utils.ember_resolve('model:room');
|
||||
Room && Room.findOne(room_id);
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1294,7 @@ FFZ.prototype._leave_room = function(room_id, no_rebuild) {
|
|||
if ( ! this.rooms[room_id] || ! this.rooms[room_id].room )
|
||||
return did_leave;
|
||||
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
r = this.rooms[room_id].room,
|
||||
user = this.get_user();
|
||||
|
||||
|
|
|
@ -55,13 +55,13 @@ FFZ.prototype.setup_conversations = function() {
|
|||
document.body.classList.toggle('ffz-minimize-conversations', this.settings.minimize_conversations);
|
||||
|
||||
this.log("Hooking the Ember Conversation Window component.");
|
||||
var ConvWindow = App.__container__.resolve('component:conversation-window');
|
||||
var ConvWindow = utils.ember_resolve('component:conversation-window');
|
||||
if ( ConvWindow )
|
||||
this._modify_conversation_window(ConvWindow);
|
||||
|
||||
|
||||
this.log("Hooking the Ember Conversation Line component.");
|
||||
var ConvLine = App.__container__.resolve('component:conversation-line');
|
||||
var ConvLine = utils.ember_resolve('component:conversation-line');
|
||||
if ( ConvLine )
|
||||
this._modify_conversation_line(ConvLine);
|
||||
|
||||
|
@ -73,8 +73,7 @@ FFZ.prototype.setup_conversations = function() {
|
|||
|
||||
FFZ.prototype._modify_conversation_window = function(component) {
|
||||
var f = this,
|
||||
|
||||
Layout = App.__container__.lookup('controller:layout');
|
||||
Layout = utils.ember_lookup('controller:layout');
|
||||
|
||||
component.reopen({
|
||||
headerBadges: Ember.computed("thread.participants", "currentUsername", function() {
|
||||
|
@ -120,8 +119,7 @@ FFZ.prototype._modify_conversation_window = function(component) {
|
|||
|
||||
FFZ.prototype._modify_conversation_line = function(component) {
|
||||
var f = this,
|
||||
|
||||
Layout = App.__container__.lookup('controller:layout');
|
||||
Layout = utils.ember_lookup('controller:layout');
|
||||
|
||||
component.reopen({
|
||||
tokenizedMessage: function() {
|
||||
|
|
|
@ -32,7 +32,7 @@ FFZ.settings_info.sidebar_followed_games = {
|
|||
help: "Display this number of followed games on the sidebar.",
|
||||
|
||||
on_update: function(val) {
|
||||
var controller = App.__container__.lookup('controller:games-following');
|
||||
var controller = utils.ember_lookup('controller:games-following');
|
||||
if ( controller )
|
||||
controller.set('ffz_sidebar_games', val);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ FFZ.settings_info.directory_group_hosts = {
|
|||
|
||||
on_update: function() {
|
||||
var f = this,
|
||||
HostModel = App.__container__.resolve('model:host'),
|
||||
HostModel = utils.ember_resolve('model:host'),
|
||||
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
||||
|
||||
if ( ! Following )
|
||||
|
@ -146,7 +146,7 @@ FFZ.settings_info.directory_host_menus = {
|
|||
|
||||
on_update: function() {
|
||||
var f = this,
|
||||
HostModel = App.__container__.resolve('model:host'),
|
||||
HostModel = utils.ember_resolve('model:host'),
|
||||
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
||||
|
||||
if ( ! Following )
|
||||
|
@ -169,7 +169,7 @@ FFZ.prototype.setup_directory = function() {
|
|||
document.body.classList.toggle('ffz-creative-showcase', this.settings.directory_creative_showcase);
|
||||
document.body.classList.toggle('ffz-hide-recommended-channels', !this.settings.sidebar_hide_recommended_channels);
|
||||
|
||||
var GamesFollowing = App.__container__.lookup('controller:games-following'),
|
||||
var GamesFollowing = utils.ember_lookup('controller:games-following'),
|
||||
f = this;
|
||||
|
||||
if ( GamesFollowing ) {
|
||||
|
@ -195,24 +195,24 @@ FFZ.prototype.setup_directory = function() {
|
|||
|
||||
this.log("Hooking the Ember Directory views.");
|
||||
|
||||
var ChannelView = App.__container__.resolve('view:channel');
|
||||
var ChannelView = utils.ember_resolve('view:channel');
|
||||
if ( ChannelView )
|
||||
this._modify_directory_live(ChannelView);
|
||||
|
||||
var CreativeChannel = App.__container__.resolve('view:creative-channel');
|
||||
var CreativeChannel = utils.ember_resolve('view:creative-channel');
|
||||
if ( CreativeChannel )
|
||||
this._modify_directory_live(CreativeChannel);
|
||||
|
||||
var CSGOChannel = App.__container__.resolve('view:cs-go-channel');
|
||||
var CSGOChannel = utils.ember_resolve('view:cs-go-channel');
|
||||
if ( CSGOChannel )
|
||||
this._modify_directory_live(CSGOChannel, true);
|
||||
|
||||
var HostView = App.__container__.resolve('view:host');
|
||||
var HostView = utils.ember_resolve('view:host');
|
||||
if ( HostView )
|
||||
this._modify_directory_host(HostView);
|
||||
|
||||
// Initialize existing views.
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
var view = views[key];
|
||||
try {
|
||||
|
@ -226,7 +226,7 @@ FFZ.prototype.setup_directory = function() {
|
|||
|
||||
|
||||
FFZ.prototype._modify_following = function() {
|
||||
var HostModel = App.__container__.resolve('model:host'),
|
||||
var HostModel = utils.ember_resolve('model:host'),
|
||||
f = this;
|
||||
|
||||
if ( HostModel ) {
|
||||
|
@ -364,7 +364,7 @@ FFZ.prototype._modify_directory_live = function(dir, is_csgo) {
|
|||
if ( e.button !== 0 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey )
|
||||
return;
|
||||
|
||||
var Channel = App.__container__.resolve('model:channel');
|
||||
var Channel = utils.ember_resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
|
@ -449,7 +449,7 @@ FFZ.prototype._modify_directory_host = function(dir) {
|
|||
},
|
||||
|
||||
ffzVisitChannel: function(target, e) {
|
||||
var Channel = App.__container__.resolve('model:channel');
|
||||
var Channel = utils.ember_resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
|
|
|
@ -32,18 +32,18 @@ FFZ.prototype.setup_profile_following = function() {
|
|||
|
||||
// First, we need to hook the model. This is what we'll use to grab the following notification state,
|
||||
// rather than making potentially hundreds of API requests.
|
||||
var Following = App.__container__.resolve('model:kraken-channel-following');
|
||||
var Following = utils.ember_resolve('model:kraken-channel-following');
|
||||
if ( Following )
|
||||
this._hook_following(Following);
|
||||
|
||||
// Also try hooking that other model.
|
||||
var Notification = App.__container__.resolve('model:notification');
|
||||
var Notification = utils.ember_resolve('model:notification');
|
||||
if ( Notification )
|
||||
this._hook_following(Notification, true);
|
||||
|
||||
|
||||
// Now, we need to edit the profile Following view itself.
|
||||
var ProfileView = App.__container__.resolve('view:channel/following');
|
||||
var ProfileView = utils.ember_resolve('view:channel/following');
|
||||
if ( ! ProfileView )
|
||||
return;
|
||||
|
||||
|
@ -256,88 +256,18 @@ FFZ.prototype.setup_profile_following = function() {
|
|||
}
|
||||
});
|
||||
|
||||
/*// Try adding a nice Manage button to the Following page of the directory
|
||||
var DirectoryFollowing = App.__container__.resolve('view:directory');
|
||||
if ( DirectoryFollowing ) {
|
||||
DirectoryFollowing.reopen({
|
||||
didInsertElement: function() {
|
||||
this._super();
|
||||
try {
|
||||
this.ffzInit();
|
||||
} catch(err) {
|
||||
f.error("view:following ffzInit: " + err);
|
||||
}
|
||||
},
|
||||
|
||||
willClearRender: function() {
|
||||
try {
|
||||
this.ffzTeardown();
|
||||
} catch(err) {
|
||||
f.error("view:following ffzTeardown: " + err);
|
||||
}
|
||||
this._super();
|
||||
},
|
||||
|
||||
ffzInit: function() {
|
||||
f.log("view:directory ffzInit called!", this);
|
||||
|
||||
var el = this.get('element'),
|
||||
nav_bar = el && el.querySelector('.directory_header ul.nav'),
|
||||
user = f.get_user();
|
||||
|
||||
if ( ! nav_bar || ! user || ! user.login || ! f.settings.enhance_profile_following )
|
||||
return;
|
||||
|
||||
var li = document.createElement('li'),
|
||||
btn = document.createElement('a'),
|
||||
t = this;
|
||||
|
||||
li.className = 'ffz-manage-following';
|
||||
btn.innerHTML = 'Manage Following';
|
||||
btn.href = '/' + user.login + '/profile/following';
|
||||
|
||||
btn.addEventListener('click', function(e) {
|
||||
var Channel = App.__container__.resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
e.preventDefault();
|
||||
t.get('controller').transitionTo('profile.following', Channel.find({id: user.login}).load());
|
||||
return false;
|
||||
});
|
||||
|
||||
li.appendChild(btn);
|
||||
nav_bar.appendChild(li);
|
||||
},
|
||||
|
||||
ffzTeardown: function() {
|
||||
this.$('.ffz-manage-following').remove();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
DirectoryFollowing.create().destroy();
|
||||
} catch(err) { }
|
||||
} else
|
||||
f.log("Could not find Directory Following View.");*/
|
||||
// TODO: Add nice Manage Following button to the directory.
|
||||
|
||||
// Now, rebuild any views.
|
||||
try {
|
||||
ProfileView.create().destroy();
|
||||
} catch(err) { }
|
||||
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main');
|
||||
var views = utils.ember_views();
|
||||
if ( views )
|
||||
for(var key in views) {
|
||||
var view = views[key];
|
||||
/*if ( DirectoryFollowing && view instanceof DirectoryFollowing ) {
|
||||
try {
|
||||
view.ffzInit();
|
||||
} catch(err) {
|
||||
this.error("setup: view:following: ffzInit: " + err);
|
||||
}
|
||||
|
||||
} else*/ if ( view instanceof ProfileView ) {
|
||||
if ( view instanceof ProfileView ) {
|
||||
this.log("Manually updating existing Following View.", view);
|
||||
try {
|
||||
view.ffzInit();
|
||||
|
|
|
@ -39,7 +39,7 @@ FFZ.settings_info.portrait_mode = {
|
|||
if ( this.has_bttv )
|
||||
return;
|
||||
|
||||
var Layout = window.App && App.__container__.lookup('controller:layout');
|
||||
var Layout = utils.ember_lookup('controller:layout');
|
||||
if ( ! Layout )
|
||||
return;
|
||||
|
||||
|
@ -126,7 +126,7 @@ FFZ.settings_info.right_column_width = {
|
|||
if ( this.has_bttv )
|
||||
return;
|
||||
|
||||
var Layout = App.__container__.lookup('controller:layout');
|
||||
var Layout = utils.ember_lookup('controller:layout');
|
||||
if ( ! Layout )
|
||||
return;
|
||||
|
||||
|
@ -153,7 +153,7 @@ FFZ.prototype.setup_layout = function() {
|
|||
document.head.appendChild(s);
|
||||
|
||||
this.log("Hooking the Ember Layout controller.");
|
||||
var Layout = App.__container__.lookup('controller:layout'),
|
||||
var Layout = utils.ember_lookup('controller:layout'),
|
||||
f = this;
|
||||
|
||||
if ( ! Layout )
|
||||
|
|
|
@ -108,7 +108,7 @@ FFZ.settings_info.scrollback_length = {
|
|||
f.settings.set("scrollback_length", new_val);
|
||||
|
||||
// Update our everything.
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
current_id = Chat && Chat.get('currentRoom.id');
|
||||
|
||||
for(var room_id in f.rooms) {
|
||||
|
@ -595,25 +595,13 @@ FFZ.prototype.setup_line = function() {
|
|||
this._last_row = {};
|
||||
|
||||
this.log("Hooking the Ember Chat Line component.");
|
||||
var Line = App.__container__.resolve('component:chat-line');
|
||||
var Line = utils.ember_resolve('component:chat-line');
|
||||
|
||||
if ( Line )
|
||||
this._modify_chat_line(Line);
|
||||
|
||||
/*this.log("Hooking the Ember Whisper Line component.");
|
||||
var Whisper = App.__container__.resolve('component:whisper-line');
|
||||
|
||||
if ( Whisper )
|
||||
this._modify_line(Whisper);
|
||||
|
||||
this.log("Hooking the Ember Message Line component.");
|
||||
var Message = App.__container__.resolve('component:message-line');
|
||||
|
||||
if ( Message )
|
||||
this._modify_line(Message);*/
|
||||
|
||||
this.log("Hooking the Ember VOD Chat Line component.");
|
||||
var VOD = App.__container__.resolve('component:vod-chat-line');
|
||||
var VOD = utils.ember_resolve('component:vod-chat-line');
|
||||
if ( VOD )
|
||||
this._modify_vod_line(VOD);
|
||||
else
|
||||
|
@ -634,8 +622,8 @@ FFZ.prototype.save_aliases = function() {
|
|||
|
||||
FFZ.prototype._modify_chat_line = function(component, is_vod) {
|
||||
var f = this,
|
||||
Layout = App.__container__.lookup('controller:layout'),
|
||||
Settings = App.__container__.lookup('controller:settings');
|
||||
Layout = utils.ember_lookup('controller:layout'),
|
||||
Settings = utils.ember_lookup('controller:settings');
|
||||
|
||||
component.reopen({
|
||||
tokenizedMessage: function() {
|
||||
|
@ -967,81 +955,6 @@ FFZ.prototype._modify_vod_line = function(component) {
|
|||
}
|
||||
|
||||
|
||||
/*FFZ.prototype._modify_line = function(component) {
|
||||
var f = this,
|
||||
|
||||
Layout = App.__container__.lookup('controller:layout'),
|
||||
Settings = App.__container__.lookup('controller:settings');
|
||||
|
||||
|
||||
component.reopen({
|
||||
click: function(e) {
|
||||
if ( e.target && e.target.classList.contains('ffz-old-messages') )
|
||||
return f._show_deleted(this.get('msgObject.room'));
|
||||
|
||||
if ( e.target && e.target.classList.contains('deleted-link') )
|
||||
return f._deleted_link_click.bind(e.target)(e);
|
||||
|
||||
if ( e.target && e.target.classList.contains('mod-icon') ) {
|
||||
jQuery(e.target).trigger('mouseout');
|
||||
|
||||
if ( e.target.classList.contains('custom') ) {
|
||||
var room_id = this.get('msgObject.room'),
|
||||
room = room_id && f.rooms[room_id] && f.rooms[room_id].room,
|
||||
cmd = e.target.getAttribute('data-cmd');
|
||||
|
||||
if ( room ) {
|
||||
var lines = cmd.split("\n");
|
||||
for(var i=0; i < lines.length; i++)
|
||||
room.send(lines[i], true);
|
||||
|
||||
if ( e.target.classList.contains('is-timeout') )
|
||||
room.clearMessages(this.get('msgObject.from'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( f._click_emote(e.target, e) )
|
||||
return;
|
||||
|
||||
return this._super(e);
|
||||
},
|
||||
|
||||
render: function(e) {
|
||||
e.push(this.buildSenderHTML());
|
||||
e.push(this.buildMessageHTML())
|
||||
},
|
||||
|
||||
ffzWasDeleted: function() {
|
||||
return f.settings.prevent_clear && this.get('msgObject.ffz_deleted');
|
||||
}.property('msgObject.ffz_deleted'),
|
||||
|
||||
ffzHasOldMessages: function() {
|
||||
var old_messages = this.get('msgObject.ffz_old_messages');
|
||||
return old_messages && old_messages.length;
|
||||
}.property('msgObject.ffz_old_messages'),
|
||||
|
||||
classNameBindings: [
|
||||
'msgObject.ffz_has_mention:ffz-mentioned',
|
||||
'ffzWasDeleted:ffz-deleted',
|
||||
'ffzHasOldMessages:clearfix',
|
||||
'ffzHasOldMessages:ffz-has-deleted'
|
||||
],
|
||||
|
||||
didInsertElement: function() {
|
||||
this._super();
|
||||
|
||||
var el = this.get('element');
|
||||
|
||||
el.setAttribute('data-room', this.get('msgObject.room'));
|
||||
el.setAttribute('data-sender', this.get('msgObject.from'));
|
||||
el.setAttribute('data-deleted', this.get('msgObject.deleted') || false);
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Capitalization
|
||||
// ---------------------
|
||||
|
|
|
@ -420,7 +420,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
|
||||
|
||||
this.log("Hooking the Ember Moderation Card view.");
|
||||
var Card = App.__container__.resolve('component:moderation-card'),
|
||||
var Card = utils.ember_resolve('component:moderation-card'),
|
||||
f = this;
|
||||
|
||||
Card.reopen({
|
||||
|
@ -494,7 +494,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
|
||||
is_mod = controller.get('cardInfo.isModeratorOrHigher'),
|
||||
|
||||
chat = window.App && App.__container__.lookup('controller:chat'),
|
||||
chat = utils.ember_lookup('controller:chat'),
|
||||
user = f.get_user(),
|
||||
room_id = chat && chat.get('currentRoom.id'),
|
||||
is_broadcaster = user && room_id === user.login,
|
||||
|
@ -541,7 +541,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
var cmds = {},
|
||||
add_btn_click = function(cmd) {
|
||||
var user_id = controller.get('cardInfo.user.id'),
|
||||
cont = App.__container__.lookup('controller:chat'),
|
||||
cont = utils.ember_lookup('controller:chat'),
|
||||
room = cont && cont.get('currentRoom');
|
||||
|
||||
room && room.send(cmd.replace(/{user}/g, user_id), true);
|
||||
|
@ -593,7 +593,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
var key = e.keyCode || e.which,
|
||||
user_id = controller.get('cardInfo.user.id'),
|
||||
is_mod = controller.get('cardInfo.isModeratorOrHigher'),
|
||||
room = App.__container__.lookup('controller:chat').get('currentRoom');
|
||||
room = utils.ember_lookup('controller:chat').get('currentRoom');
|
||||
|
||||
if ( is_mod && key == keycodes.P )
|
||||
room.send("/timeout " + user_id + " 1", true);
|
||||
|
@ -621,7 +621,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
|
||||
var btn_click = function(timeout) {
|
||||
var user_id = controller.get('cardInfo.user.id'),
|
||||
room = App.__container__.lookup('controller:chat').get('currentRoom');
|
||||
room = utils.ember_lookup('controller:chat').get('currentRoom');
|
||||
|
||||
if ( timeout === -1 )
|
||||
room.send("/unban " + user_id, true);
|
||||
|
@ -803,7 +803,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
|
||||
ffzRenderHistory: function() {
|
||||
var t = this,
|
||||
Chat = App.__container__.lookup('controller:chat'),
|
||||
Chat = utils.ember_lookup('controller:chat'),
|
||||
room = Chat && Chat.get('currentRoom'),
|
||||
delete_links = room && room.get('roomProperties.hide_chat_links'),
|
||||
tmiSession = room.tmiSession || (window.TMI && TMI._sessions && TMI._sessions[0]),
|
||||
|
@ -872,7 +872,7 @@ FFZ.prototype.setup_mod_card = function() {
|
|||
},
|
||||
|
||||
ffzAdjacentHistory: function(line) {
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
t = this,
|
||||
|
||||
user_id = this.get('cardInfo.user.id'),
|
||||
|
@ -1005,8 +1005,8 @@ FFZ.prototype._build_mod_card_history = function(msg, modcard, show_from) {
|
|||
var raw_color = msg.color,
|
||||
colors = raw_color && this._handle_color(raw_color),
|
||||
|
||||
Layout = App.__container__.lookup('controller:layout'),
|
||||
Settings = App.__container__.lookup('controller:settings'),
|
||||
Layout = utils.ember_lookup('controller:layout'),
|
||||
Settings = utils.ember_lookup('controller:settings'),
|
||||
|
||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode'));
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var FFZ = window.FrankerFaceZ;
|
||||
var FFZ = window.FrankerFaceZ,
|
||||
utils = require('../utils');
|
||||
|
||||
|
||||
// ---------------
|
||||
|
@ -42,7 +43,7 @@ FFZ.settings_info.classic_player = {
|
|||
|
||||
on_update: function(val) {
|
||||
document.body.classList.toggle('ffz-classic-player', val);
|
||||
var Layout = window.App && App.__container__.lookup('controller:layout');
|
||||
var Layout = utils.ember_lookup('controller:layout');
|
||||
if ( Layout )
|
||||
Layout.set('PLAYER_CONTROLS_HEIGHT', val ? 32 : 0);
|
||||
}
|
||||
|
@ -55,13 +56,13 @@ FFZ.settings_info.classic_player = {
|
|||
|
||||
FFZ.prototype.setup_player = function() {
|
||||
document.body.classList.toggle('ffz-classic-player', this.settings.classic_player);
|
||||
var Layout = window.App && App.__container__.lookup('controller:layout');
|
||||
var Layout = utils.ember_lookup('controller:layout');
|
||||
if ( Layout )
|
||||
Layout.set('PLAYER_CONTROLS_HEIGHT', this.settings.classic_player ? 32 : 0);
|
||||
|
||||
this.players = {};
|
||||
|
||||
var Player2 = window.App && App.__container__.resolve('component:twitch-player2');
|
||||
var Player2 = utils.ember_resolve('component:twitch-player2');
|
||||
if ( ! Player2 )
|
||||
return this.log("Unable to find twitch-player2 component.");
|
||||
|
||||
|
@ -72,7 +73,7 @@ FFZ.prototype.setup_player = function() {
|
|||
if ( ! window.Ember )
|
||||
return;
|
||||
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
|
|
@ -36,7 +36,7 @@ FFZ.prototype.setup_room = function() {
|
|||
|
||||
// Responsive ban button.
|
||||
var f = this,
|
||||
RC = App.__container__.lookup('controller:room');
|
||||
RC = utils.ember_lookup('controller:room');
|
||||
|
||||
if ( RC ) {
|
||||
var orig_ban = RC._actions.banUser,
|
||||
|
@ -53,7 +53,7 @@ FFZ.prototype.setup_room = function() {
|
|||
}
|
||||
|
||||
RC._actions.showModOverlay = function(e) {
|
||||
var Channel = App.__container__.resolve('model:channel');
|
||||
var Channel = utils.ember_resolve('model:channel');
|
||||
if ( ! Channel )
|
||||
return;
|
||||
|
||||
|
@ -84,7 +84,7 @@ FFZ.prototype.setup_room = function() {
|
|||
|
||||
this.log("Hooking the Ember Room model.");
|
||||
|
||||
var Room = App.__container__.resolve('model:room');
|
||||
var Room = utils.ember_resolve('model:room');
|
||||
this._modify_room(Room);
|
||||
|
||||
// Modify all current instances of Room, as the changes to the base
|
||||
|
@ -102,7 +102,7 @@ FFZ.prototype.setup_room = function() {
|
|||
|
||||
this.log("Hooking the Ember Room view.");
|
||||
|
||||
var RoomView = App.__container__.resolve('view:room');
|
||||
var RoomView = utils.ember_resolve('view:room');
|
||||
this._modify_rview(RoomView);
|
||||
|
||||
// For some reason, this doesn't work unless we create an instance of the
|
||||
|
@ -112,7 +112,7 @@ FFZ.prototype.setup_room = function() {
|
|||
} catch(err) { }
|
||||
|
||||
// Modify all existing Room views.
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
@ -975,7 +975,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
},
|
||||
|
||||
ffzCheckDestroy: function() {
|
||||
var Chat = App.__container__.lookup('controller:chat'),
|
||||
var Chat = utils.ember_lookup('controller:chat'),
|
||||
user = f.get_user(),
|
||||
room_id = this.get('id');
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
var is_whisper = msg.style === 'whisper';
|
||||
|
||||
// Ignore whispers if conversations are enabled.
|
||||
if ( is_whisper && App.__container__.lookup('route:application').controller.get('isConversationsEnabled') )
|
||||
if ( is_whisper && utils.ember_lookup('controller:application').get('isConversationsEnabled') )
|
||||
return;
|
||||
|
||||
if ( ! is_whisper )
|
||||
|
@ -1311,7 +1311,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
if ( user && f._cindex && this.get('id') === user.login )
|
||||
f._cindex.ffzUpdateHostButton();
|
||||
|
||||
var Chat = App.__container__.lookup('controller:chat');
|
||||
var Chat = utils.ember_lookup('controller:chat');
|
||||
if ( ! Chat || Chat.get('currentChannelRoom') !== this )
|
||||
return;
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
},
|
||||
|
||||
ffzUpdateUnread: function() {
|
||||
var Chat = App.__container__.lookup('controller:chat');
|
||||
var Chat = utils.ember_lookup('controller:chat');
|
||||
if ( Chat && Chat.get('currentRoom') === this )
|
||||
this.resetUnreadCount();
|
||||
else if ( f._chatv )
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var FFZ = window.FrankerFaceZ;
|
||||
var FFZ = window.FrankerFaceZ,
|
||||
utils = require("../utils");
|
||||
|
||||
|
||||
// --------------------
|
||||
|
@ -11,7 +12,7 @@ FFZ.prototype.setup_router = function() {
|
|||
return;
|
||||
|
||||
var f = this,
|
||||
Router = App.__container__.lookup('router:main');
|
||||
Router = utils.ember_lookup('router:main');
|
||||
|
||||
if ( Router )
|
||||
Router.reopen({
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var FFZ = window.FrankerFaceZ;
|
||||
var FFZ = window.FrankerFaceZ,
|
||||
utils = require('../utils');
|
||||
|
||||
|
||||
// --------------------
|
||||
|
@ -21,13 +22,13 @@ FFZ.settings_info.sort_viewers = {
|
|||
|
||||
FFZ.prototype.setup_viewers = function() {
|
||||
this.log("Hooking the Ember Viewers controller.");
|
||||
var Viewers = App.__container__.resolve('controller:viewers');
|
||||
var Viewers = utils.ember_lookup('controller:viewers');
|
||||
if ( Viewers )
|
||||
this._modify_viewers(Viewers);
|
||||
|
||||
/* Disable for now because Twitch reverted this change
|
||||
this.log("Hooking the Ember Viewers view.");
|
||||
var ViewerView = App.__container__.resolve('view:viewers');
|
||||
var ViewerView = utils.ember_resolve('view:viewers');
|
||||
if ( ViewerView )
|
||||
this._modify_viewer_view(ViewerView);*/
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ FFZ.prototype._modify_viewers = function(controller) {
|
|||
last_category = null;
|
||||
|
||||
// Get the broadcaster name.
|
||||
var Channel = App.__container__.lookup('controller:channel'),
|
||||
var Channel = utils.ember_lookup('controller:channel'),
|
||||
room_id = this.get('parentController.model.id'),
|
||||
broadcaster = Channel && Channel.get('id');
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ var FFZ = window.FrankerFaceZ,
|
|||
|
||||
FFZ.prototype.setup_vod_chat = function() {
|
||||
var f = this,
|
||||
VRC = App.__container__.resolve('component:vod-right-column');
|
||||
VRC = utils.ember_resolve('component:vod-right-column');
|
||||
|
||||
if ( VRC )
|
||||
this._modify_vod_right_column(VRC);
|
||||
|
@ -21,7 +21,7 @@ FFZ.prototype.setup_vod_chat = function() {
|
|||
f.error("Unable to locate VOD Right Column component.");
|
||||
|
||||
// Get the VOD Chat Service
|
||||
var VODService = App.__container__.lookup('service:vod-chat-service');
|
||||
var VODService = utils.ember_lookup('service:vod-chat-service');
|
||||
if ( VODService )
|
||||
VODService.reopen({
|
||||
messageBufferSize: f.settings.scrollback_length,
|
||||
|
@ -51,7 +51,7 @@ FFZ.prototype.setup_vod_chat = function() {
|
|||
f.error("Unable to locate VOD Chat Service.");
|
||||
|
||||
// Get the VOD Chat Display
|
||||
var VODChat = App.__container__.resolve('component:vod-chat-display');
|
||||
var VODChat = utils.ember_resolve('component:vod-chat-display');
|
||||
|
||||
if ( VODChat )
|
||||
this._modify_vod_chat_display(VODChat);
|
||||
|
@ -59,7 +59,7 @@ FFZ.prototype.setup_vod_chat = function() {
|
|||
f.error("Unable to locate VOD Chat Display component.");
|
||||
|
||||
// Modify all existing VOD Chat views.
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
var view = views[key];
|
||||
|
||||
|
@ -114,7 +114,7 @@ FFZ.prototype._modify_vod_right_column = function(component) {
|
|||
|
||||
FFZ.prototype._modify_vod_chat_display = function(component) {
|
||||
var f = this,
|
||||
VODService = App.__container__.lookup('service:vod-chat-service');
|
||||
VODService = utils.ember_lookup('service:vod-chat-service');
|
||||
|
||||
component.reopen({
|
||||
didInsertElement: function() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var FFZ = window.FrankerFaceZ;
|
||||
var FFZ = window.FrankerFaceZ,
|
||||
utils = require('../utils');
|
||||
|
||||
|
||||
// --------------------
|
||||
|
@ -31,7 +32,7 @@ FFZ.prototype.setup_emote_menu = function(delay) {
|
|||
FFZ.prototype._emote_menu_enumerator = function() {
|
||||
var twitch_user = this.get_user(),
|
||||
user_id = twitch_user ? twitch_user.login : null,
|
||||
controller = App.__container__.lookup('controller:chat'),
|
||||
controller = utils.ember_lookup('controller:chat'),
|
||||
room_id = controller ? controller.get('currentRoom.id') : null,
|
||||
sets = this.getEmotes(user_id, room_id),
|
||||
emotes = [];
|
||||
|
|
|
@ -56,7 +56,9 @@ FFZ.prototype.find_rechat = function() {
|
|||
// Look-up dark mode.
|
||||
var dark_chat = this.settings.dark_twitch;
|
||||
if ( ! dark_chat ) {
|
||||
var model = window.App ? App.__container__.lookup('controller:settings').get('model') : undefined;
|
||||
var Settings = utils.ember_lookup('controller:settings'),
|
||||
model = Settings ? Settings.get('model') : undefined;
|
||||
|
||||
dark_chat = model && model.get('darkMode');
|
||||
}
|
||||
|
||||
|
@ -89,7 +91,9 @@ FFZ.prototype.find_rechat = function() {
|
|||
// Look-up dark mode.
|
||||
var dark_chat = this.settings.dark_twitch;
|
||||
if ( ! dark_chat ) {
|
||||
var model = window.App ? App.__container__.lookup('controller:settings').get('model') : undefined;
|
||||
var Settings = utils.ember_lookup('controller:settings'),
|
||||
model = Settings ? Settings.get('model') : undefined;
|
||||
|
||||
dark_chat = model && model.get('darkMode');
|
||||
}
|
||||
|
||||
|
@ -147,8 +151,8 @@ FFZ.prototype.process_rechat_line = function(line, reprocess) {
|
|||
user_id = line.getAttribute('data-sender'),
|
||||
room_id = line.getAttribute('data-room'),
|
||||
|
||||
Layout = App.__container__.lookup('controller:layout'),
|
||||
Settings = App.__container__.lookup('controller:settings'),
|
||||
Layout = utils.ember_lookup('controller:layout'),
|
||||
Settings = utils.ember_lookup('controller:settings'),
|
||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
||||
|
||||
badges_el = line.querySelector('.badges'),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var FFZ = window.FrankerFaceZ,
|
||||
constants = require('./constants');
|
||||
constants = require('./constants'),
|
||||
utils = require('./utils');
|
||||
|
||||
|
||||
// --------------------
|
||||
|
@ -51,7 +52,7 @@ FFZ.prototype._feature_friday_ui = function(room_id, parent, view) {
|
|||
|
||||
// Before we add the button, make sure the channel isn't the
|
||||
// current channel.
|
||||
var Channel = App.__container__.lookup('controller:channel');
|
||||
var Channel = utils.ember_lookup('controller:channel');
|
||||
if ( ! this.feature_friday.channel || (Channel && Channel.get('id') === this.feature_friday.channel) )
|
||||
return;
|
||||
|
||||
|
|
16
src/main.js
16
src/main.js
|
@ -35,7 +35,7 @@ FFZ.msg_commands = {};
|
|||
|
||||
// Version
|
||||
var VER = FFZ.version_info = {
|
||||
major: 3, minor: 5, revision: 133,
|
||||
major: 3, minor: 5, revision: 134,
|
||||
toString: function() {
|
||||
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
|
||||
}
|
||||
|
@ -108,11 +108,8 @@ FFZ.prototype.get_user = function() {
|
|||
if ( this.__user )
|
||||
return this.__user;
|
||||
|
||||
var user;
|
||||
if ( window.App ) {
|
||||
var nc = App.__container__.lookup('controller:login');
|
||||
user = nc ? nc.get('userData') : undefined;
|
||||
}
|
||||
var LC = FFZ.utils.ember_lookup('controller:login'),
|
||||
user = LC ? LC.get('userData') : undefined;
|
||||
|
||||
if ( ! user && window.PP && PP.login )
|
||||
user = PP;
|
||||
|
@ -225,10 +222,7 @@ FFZ.prototype.initialize = function(increment, delay) {
|
|||
return;
|
||||
}
|
||||
|
||||
var loaded = window.App != undefined &&
|
||||
App.__container__ != undefined &&
|
||||
App.__container__.resolve('model:room') != undefined;
|
||||
|
||||
var loaded = FFZ.utils.ember_resolve('model:room');
|
||||
if ( !loaded ) {
|
||||
increment = increment || 10;
|
||||
if ( delay >= 60000 )
|
||||
|
@ -384,7 +378,7 @@ FFZ.prototype.init_ember = function(delay) {
|
|||
|
||||
|
||||
// Make an alias so they STOP RENAMING THIS ON ME
|
||||
var Settings = App.__container__.lookup('controller:settings');
|
||||
var Settings = FFZ.utils.ember_lookup('controller:settings');
|
||||
if ( Settings && Settings.get('settings') === undefined )
|
||||
Settings.reopen({settings: Ember.computed.alias('model')});
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification, del
|
|||
(this.settings.notification_timeout*1000),
|
||||
function() {
|
||||
window.focus();
|
||||
var cont = App.__container__.lookup('controller:chat');
|
||||
var cont = utils.ember_lookup('controller:chat');
|
||||
room && cont && cont.focusRoom(room);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var FFZ = window.FrankerFaceZ,
|
||||
constants = require("../constants");
|
||||
constants = require("../constants"),
|
||||
utils = require("../utils");
|
||||
//styles = require("../styles");
|
||||
|
||||
|
||||
|
@ -136,7 +137,7 @@ FFZ.settings_info.dark_twitch = {
|
|||
|
||||
document.body.classList.toggle("ffz-dark", val);
|
||||
|
||||
var Settings = window.App && App.__container__.lookup('controller:settings'),
|
||||
var Settings = utils.ember_lookup('controller:settings'),
|
||||
settings = Settings && Settings.get('settings');
|
||||
|
||||
if ( val ) {
|
||||
|
@ -201,7 +202,7 @@ FFZ.prototype.setup_dark = function() {
|
|||
if ( ! this.settings.dark_twitch )
|
||||
return;
|
||||
|
||||
var Settings = window.App && App.__container__.lookup('controller:settings');
|
||||
var Settings = utils.ember_lookup('controller:settings');
|
||||
if ( Settings ) {
|
||||
try {
|
||||
Settings.set('settings.darkMode', true);
|
||||
|
|
|
@ -24,7 +24,7 @@ FFZ.settings_info.following_count = {
|
|||
on_update: function(val) {
|
||||
this._schedule_following_count();
|
||||
|
||||
var Stream = window.App && App.__container__.resolve('model:stream'),
|
||||
var Stream = utils.ember_resolve('model:stream'),
|
||||
Live = Stream && Stream.find("live");
|
||||
|
||||
if ( Live ) {
|
||||
|
@ -55,7 +55,7 @@ FFZ.prototype.setup_following_count = function(has_ember) {
|
|||
return this._following_get_me();
|
||||
|
||||
this.log("Connecting to Live Streams model.");
|
||||
var Stream = window.App && App.__container__.resolve('model:stream');
|
||||
var Stream = utils.ember_resolve('model:stream');
|
||||
if ( ! Stream )
|
||||
return this.log("Unable to find Stream model.");
|
||||
|
||||
|
@ -70,7 +70,7 @@ FFZ.prototype.setup_following_count = function(has_ember) {
|
|||
|
||||
Live.load();
|
||||
|
||||
/*var Host = window.App && App.__container__.resolve('model:host'),
|
||||
/*var Host = utils.ember_resolve('model:hist'),
|
||||
HostLive = Host && Host.find("following");
|
||||
|
||||
if ( HostLive )
|
||||
|
@ -132,10 +132,10 @@ FFZ.prototype._update_following_count = function() {
|
|||
|
||||
this._following_count_timer = setTimeout(this._update_following_count.bind(this), 55000 + (10000*Math.random()));
|
||||
|
||||
var Stream = window.App && App.__container__.resolve('model:stream'),
|
||||
var Stream = utils.ember_resolve('model:stream'),
|
||||
Live = Stream && Stream.find("live"),
|
||||
|
||||
Host = window.App && App.__container__.resolve('model:host'),
|
||||
Host = utils.ember_resolve('model:host'),
|
||||
HostLive = Host && Host.find("following"),
|
||||
|
||||
f = this;
|
||||
|
@ -172,7 +172,7 @@ FFZ.prototype._build_following_tooltip = function(el) {
|
|||
height = document.body.clientHeight - (bb.bottom + 50),
|
||||
max_lines = Math.max(Math.floor(height / 40) - 1, 2),
|
||||
|
||||
/*Host = window.App && App.__container__.resolve('model:host'),
|
||||
/*Host = utils.ember_resolve('model:host'),
|
||||
HostLive = Host && Host.find("following"),*/
|
||||
|
||||
streams = this._tooltip_streams,
|
||||
|
|
|
@ -76,7 +76,7 @@ FFZ.ffz_commands.following = function(room, args) {
|
|||
// ---------------
|
||||
|
||||
FFZ.ws_on_close.push(function() {
|
||||
var controller = window.App && App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
current_id = controller && controller.get('id'),
|
||||
current_host = controller && controller.get('hostModeTarget.id'),
|
||||
need_update = false;
|
||||
|
@ -112,7 +112,7 @@ FFZ.ws_on_close.push(function() {
|
|||
|
||||
|
||||
FFZ.ws_commands.follow_buttons = function(data) {
|
||||
var controller = window.App && App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
current_id = controller && controller.get('content.id'),
|
||||
current_host = controller && controller.get('hostModeTarget.id'),
|
||||
need_update = false;
|
||||
|
@ -131,7 +131,7 @@ FFZ.ws_commands.follow_buttons = function(data) {
|
|||
|
||||
|
||||
FFZ.ws_commands.follow_sets = function(data) {
|
||||
var controller = App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
current_id = controller && controller.get('content.id'),
|
||||
current_host = controller && controller.get('hostModeTarget.id'),
|
||||
need_update = false,
|
||||
|
@ -188,7 +188,7 @@ FFZ.ws_commands.follow_sets = function(data) {
|
|||
// ---------------
|
||||
|
||||
FFZ.prototype.rebuild_following_ui = function() {
|
||||
var controller = App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
channel_id = controller && controller.get('content.id'),
|
||||
hosted_id = controller && controller.get('hostModeTarget.id');
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ FFZ.prototype.setup_menu = function() {
|
|||
|
||||
this.log("Hooking the Ember Chat Settings view.");
|
||||
|
||||
var Settings = window.App && App.__container__.resolve('view:settings'),
|
||||
Layout = window.App && App.__container__.lookup('controller:layout'),
|
||||
var Settings = utils.ember_resolve('view:settings'),
|
||||
Layout = utils.ember_lookup('controller:layout'),
|
||||
f = this;
|
||||
|
||||
if ( ! Settings )
|
||||
|
@ -164,7 +164,7 @@ FFZ.prototype.setup_menu = function() {
|
|||
} catch(err) { }
|
||||
|
||||
// Modify all existing Chat Settings views.
|
||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
||||
var views = utils.ember_views();
|
||||
for(var key in views) {
|
||||
if ( ! views.hasOwnProperty(key) )
|
||||
continue;
|
||||
|
@ -498,7 +498,8 @@ FFZ.menu_pages.channel = {
|
|||
if ( product && !product.get("error") ) {
|
||||
// We have a product, and no error~!
|
||||
has_product = true;
|
||||
var tickets = App.__container__.resolve('model:ticket').find('user', {channel: room_id}),
|
||||
var Ticket = utils.ember_resolve('model:ticket'),
|
||||
tickets = Ticket && Ticket.find('user', {channel: room_id}),
|
||||
is_subscribed = tickets ? tickets.get('content') : false,
|
||||
is_loaded = tickets ? tickets.get('isLoaded') : false,
|
||||
icon = room.room.get("badgeSet.subscriber.image"),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var FFZ = window.FrankerFaceZ,
|
||||
constants = require('../constants');
|
||||
constants = require('../constants'),
|
||||
utils = require('../utils');
|
||||
|
||||
// --------------------
|
||||
// Initialization
|
||||
|
@ -18,7 +19,7 @@ FFZ.prototype.build_ui_link = function(view) {
|
|||
|
||||
|
||||
FFZ.prototype.update_ui_link = function(link) {
|
||||
var controller = window.App && App.__container__.lookup('controller:chat');
|
||||
var controller = utils.ember_lookup('controller:chat');
|
||||
link = link || document.querySelector('a.ffz-ui-toggle');
|
||||
if ( !link || !controller )
|
||||
return;
|
||||
|
|
|
@ -35,7 +35,7 @@ FFZ.settings_info.srl_races = {
|
|||
// ---------------
|
||||
|
||||
FFZ.ws_on_close.push(function() {
|
||||
var controller = window.App && App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
current_id = controller && controller.get('id'),
|
||||
current_host = controller && controller.get('hostModeTarget.id'),
|
||||
need_update = false;
|
||||
|
@ -55,7 +55,7 @@ FFZ.ws_on_close.push(function() {
|
|||
|
||||
|
||||
FFZ.ws_commands.srl_race = function(data) {
|
||||
var controller = App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
current_id = controller && controller.get('id'),
|
||||
current_host = controller && controller.get('hostModeTarget.id'),
|
||||
need_update = false;
|
||||
|
@ -91,7 +91,7 @@ FFZ.ws_commands.srl_race = function(data) {
|
|||
// ---------------
|
||||
|
||||
FFZ.prototype.rebuild_race_ui = function() {
|
||||
var controller = App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
channel_id = controller && controller.get('id'),
|
||||
hosted_id = controller && controller.get('hostModeTarget.id');
|
||||
|
||||
|
@ -211,7 +211,7 @@ FFZ.prototype._build_race_popup = function(container, channel_id) {
|
|||
}
|
||||
|
||||
var height = document.querySelector('.app-main.theatre') ? document.body.clientHeight - 300 : container.parentElement.offsetTop - 175,
|
||||
controller = App.__container__.lookup('controller:channel'),
|
||||
controller = utils.ember_lookup('controller:channel'),
|
||||
display_name = controller ? controller.get('display_name') : FFZ.get_capitalization(channel_id),
|
||||
tweet = encodeURIComponent("I'm watching " + display_name + " race " + race.goal + " in " + race.game + " on SpeedRunsLive!");
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ var FFZ = window.FrankerFaceZ,
|
|||
|
||||
FFZ.prototype.fix_tooltips = function() {
|
||||
// First, override the tooltip mixin.
|
||||
var TipsyTooltip = window.App && App.__container__.resolve('component:tipsy-tooltip');
|
||||
var TipsyTooltip = utils.ember_resolve('component:tipsy-tooltip');
|
||||
if ( TipsyTooltip ) {
|
||||
this.log("Modifying Tipsy-Tooltip component to use gravity.");
|
||||
TipsyTooltip.reopen({
|
||||
|
|
|
@ -10,7 +10,7 @@ var FFZ = window.FrankerFaceZ,
|
|||
FFZ.ws_commands.chatters = function(data) {
|
||||
var channel = data[0], count = data[1];
|
||||
|
||||
var controller = window.App && App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
match = this.is_dashboard ? location.pathname.match(/\/([^\/]+)/) : undefined,
|
||||
id = this.is_dashboard ? match && match[1] : controller && controller.get && controller.get('id');
|
||||
|
||||
|
@ -30,7 +30,7 @@ FFZ.ws_commands.chatters = function(data) {
|
|||
FFZ.ws_commands.viewers = function(data) {
|
||||
var channel = data[0], count = data[1];
|
||||
|
||||
var controller = window.App && App.__container__.lookup('controller:channel'),
|
||||
var controller = utils.ember_lookup('controller:channel'),
|
||||
match = this.is_dashboard ? location.pathname.match(/\/([^\/]+)/) : undefined,
|
||||
id = this.is_dashboard ? match && match[1] : controller && controller.get && controller.get('id');
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ var sanitize_el = document.createElement('span'),
|
|||
if ( ! window.App )
|
||||
return;
|
||||
|
||||
if ( App.__deprecatedInstance__ && App.__deprecatedInstance__.registry && App.__deprecatedInstance_.registry.lookup )
|
||||
if ( App.__deprecatedInstance__ && App.__deprecatedInstance__.registry && App.__deprecatedInstance__.registry.lookup )
|
||||
return App.__deprecatedInstance__.registry.lookup(thing);
|
||||
if ( App.__container__ && App.__container__.lookup )
|
||||
return App.__container__.lookup(thing);
|
||||
|
@ -234,7 +234,7 @@ module.exports = FFZ.utils = {
|
|||
if ( ! window.App )
|
||||
return;
|
||||
|
||||
if ( App.__deprecatedInstance__ && App.__deprecatedInstance__.registry && App.__deprecatedInstance_.registry.resolve )
|
||||
if ( App.__deprecatedInstance__ && App.__deprecatedInstance__.registry && App.__deprecatedInstance__.registry.resolve )
|
||||
return App.__deprecatedInstance__.registry.resolve(thing);
|
||||
if ( App.__container__ && App.__container__.resolve )
|
||||
return App.__container__.resolve(thing);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue