diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2016-04-13 15:26:06 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2016-04-13 15:26:06 +0200 |
commit | f0ee41a22d4030b63b06ce38328433fca6a8a6e2 (patch) | |
tree | e220bdcb0d6739fc8b21b5a2dffde74126b58891 /js/reveal.js | |
parent | 5dd90671507f8f56b27fe9d8a2fd25c1adb08d6b (diff) | |
parent | a63c8cab92932dfb71097b40092d3c7c7c5429c1 (diff) | |
download | fosdem-2018-presentation-f0ee41a22d4030b63b06ce38328433fca6a8a6e2.tar fosdem-2018-presentation-f0ee41a22d4030b63b06ce38328433fca6a8a6e2.tar.gz |
Merge branch '1549' of https://github.com/RopoMen/reveal.js into dev
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/js/reveal.js b/js/reveal.js index 96a6359..dbb227b 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -32,6 +32,7 @@ HORIZONTAL_SLIDES_SELECTOR = '.slides>section', VERTICAL_SLIDES_SELECTOR = '.slides>section.present>section', HOME_SLIDE_SELECTOR = '.slides>section:first-of-type', + UA = navigator.userAgent, // Configuration defaults, can be overridden at initialization time config = { @@ -201,6 +202,9 @@ // Client is a mobile device, see #checkCapabilities() isMobileDevice, + // Client is a desktop Chrome, see #checkCapabilities() + isChrome, + // Throttles mouse wheel navigation lastMouseWheelStep = 0, @@ -305,7 +309,8 @@ */ function checkCapabilities() { - isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( navigator.userAgent ); + isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( UA ); + isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA ); var testElement = document.createElement( 'div' ); @@ -328,13 +333,13 @@ // Transitions in the overview are disabled in desktop and // Safari due to lag - features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( navigator.userAgent ); + features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( UA ); // Flags if we should use zoom instead of transform to scale // up slides. Zoom produces crisper results but has a lot of // xbrowser quirks so we only use it in whitelsited browsers. features.zoom = 'zoom' in testElement.style && !isMobileDevice && - ( /chrome/i.test( navigator.userAgent ) || /Version\/[\d\.]+.*Safari/.test( navigator.userAgent ) ); + ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) ); } @@ -1052,7 +1057,7 @@ // Only support touch for Android, fixes double navigations in // stock browser - if( navigator.userAgent.match( /android/gi ) ) { + if( UA.match( /android/gi ) ) { pointerEvents = [ 'touchstart' ]; } @@ -4180,7 +4185,7 @@ } // There's a bug with swiping on some Android devices unless // the default action is always prevented - else if( navigator.userAgent.match( /android/gi ) ) { + else if( UA.match( /android/gi ) ) { event.preventDefault(); } |