satorumurmur / bibi

Bibi | EPUB Reader on your website.
https://bibi.epub.link
MIT License
859 stars 123 forks source link

holderadded event #13

Closed KitaitiMakoto closed 9 years ago

KitaitiMakoto commented 9 years ago

@satorumurmur Hi,

I think it's helpful if we can know when BiB/i's holder span element is added to DOM tree so that we can find and manipulate it safely. This pull request is for that needs.

Of course, there are something to consider carefully like event name(holderadded), namespace(bibi:) and timing to dispatch. But, can you start with consideration whether BiB/i should have event API or not? I will rewrite patch if needed.

Thanks.

KitaitiMakoto commented 9 years ago

I'd appreciate if @shunito comments on this topic from the perspective of the plugin system developer.

satorumurmur commented 9 years ago

Thanks.

The embedder script "bib/i.js" (it's called "Pipi" from me) does;

  1. Search placeholder "a" elements with "data-bibi" and "href" attribute in HTML DOM.
  2. Create and insert "span.bibi-holder" element before each placeholder "a".
  3. Create and append "iframe.bibi-frame" element to each "span.bibi-holder", and load BiB/i.
  4. (Make some UIs for entering fullscreen or opening another window and so on.)

By marging your request;

It's very useful.

KitaitiMakoto commented 9 years ago

Thanks fir the details of Pipi and merging my paches.