/*! * bespoke-simple-overview v1.1.0 * * Copyright 2021, Flávio Coutinho * This content is released under the MIT license */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g=(g.bespoke||(g.bespoke = {}));g=(g.plugins||(g.plugins = {}));g.simpleOverview = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i typeof value === 'string' ? value.toUpperCase().charCodeAt(0) : value module.exports = function ({ activationKey = 27, insertStyles = true } = {}) { activationKey = ensureCharCode(activationKey) return function (deck) { let onDeckActivated, onActivationKeyPressed, onDeckDestroyed, onSlideChange, toggleSimpleOverview, isOverviewActive onDeckActivated = function () { deck.on('activate', onDeckActivated)() // de-register so it happens 1x window.addEventListener('keydown', onActivationKeyPressed, false) // inserts the css if necessary if (insertStyles) { _dereq_('../lib/bespoke-simple-overview.css') } // if the deck.parent already has the bespoke-overview class, turn it on isOverviewActive = deck.parent.classList.contains( 'bespoke-simple-overview' ) } onDeckDestroyed = function () { window.removeEventListener('keydown', onActivationKeyPressed, false) } onSlideChange = function (direction) { let newSlideIndex if (isOverviewActive) { newSlideIndex = deck.slide() + direction if (newSlideIndex >= 0 && newSlideIndex < deck.slides.length) { deck.slide(newSlideIndex) } return false } } onActivationKeyPressed = function (e) { switch (e.which) { case activationKey: toggleSimpleOverview() break default: break } } toggleSimpleOverview = function (toActivate) { isOverviewActive = typeof toActivate === 'boolean' ? toActivate : !isOverviewActive deck.parent.classList.toggle('bespoke-simple-overview', isOverviewActive) } deck.on('activate', onDeckActivated) deck.on('destroy', onDeckDestroyed) // exposes 3 events to outside world so they can enable/disable/toggle this deck.on('simple-overview.enable', toggleSimpleOverview.bind(null, true)) deck.on('simple-overview.disable', toggleSimpleOverview.bind(null, false)) deck.on('simple-overview.toggle', toggleSimpleOverview.bind(null)) // prevent bespoke-bullets from spoiling the fun deck.on('prev', onSlideChange.bind(null, -1)) deck.on('next', onSlideChange.bind(null, 1)) } } },{"../lib/bespoke-simple-overview.css":1}],3:[function(_dereq_,module,exports){ 'use strict'; // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field. var styleElementsInsertedAtTop = []; var insertStyleElement = function(styleElement, options) { var head = document.head || document.getElementsByTagName('head')[0]; var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; options = options || {}; options.insertAt = options.insertAt || 'bottom'; if (options.insertAt === 'top') { if (!lastStyleElementInsertedAtTop) { head.insertBefore(styleElement, head.firstChild); } else if (lastStyleElementInsertedAtTop.nextSibling) { head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); } else { head.appendChild(styleElement); } styleElementsInsertedAtTop.push(styleElement); } else if (options.insertAt === 'bottom') { head.appendChild(styleElement); } else { throw new Error('Invalid value for parameter \'insertAt\'. Must be \'top\' or \'bottom\'.'); } }; module.exports = { // Create a tag with optional data attributes createLink: function(href, attributes) { var head = document.head || document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.href = href; link.rel = 'stylesheet'; for (var key in attributes) { if ( ! attributes.hasOwnProperty(key)) { continue; } var value = attributes[key]; link.setAttribute('data-' + key, value); } head.appendChild(link); }, // Create a