From 40a46e1c0c7836bdc26d25993a5c785be82e9973 Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Sun, 30 Apr 2017 17:19:01 +0930 Subject: Added description of custom key binding API to readme --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index c52a492..0455089 100644 --- a/README.md +++ b/README.md @@ -393,6 +393,37 @@ Reveal.isPaused(); Reveal.isAutoSliding(); ``` +### Custom Key Bindings + +Custom key bindings can be added and removed using the following Javascript API. Custom key bindings will override the default keyboard bindings, but will in turn be overridden by the user defined bindings in the ``keyboard`` config option. + +```javascript +Reveal.addKeyBinding( binding, callback ); +Reveal.removeKeyBinding( keyCode ); +``` + +For example + +```javascript +// The binding parameter provides the following properties +// keyCode: the keycode for binding to the callback +// key: the key label to show in the help overlay +// description: the description of the action to show in the help overlay +Reveal.addKeyBinding( { keyCode: 84, key: 'T', description: 'Start timer' }, function() { + // start timer +} ) + +// The binding parameter can also be a direct keycode without providing the help description +Reveal.addKeyBinding( 82, function() { + // reset timer +} ) +``` + +This allows plugins to add key bindings directly to Reveal so they can + +* make use of Reveal's pre-processing logic for key handling (for example, ignoring key presses when paused); and +* be included in the help overlay (optional) + ### Slide Changed Event A 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes. -- cgit v1.2.3 From 260f28792644055998c7237cf879ec2a9ffe857e Mon Sep 17 00:00:00 2001 From: Dougal J. Sutherland Date: Thu, 4 Jan 2018 20:09:01 +0000 Subject: optionally put the fragment in the URL --- README.md | 4 ++++ js/reveal.js | 32 +++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9d71472..9a2d516 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,10 @@ Reveal.initialize({ // Turns fragments on and off globally fragments: true, + // Flags whether to include the current fragment in the URL, + // so that reloading brings you to the same fragment position + fragmentInURL: false, + // Flags if the presentation is running in an embedded mode, // i.e. contained within a limited portion of the screen embedded: false, diff --git a/js/reveal.js b/js/reveal.js index f125c55..8edf66a 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -102,6 +102,10 @@ // Turns fragments on and off globally fragments: true, + // Flags whether to include the current fragment in the URL, + // so that reloading brings you to the same fragment position + fragmentInURL: false, + // Flags if the presentation is running in an embedded mode, // i.e. contained within a limited portion of the screen embedded: false, @@ -3709,10 +3713,14 @@ else { // Read the index components of the hash var h = parseInt( bits[0], 10 ) || 0, - v = parseInt( bits[1], 10 ) || 0; + v = parseInt( bits[1], 10 ) || 0, + f; + if( config.fragmentInURL ) { + f = parseInt( bits[2], 10 ) || undefined; + } - if( h !== indexh || v !== indexv ) { - slide( h, v ); + if( h !== indexh || v !== indexv || f !== undefined ) { + slide( h, v, f ); } } @@ -3745,14 +3753,21 @@ id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' ); } - // If the current slide has an ID, use that as a named link - if( typeof id === 'string' && id.length ) { + var indexf; + if( config.fragmentInURL ) { + indexf = getIndices().f; + } + + // If the current slide has an ID, use that as a named link, + // but we don't support named links with a fragment index + if( typeof id === 'string' && id.length && indexf === undefined ) { url = '/' + id; } // Otherwise use the /h/v index else { - if( indexh > 0 || indexv > 0 ) url += indexh; - if( indexv > 0 ) url += '/' + indexv; + if( indexh > 0 || indexv > 0 || indexf !== undefined ) url += indexh; + if( indexv > 0 || indexf !== undefined ) url += '/' + indexv; + if( indexf !== undefined ) url += '/' + indexf; } window.location.hash = url; @@ -4089,6 +4104,9 @@ updateControls(); updateProgress(); + if( config.fragmentInURL ) { + writeURL(); + } return !!( fragmentsShown.length || fragmentsHidden.length ); -- cgit v1.2.3 From de746bb64242820dc688b17f47935911ba7bfa86 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Thu, 25 Jan 2018 09:26:10 +0100 Subject: reorganize config options --- README.md | 8 +++++--- js/reveal.js | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 94726ab..0c77d0e 100644 --- a/README.md +++ b/README.md @@ -198,9 +198,6 @@ Reveal.initialize({ // Display a presentation progress bar progress: true, - // Set default timing of 2 minutes per slide - defaultTiming: 120, - // Display the page number of the current slide slideNumber: false, @@ -259,6 +256,11 @@ Reveal.initialize({ // Use this method for navigation when auto-sliding autoSlideMethod: Reveal.navigateNext, + // Specify the average time in seconds that you think you will spend + // presenting each slide. This is used to show a pacing timer in the + // speaker view + defaultTiming: 120, + // Enable slide navigation via mouse wheel mouseWheel: false, diff --git a/js/reveal.js b/js/reveal.js index 0120f31..c9fa9f1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -135,6 +135,11 @@ // Use this method for navigation when auto-sliding (defaults to navigateNext) autoSlideMethod: null, + // Specify the average time in seconds that you think you will spend + // presenting each slide. This is used to show a pacing timer in the + // speaker view + defaultTiming: null, + // Enable slide navigation via mouse wheel mouseWheel: false, -- cgit v1.2.3 From 8ff5fe4986a8f83a660c0f28a14e3542d986c884 Mon Sep 17 00:00:00 2001 From: craigsdennis Date: Fri, 16 Mar 2018 22:41:16 -0700 Subject: Updates copyright to 2018 --- Gruntfile.js | 4 ++-- LICENSE | 2 +- README.md | 2 +- css/reveal.css | 2 +- css/reveal.scss | 2 +- js/reveal.js | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/Gruntfile.js b/Gruntfile.js index ff7da2d..fc38abb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,7 +15,7 @@ module.exports = function(grunt) { ' * http://revealjs.com\n' + ' * MIT licensed\n' + ' *\n' + - ' * Copyright (C) 2017 Hakim El Hattab, http://hakim.se\n' + + ' * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n' + ' */' }, @@ -164,7 +164,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks( 'grunt-retire' ); grunt.loadNpmTasks( 'grunt-sass' ); grunt.loadNpmTasks( 'grunt-zip' ); - + // Default task grunt.registerTask( 'default', [ 'css', 'js' ] ); diff --git a/LICENSE b/LICENSE index c3e6e5f..1b8b5a7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2017 Hakim El Hattab, http://hakim.se, and reveal.js contributors +Copyright (C) 2018 Hakim El Hattab, http://hakim.se, and reveal.js contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index ad7d539..b7bbafc 100644 --- a/README.md +++ b/README.md @@ -1280,4 +1280,4 @@ Some reveal.js features, like external Markdown and speaker notes, require that MIT licensed -Copyright (C) 2017 Hakim El Hattab, http://hakim.se +Copyright (C) 2018 Hakim El Hattab, http://hakim.se diff --git a/css/reveal.css b/css/reveal.css index 3392753..d79024c 100644 --- a/css/reveal.css +++ b/css/reveal.css @@ -3,7 +3,7 @@ * http://revealjs.com * MIT licensed * - * Copyright (C) 2017 Hakim El Hattab, http://hakim.se + * Copyright (C) 2018 Hakim El Hattab, http://hakim.se */ /********************************************* * RESET STYLES diff --git a/css/reveal.scss b/css/reveal.scss index 1a87624..6fb5419 100644 --- a/css/reveal.scss +++ b/css/reveal.scss @@ -3,7 +3,7 @@ * http://revealjs.com * MIT licensed * - * Copyright (C) 2017 Hakim El Hattab, http://hakim.se + * Copyright (C) 2018 Hakim El Hattab, http://hakim.se */ diff --git a/js/reveal.js b/js/reveal.js index dcd09c7..e246db7 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3,7 +3,7 @@ * http://revealjs.com * MIT licensed * - * Copyright (C) 2017 Hakim El Hattab, http://hakim.se + * Copyright (C) 2018 Hakim El Hattab, http://hakim.se */ (function( root, factory ) { if( typeof define === 'function' && define.amd ) { @@ -300,7 +300,7 @@ 'F': 'Fullscreen', 'ESC, O': 'Slide overview' }, - + // Holds custom key code mappings registeredKeyBindings = {}; -- cgit v1.2.3