Commit 12fc4747 authored by Oleg Roschupkin's avatar Oleg Roschupkin

Update onclick slide check to be more flexible.

parent 54a2d333
...@@ -81,17 +81,28 @@ ...@@ -81,17 +81,28 @@
} }
} }
function getContainingSlideId(el) {
var node = el;
while ('BODY' !== node.nodeName) {
if (-1 !== node.className.indexOf('slide')) {
return node.id;
} else {
node = node.parentNode;
}
}
return '';
}
function dispatchSingleSlideMode(e) { function dispatchSingleSlideMode(e) {
if ( var slideId = getContainingSlideId(e.target);
'SECTION' === e.target.nodeName &&
-1 !== e.target.parentNode.parentNode.className.indexOf('slide') && if ('' !== slideId && isSlideListMode()) {
isSlideListMode()
) {
e.preventDefault(); e.preventDefault();
// NOTE: we should update hash to get things work properly // NOTE: we should update hash to get things work properly
url.hash = '#' + e.target.parentNode.parentNode.id; url.hash = '#' + slideId;
history.replaceState(null, null, url.pathname + '?full#' + e.target.parentNode.parentNode.id); history.replaceState(null, null, url.pathname + '?full#' + slideId);
enterSingleSlideMode(); enterSingleSlideMode();
updateProgress(getCurrentSlideNumber()); updateProgress(getCurrentSlideNumber());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment