joseph/Monocle — pull request #173 by julien-c (2013-01-31 18:03:44+00:00)
Title: Enable controls that live outside of `monelem_box`

I'm implementing a scrubber that lives on my main page, **outside of Monocle's containers**.

I figured out I could pass a DOM node to `createControlElements`, however, I must first "extend" my node with `Monocle.Factory()` so that controls can call the `node.dom` suite of DOM helpers.

Here's how I ended up doing it:

var scrubber = document.getElementById('scrubber');
scrubber.dom = new Monocle.Factory(scrubber, 'scrubber', null, reader);
Monocle.scrubber = new Monocle.Controls.Scrubber(reader);
reader.addControl(Monocle.scrubber, 'explicit', {node: scrubber});

Feel free to suggest anything simpler, or more elegant!

Best,

Julien