News for hackers. Stuff that matters.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Monday January 23, 2017 @07:14PM (#13467628)
Dev Here:

I made this because I'm tired of seeing political flame-stories on here and I hate flagging them or, even worse, going in the threads to complain about them.

With this extension you can make a comma-separated list of words that when matched within a headline, the link is removed from the page before you ever see it.

You can check the console to see what stories are being removed. It's open source so feel free to fork, customize, contribute or whatever.

It can be used to filter anything, so if you can't stand to see another "JavaScript" or "Python" story, you can block those too.

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by detaro on Tuesday January 24, 2017 @02:01AM (#13469386)
Good idea, thanks for making it!

> It's open source so feel free to fork, customize, contribute or whatever.

Could you add a license to the repo then?

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:00AM (#13471780)
added a GPL. thanks for reminding me.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by kasbah on Monday January 23, 2017 @09:38PM (#13468368)
I thought about making something like this to filter out Apple stories actually. I use Firefox, might try and load this as a web extension.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by mp3geek on Tuesday January 24, 2017 @06:28AM (#13470530)
Loaded, but didnt show the icon in the bar.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by detaro on Tuesday January 24, 2017 @06:46AM (#13470601)
it uses an API that doesn't exist in Firefox to only trigger on news.ycombinator.com
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:01AM (#13471790)
if you don't mind, could you add that as an issue to the repo. I already have a contributor so maybe someone could pitch in and make it proper cross platform.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Tuesday January 24, 2017 @09:02AM (#13471320)
Rad! You might be able to save a little time/logic by updating the JavaScript from ES3. Instead of:

  if(thisText.indexOf(thisWord) > -1)
You can just do:

  if ( thisText.includes(thisWord) )
Likewise...

  for(let i = 0; i < entries.length; i++){
Can be replaced with:

  entries.forEach(function(entry, index){ 
Chrome supports both the relevant parts of ES6 and ES5 out of the box.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:07AM (#13471853)
thanks for the suggestions. I tend to avoid forEach because of the memory overhead (adds function calls where not really necessary). I guess I'm old school, but never got around to using includes. It's been on my radar for a while. I've always tried to write code that is as portable as possible, even though now, with evergreen browsers in the lead, it doesn't really matter as much.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Tuesday January 24, 2017 @10:30AM (#13472086)
Yeah, .forEach() is a new scope. But the better readability is worth the minor performance impact for everything but the most performance-intensive code.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by drenvuk on Wednesday January 25, 2017 @09:24PM (#13488209)
It's that kind of thinking that gets us really slow software.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Thursday January 26, 2017 @07:29AM (#13490767)
"premature optimization is the root of all evil" - Don Knuth

Also old-style for loops in JS fall victim to the last entry effect since people often use them to set up event handlers and wonder why they don't work.

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by cpeterso on Monday January 23, 2017 @09:56PM (#13468450)
I'd love to see an extension like this for Twitter.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by unchaotic on Tuesday January 24, 2017 @12:24AM (#13469024)
Somewhat related : Wrote a chrome extension [1] to reduce some noise on twitter. It should be easy to add the ability to filter out tweets by keyword (I'll do it probably this weekend if it is useful).

[1] https://chrome.google.com/webstore/detail/hackybird/ddlhmpom...

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by unchaotic on Tuesday January 24, 2017 @11:54PM (#13478645)
Updated extension should now let you filter tweets based on keywords (& also sort tweets by popularity...)

https://chrome.google.com/webstore/detail/hackybird/ddlhmpom...

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by viiralvx on Tuesday January 24, 2017 @09:22AM (#13471480)
I actually wrote something like that already: https://chrome.google.com/webstore/detail/social-muter/pipnn... Enjoy!
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by cpeterso on Tuesday January 24, 2017 @06:14PM (#13476696)
For some reason, the screenshot on the socialmuter.com home page doesn't load in Firefox or Edge.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by nailer on Tuesday January 24, 2017 @09:00AM (#13471302)
I'd love for Twitter to support shared keyword filters and block lists, rather than the current, web-only, politically driven, content-and-code-combined, filters that exist at present.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by keyle on Monday January 23, 2017 @11:13PM (#13468751)
And Facebook!
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Monday January 23, 2017 @11:19PM (#13468774)
I feel both of you! Feel free to fork it and make it work for whatever site you want. The code base is pretty straightforward. You'd just need to change the DOM logic (which is about 2 loc) so it should be pretty doable.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by cpeterso on Tuesday January 24, 2017 @12:10AM (#13468965)
Or an extension that understands how to parse many different news sites and can filter out stories on all of them. Add one keyword (pick your own example ;) and see no headlines containing that keyword on any news site. It wouldn't be that hard, though it would reinforce one's own news bubble.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:02AM (#13471803)
I actually thought about something similar last night. Have a project that had a plugable DOM parser so people could build plug ins for various sites.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by aryamaan on Tuesday January 24, 2017 @10:02AM (#13471799)
I would like to make an extension which sorts the stories based upon numbers of comments. How do I start? I have been working as a backend developer and completely agnostic about this stuff. TIA.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:05AM (#13471828)
If you check the code, contentScript.js:28 that line removes the meta data line, which contains the number of comments. One could easily parse the comment line and use it to rearrange the some, as opposed to deleting it. Fork the code and give it a try!
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by elcapitan on Tuesday January 24, 2017 @08:51AM (#13471244)
Did it work for you? Filtering by title keywords only seems to be rather hard, especially for political stuff, which often uses rather non-descriptive headlines.

Example: "New CIA Chief to Gladly Spy on Americans, Even If Using Info Hacked by Russians" looks like opinionism that I could pretty well live without, but it doesn't contain any keywords I would blacklist.

For technical stuff it's probably a lot easier (just name the language/framework/etc).

Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Tuesday January 24, 2017 @10:03AM (#13471808)
Yeah, I ran into something similar. I had "president" on my list and it blocked a story on the president of a company. It's kind of trial and error. That's why I find it useful to see what stories are blocked so you can get a sense for how well your filter is working.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by Shad0w59 on Monday January 23, 2017 @09:34PM (#13468358)
Great, now I can de-Trump my feed.
Re:Show HN: Chrome Extension to Filter HN Stories by Keyword by alistproducer2 on Monday January 23, 2017 @09:47PM (#13468405)
Version < 0.4 have a bug that filters comments containing words on naughty list. 0.4 has been pushed to webstore but it will take a minute to propagate. If you want fixed version now, pull it from github.

Although filtering out comments could be a feature and not a bug, amiright?