Sha256: 20ee9a1a4b6fe20a6fa440bfd8a8560d8e9f215e8601771b72b7034b2db85461

Contents?: true

Size: 778 Bytes

Versions: 3

Compression:

Stored size: 778 Bytes

Contents

module Slippery
  module Processors
    # http://markdalgleish.com/projects/fathom/
    class FathomJs
      include ProcessorHelpers

      FATHOM = 'https://raw.githubusercontent.com/markdalgleish/fathom/master/fathom.min.js'
      def initialize(options)
        @options = options
      end

      processor :add_fathom, 'head' do |head|
        head.add(javascript_include_tag(JQUERY))
      end

      processor :wrap_presentation, 'body' do |body|
        body.set_children(H[:div, {id: 'presentation'}, body.children])
      end

      processor :init_fathom, 'head' do |head|
        head.add(H[:script, {type: 'text/javascript'}, <<"JS"])
$(document).ready(function(){
  $('#presentation').fathom({
    #{hash_to_js(@options)}
  });
});
JS
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slippery-0.4.2 lib/slippery/processors/fathom_js.rb
slippery-0.4.1 lib/slippery/processors/fathom_js.rb
slippery-0.4.0 lib/slippery/processors/fathom_js.rb