Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Google seems to know from a pdf where the various <code>x,y</code> text offsets are in the file. When you select a bunch of lines, it places a set of absolutely positioned "selection" divs over the image where the "text" is (they have class <code>highlight-pane</code>). When you select text, it fills in a <code>#selection-content</code> textarea with the contents of what you have selected, and selects the text in it (try using <code>window.getSelection().anchorNode</code> in Chrome, e.g.). Besides those selection overlays, there is just an image <code>.page-image</code>. I bet they actually use window to capture all the mouse gestures they care about (I assume <code>mousedown</code> and <code>mouseup</code>). (<a href="http://docs.google.com/viewer?url=http://labs.google.com/papers/bigtable-osdi06.pdf" rel="nofollow">Here's an example pdf document</a>)</p> <p>If you're absolute-positioning the elements, you could detect <code>mousedown</code>, <code>mousemove</code> and <code>mouseup</code>, figure out the span elements mouse is over (or nearest to), and fill in a textarea with the contents of all content between those two elements. If you want to just use word-granularity, I doubt anyone would complain (surround each word with a span, rather than each letter).</p> <p><strong>Edit</strong>: I got kinda curious last night and coded up a <em>really</em> naive version. It only does <code>mousedown</code> and <code>mouseup</code>, and it doesn't work in IE (I don't feel like debugging it :)</p> <p><a href="http://jsfiddle.net/PmjTj/" rel="nofollow">Check it out on jsfiddle.</a></p> <p>Features you might want to add:</p> <ol> <li>Some better way of checking for position-based matches; I just do whether it's included in the box.</li> <li>Dynamic updating on <code>mousemove</code></li> <li>Line-based rather than span-based</li> <li>You could still do selecting by background color, but depending on how your elements are arranged it might not look very good. Also would need to support transparency.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload