mohamedmansour / stream-filter-extension

Filter your stream by removing topics from words and monitor them
http://mohamedmansour.com
9 stars 5 forks source link

Filter only posts with pictures #4

Open tzafrir opened 13 years ago

tzafrir commented 13 years ago

I'd like to filter only posts that match a filter and have an image.

Example: Filter posts that contain "NSFW" and also have an image (If there's no image then the post itself is safe for work).

Advanced feature: Collapse only the image and keep the post in the stream, with an expand link.

I thought of coding it myself, but I'll need your thought on how to modify the design to allow attaching values to filters.

mohamedmansour commented 13 years ago

Heya, small tip for advanced users, the stuff in the filters accept regex :) If you can figure out a regex for what your doing, I believe it should work. I was planning to an easy UI to filter specific extensions (like images) but this was done in the morning. If you have any recommendations what the best way to parse the filters efficiently, please let me know :)

mohamedmansour commented 13 years ago

This is an interesting thing, maybe the best thing to do is instead of doing: https://github.com/mohamedmansour/stream-filter-extension/blob/master/js/filter_injection.js#L105

 var text = textDOM.innerText.toLowerCase();

We could smartly strip out every tag except links and images. For example, if we found a link via <a> tag, we could replace it with a markdown friendly format like (link title)[http://google.com] same goes for the image, we can replace it with that format ((image title))[http://google.com/logo.png]

When that is done, we could let the filters take control with how we present these stuff, what do you think? If you look at release 1.6.5 (pushed yesterday), it blocks animated gifs, we could have something similar but when a complete black overlay for NSFW stuff images!

tzafrir commented 13 years ago

Why markdown? Doesn't the DOM itself already have all those elements we need?

mohamedmansour commented 13 years ago

It can be anything, not just markdown. But I want the filter code to be able to tap into this. What do you think? The filter code requires text because I am doing a ".indexOf" and ".search" on a block of text since it is fast because .innerText is part of each element.

What do you think would be a good way doing this? I would like to see images, and links. Currently, I treat gifs separately because that is a filter of its own. But if a user places text with a Gif, the filtering mechanism still kicks in.

tzafrir commented 13 years ago

Sounds like a bit of overkill, and will be hard on users to grok the filtering format.

Also, as far as I can see, images don't have a title, and are proxied through google servers.

mohamedmansour commented 13 years ago

What extra values would we want for each filter? It could be possible, I just need to change the dialog to accept values, and when it is persisted, it would be a JSON object instead of a comma separated string.

tzafrir commented 13 years ago

For this feature I'd imagine a checkbox saying "Only hide images" or something of the sort.

Can you think of more special filtering modifiers?

mohamedmansour commented 13 years ago

You know, I always wanted to create something like attributes per item. For example, if someone says anything about "ottawa", I want to tag it and not hide it. If someone says something about NSFW, I want it to block it or hide resources.

I have to think about it more to see what I can do, my end goal is to have a nice stream of what the user wants. I want to listen for just Ottawa and quickly filter the stream in real time, like searching. The exlusion mechanisms, should be smarter as you said, so having an ability to add an action to a filter would be great, with a drop down:

 Filter: [_______________________]
 Action [ Hide Images ]
           [ Block ] 
           [ Filter out ] 
           [ Label ]

It can be more complex, like having multiple actions, aaaarggs. Things can get complicated ::)

tzafrir commented 13 years ago

Software? Complex? You must be kidding! :)

Representing each item as an object is probably the way to go here.