bishless / handedness

jQuery plugin for tailoring documentation to right-handed or left-handed readers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

handedness.js

Wouldn't it be nice if documentation were written for both right AND left handers?

Rough

Ideally, no extra markup would be required. A user of this plugin would simply chain .handedness() onto the containing element of their choice. i.e.

$('.content').handedness();
  1. write default mouse button orientation to cookie or localStorage (righthanded).
  2. when ready, search for instances of ' click ' or 'left-click' and/or other strings that make sense. (note: ... this is harder than I expected.)
  3. wrap those matches with '' and ''.
  4. then search for instances of 'right-click' (+others).
  5. wrap those matches with '' and ''.
  6. then, add two buttons near top of document
    1. button1 = Lefty
    2. button2 = Righty
  7. if reader clicks Righty, that orientation is already set, do nothing.
  8. if reader clicks Lefty, change the internal text of all instances of span.mb-primary to 'right-click'. Also change the internal text of all instances of span.mb-secondary to 'left-click'.
  • possibly, add svg/iconfont via css :before to display a small icon next to each span?

About

jQuery plugin for tailoring documentation to right-handed or left-handed readers


Languages

Language:JavaScript 100.0%