diff --git a/lib/slide.js b/lib/slide.js index 2af967c..ecaf362 100644 --- a/lib/slide.js +++ b/lib/slide.js @@ -333,8 +333,10 @@ Slide.prototype.render = function(screen) { .then(contents => { /* put parse result into blessed box */ var boxes =[]; + var numPages = contents.length; contents.forEach((content, idx) => { - boxes.push(function(screen) { + boxes.push(function(screen, currPage) { + /* slide content page box */ var box = blessed.box({ top: 'center' , left: 'center' , width: '95%' @@ -349,14 +351,26 @@ Slide.prototype.render = function(screen) { , style: {invisible: true} , content: content}); screen.append(box); + /* slide page index box */ + var idxBox = blessed.box({ right: 5 + , bottom: 2 + , width: "6%" + , height: "5%" + , style: {invisible: true} + , content: currPage + 1 + '/' + numPages}); + screen.append(idxBox); + /* set fade in animate */ /* FIXME: current solution is bad */ setTimeout(() => { box.style.invisible = false; box.style.transparent = true; + idxBox.style.invisible = false; + idxBox.style.transparent = true; screen.render(); setTimeout(() => { box.style.transparent = false; + idxBox.style.transparent = false; screen.render(); }, 80); }, 100);