diff --git a/dark.css b/dark.css index 0b762196..89ded21a 100644 --- a/dark.css +++ b/dark.css @@ -1119,6 +1119,9 @@ body.ffz-dark, /* Activity Feeds */ +.button.alert { color: #fff !important } + +.ffz-dark .activity-notice { background-color: rgba(24,24,24,0.9) } .ffz-dark .pill { background-color: rgba(255,255,255,0.2) } .ffz-dark .activity-list-end svg { fill: #474747 } diff --git a/src/commands.js b/src/commands.js index 811272ca..78d8d6a8 100644 --- a/src/commands.js +++ b/src/commands.js @@ -41,7 +41,7 @@ FFZ.ffz_commands.reload = function(room, args) { // Emote Sets for(var set_id in this.emote_sets) { var es = this.emote_sets[set_id]; - if ( es.hasOwnProperty('source_ext') ) + if ( ! es || es.hasOwnProperty('source_ext') ) continue; promises.push(new Promise(function(done, fail) { diff --git a/src/ember/channel.js b/src/ember/channel.js index 24a2ec31..a2882702 100644 --- a/src/ember/channel.js +++ b/src/ember/channel.js @@ -216,30 +216,13 @@ FFZ.prototype._modify_cindex = function(view) { el.classList.add('ffz-channel'); // Try changing the theater mode tooltip. + /* Deprecated: Theatre button is now in the player. var tb = this.$('.theatre-button > a'), opts = tb.data('tipsy'); tb.attr('title', 'Theater Mode (Alt+T)'); if ( opts && opts.options && typeof opts.options.gravity !== "function" ) - opts.options.gravity = utils.tooltip_placement(constants.TOOLTIP_DISTANCE, opts.options.gravity || 'n'); - - - /*if ( id === 'memeathon' ) { - var sb = document.createElement('a'); - sb.className = 'action button js-sub-button primary subscribe-button meme-sub-button'; - sb.id = 'meme-scribe'; - sb.innerHTML = 'Subscribe$599.99'; - - var actions = el.querySelector('.channel-actions'); - if ( actions ) { - var c = actions.querySelector('.notification-controls') || actions.querySelector('.follow-button'); - if ( c ) - actions.insertBefore(sb, c.nextSibling); - else - actions.appendChild(sb); - } - }*/ - + opts.options.gravity = utils.tooltip_placement(constants.TOOLTIP_DISTANCE, opts.options.gravity || 'n');*/ this.ffzFixTitle(); this.ffzUpdateUptime(); diff --git a/src/ember/feed-card.js b/src/ember/feed-card.js new file mode 100644 index 00000000..a8bccaaf --- /dev/null +++ b/src/ember/feed-card.js @@ -0,0 +1,98 @@ +var FFZ = window.FrankerFaceZ, + utils = require('../utils'), + constants = require('../constants'), + + parse_emotes = function(emotes) { + var output = {}; + if ( ! emotes || ! emotes.length ) + return output; + + for(var i=0; i < emotes.length; i++) { + var emote = emotes[i]; + if ( ! emote || ! emote.id ) + continue; + + var entries = output[emote.id] = output[emote.id] || []; + entries.push([emote.start, emote.end]); + } + + return output; + }; + + +FFZ.prototype.setup_feed_cards = function() { + var FeedCard = utils.ember_resolve('component:feed-card'); + if ( ! FeedCard ) + return; + + this._modify_feed_card(FeedCard); + + try { FeedCard.create().destroy(); + } catch(err) { } + + this.rerender_feed_cards(); +} + + +FFZ.prototype.rerender_feed_cards = function(for_set) { + var FeedCard = utils.ember_resolve('component:feed-card'), + views = utils.ember_views(); + + if ( ! FeedCard ) + return; + + for(var view_id in views) { + var view = views[view_id]; + if ( view instanceof FeedCard ) { + try { + if ( ! view.ffzInit ) + this._modify_feed_card(view); + view.ffzInit(for_set); + } catch(err) { + this.error("setup component:feed-card ffzInit: " + err) + } + } + } +} + + +FFZ.prototype._modify_feed_card = function(component) { + var f = this; + component.reopen({ + didInsertElement: function() { + this._super(); + try { + this.ffzInit(); + } catch(err) { + f.error("component:feed-card ffzInit: " + err); + } + }, + + ffzInit: function(for_set) { + var el = this.get('element'), + message = this.get('post.body'), + emotes = parse_emotes(this.get('post.emotes')), + user_id = this.get('post.user.login'), + room_id = this.get('channelId'), + pbody = el && el.querySelector('.activity-body'); + + if ( ! message || ! el || ! pbody ) + return; + + // If this is for a specific emote set, only rerender if it matters. + if ( for_set && f.rooms && f.rooms[room_id] ) { + var sets = f.getEmotes(user_id, room_id); + if ( sets.indexOf(for_set) === -1 ) + return; + } + + var tokens = f.tokenize_feed_body(message, emotes, user_id, room_id), + output = f.render_tokens(tokens, true, false); + + pbody.innerHTML = '
' + output + '
'; + + jQuery('.ffz-tooltip', pbody).tipsy({html: true, title: f.render_tooltip(), gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')}); + jQuery('.html-tooltip', pbody).tipsy({html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')}); + } + }); +} \ No newline at end of file diff --git a/src/ember/room.js b/src/ember/room.js index 5a15dbb6..7da44031 100644 --- a/src/ember/room.js +++ b/src/ember/room.js @@ -917,6 +917,9 @@ FFZ.prototype._load_room_json = function(room_id, callback, data) { this.update_ui_link(); + if ( data.set ) + this.rerender_feed_cards(data.set); + if ( callback ) callback(true, data); } diff --git a/src/emoticons.js b/src/emoticons.js index d7c15adb..6bb83ed3 100644 --- a/src/emoticons.js +++ b/src/emoticons.js @@ -8,7 +8,7 @@ var FFZ = window.FrankerFaceZ, if ( ! emote.margins && ! emote.css ) return ""; - return 'img[src="' + emote.urls[1] + '"] { ' + (emote.margins ? "margin: " + emote.margins + ";" : "") + (emote.css || "") + " }\n"; + return 'img[data-ffz-emote="' + emote.id + '"] { ' + (emote.margins ? "margin: " + emote.margins + ";" : "") + (emote.css || "") + " }\n"; }; @@ -413,7 +413,7 @@ FFZ.prototype._load_set_json = function(set_id, callback, data) { if ( this._inputv ) Ember.propertyDidChange(this._inputv, 'ffz_emoticons'); - this.rerender_feed_cards(); + this.rerender_feed_cards(set_id); if ( callback ) callback(true, data); diff --git a/src/main.js b/src/main.js index b862ec78..cf259318 100644 --- a/src/main.js +++ b/src/main.js @@ -35,7 +35,7 @@ FFZ.msg_commands = {}; // Version var VER = FFZ.version_info = { - major: 3, minor: 5, revision: 152, + major: 3, minor: 5, revision: 156, toString: function() { return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || ""); } @@ -181,7 +181,6 @@ require('./ui/about_page'); require('./commands'); require('./ext/api'); -//require('./memes'); // --------------- @@ -436,8 +435,6 @@ FFZ.prototype.init_ember = function(delay) { this.find_bttv(10); this.find_emote_menu(10); - //this.setup_memes(); - //this.check_news(); this.check_ff(); this.refresh_chat(); diff --git a/src/socket.js b/src/socket.js index 7a58c9fa..3644427a 100644 --- a/src/socket.js +++ b/src/socket.js @@ -429,6 +429,7 @@ FFZ.ws_commands.do_authorize = function(data) { continue; var r = this.rooms[room_id]; + if ( r && r.room && !r.room.get('roomProperties.eventchat') && !r.room.get('isGroupRoom') && r.room.tmiRoom ) { var c = r.room.tmiRoom._getConnection(); if ( c.isConnected ) { diff --git a/src/tokenize.js b/src/tokenize.js index 9b5a15a8..d247e7be 100644 --- a/src/tokenize.js +++ b/src/tokenize.js @@ -260,6 +260,9 @@ FFZ.prototype.render_tooltip = function(el) { var preview_url, width=0, height=0, image, set_id, emote, emote_set, emote_id = this.getAttribute('data-ffz-emote'); if ( emote_id ) { + if ( emote_id == "93269" ) + return ''; + set_id = this.getAttribute('data-ffz-set'); emote_set = f.emote_sets[set_id]; emote = emote_set && emote_set.emoticons[emote_id]; @@ -305,7 +308,8 @@ FFZ.prototype.render_tooltip = function(el) { //image = preview_url ? `