项目作者: McShelby

项目描述 :
A reveal.js 3.x / 4.x plugin to switch between multiple alternative configuartion presets by pressing a shortcut key.
高级语言: JavaScript
项目地址: git://github.com/McShelby/reveal-altmode.git
创建时间: 2018-06-07T15:32:48Z
项目社区:https://github.com/McShelby/reveal-altmode

开源协议:MIT License

下载


AltMode

A reveal.js 3.x / 4.x plugin to switch between multiple alternative configuartion presets by pressing a shortcut key.

If you are presenting your slide deck you are usually used to handling reveal.js. You want to keep your audience free of all unnecessary visual distraction to stay concentrated on what you are presenting.

On the other hand you may want to upload your slides later. Other viewers in front of their computers will then operate your presentation and may not be used to handling reveal.js. In this case you want to give them every available help to navigate thru your slide deck.

Instead of adjusting the configuration for every use case, you can store alternative configurations as ready to use presets and switch between them by pressing a shortcut key.

To change themes in presets the ThemeOverride plugin or similar may come in handy.

Installation

Copy this repository into the plugin folder of your reveal.js presentation, ie plugin/altmode.

Add the plugin to the initialization of your presentation, as below.

reveal 4.x

  1. <script src="plugin/altmode/altmode.js"></script>
  2. // ..
  3. Reveal.initialize({
  4. // ...
  5. plugins: [
  6. // ..
  7. AltMode,
  8. ]
  9. });

reveal 3.x

  1. Reveal.initialize({
  2. // ...
  3. dependencies: [
  4. // ...
  5. { src: 'plugin/altmode/altmode.js', async: true },
  6. ]
  7. });

Usage

With no further configuration, the plugin will configure one alternative preset for distraction free presentation mode.

To use an alternative preset you can either:

  • toggle thru the presets by pressing the A shortcut on the keyboard. This is only available if you are not in PDF export mode.
  • set the altMode parameter as an URI parameter.
  • set the altMode parameter in the configuration options.

The URI parameter will have precedence over the configuration option. By default the default configuration is shown which is equivalent to altMode=0.

Configuration

You can define an unlimited amount of alternative presets in the altModeConfig array parameter of your configuration. You access them with the nummerical altMode parameter. 0 is the default configuration, all other numbers -1 refer to alternative configuration items defined in the altModeConfig array parameter.

  1. Reveal.initialize({
  2. // ...
  3. // Define your alternative presets here. If this parameter is not
  4. // set, the plugin will install distraction free presentation mode
  5. // as your only alternative preset.
  6. // Once the array is defined (even if it is empty), distraction free
  7. // presentation mode needs to be set manually. You can add distraction
  8. // free presentation mode to any configuration preset by setting
  9. // altModePresenter=true - see below.
  10. altModeConfig: [
  11. {
  12. // distraction free presentation mode
  13. altModePresenter: true
  14. },{
  15. // change transitions in this preset
  16. backgroundTransition: 'zoom',
  17. transition: 'zoom',
  18. }
  19. ]
  20. // You access your configuration presets with a nummerical value.
  21. // 0 is the default configuration
  22. // n-1 is used as an index to access your alternative presets in
  23. // the altModeConfig array
  24. altMode: 0,
  25. // If set to true, the plugin will add distraction free presentation mode
  26. // to this configuration; by that you can apply distraction free
  27. // presentation mode to the default configuration as well as to any other
  28. // configuration of your alternative presets.
  29. altModePresenter: false,
  30. // Shortcut for toggling between default configuration and alternative presets
  31. altModeShortcut: 'A',
  32. });

URI Parameter

  1. http://example.com/demo.html?altMode=1

Distraction free presentation mode

This alternative preset removes all unnecessary UI elements from your slide. It is installed if you are not giving any own configuration of alternative presets. It corresponds to the following reveal.js configuration parameters:

  1. Reveal.initialize({
  2. controls: false,
  3. controlsTutorial: false,
  4. helpButtonDisplay: 'none', // HelpButton plugin
  5. hideAddressBar: true,
  6. history: false,
  7. mouseWheel: false,
  8. previewLinks: false,
  9. progress: false,
  10. slideNumber: false,
  11. });

API

Javascript

The plugin API is accessible from the global AltMode object.

  1. // Change a config value at runtime
  2. AltMode.configure({
  3. // Takes the same options as for configuration
  4. altMode: 1,
  5. });
  6. // Retrieves an object with the settings for
  7. // distraction free presentation mode
  8. AltMode.getPresenterConfig();

License

MIT licensed.

Copyright (C) 2020 Sören Weber