jpgohlke / twitch-chat-filter

58 stars 37 forks source link

Chat filter not working again. #170

Closed RevoSucks closed 9 years ago

RevoSucks commented 9 years ago

Self explanatory.

hugomg commented 9 years ago

No such thing as a "self explanatory bug" :)

What browser are you using? How are you running TPP (greasemonkey, bookmarklet, etc)? Do any error messages appear in the Javascript console? (you can open the console with F12 on most browsers)

RevoSucks commented 9 years ago

Firefox, Greasemonkey. Havent tried total reset of firefox, will try soon.

aaaaaa123456789 commented 9 years ago

The chat filter works when enabled (i.e., by entering the command via console and/or using the bookmark), but only for messages already in the chat; it doesn't filter new ones. Adding a new instance of the filter repeats the process, but new, incoming messages never get filtered. (I'm on the latest version of Chrome, if that matters.)

iriomote14 commented 9 years ago

So I think I found a fix for the chat filter thing ... I tested it out locally, and it seems to be working correctly. Basically, I replaced:

add_initializer(function(){ var View_proto = require("web-client/views/line")["default"].prototype;

// New lines
var original_didInsertElement = View_proto.didInsertElement;
View_proto.didInsertElement = function() {
    original_didInsertElement.apply(this, arguments);

    var view = this.$();
    var matches = matches_filters(this.get("context.model.message"), this.get("context.model.from"));
    for (var filter in matches) {
        view.toggleClass(filter, matches[filter]);
    }
};

with the following:

add_initializer(function(){ var View_proto = require("web-client/components/chat-line")["default"].prototype;

// New lines
var original_didInsertElement = View_proto.didInsertElement;
View_proto.didInsertElement = function() {
    original_didInsertElement.apply(this, arguments);
    var view = this.$();
    var matches = matches_filters(this.get("msgObject.message"), this.get("msgObject.from"));
    for (var filter in matches) {
        view.toggleClass(filter, matches[filter]);
    }
};

I'm not too confident in my Javascript abilities, so I'll leave it to you to determine if this should go in as such. But you can at least see where the problem is based on what I've written here - hopefully it's enough to go on.

Thanks so much for this filter - it's always great to use it! :)

MattiasBuelens commented 9 years ago

@iriomote14 You're absolutely correct. Twitch has changed some of the names in their JavaScript code, so our monkey patch were broken.

Version 3.2 is now up with a fix. Update your Greasemonkey user script, or reload the stream and re-apply the bookmarklet.