vanillajs-deck/js/slide.js

39 lines
945 B
JavaScript
Raw Normal View History

2019-11-22 19:28:19 +00:00
export class Slide {
constructor(text) {
this._text = text;
this._html = document.createElement('div');
this._html.innerHTML = text;
this._title = this._html.querySelectorAll("title")[0].innerText;
2019-11-23 20:07:22 +00:00
const transition = this._html.querySelectorAll("transition");
if (transition.length) {
this._transition = transition[0].innerText;
}
else {
this._transition = null;
}
2019-11-22 19:28:19 +00:00
const hasNext = this._html.querySelectorAll("nextslide");
if (hasNext.length > 0) {
this._nextSlideName = hasNext[0].innerText;
}
else {
this._nextSlideName = null;
}
}
2019-11-23 20:07:22 +00:00
get transition() {
return this._transition;
}
2019-11-22 19:28:19 +00:00
get title() {
return this._title;
}
get html() {
return this._html;
}
get nextSlide() {
return this._nextSlideName;
}
}