Live data from Hacker News

NYTimes Opensources Their Deep Linking JS

open.blogs.nytimes.com

1–10 of 56 posts

Re: NYTimes Opensources Their Deep Linking JS

#4

On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.

It looks like they are only using a small portion of it -- selectors in init and a few event handlers. They could use one of the many pre-existing selector engines and write a simple cross-browser addEvent function

Re: NYTimes Opensources Their Deep Linking JS

#5

On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.

You know what I would love to have the HTML5 guys add to the spec? Some way of keeping libraries like PrototypeJS and jQuery in the browser cache at all times, so that pages could just use them without worrying about the size.

Perhaps some kind of alternate src attribute on script tags, so you could list a local copy (for reliability) as well as Google and Microsoft CDN URLs, and the browser would go with the first one it had in its cache. And if individual browsers wanted to distribute jQuery (et al.) along with the browser itself, and define an URN for it, so much the better.

This is just something I thought up in the past few minutes, so take it with a grain of salt, but as a web developer, I would love this.

Re: NYTimes Opensources Their Deep Linking JS

#6
I don't understand what's so awesome about this? Browsers have supported deep linking since forever. You can link to any specific id on a page and the browser will scroll to it when you open the page.

For example, I could have every paragraph an id say id="p5" and then link ad example.com/story#p5 and voila, deep linking.

Hoorah for reinventing the wheel :)

Re: NYTimes Opensources Their Deep Linking JS

#8
post #6

I don't understand what's so awesome about this? Browsers have supported deep linking since forever. You can link to any specific id on a page and the browser will scroll to it when you open the page. For example, I could have every paragraph an id say id="p5" and then link ad example.com/story#p5 and voila, deep linking. Hoorah for reinventing the wheel :)

The problem with this approach is that as the paragraph is moved around, the linear id's become stale. Say the article is edited to move content, your deep link may break, still right page of content, but wrong deep link to content.

This addresses this (as stated in the article) without some elaborate server content management solution that tracks paragraphs and their html id links.

Re: NYTimes Opensources Their Deep Linking JS

#9
post #3

Speaking of NYTimes, Safari user stylesheet has a line to disable the annoying word definition popup when selecting text. .nytd_selection_button { display:none; }

That's why NYT is never getting on my NoScript whitelist. I have a nervous habit of highlighting random text while I read.

Re: NYTimes Opensources Their Deep Linking JS

#10
post #6

I don't understand what's so awesome about this? Browsers have supported deep linking since forever. You can link to any specific id on a page and the browser will scroll to it when you open the page. For example, I could have every paragraph an id say id="p5" and then link ad example.com/story#p5 and voila, deep linking. Hoorah for reinventing the wheel :)

RTFM? :)

The difference is no 'href' tags. The 'tag' is automatically created based on the words in the paragraph, via Javascript, and decoded appropriately.

It is also slightly neat in that you can highlight a specific sentence (multiple sentences actually, see the little tutorial at the bottom).

I actually kind of like it, it would be a neat way to really highlight what you think is interesting in an article when sending someone a link. But doing it as a per site thing is crazy.. seems like it could be a good browser extension though. People who have it installed would instantly get a more functional linking experience. Imagine linking off to some documentation in a blog post for a coding problem, say to a Django documentation page, and when someone clicks the link they are not only taken to the specific part of the page that you are talking about, but the relevant stuff is actually highlighted. That'd be Neat (tm).

Post reply on HN