News for hackers. Stuff that matters.
Re:Show HN: A Firefox extension to leave comments on any URL by rtpg on Thursday June 27, 2019 @06:53AM (#20293290)
I wrote a chrome extension that went the opposite direction: hit the extension button and you would get a list of hacker news and reddit submissions for that URL. Was super useful for finding some cool comments on a page

I’ve since moved to Firefox and gave up on the extension, but it might be an easy port...

Re:Show HN: A Firefox extension to leave comments on any URL by syx on Thursday June 27, 2019 @07:56AM (#20293606)
you just described exactly what I've done a year ago [1] I always promised myself to rewrite it for Firefox but was too lazy.

[1] https://github.com/syxanash/commentdat

Re:Show HN: A Firefox extension to leave comments on any URL by gitgud on Thursday June 27, 2019 @08:42AM (#20293855)
Same as the [1] extension I wrote last year. Firefox was easier to incorporate than I thought though, the API is almost identical.

[1] https://newsit.benwinding.com/

Re:Show HN: A Firefox extension to leave comments on any URL by MetallicKat on Thursday June 27, 2019 @11:53AM (#20295531)
This is nice. Exactly what I am looking for!
Re:Show HN: A Firefox extension to leave comments on any URL by the_duke on Thursday June 27, 2019 @08:31AM (#20293806)
FYI: converting a Chrome to a FF extension is easy to do now.

They are mostly the same, and Firefox has a compatibility library that stubs most of the incompatibilities.

Re:Show HN: A Firefox extension to leave comments on any URL by comntr on Thursday June 27, 2019 @01:16PM (#20296452)
Yep, I didn't have to do much other then doing if(chrome.contextMenus){...} to make this extension run on Firefox and Firefox Android. But I intentionally chose the <iframe> approach to minimise the browser-dependent surface, so the <iframe> draws the UI and the extension only makes a few basic things like updating the icon color.
Re:Show HN: A Firefox extension to leave comments on any URL by tetizera on Thursday June 27, 2019 @08:05AM (#20293660)
I'd love to have this extension! Let us know if you ever pick up that extension. I do have one question though. Links on e-mails usually have "?utm_campaign=id_campaign&utm_source=nytimes" for example. Is it possible to avoid duplicates? To this day this is one of the major headaches for mods on Reddit. There's also the mobile links for the same news article.
Re:Show HN: A Firefox extension to leave comments on any URL by syx on Thursday June 27, 2019 @08:12AM (#20293701)
This was more of a kludge than a serious project, but glad I was not the only one to find this useful, will definitley continue working on it.

>Is it possible to avoid duplicates?

I thought about this as well in the past but never actually found a solution. Maybe someone here knows if there's research or an algorithm to uniquely identify the URL.

Edit: typos

Re:Show HN: A Firefox extension to leave comments on any URL by 333c on Thursday June 27, 2019 @01:29PM (#20296594)
Some pages will link to a canonical URL in the head: https://en.wikipedia.org/wiki/Canonical_link_element
Re:Show HN: A Firefox extension to leave comments on any URL by weaksauce on Thursday June 27, 2019 @11:33AM (#20295327)
Stripping out the query string probably works for 80%(maybe even more) of the sites. Maybe that by default and then an option to search for the whole url as a fallback?
Re:Show HN: A Firefox extension to leave comments on any URL by ekzy on Thursday June 27, 2019 @05:06PM (#20298757)
I wrote a similar extension too! Looks like we all had the same idea

https://chrome.google.com/webstore/detail/hacker-news-lookup...

Re:Show HN: A Firefox extension to leave comments on any URL by Jaruzel on Thursday June 27, 2019 @09:44AM (#20294253)
You might be able to do with just a bookmarklet into the algolia search for HN.

EDIT: I've just created a proof of concept that works:

http://www.jaruzel.com/apps/hnlookup/

Re:Show HN: A Firefox extension to leave comments on any URL by comntr on Thursday June 27, 2019 @11:41PM (#20301295)
So it effectively runs arbitrary javascript in the current page? I mean, if I run it on my online banking page, it'll have access to everything. The extension isn't ideal either - access to the current URL is too much - but at least it can't run arbitrary JS in the page itself.
Re:Show HN: A Firefox extension to leave comments on any URL by Jaruzel on Tuesday July 02, 2019 @03:38AM (#20333011)
If you look at the bookmarklet, you'll see that the JS in it only fetches the URL and appends it to an Algolia search query. Nothing is sent to any other server. It's all done in your browser. Hacker News has exactly the same type of bookmarklet on their 'bookmarklet' link at the bottom of every page[1]. Arguably this method is safer than an Extension.

---

[1] https://news.ycombinator.com/bookmarklet.html

Re:Show HN: A Firefox extension to leave comments on any URL by air7 on Thursday June 27, 2019 @07:11AM (#20293382)
Firefox extensions are nowadays (since Quantum) web-extensions and are almost identical to chrome's so porting should be quite simple.