Live data from Hacker News

Show HN: Marginotes, quick and elegant side notes for your paragraphs

github.com

21–30 of 31 posts

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#21
This is excellent. I've been thinking about rolling my own blog software since Medium took away their marginal note feature (IIRC, you can now make notes but they're for yourself only, readers can't see them). Since reading Ed Tufte's books, I'm convinced that margin notes are infinitely better than footnotes or (egad) endnotes for sharing little "extras" with your readers.

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#23
post #2

http://youmightnotneedjquery.com/

Yes, this would have been awesome without the jQuery dependency. I don't think Javascript libraries should introduce ANY dependencies, because you are limiting the audience to codebases that already include said dependency. (No one will introduce a huge dependency like jQuery for just ONE library.)

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#24
I made a little experiment, and converted this to a vanilla Javascript library. Relevant to some of the questions below about whether this should use jQuery or not.

Edit: There were two gotchas beyond browser compatibility. jQuery provides a consistent interface to set numeric style values - in vanilla Javascript you have to remember to turn these numbers into strings suffixed with "px". And I hacked together the code that stops fadein and fadeout from stepping on each other.

Changes: https://github.com/fdansv/marginotes/pull/2 Working Example: http://mshenfield.github.io/fdansv.github.io/

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#25

I made a little experiment, and converted this to a vanilla Javascript library. Relevant to some of the questions below about whether this should use jQuery or not. Edit: There were two gotchas beyond browser compatibility. jQuery provides a consistent interface to set numeric style values - in vanilla Javascript you have to remember to turn these numbers into strings suffixed with "px". And I hacked together the cod…

Looks like you've got a bug when the mouse passes over a link that has no sidenote. To reproduce:

  1. Hover over a link with a sidenote (i.e. "Bill Gates").
  2. Hover over a link without a sidenote (i.e. "unrecognised").
  3. Move your mouse off of the link.
During step 3 the previous sidenote will briefly appear.

