-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfooter.js
37 lines (37 loc) · 1.43 KB
/
footer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(
function(){
function addAll(){
var sections = document.querySelectorAll('section');
sections.forEach(addFooter);
}
function addFooter(currentSelector){
if (currentSelector.querySelectorAll('section').length > 0) return;
var numOfFooters = currentSelector.querySelectorAll('.foot').length
var spacer = document.createElement('div');
spacer.setAttribute('class', 'stretch');
var footer = document.createElement('div');
footer.setAttribute('class', 'foot');
var text = document.createTextNode(Reveal.getConfig().footer || '');
footer.appendChild(text);
if (numOfFooters==0){
var isTitleSlide = currentSelector.classList.contains('title-slide')
var wrappingDiv = document.createElement('div');
if (isTitleSlide){
wrappingDiv.setAttribute('class', 'stretch');
}
var i;
var initialNumOfChildren = currentSelector.children.length
for (i=0; i<initialNumOfChildren ;i++){
wrappingDiv.appendChild(currentSelector.children[0]);
}
currentSelector.appendChild(wrappingDiv);
if (!isTitleSlide){
currentSelector.appendChild(spacer);
}
currentSelector.appendChild(footer);
var state = Reveal.getState();
Reveal.setState( state );
}
}
addAll();
})()