TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

NYTimes Opensources Their Deep Linking JS

169 pointsby joeybakerover 14 years ago

11 comments

donohoeover 14 years ago
I'm surprised to find this posted here. I developed this and given the community here I'd appreciate any feedback for future iterations...
评论 #2094555 未加载
评论 #2095418 未加载
评论 #2094628 未加载
评论 #2094531 未加载
omouseover 14 years ago
Awesome, they just invented a small part of Ted Nelson's Xanadu project. Say what you will about Xanadu being vapour-ware but at least Mr Nelson designed it properly to handle problems like deep-linking and track-backs which the Web has to employ workarounds for.
hinathanover 14 years ago
Speaking of NYTimes, Safari user stylesheet has a line to disable the annoying word definition popup when selecting text.<p>.nytd_selection_button { display:none; }
评论 #2094182 未加载
joeybakerover 14 years ago
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.
评论 #2094150 未加载
评论 #2094600 未加载
评论 #2094083 未加载
sicularsover 14 years ago
Grats donohoe, well done. What is of particular interest to me here is the use of the Levenshtein distance algorithm. The reason this works well here is because you are comparing your supplied key against a constrained set. Applying the Levenshtein distance algorithm (or its variants) against a constrained set of small size in this fashion has virtually no performance impact as the time to complete is entirely based on the size of the set you are matching against. On the other hand, matching against a set of millions of records does get costly.
stdbrouwover 14 years ago
I think v2 is trying to solve a problem it shouldn't have to solve. If the NYT made available previous (published!) revisions of their content, there would be no need to assign paragraphs with special IDs or the like. You'd simply say, "get me p2 for the story as it was on Jan 11 15:33". When you link to a specific piece of content, it's in the hopes that people will read or see the same thing you saw when you made the link. You don't want to be talking about different things, so revision-awareness would actually make more sense overall.
评论 #2096244 未加载
评论 #2097228 未加载
jrockwayover 14 years ago
Pretty good. Did they do an analysis of the NYT archives to ensure that their First Three Words Last Three Words technique is "good enough"?
评论 #2096231 未加载
chapelover 14 years ago
I played around with this and got it so you can both highlight and have it move the view to the paragraph of choice. Seems pretty interesting.<p>An issue with it though, when sending the link to someone, and then they click it, browsers (Chrome here) turn the #h[TArTWw,1] into #h%5BTArTWw,1%5D which then seems to be ignored by the script.
评论 #2094500 未加载
barredoover 14 years ago
I made something similar to this NYTimes.com feature, a few days ago: <a href="https://github.com/alexbarredo/insidelink" rel="nofollow">https://github.com/alexbarredo/insidelink</a><p>It's simpler, of course. It's in plain JS and as jQuery plugin
评论 #2094535 未加载
wookiehangoverover 14 years ago
Enterprise JS is 400 lines of code... 0 lines of tests. Kudos, NYT.
评论 #2094590 未加载
评论 #2094192 未加载
Swizecover 14 years ago
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.<p>For example, I could have every paragraph an id say id="p5" and then link ad example.com/story#p5 and voila, deep linking.<p>Hoorah for reinventing the wheel :)
评论 #2094184 未加载
评论 #2094172 未加载