News for hackers. Stuff that matters.
Re:Code to block unwanted News Genius annotations by koolba on Friday April 01, 2016 @03:38PM (#11407891)
I'm no JS expert[1] but this doesn't look correct:

     # https://github.com/marlabrizel/genius-blocker/blob/master/lib/genius/blocker.rb#L11
     var annotated = window.location.href.indexOf("genius.it/") != -1;
     if (annotated) {
       window.location.href = window.location.href.replace("genius.it/", "")
     }
Wouldn't this match any instance of "genius.it" throughout the URL, not just at the beginning?

For example it'd match "https://example.com/blog/how-to-block-genius.it" and redirect the user to a (probably) non-existent link with that string removed.

[1]: I just play one on HN.

Re:Code to block unwanted News Genius annotations by runandcode on Friday April 01, 2016 @04:42PM (#11408442)
Hey koolba, OP here.

Thanks for the code review - it's always good to see suggestions on how to improve things. If you have ideas on how to make the code better, please feel free to submit a pull request. Thanks for sharing your feedback!