(I'm running Chrome 48.0.2564.116 on OS X 10.11.3 if that matters)

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#26
post #19

Earlier quoted context omitted.

> and I do have So you can tell us: what happens if you have Javascript turned off? I have sympathy for the "what happens if I'm using a screen reader or other accessibility device" question, not excluding those who need to use assertive technologies where possible is important. geocar's post below suggests what might be a better implementation in that regard, which will support your use case too, but some advanced s…

I disable javascript for two reasons: I do not want to download megabytes of useless scripts everyday dozens of times, and I do not want to allow strangers run arbitrary Turing-complete code on my computer, even on a restricted platform like the browser. Thus, I use xombrero + very strict whitelisting. I do not want the world to conform to me, I just conform selectively. I know the consequences of being a NoJS surfer…

> I do not want the world to conform to me, I just conform selectively.

A healthy attitude.

> I know the consequences of being a NoJS surfer, I just live with it, and don't complain.

I'm a bit more open with JS, though I've completely blocked flash for years. Any site that doesn't work just, well, doesn't work - I can always try others.

> And here I try to make some criticism of the posted work, and constructively.

I may have misread your short message as being much more "snarky" than you intended, in which case I apologise for my knee jerking in reaction.

> I think the JS CDNs are the most stupid things on the world. Hack one CDN, and you'll get to run your code on maybe millions of websites

Good point, and why I use local copies instead of CDNs myself. That and I prefer not to rely on an external resource unless I have to - it is an extra possible point of failure. The extra bandwidth use is insignificant from a hosting point of view and if you have caching directives set properly it'll only affect your users on first access (and you can often minimise that effect with careful lazy loading). But CDNs are an unavoidable consideration because every other man/woman/other and their dog seem to disagree.

> And who decides which CDNs are major, and/or better or more secure?

A thorny point. I would only include official locations of significant projects like code.jquery.com rather than anything more generic. I wouldn't even exclude ajax.googleapis.com from the "nothing generic" rule.

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#27
post #19

Earlier quoted context omitted.

I disable javascript for two reasons: I do not want to download megabytes of useless scripts everyday dozens of times, and I do not want to allow strangers run arbitrary Turing-complete code on my computer, even on a restricted platform like the browser. Thus, I use xombrero + very strict whitelisting. I do not want the world to conform to me, I just conform selectively. I know the consequences of being a NoJS surfer…

> I do not want the world to conform to me, I just conform selectively. A healthy attitude. > I know the consequences of being a NoJS surfer, I just live with it, and don't complain. I'm a bit more open with JS, though I've completely blocked flash for years. Any site that doesn't work just, well, doesn't work - I can always try others. > And here I try to make some criticism of the posted work, and constructively. I…

Happy we mostly agree. Should've been more elaborate, sorry. I sometimes trade off elaboration for brevity and/or laconicism, which causes misunderstandings and off-topic threads.

With regards to CDN, I guess the best option is to have a "standard library" for web, where the browsers provide a standard selection of javascript libraries, jquery, react (I really don't know what this last one is) and the like, and bootstrap and stuff, so that these need not be downloaded, and we can be sure that our copies are mostly secure (audited, tested) and that there's no real single point of failure.

There's still a who decides problem with this approach, but at least I won't be able to steal millions of session cookies should I manage to tamper a single JS file on some domain. Tho I'm not a security person, so it's possible that I'm telling useless crap.

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#28

I made a little experiment, and converted this to a vanilla Javascript library. Relevant to some of the questions below about whether this should use jQuery or not. Edit: There were two gotchas beyond browser compatibility. jQuery provides a consistent interface to set numeric style values - in vanilla Javascript you have to remember to turn these numbers into strings suffixed with "px". And I hacked together the cod…

Looks like you've got a bug when the mouse passes over a link that has no sidenote. To reproduce: 1. Hover over a link with a sidenote (i.e. "Bill Gates"). 2. Hover over a link without a sidenote (i.e. "unrecognised"). 3. Move your mouse off of the link. During step 3 the previous sidenote will briefly appear. (I'm running Chrome 48.0.2564.116 on OS X 10.11.3 if that matters)

Nice catch! My fadeout function mistakenly set the opacity to 1 to start off. Fixed.

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#29
post #27

Earlier quoted context omitted.

> I do not want the world to conform to me, I just conform selectively. A healthy attitude. > I know the consequences of being a NoJS surfer, I just live with it, and don't complain. I'm a bit more open with JS, though I've completely blocked flash for years. Any site that doesn't work just, well, doesn't work - I can always try others. > And here I try to make some criticism of the posted work, and constructively. I…

Happy we mostly agree. Should've been more elaborate, sorry. I sometimes trade off elaboration for brevity and/or laconicism, which causes misunderstandings and off-topic threads. With regards to CDN, I guess the best option is to have a "standard library" for web, where the browsers provide a standard selection of javascript libraries, jquery, react (I really don't know what this last one is) and the like, and boots…

No, that is definitely a valid security concern if copies of code on CDNs are compromised. Though once you have code injected into something like that you can pretty directly do worse than take session cookies.

One possibility would be to have everything signed and include the fingerprint with the tag. That way you could safely read jquery.version.js from anywhere and be as sure it is the real thing as if you'd picked it up from jquery.com. That would in fact remove the need for a CDN - one that copy has been ready from my site and verified there would be no need to read it from your site, so every site that uses the signed version essentially becomes part of a global communal CDN. Of course then you have the hassle of certificate management (how do I trust the signature on that file?). The current infrastructure used for SSL certificates, for all its faults, would suffice, but getting library maintainers to use it might be a struggle.

On further thought: in fact a digital signature may not be needed. Just a hash (and not even a salted one) using a sufficiently provably secure function may be adequate, as already provided by many download sites for verifying the absence of transmission errors, removing the need for any signature/certificate jiggery pokery.

Re: Show HN: Marginotes, quick and elegant side notes for your paragraphs

#30
post #12
post #11

Earlier quoted context omitted.

Which is bad if them notes are not ornaments only. So there should be some fallback. I guess a good approach would be to collect the content from some p.marginnote elements which would be hidden if JS is present and left intact if not. So, like GCC ... The GNU Compiler Collection With JS, they'd become margin notes, whithout it, they'd render as plain footnotes.

Sure, but as the README.md states "adds notes to the margin with the text provided in HTML attributes" it's presumably left up to the user how else they display the data if they want it to be visible for people who disable JS. This library is a progressive enhancement. It's very much the right way to do web dev in my opinion.

It's almost the right way -- somewhat better would be to do what one of the above comments say, to add the notes as footnotes using POSH. Then the javascript can rewrite the footnotes into hide/show marginal notes with the same appearance and user interface as this library.
Post reply on HN