forked from openlp/openlp
Added the text slide footer
This commit is contained in:
parent
6ea3ac875c
commit
4489feb935
@ -384,10 +384,11 @@ var Display = {
|
||||
/**
|
||||
* Add a slides. If the slide exists but the HTML is different, update the slide.
|
||||
* @param {string} verse - The verse number, e.g. "v1"
|
||||
* @param {string} html - The HTML for the verse, e.g. "line1<br>line2"
|
||||
* @param {string} text - The HTML for the verse, e.g. "line1<br>line2"
|
||||
* @param {string} footer_text - The HTML for the footer"
|
||||
* @param {bool} [reinit=true] - Re-initialize Reveal. Defaults to true.
|
||||
*/
|
||||
addTextSlide: function (verse, text) {
|
||||
addTextSlide: function (verse, text, footer_text) {
|
||||
var html = _prepareText(text);
|
||||
if (this._slides.hasOwnProperty(verse)) {
|
||||
var slide = $("#" + verse)[0];
|
||||
@ -403,11 +404,16 @@ var Display = {
|
||||
slidesDiv.appendChild(slide);
|
||||
var slides = $(".slides > section");
|
||||
this._slides[verse] = slides.length - 1;
|
||||
|
||||
console.debug(" footer_text: " + footer_text);
|
||||
|
||||
var footerDiv = $(".footer")[0];
|
||||
footerDiv.innerHTML = footer_text;
|
||||
}
|
||||
if ((arguments.length > 2) && (arguments[2] === true)) {
|
||||
if ((arguments.length > 3) && (arguments[3] === true)) {
|
||||
this.reinit();
|
||||
}
|
||||
else if (arguments.length == 2) {
|
||||
else if (arguments.length == 3) {
|
||||
this.reinit();
|
||||
}
|
||||
},
|
||||
@ -418,7 +424,7 @@ var Display = {
|
||||
setTextSlides: function (slides) {
|
||||
Display.clearSlides();
|
||||
slides.forEach(function (slide) {
|
||||
Display.addTextSlide(slide.verse, slide.text, false);
|
||||
Display.addTextSlide(slide.verse, slide.text, slide.footer, false);
|
||||
});
|
||||
Display.reinit();
|
||||
Display.goToSlide(0);
|
||||
@ -590,6 +596,8 @@ var Display = {
|
||||
blankToTheme: function () {
|
||||
var slidesDiv = $(".slides")[0];
|
||||
slidesDiv.style.visibility = "hidden";
|
||||
var footerDiv = $(".footer")[0];
|
||||
footerDiv.style.visibility = "hidden";
|
||||
if (Reveal.isPaused()) {
|
||||
Reveal.togglePause();
|
||||
}
|
||||
@ -600,6 +608,8 @@ var Display = {
|
||||
show: function () {
|
||||
var slidesDiv = $(".slides")[0];
|
||||
slidesDiv.style.visibility = "visible";
|
||||
var footerDiv = $(".footer")[0];
|
||||
footerDiv.style.visibility = "visible";
|
||||
if (Reveal.isPaused()) {
|
||||
Reveal.togglePause();
|
||||
}
|
||||
@ -733,6 +743,7 @@ var Display = {
|
||||
};
|
||||
footerStyle["position"] = "absolute";
|
||||
footerStyle["left"] = "" + theme.font_footer_x + "px";
|
||||
footerStyle["top"] = "" + theme.font_footer_y + "px";
|
||||
footerStyle["bottom"] = "" + (window.innerHeight - theme.font_footer_y - theme.font_footer_height) + "px";
|
||||
footerStyle["width"] = "" + theme.font_footer_width + "px";
|
||||
footerStyle["font-family"] = theme.font_footer_name;
|
||||
|
@ -713,7 +713,7 @@ class Renderer(RegistryBase, LogMixin, RegistryProperties, DisplayWindow):
|
||||
:param text: The text to check. It may contain HTML tags.
|
||||
"""
|
||||
self.clear_slides()
|
||||
self.run_javascript('Display.addTextSlide("v1", "{text}");'.format(text=text), is_sync=True)
|
||||
self.run_javascript('Display.addTextSlide("v1", "{text}", "Dummy Footer");'.format(text=text), is_sync=True)
|
||||
does_text_fits = self.run_javascript('Display.doesContentFit();', is_sync=True)
|
||||
return does_text_fits
|
||||
|
||||
|
@ -165,6 +165,7 @@ class ServiceItem(RegistryProperties):
|
||||
# the dict instead of rendering them again.
|
||||
previous_pages = {}
|
||||
index = 0
|
||||
self.foot_text = '<br>'.join([_f for _f in self.raw_footer if _f])
|
||||
for raw_slide in self.slides:
|
||||
verse_tag = raw_slide['verse']
|
||||
if verse_tag in previous_pages and previous_pages[verse_tag][0] == raw_slide:
|
||||
@ -177,6 +178,7 @@ class ServiceItem(RegistryProperties):
|
||||
'title': raw_slide['title'],
|
||||
'text': render_tags(page),
|
||||
'verse': index,
|
||||
'footer' : self.foot_text,
|
||||
}
|
||||
self._rendered_slides.append(rendered_slide)
|
||||
display_slide = {
|
||||
|
Loading…
Reference in New Issue
Block a user