remove legacy feature detection for <IE11

edit
Hakim El Hattab 2020-03-06 10:36:39 +01:00
parent d545d79cd7
commit 6ab65d4b8a
1 changed files with 4 additions and 77 deletions

View File

@ -243,9 +243,6 @@
// Enable slide navigation via mouse wheel // Enable slide navigation via mouse wheel
mouseWheel: false, mouseWheel: false,
// Apply a 3D roll to links on hover
rollingLinks: false,
// Opens links in an iframe preview overlay // Opens links in an iframe preview overlay
// Add `data-preview-link` and `data-preview-link="false"` to customise each link // Add `data-preview-link` and `data-preview-link="false"` to customise each link
// individually // individually
@ -436,6 +433,7 @@
checkCapabilities(); checkCapabilities();
/*
if( !features.transforms2d && !features.transforms3d ) { if( !features.transforms2d && !features.transforms3d ) {
document.body.setAttribute( 'class', 'no-transforms' ); document.body.setAttribute( 'class', 'no-transforms' );
@ -458,6 +456,7 @@
// using JavaScript to control the presentation // using JavaScript to control the presentation
return; return;
} }
*/
// Cache references to key DOM elements // Cache references to key DOM elements
dom.wrapper = document.querySelector( '.reveal' ); dom.wrapper = document.querySelector( '.reveal' );
@ -493,15 +492,6 @@
let testElement = document.createElement( 'div' ); let testElement = document.createElement( 'div' );
features.transforms3d = 'perspective' in testElement.style;
features.transforms2d = 'transform' in testElement.style;
features.canvas = !!document.createElement( 'canvas' ).getContext;
// Transitions in the overview are disabled in desktop and
// Safari due to lag
features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( UA );
// Flags if we should use zoom instead of transform to scale // Flags if we should use zoom instead of transform to scale
// up slides. Zoom produces crisper results but has a lot of // up slides. Zoom produces crisper results but has a lot of
// xbrowser quirks so we only use it in whitelsited browsers. // xbrowser quirks so we only use it in whitelsited browsers.
@ -1343,9 +1333,6 @@
// Remove the previously configured transition class // Remove the previously configured transition class
dom.wrapper.classList.remove( oldTransition ); dom.wrapper.classList.remove( oldTransition );
// Force linear transition based on browser capabilities
if( features.transforms3d === false ) config.transition = 'linear';
dom.wrapper.classList.add( config.transition ); dom.wrapper.classList.add( config.transition );
dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed ); dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed );
@ -1393,14 +1380,6 @@
document.removeEventListener( 'mousewheel', onDocumentMouseScroll, false ); document.removeEventListener( 'mousewheel', onDocumentMouseScroll, false );
} }
// Rolling 3D links
if( config.rollingLinks ) {
enableRollingLinks();
}
else {
disableRollingLinks();
}
// Auto-hide the mouse pointer when its inactive // Auto-hide the mouse pointer when its inactive
if( config.hideInactiveCursor ) { if( config.hideInactiveCursor ) {
document.addEventListener( 'mousemove', onDocumentCursorActive, false ); document.addEventListener( 'mousemove', onDocumentCursorActive, false );
@ -1442,7 +1421,7 @@
} }
// Generate auto-slide controls if needed // Generate auto-slide controls if needed
if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.requestAnimationFrame ) { if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable ) {
autoSlidePlayer = new Playback( dom.wrapper, function() { autoSlidePlayer = new Playback( dom.wrapper, function() {
return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 ); return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 );
} ); } );
@ -2009,50 +1988,6 @@
} }
/**
* Wrap all links in 3D goodness.
*/
function enableRollingLinks() {
if( features.transforms3d && !( 'msPerspective' in document.body.style ) ) {
var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a' );
for( var i = 0, len = anchors.length; i < len; i++ ) {
var anchor = anchors[i];
if( anchor.textContent && !anchor.querySelector( '*' ) && ( !anchor.className || !anchor.classList.contains( anchor, 'roll' ) ) ) {
var span = document.createElement('span');
span.setAttribute('data-title', anchor.text);
span.innerHTML = anchor.innerHTML;
anchor.classList.add( 'roll' );
anchor.innerHTML = '';
anchor.appendChild(span);
}
}
}
}
/**
* Unwrap all 3D links.
*/
function disableRollingLinks() {
var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a.roll' );
for( var i = 0, len = anchors.length; i < len; i++ ) {
var anchor = anchors[i];
var span = anchor.querySelector( 'span' );
if( span ) {
anchor.classList.remove( 'roll' );
anchor.innerHTML = span.innerHTML;
}
}
}
/** /**
* Bind preview frame links. * Bind preview frame links.
* *
@ -2459,13 +2394,6 @@
overview = true; overview = true;
dom.wrapper.classList.add( 'overview' ); dom.wrapper.classList.add( 'overview' );
dom.wrapper.classList.remove( 'overview-deactivating' );
if( features.overviewTransitions ) {
setTimeout( function() {
dom.wrapper.classList.add( 'overview-animated' );
}, 1 );
}
// Don't auto-slide while in overview mode // Don't auto-slide while in overview mode
cancelAutoSlide(); cancelAutoSlide();
@ -2574,7 +2502,6 @@
overview = false; overview = false;
dom.wrapper.classList.remove( 'overview' ); dom.wrapper.classList.remove( 'overview' );
dom.wrapper.classList.remove( 'overview-animated' );
// Temporarily add a class so that transitions can do different things // Temporarily add a class so that transitions can do different things
// depending on whether they are exiting/entering overview, or just // depending on whether they are exiting/entering overview, or just
@ -5974,7 +5901,7 @@
event.preventDefault && event.preventDefault(); event.preventDefault && event.preventDefault();
} }
// ESC or O key // ESC or O key
else if ( ( keyCode === 27 || keyCode === 79 ) && features.transforms3d ) { else if( keyCode === 27 || keyCode === 79 ) {
if( dom.overlay ) { if( dom.overlay ) {
closeOverlay(); closeOverlay();
} }