Sha256: 1d0927a1953835eaa23eb849ab8d2aebc59ed760dd7c532f712184996fba66a1
Contents?: true
Size: 709 Bytes
Versions: 3
Compression:
Stored size: 709 Bytes
Contents
module Slippery module Processors module ImpressJs class AddImpressJs include ProcessorHelpers def self.call(doc) self.new.call(doc) end attr_reader :attributes DEFAULT_ATTRS = { 'transition-duration' => 1000 }.freeze def initialize(attributes = {}) @attributes = DEFAULT_ATTRS.merge(attributes).freeze end def call(doc) doc.replace('body') do |body| include_local_javascript(body, 'impress.js/js/impress.js') .set_attrs({id: 'impress'}.merge(data_attributes(attributes))) .add H[:script, 'impress().init();'] end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems