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();
|
this._update_colors();
|
||||||
|
|
||||||
// Events for rebuilding colors.
|
// Events for rebuilding colors.
|
||||||
var Layout = window.App && App.__container__.lookup('controller:layout'),
|
var Layout = utils.ember_lookup('controller:layout'),
|
||||||
Settings = window.App && App.__container__.lookup('controller:settings');
|
Settings = utils.ember_lookup('controller:settings');
|
||||||
|
|
||||||
if ( Layout )
|
if ( Layout )
|
||||||
Layout.addObserver("isTheatreMode", this._update_colors.bind(this, true));
|
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) {
|
FFZ.prototype._update_colors = function(darkness_only) {
|
||||||
// Update the lines. ALL of them.
|
// Update the lines. ALL of them.
|
||||||
var Layout = window.App && App.__container__.lookup('controller:layout'),
|
var Layout = utils.ember_lookup('controller:layout'),
|
||||||
Settings = window.App && App.__container__.lookup('controller:settings'),
|
Settings = utils.ember_lookup('controller:settings'),
|
||||||
|
|
||||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
||||||
cr_dark = this.settings.dark_twitch || (Layout && Layout.get('isTheatreMode'));
|
cr_dark = this.settings.dark_twitch || (Layout && Layout.get('isTheatreMode'));
|
||||||
|
|
|
@ -24,7 +24,7 @@ FFZ.prototype.setup_channel = function() {
|
||||||
document.head.appendChild(s);
|
document.head.appendChild(s);
|
||||||
|
|
||||||
this.log("Hooking the Ember Channel Index view.");
|
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;
|
f = this;
|
||||||
|
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
|
@ -38,7 +38,7 @@ FFZ.prototype.setup_channel = function() {
|
||||||
} catch(err) { }
|
} catch(err) { }
|
||||||
|
|
||||||
// Update Existing
|
// 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) {
|
for(var key in views) {
|
||||||
if ( ! views.hasOwnProperty(key) )
|
if ( ! views.hasOwnProperty(key) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -54,7 +54,7 @@ FFZ.prototype.setup_channel = function() {
|
||||||
|
|
||||||
|
|
||||||
this.log("Hooking the Ember Channel model.");
|
this.log("Hooking the Ember Channel model.");
|
||||||
Channel = App.__container__.resolve('model:channel');
|
Channel = utils.ember_resolve('model:channel');
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ FFZ.prototype.setup_channel = function() {
|
||||||
|
|
||||||
this.log("Hooking the Ember Channel controller.");
|
this.log("Hooking the Ember Channel controller.");
|
||||||
|
|
||||||
Channel = App.__container__.lookup('controller:channel');
|
Channel = utils.ember_lookup('controller:channel');
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ FFZ.prototype._modify_cindex = function(view) {
|
||||||
f.rebuild_race_ui();
|
f.rebuild_race_ui();
|
||||||
|
|
||||||
if ( f.settings.auto_theater ) {
|
if ( f.settings.auto_theater ) {
|
||||||
var Layout = App.__container__.lookup('controller:layout');
|
var Layout = utils.ember_lookup('controller:layout');
|
||||||
if ( Layout )
|
if ( Layout )
|
||||||
Layout.set('isTheatreMode', true);
|
Layout.set('isTheatreMode', true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ FFZ.settings_info.input_emoji = {
|
||||||
|
|
||||||
FFZ.prototype.setup_chat_input = function() {
|
FFZ.prototype.setup_chat_input = function() {
|
||||||
this.log("Hooking the Ember Chat Input component.");
|
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;
|
f = this;
|
||||||
|
|
||||||
if ( ! Input )
|
if ( ! Input )
|
||||||
|
@ -99,7 +99,7 @@ FFZ.prototype.setup_chat_input = function() {
|
||||||
|
|
||||||
this._modify_chat_input(Input);
|
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) {
|
for(var key in views) {
|
||||||
var v = views[key];
|
var v = views[key];
|
||||||
if ( v instanceof Input ) {
|
if ( v instanceof Input ) {
|
||||||
|
|
|
@ -336,7 +336,7 @@ FFZ.prototype.refresh_chat = function() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// There are chat-lines in the DOM and they aren't chat replay.
|
// 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 )
|
if ( ! controller )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ FFZ.prototype.setup_chatview = function() {
|
||||||
|
|
||||||
this.log("Hooking the Ember Chat controller.");
|
this.log("Hooking the Ember Chat controller.");
|
||||||
|
|
||||||
var Chat = App.__container__.lookup('controller:chat'),
|
var Chat = utils.ember_lookup('controller:chat'),
|
||||||
f = this;
|
f = this;
|
||||||
|
|
||||||
if ( Chat ) {
|
if ( Chat ) {
|
||||||
|
@ -442,7 +442,7 @@ FFZ.prototype.setup_chatview = function() {
|
||||||
|
|
||||||
this.log("Hooking the Ember Chat view.");
|
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);
|
this._modify_cview(Chat);
|
||||||
|
|
||||||
// For some reason, this doesn't work unless we create an instance of the
|
// 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) { }
|
} catch(err) { }
|
||||||
|
|
||||||
// Modify all existing Chat views.
|
// 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) {
|
for(var key in views) {
|
||||||
if ( ! views.hasOwnProperty(key) )
|
if ( ! views.hasOwnProperty(key) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -470,24 +470,6 @@ FFZ.prototype.setup_chatview = function() {
|
||||||
this.error("setup: build_ui_link: " + err);
|
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() {
|
ffzUpdateHost: function() {
|
||||||
var Channel = App.__container__.lookup('controller:channel'),
|
var Channel = utils.ember_lookup('controller:channel'),
|
||||||
Room = App.__container__.resolve('model:room'),
|
Room = utils.ember_resolve('model:room'),
|
||||||
target = Room && Channel && Channel.get('hostModeTarget'),
|
target = Room && Channel && Channel.get('hostModeTarget'),
|
||||||
|
|
||||||
updated = false;
|
updated = false;
|
||||||
|
@ -1224,7 +1206,7 @@ FFZ.prototype.connect_extra_chat = function() {
|
||||||
if ( user && user.login ) {
|
if ( user && user.login ) {
|
||||||
// Make sure we're in the user's room.
|
// Make sure we're in the user's room.
|
||||||
if ( ! this.rooms[user.login] || this.rooms[user.login].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);
|
Room && Room.findOne(user.login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1249,7 +1231,7 @@ FFZ.prototype.connect_extra_chat = function() {
|
||||||
|
|
||||||
|
|
||||||
FFZ.prototype.disconnect_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_channel_id = Chat && Chat.get('currentChannelRoom.id'),
|
||||||
current_id = Chat && Chat.get('currentRoom.id'),
|
current_id = Chat && Chat.get('currentRoom.id'),
|
||||||
user = this.get_user();
|
user = this.get_user();
|
||||||
|
@ -1284,7 +1266,7 @@ FFZ.prototype._join_room = function(room_id, no_rebuild) {
|
||||||
// Make sure we're not already there.
|
// Make sure we're not already there.
|
||||||
if ( ! this.rooms[room_id] || ! this.rooms[room_id].room ) {
|
if ( ! this.rooms[room_id] || ! this.rooms[room_id].room ) {
|
||||||
// Okay, fine. Get it.
|
// Okay, fine. Get it.
|
||||||
var Room = App.__container__.resolve('model:room');
|
var Room = utils.ember_resolve('model:room');
|
||||||
Room && Room.findOne(room_id);
|
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 )
|
if ( ! this.rooms[room_id] || ! this.rooms[room_id].room )
|
||||||
return did_leave;
|
return did_leave;
|
||||||
|
|
||||||
var Chat = App.__container__.lookup('controller:chat'),
|
var Chat = utils.ember_lookup('controller:chat'),
|
||||||
r = this.rooms[room_id].room,
|
r = this.rooms[room_id].room,
|
||||||
user = this.get_user();
|
user = this.get_user();
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,13 @@ FFZ.prototype.setup_conversations = function() {
|
||||||
document.body.classList.toggle('ffz-minimize-conversations', this.settings.minimize_conversations);
|
document.body.classList.toggle('ffz-minimize-conversations', this.settings.minimize_conversations);
|
||||||
|
|
||||||
this.log("Hooking the Ember Conversation Window component.");
|
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 )
|
if ( ConvWindow )
|
||||||
this._modify_conversation_window(ConvWindow);
|
this._modify_conversation_window(ConvWindow);
|
||||||
|
|
||||||
|
|
||||||
this.log("Hooking the Ember Conversation Line component.");
|
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 )
|
if ( ConvLine )
|
||||||
this._modify_conversation_line(ConvLine);
|
this._modify_conversation_line(ConvLine);
|
||||||
|
|
||||||
|
@ -73,8 +73,7 @@ FFZ.prototype.setup_conversations = function() {
|
||||||
|
|
||||||
FFZ.prototype._modify_conversation_window = function(component) {
|
FFZ.prototype._modify_conversation_window = function(component) {
|
||||||
var f = this,
|
var f = this,
|
||||||
|
Layout = utils.ember_lookup('controller:layout');
|
||||||
Layout = App.__container__.lookup('controller:layout');
|
|
||||||
|
|
||||||
component.reopen({
|
component.reopen({
|
||||||
headerBadges: Ember.computed("thread.participants", "currentUsername", function() {
|
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) {
|
FFZ.prototype._modify_conversation_line = function(component) {
|
||||||
var f = this,
|
var f = this,
|
||||||
|
Layout = utils.ember_lookup('controller:layout');
|
||||||
Layout = App.__container__.lookup('controller:layout');
|
|
||||||
|
|
||||||
component.reopen({
|
component.reopen({
|
||||||
tokenizedMessage: function() {
|
tokenizedMessage: function() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ FFZ.settings_info.sidebar_followed_games = {
|
||||||
help: "Display this number of followed games on the sidebar.",
|
help: "Display this number of followed games on the sidebar.",
|
||||||
|
|
||||||
on_update: function(val) {
|
on_update: function(val) {
|
||||||
var controller = App.__container__.lookup('controller:games-following');
|
var controller = utils.ember_lookup('controller:games-following');
|
||||||
if ( controller )
|
if ( controller )
|
||||||
controller.set('ffz_sidebar_games', val);
|
controller.set('ffz_sidebar_games', val);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ FFZ.settings_info.directory_group_hosts = {
|
||||||
|
|
||||||
on_update: function() {
|
on_update: function() {
|
||||||
var f = this,
|
var f = this,
|
||||||
HostModel = App.__container__.resolve('model:host'),
|
HostModel = utils.ember_resolve('model:host'),
|
||||||
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
||||||
|
|
||||||
if ( ! Following )
|
if ( ! Following )
|
||||||
|
@ -146,7 +146,7 @@ FFZ.settings_info.directory_host_menus = {
|
||||||
|
|
||||||
on_update: function() {
|
on_update: function() {
|
||||||
var f = this,
|
var f = this,
|
||||||
HostModel = App.__container__.resolve('model:host'),
|
HostModel = utils.ember_resolve('model:host'),
|
||||||
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
Following = HostModel && HostModel.collections[HostModel.collectionId("following")];
|
||||||
|
|
||||||
if ( ! 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-creative-showcase', this.settings.directory_creative_showcase);
|
||||||
document.body.classList.toggle('ffz-hide-recommended-channels', !this.settings.sidebar_hide_recommended_channels);
|
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;
|
f = this;
|
||||||
|
|
||||||
if ( GamesFollowing ) {
|
if ( GamesFollowing ) {
|
||||||
|
@ -195,24 +195,24 @@ FFZ.prototype.setup_directory = function() {
|
||||||
|
|
||||||
this.log("Hooking the Ember Directory views.");
|
this.log("Hooking the Ember Directory views.");
|
||||||
|
|
||||||
var ChannelView = App.__container__.resolve('view:channel');
|
var ChannelView = utils.ember_resolve('view:channel');
|
||||||
if ( ChannelView )
|
if ( ChannelView )
|
||||||
this._modify_directory_live(ChannelView);
|
this._modify_directory_live(ChannelView);
|
||||||
|
|
||||||
var CreativeChannel = App.__container__.resolve('view:creative-channel');
|
var CreativeChannel = utils.ember_resolve('view:creative-channel');
|
||||||
if ( CreativeChannel )
|
if ( CreativeChannel )
|
||||||
this._modify_directory_live(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 )
|
if ( CSGOChannel )
|
||||||
this._modify_directory_live(CSGOChannel, true);
|
this._modify_directory_live(CSGOChannel, true);
|
||||||
|
|
||||||
var HostView = App.__container__.resolve('view:host');
|
var HostView = utils.ember_resolve('view:host');
|
||||||
if ( HostView )
|
if ( HostView )
|
||||||
this._modify_directory_host(HostView);
|
this._modify_directory_host(HostView);
|
||||||
|
|
||||||
// Initialize existing views.
|
// 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) {
|
for(var key in views) {
|
||||||
var view = views[key];
|
var view = views[key];
|
||||||
try {
|
try {
|
||||||
|
@ -226,7 +226,7 @@ FFZ.prototype.setup_directory = function() {
|
||||||
|
|
||||||
|
|
||||||
FFZ.prototype._modify_following = function() {
|
FFZ.prototype._modify_following = function() {
|
||||||
var HostModel = App.__container__.resolve('model:host'),
|
var HostModel = utils.ember_resolve('model:host'),
|
||||||
f = this;
|
f = this;
|
||||||
|
|
||||||
if ( HostModel ) {
|
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 )
|
if ( e.button !== 0 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var Channel = App.__container__.resolve('model:channel');
|
var Channel = utils.ember_resolve('model:channel');
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ FFZ.prototype._modify_directory_host = function(dir) {
|
||||||
},
|
},
|
||||||
|
|
||||||
ffzVisitChannel: function(target, e) {
|
ffzVisitChannel: function(target, e) {
|
||||||
var Channel = App.__container__.resolve('model:channel');
|
var Channel = utils.ember_resolve('model:channel');
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
return;
|
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,
|
// 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.
|
// 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 )
|
if ( Following )
|
||||||
this._hook_following(Following);
|
this._hook_following(Following);
|
||||||
|
|
||||||
// Also try hooking that other model.
|
// Also try hooking that other model.
|
||||||
var Notification = App.__container__.resolve('model:notification');
|
var Notification = utils.ember_resolve('model:notification');
|
||||||
if ( Notification )
|
if ( Notification )
|
||||||
this._hook_following(Notification, true);
|
this._hook_following(Notification, true);
|
||||||
|
|
||||||
|
|
||||||
// Now, we need to edit the profile Following view itself.
|
// 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 )
|
if ( ! ProfileView )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -256,88 +256,18 @@ FFZ.prototype.setup_profile_following = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*// Try adding a nice Manage button to the Following page of the directory
|
// TODO: Add nice Manage Following button to 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.");*/
|
|
||||||
|
|
||||||
// Now, rebuild any views.
|
// Now, rebuild any views.
|
||||||
try {
|
try {
|
||||||
ProfileView.create().destroy();
|
ProfileView.create().destroy();
|
||||||
} catch(err) { }
|
} catch(err) { }
|
||||||
|
|
||||||
var views = window.App && App.__container__.lookup('-view-registry:main');
|
var views = utils.ember_views();
|
||||||
if ( views )
|
if ( views )
|
||||||
for(var key in views) {
|
for(var key in views) {
|
||||||
var view = views[key];
|
var view = views[key];
|
||||||
/*if ( DirectoryFollowing && view instanceof DirectoryFollowing ) {
|
if ( view instanceof ProfileView ) {
|
||||||
try {
|
|
||||||
view.ffzInit();
|
|
||||||
} catch(err) {
|
|
||||||
this.error("setup: view:following: ffzInit: " + err);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else*/ if ( view instanceof ProfileView ) {
|
|
||||||
this.log("Manually updating existing Following View.", view);
|
this.log("Manually updating existing Following View.", view);
|
||||||
try {
|
try {
|
||||||
view.ffzInit();
|
view.ffzInit();
|
||||||
|
|
|
@ -39,7 +39,7 @@ FFZ.settings_info.portrait_mode = {
|
||||||
if ( this.has_bttv )
|
if ( this.has_bttv )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var Layout = window.App && App.__container__.lookup('controller:layout');
|
var Layout = utils.ember_lookup('controller:layout');
|
||||||
if ( ! Layout )
|
if ( ! Layout )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ FFZ.settings_info.right_column_width = {
|
||||||
if ( this.has_bttv )
|
if ( this.has_bttv )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var Layout = App.__container__.lookup('controller:layout');
|
var Layout = utils.ember_lookup('controller:layout');
|
||||||
if ( ! Layout )
|
if ( ! Layout )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ FFZ.prototype.setup_layout = function() {
|
||||||
document.head.appendChild(s);
|
document.head.appendChild(s);
|
||||||
|
|
||||||
this.log("Hooking the Ember Layout controller.");
|
this.log("Hooking the Ember Layout controller.");
|
||||||
var Layout = App.__container__.lookup('controller:layout'),
|
var Layout = utils.ember_lookup('controller:layout'),
|
||||||
f = this;
|
f = this;
|
||||||
|
|
||||||
if ( ! Layout )
|
if ( ! Layout )
|
||||||
|
|
|
@ -108,7 +108,7 @@ FFZ.settings_info.scrollback_length = {
|
||||||
f.settings.set("scrollback_length", new_val);
|
f.settings.set("scrollback_length", new_val);
|
||||||
|
|
||||||
// Update our everything.
|
// Update our everything.
|
||||||
var Chat = App.__container__.lookup('controller:chat'),
|
var Chat = utils.ember_lookup('controller:chat'),
|
||||||
current_id = Chat && Chat.get('currentRoom.id');
|
current_id = Chat && Chat.get('currentRoom.id');
|
||||||
|
|
||||||
for(var room_id in f.rooms) {
|
for(var room_id in f.rooms) {
|
||||||
|
@ -595,25 +595,13 @@ FFZ.prototype.setup_line = function() {
|
||||||
this._last_row = {};
|
this._last_row = {};
|
||||||
|
|
||||||
this.log("Hooking the Ember Chat Line component.");
|
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 )
|
if ( Line )
|
||||||
this._modify_chat_line(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.");
|
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 )
|
if ( VOD )
|
||||||
this._modify_vod_line(VOD);
|
this._modify_vod_line(VOD);
|
||||||
else
|
else
|
||||||
|
@ -634,8 +622,8 @@ FFZ.prototype.save_aliases = function() {
|
||||||
|
|
||||||
FFZ.prototype._modify_chat_line = function(component, is_vod) {
|
FFZ.prototype._modify_chat_line = function(component, is_vod) {
|
||||||
var f = this,
|
var f = this,
|
||||||
Layout = App.__container__.lookup('controller:layout'),
|
Layout = utils.ember_lookup('controller:layout'),
|
||||||
Settings = App.__container__.lookup('controller:settings');
|
Settings = utils.ember_lookup('controller:settings');
|
||||||
|
|
||||||
component.reopen({
|
component.reopen({
|
||||||
tokenizedMessage: function() {
|
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
|
// Capitalization
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
|
|
@ -420,7 +420,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
|
|
||||||
|
|
||||||
this.log("Hooking the Ember Moderation Card view.");
|
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;
|
f = this;
|
||||||
|
|
||||||
Card.reopen({
|
Card.reopen({
|
||||||
|
@ -494,7 +494,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
|
|
||||||
is_mod = controller.get('cardInfo.isModeratorOrHigher'),
|
is_mod = controller.get('cardInfo.isModeratorOrHigher'),
|
||||||
|
|
||||||
chat = window.App && App.__container__.lookup('controller:chat'),
|
chat = utils.ember_lookup('controller:chat'),
|
||||||
user = f.get_user(),
|
user = f.get_user(),
|
||||||
room_id = chat && chat.get('currentRoom.id'),
|
room_id = chat && chat.get('currentRoom.id'),
|
||||||
is_broadcaster = user && room_id === user.login,
|
is_broadcaster = user && room_id === user.login,
|
||||||
|
@ -541,7 +541,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
var cmds = {},
|
var cmds = {},
|
||||||
add_btn_click = function(cmd) {
|
add_btn_click = function(cmd) {
|
||||||
var user_id = controller.get('cardInfo.user.id'),
|
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 = cont && cont.get('currentRoom');
|
||||||
|
|
||||||
room && room.send(cmd.replace(/{user}/g, user_id), true);
|
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,
|
var key = e.keyCode || e.which,
|
||||||
user_id = controller.get('cardInfo.user.id'),
|
user_id = controller.get('cardInfo.user.id'),
|
||||||
is_mod = controller.get('cardInfo.isModeratorOrHigher'),
|
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 )
|
if ( is_mod && key == keycodes.P )
|
||||||
room.send("/timeout " + user_id + " 1", true);
|
room.send("/timeout " + user_id + " 1", true);
|
||||||
|
@ -621,7 +621,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
|
|
||||||
var btn_click = function(timeout) {
|
var btn_click = function(timeout) {
|
||||||
var user_id = controller.get('cardInfo.user.id'),
|
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 )
|
if ( timeout === -1 )
|
||||||
room.send("/unban " + user_id, true);
|
room.send("/unban " + user_id, true);
|
||||||
|
@ -803,7 +803,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
|
|
||||||
ffzRenderHistory: function() {
|
ffzRenderHistory: function() {
|
||||||
var t = this,
|
var t = this,
|
||||||
Chat = App.__container__.lookup('controller:chat'),
|
Chat = utils.ember_lookup('controller:chat'),
|
||||||
room = Chat && Chat.get('currentRoom'),
|
room = Chat && Chat.get('currentRoom'),
|
||||||
delete_links = room && room.get('roomProperties.hide_chat_links'),
|
delete_links = room && room.get('roomProperties.hide_chat_links'),
|
||||||
tmiSession = room.tmiSession || (window.TMI && TMI._sessions && TMI._sessions[0]),
|
tmiSession = room.tmiSession || (window.TMI && TMI._sessions && TMI._sessions[0]),
|
||||||
|
@ -872,7 +872,7 @@ FFZ.prototype.setup_mod_card = function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
ffzAdjacentHistory: function(line) {
|
ffzAdjacentHistory: function(line) {
|
||||||
var Chat = App.__container__.lookup('controller:chat'),
|
var Chat = utils.ember_lookup('controller:chat'),
|
||||||
t = this,
|
t = this,
|
||||||
|
|
||||||
user_id = this.get('cardInfo.user.id'),
|
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,
|
var raw_color = msg.color,
|
||||||
colors = raw_color && this._handle_color(raw_color),
|
colors = raw_color && this._handle_color(raw_color),
|
||||||
|
|
||||||
Layout = App.__container__.lookup('controller:layout'),
|
Layout = utils.ember_lookup('controller:layout'),
|
||||||
Settings = App.__container__.lookup('controller:settings'),
|
Settings = utils.ember_lookup('controller:settings'),
|
||||||
|
|
||||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode'));
|
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) {
|
on_update: function(val) {
|
||||||
document.body.classList.toggle('ffz-classic-player', 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 )
|
if ( Layout )
|
||||||
Layout.set('PLAYER_CONTROLS_HEIGHT', val ? 32 : 0);
|
Layout.set('PLAYER_CONTROLS_HEIGHT', val ? 32 : 0);
|
||||||
}
|
}
|
||||||
|
@ -55,13 +56,13 @@ FFZ.settings_info.classic_player = {
|
||||||
|
|
||||||
FFZ.prototype.setup_player = function() {
|
FFZ.prototype.setup_player = function() {
|
||||||
document.body.classList.toggle('ffz-classic-player', this.settings.classic_player);
|
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 )
|
if ( Layout )
|
||||||
Layout.set('PLAYER_CONTROLS_HEIGHT', this.settings.classic_player ? 32 : 0);
|
Layout.set('PLAYER_CONTROLS_HEIGHT', this.settings.classic_player ? 32 : 0);
|
||||||
|
|
||||||
this.players = {};
|
this.players = {};
|
||||||
|
|
||||||
var Player2 = window.App && App.__container__.resolve('component:twitch-player2');
|
var Player2 = utils.ember_resolve('component:twitch-player2');
|
||||||
if ( ! Player2 )
|
if ( ! Player2 )
|
||||||
return this.log("Unable to find twitch-player2 component.");
|
return this.log("Unable to find twitch-player2 component.");
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ FFZ.prototype.setup_player = function() {
|
||||||
if ( ! window.Ember )
|
if ( ! window.Ember )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var views = window.App && App.__container__.lookup('-view-registry:main') || Ember.View.views;
|
var views = utils.ember_views();
|
||||||
for(var key in views) {
|
for(var key in views) {
|
||||||
if ( ! views.hasOwnProperty(key) )
|
if ( ! views.hasOwnProperty(key) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -36,7 +36,7 @@ FFZ.prototype.setup_room = function() {
|
||||||
|
|
||||||
// Responsive ban button.
|
// Responsive ban button.
|
||||||
var f = this,
|
var f = this,
|
||||||
RC = App.__container__.lookup('controller:room');
|
RC = utils.ember_lookup('controller:room');
|
||||||
|
|
||||||
if ( RC ) {
|
if ( RC ) {
|
||||||
var orig_ban = RC._actions.banUser,
|
var orig_ban = RC._actions.banUser,
|
||||||
|
@ -53,7 +53,7 @@ FFZ.prototype.setup_room = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RC._actions.showModOverlay = function(e) {
|
RC._actions.showModOverlay = function(e) {
|
||||||
var Channel = App.__container__.resolve('model:channel');
|
var Channel = utils.ember_resolve('model:channel');
|
||||||
if ( ! Channel )
|
if ( ! Channel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ FFZ.prototype.setup_room = function() {
|
||||||
|
|
||||||
this.log("Hooking the Ember Room model.");
|
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);
|
this._modify_room(Room);
|
||||||
|
|
||||||
// Modify all current instances of Room, as the changes to the base
|
// 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.");
|
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);
|
this._modify_rview(RoomView);
|
||||||
|
|
||||||
// For some reason, this doesn't work unless we create an instance of the
|
// 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) { }
|
} catch(err) { }
|
||||||
|
|
||||||
// Modify all existing Room views.
|
// 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) {
|
for(var key in views) {
|
||||||
if ( ! views.hasOwnProperty(key) )
|
if ( ! views.hasOwnProperty(key) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -975,7 +975,7 @@ FFZ.prototype._modify_room = function(room) {
|
||||||
},
|
},
|
||||||
|
|
||||||
ffzCheckDestroy: function() {
|
ffzCheckDestroy: function() {
|
||||||
var Chat = App.__container__.lookup('controller:chat'),
|
var Chat = utils.ember_lookup('controller:chat'),
|
||||||
user = f.get_user(),
|
user = f.get_user(),
|
||||||
room_id = this.get('id');
|
room_id = this.get('id');
|
||||||
|
|
||||||
|
@ -1210,7 +1210,7 @@ FFZ.prototype._modify_room = function(room) {
|
||||||
var is_whisper = msg.style === 'whisper';
|
var is_whisper = msg.style === 'whisper';
|
||||||
|
|
||||||
// Ignore whispers if conversations are enabled.
|
// 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;
|
return;
|
||||||
|
|
||||||
if ( ! is_whisper )
|
if ( ! is_whisper )
|
||||||
|
@ -1311,7 +1311,7 @@ FFZ.prototype._modify_room = function(room) {
|
||||||
if ( user && f._cindex && this.get('id') === user.login )
|
if ( user && f._cindex && this.get('id') === user.login )
|
||||||
f._cindex.ffzUpdateHostButton();
|
f._cindex.ffzUpdateHostButton();
|
||||||
|
|
||||||
var Chat = App.__container__.lookup('controller:chat');
|
var Chat = utils.ember_lookup('controller:chat');
|
||||||
if ( ! Chat || Chat.get('currentChannelRoom') !== this )
|
if ( ! Chat || Chat.get('currentChannelRoom') !== this )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ FFZ.prototype._modify_room = function(room) {
|
||||||
},
|
},
|
||||||
|
|
||||||
ffzUpdateUnread: function() {
|
ffzUpdateUnread: function() {
|
||||||
var Chat = App.__container__.lookup('controller:chat');
|
var Chat = utils.ember_lookup('controller:chat');
|
||||||
if ( Chat && Chat.get('currentRoom') === this )
|
if ( Chat && Chat.get('currentRoom') === this )
|
||||||
this.resetUnreadCount();
|
this.resetUnreadCount();
|
||||||
else if ( f._chatv )
|
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;
|
return;
|
||||||
|
|
||||||
var f = this,
|
var f = this,
|
||||||
Router = App.__container__.lookup('router:main');
|
Router = utils.ember_lookup('router:main');
|
||||||
|
|
||||||
if ( Router )
|
if ( Router )
|
||||||
Router.reopen({
|
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() {
|
FFZ.prototype.setup_viewers = function() {
|
||||||
this.log("Hooking the Ember Viewers controller.");
|
this.log("Hooking the Ember Viewers controller.");
|
||||||
var Viewers = App.__container__.resolve('controller:viewers');
|
var Viewers = utils.ember_lookup('controller:viewers');
|
||||||
if ( Viewers )
|
if ( Viewers )
|
||||||
this._modify_viewers(Viewers);
|
this._modify_viewers(Viewers);
|
||||||
|
|
||||||
/* Disable for now because Twitch reverted this change
|
/* Disable for now because Twitch reverted this change
|
||||||
this.log("Hooking the Ember Viewers view.");
|
this.log("Hooking the Ember Viewers view.");
|
||||||
var ViewerView = App.__container__.resolve('view:viewers');
|
var ViewerView = utils.ember_resolve('view:viewers');
|
||||||
if ( ViewerView )
|
if ( ViewerView )
|
||||||
this._modify_viewer_view(ViewerView);*/
|
this._modify_viewer_view(ViewerView);*/
|
||||||
}
|
}
|
||||||
|
@ -58,7 +59,7 @@ FFZ.prototype._modify_viewers = function(controller) {
|
||||||
last_category = null;
|
last_category = null;
|
||||||
|
|
||||||
// Get the broadcaster name.
|
// 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'),
|
room_id = this.get('parentController.model.id'),
|
||||||
broadcaster = Channel && Channel.get('id');
|
broadcaster = Channel && Channel.get('id');
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ var FFZ = window.FrankerFaceZ,
|
||||||
|
|
||||||
FFZ.prototype.setup_vod_chat = function() {
|
FFZ.prototype.setup_vod_chat = function() {
|
||||||
var f = this,
|
var f = this,
|
||||||
VRC = App.__container__.resolve('component:vod-right-column');
|
VRC = utils.ember_resolve('component:vod-right-column');
|
||||||
|
|
||||||
if ( VRC )
|
if ( VRC )
|
||||||
this._modify_vod_right_column(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.");
|
f.error("Unable to locate VOD Right Column component.");
|
||||||
|
|
||||||
// Get the VOD Chat Service
|
// 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 )
|
if ( VODService )
|
||||||
VODService.reopen({
|
VODService.reopen({
|
||||||
messageBufferSize: f.settings.scrollback_length,
|
messageBufferSize: f.settings.scrollback_length,
|
||||||
|
@ -51,7 +51,7 @@ FFZ.prototype.setup_vod_chat = function() {
|
||||||
f.error("Unable to locate VOD Chat Service.");
|
f.error("Unable to locate VOD Chat Service.");
|
||||||
|
|
||||||
// Get the VOD Chat Display
|
// 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 )
|
if ( VODChat )
|
||||||
this._modify_vod_chat_display(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.");
|
f.error("Unable to locate VOD Chat Display component.");
|
||||||
|
|
||||||
// Modify all existing VOD Chat views.
|
// 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) {
|
for(var key in views) {
|
||||||
var view = views[key];
|
var view = views[key];
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ FFZ.prototype._modify_vod_right_column = function(component) {
|
||||||
|
|
||||||
FFZ.prototype._modify_vod_chat_display = function(component) {
|
FFZ.prototype._modify_vod_chat_display = function(component) {
|
||||||
var f = this,
|
var f = this,
|
||||||
VODService = App.__container__.lookup('service:vod-chat-service');
|
VODService = utils.ember_lookup('service:vod-chat-service');
|
||||||
|
|
||||||
component.reopen({
|
component.reopen({
|
||||||
didInsertElement: function() {
|
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() {
|
FFZ.prototype._emote_menu_enumerator = function() {
|
||||||
var twitch_user = this.get_user(),
|
var twitch_user = this.get_user(),
|
||||||
user_id = twitch_user ? twitch_user.login : null,
|
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,
|
room_id = controller ? controller.get('currentRoom.id') : null,
|
||||||
sets = this.getEmotes(user_id, room_id),
|
sets = this.getEmotes(user_id, room_id),
|
||||||
emotes = [];
|
emotes = [];
|
||||||
|
|
|
@ -56,7 +56,9 @@ FFZ.prototype.find_rechat = function() {
|
||||||
// Look-up dark mode.
|
// Look-up dark mode.
|
||||||
var dark_chat = this.settings.dark_twitch;
|
var dark_chat = this.settings.dark_twitch;
|
||||||
if ( ! dark_chat ) {
|
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');
|
dark_chat = model && model.get('darkMode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +91,9 @@ FFZ.prototype.find_rechat = function() {
|
||||||
// Look-up dark mode.
|
// Look-up dark mode.
|
||||||
var dark_chat = this.settings.dark_twitch;
|
var dark_chat = this.settings.dark_twitch;
|
||||||
if ( ! dark_chat ) {
|
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');
|
dark_chat = model && model.get('darkMode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +151,8 @@ FFZ.prototype.process_rechat_line = function(line, reprocess) {
|
||||||
user_id = line.getAttribute('data-sender'),
|
user_id = line.getAttribute('data-sender'),
|
||||||
room_id = line.getAttribute('data-room'),
|
room_id = line.getAttribute('data-room'),
|
||||||
|
|
||||||
Layout = App.__container__.lookup('controller:layout'),
|
Layout = utils.ember_lookup('controller:layout'),
|
||||||
Settings = App.__container__.lookup('controller:settings'),
|
Settings = utils.ember_lookup('controller:settings'),
|
||||||
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
is_dark = (Layout && Layout.get('isTheatreMode')) || (Settings && Settings.get('settings.darkMode')),
|
||||||
|
|
||||||
badges_el = line.querySelector('.badges'),
|
badges_el = line.querySelector('.badges'),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var FFZ = window.FrankerFaceZ,
|
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
|
// Before we add the button, make sure the channel isn't the
|
||||||
// current channel.
|
// 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) )
|
if ( ! this.feature_friday.channel || (Channel && Channel.get('id') === this.feature_friday.channel) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
26
src/main.js
26
src/main.js
|
@ -35,7 +35,7 @@ FFZ.msg_commands = {};
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
var VER = FFZ.version_info = {
|
var VER = FFZ.version_info = {
|
||||||
major: 3, minor: 5, revision: 133,
|
major: 3, minor: 5, revision: 134,
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
|
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
|
||||||
}
|
}
|
||||||
|
@ -108,19 +108,16 @@ FFZ.prototype.get_user = function() {
|
||||||
if ( this.__user )
|
if ( this.__user )
|
||||||
return this.__user;
|
return this.__user;
|
||||||
|
|
||||||
var user;
|
var LC = FFZ.utils.ember_lookup('controller:login'),
|
||||||
if ( window.App ) {
|
user = LC ? LC.get('userData') : undefined;
|
||||||
var nc = App.__container__.lookup('controller:login');
|
|
||||||
user = nc ? nc.get('userData') : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! user && window.PP && PP.login )
|
if ( ! user && window.PP && PP.login )
|
||||||
user = PP;
|
user = PP;
|
||||||
|
|
||||||
if ( user )
|
if ( user )
|
||||||
this.__user = user;
|
this.__user = user;
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,10 +222,7 @@ FFZ.prototype.initialize = function(increment, delay) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var loaded = window.App != undefined &&
|
var loaded = FFZ.utils.ember_resolve('model:room');
|
||||||
App.__container__ != undefined &&
|
|
||||||
App.__container__.resolve('model:room') != undefined;
|
|
||||||
|
|
||||||
if ( !loaded ) {
|
if ( !loaded ) {
|
||||||
increment = increment || 10;
|
increment = increment || 10;
|
||||||
if ( delay >= 60000 )
|
if ( delay >= 60000 )
|
||||||
|
@ -384,7 +378,7 @@ FFZ.prototype.init_ember = function(delay) {
|
||||||
|
|
||||||
|
|
||||||
// Make an alias so they STOP RENAMING THIS ON ME
|
// 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 )
|
if ( Settings && Settings.get('settings') === undefined )
|
||||||
Settings.reopen({settings: Ember.computed.alias('model')});
|
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),
|
(this.settings.notification_timeout*1000),
|
||||||
function() {
|
function() {
|
||||||
window.focus();
|
window.focus();
|
||||||
var cont = App.__container__.lookup('controller:chat');
|
var cont = utils.ember_lookup('controller:chat');
|
||||||
room && cont && cont.focusRoom(room);
|
room && cont && cont.focusRoom(room);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var FFZ = window.FrankerFaceZ,
|
var FFZ = window.FrankerFaceZ,
|
||||||
constants = require("../constants");
|
constants = require("../constants"),
|
||||||
|
utils = require("../utils");
|
||||||
//styles = require("../styles");
|
//styles = require("../styles");
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ FFZ.settings_info.dark_twitch = {
|
||||||
|
|
||||||
document.body.classList.toggle("ffz-dark", val);
|
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');
|
settings = Settings && Settings.get('settings');
|
||||||
|
|
||||||
if ( val ) {
|
if ( val ) {
|
||||||
|
@ -201,7 +202,7 @@ FFZ.prototype.setup_dark = function() {
|
||||||
if ( ! this.settings.dark_twitch )
|
if ( ! this.settings.dark_twitch )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var Settings = window.App && App.__container__.lookup('controller:settings');
|
var Settings = utils.ember_lookup('controller:settings');
|
||||||
if ( Settings ) {
|
if ( Settings ) {
|
||||||
try {
|
try {
|
||||||
Settings.set('settings.darkMode', true);
|
Settings.set('settings.darkMode', true);
|
||||||
|
|
|
@ -24,7 +24,7 @@ FFZ.settings_info.following_count = {
|
||||||
on_update: function(val) {
|
on_update: function(val) {
|
||||||
this._schedule_following_count();
|
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");
|
Live = Stream && Stream.find("live");
|
||||||
|
|
||||||
if ( Live ) {
|
if ( Live ) {
|
||||||
|
@ -55,7 +55,7 @@ FFZ.prototype.setup_following_count = function(has_ember) {
|
||||||
return this._following_get_me();
|
return this._following_get_me();
|
||||||
|
|
||||||
this.log("Connecting to Live Streams model.");
|
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 )
|
if ( ! Stream )
|
||||||
return this.log("Unable to find Stream model.");
|
return this.log("Unable to find Stream model.");
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ FFZ.prototype.setup_following_count = function(has_ember) {
|
||||||
|
|
||||||
Live.load();
|
Live.load();
|
||||||
|
|
||||||
/*var Host = window.App && App.__container__.resolve('model:host'),
|
/*var Host = utils.ember_resolve('model:hist'),
|
||||||
HostLive = Host && Host.find("following");
|
HostLive = Host && Host.find("following");
|
||||||
|
|
||||||
if ( HostLive )
|
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()));
|
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"),
|
Live = Stream && Stream.find("live"),
|
||||||
|
|
||||||
Host = window.App && App.__container__.resolve('model:host'),
|
Host = utils.ember_resolve('model:host'),
|
||||||
HostLive = Host && Host.find("following"),
|
HostLive = Host && Host.find("following"),
|
||||||
|
|
||||||
f = this;
|
f = this;
|
||||||
|
@ -172,7 +172,7 @@ FFZ.prototype._build_following_tooltip = function(el) {
|
||||||
height = document.body.clientHeight - (bb.bottom + 50),
|
height = document.body.clientHeight - (bb.bottom + 50),
|
||||||
max_lines = Math.max(Math.floor(height / 40) - 1, 2),
|
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"),*/
|
HostLive = Host && Host.find("following"),*/
|
||||||
|
|
||||||
streams = this._tooltip_streams,
|
streams = this._tooltip_streams,
|
||||||
|
|
|
@ -76,7 +76,7 @@ FFZ.ffz_commands.following = function(room, args) {
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
FFZ.ws_on_close.push(function() {
|
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_id = controller && controller.get('id'),
|
||||||
current_host = controller && controller.get('hostModeTarget.id'),
|
current_host = controller && controller.get('hostModeTarget.id'),
|
||||||
need_update = false;
|
need_update = false;
|
||||||
|
@ -112,7 +112,7 @@ FFZ.ws_on_close.push(function() {
|
||||||
|
|
||||||
|
|
||||||
FFZ.ws_commands.follow_buttons = function(data) {
|
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_id = controller && controller.get('content.id'),
|
||||||
current_host = controller && controller.get('hostModeTarget.id'),
|
current_host = controller && controller.get('hostModeTarget.id'),
|
||||||
need_update = false;
|
need_update = false;
|
||||||
|
@ -131,7 +131,7 @@ FFZ.ws_commands.follow_buttons = function(data) {
|
||||||
|
|
||||||
|
|
||||||
FFZ.ws_commands.follow_sets = 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_id = controller && controller.get('content.id'),
|
||||||
current_host = controller && controller.get('hostModeTarget.id'),
|
current_host = controller && controller.get('hostModeTarget.id'),
|
||||||
need_update = false,
|
need_update = false,
|
||||||
|
@ -188,7 +188,7 @@ FFZ.ws_commands.follow_sets = function(data) {
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
FFZ.prototype.rebuild_following_ui = function() {
|
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'),
|
channel_id = controller && controller.get('content.id'),
|
||||||
hosted_id = controller && controller.get('hostModeTarget.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.");
|
this.log("Hooking the Ember Chat Settings view.");
|
||||||
|
|
||||||
var Settings = window.App && App.__container__.resolve('view:settings'),
|
var Settings = utils.ember_resolve('view:settings'),
|
||||||
Layout = window.App && App.__container__.lookup('controller:layout'),
|
Layout = utils.ember_lookup('controller:layout'),
|
||||||
f = this;
|
f = this;
|
||||||
|
|
||||||
if ( ! Settings )
|
if ( ! Settings )
|
||||||
|
@ -164,7 +164,7 @@ FFZ.prototype.setup_menu = function() {
|
||||||
} catch(err) { }
|
} catch(err) { }
|
||||||
|
|
||||||
// Modify all existing Chat Settings views.
|
// 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) {
|
for(var key in views) {
|
||||||
if ( ! views.hasOwnProperty(key) )
|
if ( ! views.hasOwnProperty(key) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -498,7 +498,8 @@ FFZ.menu_pages.channel = {
|
||||||
if ( product && !product.get("error") ) {
|
if ( product && !product.get("error") ) {
|
||||||
// We have a product, and no error~!
|
// We have a product, and no error~!
|
||||||
has_product = true;
|
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_subscribed = tickets ? tickets.get('content') : false,
|
||||||
is_loaded = tickets ? tickets.get('isLoaded') : false,
|
is_loaded = tickets ? tickets.get('isLoaded') : false,
|
||||||
icon = room.room.get("badgeSet.subscriber.image"),
|
icon = room.room.get("badgeSet.subscriber.image"),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var FFZ = window.FrankerFaceZ,
|
var FFZ = window.FrankerFaceZ,
|
||||||
constants = require('../constants');
|
constants = require('../constants'),
|
||||||
|
utils = require('../utils');
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -18,7 +19,7 @@ FFZ.prototype.build_ui_link = function(view) {
|
||||||
|
|
||||||
|
|
||||||
FFZ.prototype.update_ui_link = function(link) {
|
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');
|
link = link || document.querySelector('a.ffz-ui-toggle');
|
||||||
if ( !link || !controller )
|
if ( !link || !controller )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,7 +35,7 @@ FFZ.settings_info.srl_races = {
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
FFZ.ws_on_close.push(function() {
|
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_id = controller && controller.get('id'),
|
||||||
current_host = controller && controller.get('hostModeTarget.id'),
|
current_host = controller && controller.get('hostModeTarget.id'),
|
||||||
need_update = false;
|
need_update = false;
|
||||||
|
@ -55,7 +55,7 @@ FFZ.ws_on_close.push(function() {
|
||||||
|
|
||||||
|
|
||||||
FFZ.ws_commands.srl_race = function(data) {
|
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_id = controller && controller.get('id'),
|
||||||
current_host = controller && controller.get('hostModeTarget.id'),
|
current_host = controller && controller.get('hostModeTarget.id'),
|
||||||
need_update = false;
|
need_update = false;
|
||||||
|
@ -91,7 +91,7 @@ FFZ.ws_commands.srl_race = function(data) {
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
FFZ.prototype.rebuild_race_ui = function() {
|
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'),
|
channel_id = controller && controller.get('id'),
|
||||||
hosted_id = controller && controller.get('hostModeTarget.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,
|
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),
|
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!");
|
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() {
|
FFZ.prototype.fix_tooltips = function() {
|
||||||
// First, override the tooltip mixin.
|
// 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 ) {
|
if ( TipsyTooltip ) {
|
||||||
this.log("Modifying Tipsy-Tooltip component to use gravity.");
|
this.log("Modifying Tipsy-Tooltip component to use gravity.");
|
||||||
TipsyTooltip.reopen({
|
TipsyTooltip.reopen({
|
||||||
|
|
|
@ -10,7 +10,7 @@ var FFZ = window.FrankerFaceZ,
|
||||||
FFZ.ws_commands.chatters = function(data) {
|
FFZ.ws_commands.chatters = function(data) {
|
||||||
var channel = data[0], count = data[1];
|
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,
|
match = this.is_dashboard ? location.pathname.match(/\/([^\/]+)/) : undefined,
|
||||||
id = this.is_dashboard ? match && match[1] : controller && controller.get && controller.get('id');
|
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) {
|
FFZ.ws_commands.viewers = function(data) {
|
||||||
var channel = data[0], count = data[1];
|
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,
|
match = this.is_dashboard ? location.pathname.match(/\/([^\/]+)/) : undefined,
|
||||||
id = this.is_dashboard ? match && match[1] : controller && controller.get && controller.get('id');
|
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 )
|
if ( ! window.App )
|
||||||
return;
|
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);
|
return App.__deprecatedInstance__.registry.lookup(thing);
|
||||||
if ( App.__container__ && App.__container__.lookup )
|
if ( App.__container__ && App.__container__.lookup )
|
||||||
return App.__container__.lookup(thing);
|
return App.__container__.lookup(thing);
|
||||||
|
@ -234,7 +234,7 @@ module.exports = FFZ.utils = {
|
||||||
if ( ! window.App )
|
if ( ! window.App )
|
||||||
return;
|
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);
|
return App.__deprecatedInstance__.registry.resolve(thing);
|
||||||
if ( App.__container__ && App.__container__.resolve )
|
if ( App.__container__ && App.__container__.resolve )
|
||||||
return App.__container__.resolve(thing);
|
return App.__container__.resolve(thing);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue