Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General purpose front-end integration JavaScript library #21

Open
konklone opened this issue Oct 9, 2013 · 11 comments
Open

General purpose front-end integration JavaScript library #21

konklone opened this issue Oct 9, 2013 · 11 comments

Comments

@konklone
Copy link
Member

konklone commented Oct 9, 2013

I added some super basic integration into Scout, using a JS-driven approach here:

https://github.com/sunlightlabs/scout/blob/master/subscriptions/views/federal_bills/_show.erb#L168

This is what is highlighting "Cloture" all over S. Res. 15.

It needs optimization to work for more than a handful of terms (mainly, it needs to be turned into a single regex, rather than passing over the nodes with a regex for every term), but it does handle the hard part of find/replacing text with nodes, in a DOM where text is nested in arbitrary nodes.

Optimizing and generalizing this for easy client-side integration of the glossary would be awesome.

@waldoj
Copy link
Member

waldoj commented Oct 10, 2013

I learned a UI lesson about definitions with The State Decoded, which I'll pass along here in case you might regard it as useful.

Initially I highlighted defined terms quite prominently, and feedback about that fell into three different categories: 1. This is great. 2. This is incredibly annoying. 3. This is useful, but it makes it very distracting to scan the text, because my eye is drawn only to the defined terms. With experimentation, I found that using a very low-key indicator (a faint, dotted underline), people could either ignore them or seek them out, depending on what they wanted, while nobody found that those indicators distracted them from reading.

JM2C, YMMV, etc., etc.

@konklone
Copy link
Member Author

Yeah, faint was my first instinct and implementation, then people said they could barely see it -- but of course those people were coworkers, not users. =) This is good feedback, I'll make it faint again.

@waldoj
Copy link
Member

waldoj commented Oct 10, 2013

It seemed to me to be like the Pepsi Challenge—people just checking it out real quick thought the bold definitions were great, but people actually engaged in reading a lot of text for a real purpose often found it frustrating.

@gregelin
Copy link
Member

It would be VERY slick if after you moused over a term the highlighting for
THAT term became very subtle. In other words, once you've read a definition
presumably you do not need to keep reading it.

It is nice to see the definitions short and written to be read while
mousing over. This speaks well for value of public domain "mouse-over
glossaries" vs traditional glossary lists. Its a good practice.

You know...we should connect mouse-over glossaries with the plain language
act and movement http://www.plainlanguage.gov/

Greg

On Wed, Oct 9, 2013 at 9:15 PM, Waldo Jaquith [email protected]:

It seemed to me to be like the Pepsi Challengehttps://en.wikipedia.org/wiki/Pepsi_Challenge#Criticism—people
just checking it out real quick thought the bold definitions were great,
but people actually engaged in reading a lot of text for a real purpose
often found it frustrating.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-26022394
.

@waldoj
Copy link
Member

waldoj commented Oct 10, 2013

It would be VERY slick if after you moused over a term the highlighting for THAT term became very subtle. In other words, once you've read a definition presumably you do not need to keep reading it.

👍

I'd want to test this out, to see if it works as well as I think it would, but at first blush I think this is a great idea. I wonder about persistence—if the reduced-strength highlighting resets for each page view, each session, or never resets for that user. I suspect one would want to use client-side storage to save the list of viewed definitions.

@konklone
Copy link
Member Author

It'd probably need to be client-side storage, which could be packaged in a JS library. It does mean it'd reset itself every time they switched browsers or cleared their cache/cookies/etc, so I would still make the default color undistracting, but making it even subtle-r upon seeing it seems like all upside.

@gregelin
Copy link
Member

The client-side storage of browsers and powerful HTML5 and ajax means there is the possibility of essentially of building follow-the-user functionality into the use of the Glossary (or statedecoded). After all, Hypothes.is was at the meeting with us and they are pursuing web page annotations.

I'm imagining popping up a little control that may even let me control certain things between visits.

It would make sense that I could as user create my own set of notes and expertise level as I view legislation at Federal, State, Local and other jurisdictions. If Glossaries were common, than I could have my own interaction with glossary that was recognized and consistent across different visits and different sites.

Maybe there is an easy way for all of that to be done via local storage (and give me as user control over it). There's certainly a way to store in the cloud and log into my annotations as I moved across sites.

My guess is that Mozilla would be interested in support this idea. It is a kind of reverse cookie, in which I as the user, native to the browser, have the ability select a profile and decisively store data in that profile that I allow sites to see by default or by white list. It makes sense for this to be a specification and API. Maybe it already is and I just do not know it?

@konklone
Copy link
Member Author

::brain expands::

I have no idea whether you can use local storage to create bins that any website can use, or if they have to be locked per-domain, but there's clearly a lot of fun to be had here. I'm gonna focus on what's in front of me for now, but a separate branch or repo for front-end experimentation is welcome.

@waldoj
Copy link
Member

waldoj commented Oct 10, 2013

@gregelin
Copy link
Member

I like it.

Maybe there is a way to do something like gravatar or extend gravatar?

On Thu, Oct 10, 2013 at 1:33 PM, Waldo Jaquith [email protected]:

Apparently this is a thinghttp://www.nczonline.net/blog/2010/09/07/learning-from-xauth-cross-domain-localstorage/
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-26074065
.

@konklone
Copy link
Member Author

I like the model! Looks like the xauth example there is a long-dead project, unfortunately. But with server intervention, anything is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants