bespokejs / bespoke

DIY Presentation Micro-Framework

Home Page:http://markdalgleish.com/projects/bespoke.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plugin run when before hook events.

suisho opened this issue · comments

Hello.
I tried to create plugin that modify sections before bespoke start hook event.
But currently cannot that.

Out of necessity, I implement this function as outside plugin. But that so dirty. 😭
like this

beforeBespke('article', function(from){
  bespoke.from(from, {
    keys: true,
    touch: true,
  });
})
var beforeBespke = function(from, callback){
  // emulate bespoke from
  var parent = selectorOrElement.nodeType === 1 ? selectorOrElement : document.querySelector(selectorOrElement)
  var slides = [].filter.call(parent.children, function(el) { return el.nodeName !== 'SCRIPT'; })
  var deck = {
    slides : slides
  }

  //  :
  // do something modification to slide.
  // (This is a point want to plugin)
  //  :

  callback(from)
}

Please tell me if you have more good idea

What is your plugin attempting to do? I've considered this functionality in the past, but I've never personally had a need for this so I've avoided complicating things.

Sorry, my case is actually rare case, not commonly.

In detail, I need print out PDF and use that on the presentation.
And split bullets page when print out.
(I omit the reason for must use PDF, because complex and shitty..)

For example,

origin

<article>
  <section>
    <ul>
      <li> list 1 </li>
      <li> list 2 </li>
      <li> list 3 </li>
    </ul>
  </section>
</article>

after convert

<article>
  <section>
    <ul>
      <li> list 1 </li>
    </ul>
  </section>
  <section>
    <ul>
      <li> list 1 </li>
      <li> list 2 </li>
    </ul>
  </section>
  <section>
    <ul>
      <li> list 1 </li>
      <li> list 2 </li>
      <li> list 3 </li>
    </ul>
  </section>
</article>

This is sample
http://suisho.github.io/bespoke-printable-bullete/

I've actually discussed this functionality with a couple of other Bespoke users and it's possible without modifying the slide markup.

Our idea was to use PhantomJS to take a screenshot of every state, calling deck.next() until the presentation finishes. The benefit of this approach is that it would allow all custom themes to be printable without the need for a special print styles.

Sorry, but I'm going to close this issue. I'm open to the idea if a compelling use case comes along, but I'm afraid this isn't it.

Ok, Thank you.