3 ms·
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 annotate
by koolba 11y ago
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" 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.
- runandcode 11y agoHey 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!