2
* Xibo - Digital Signage - http://www.xibo.org.uk
3
* Copyright (C) 2009-2014 Daniel Garner
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
xiboFinanceRender: function(options, items, body) {
28
"durationIsPerPage": false,
36
options = $.extend({}, defaults, options);
38
// Calculate the dimensions of this item based on the preview/original dimensions
39
var width = height = 0;
40
if (options.previewWidth === 0 || options.previewHeight === 0) {
41
width = options.originalWidth;
42
height = options.originalHeight;
44
width = options.previewWidth;
45
height = options.previewHeight;
48
if (options.scaleOverride !== 0) {
49
width = width / options.scaleOverride;
50
height = height / options.scaleOverride;
53
if (options.widgetDesignWidth > 0 && options.widgetDesignHeight > 0) {
54
options.widgetDesignWidth = options.widgetDesignWidth;
55
options.widgetDesignHeight = options.widgetDesignHeight;
56
width = options.widgetDesignWidth;
57
height = options.widgetDesignHeight;
60
// For each matched element
61
this.each(function() {
62
// How many pages to we need?
63
var numberOfPages = (options.numItems > options.maxItemsPerPage) ? Math.ceil(options.numItems / options.maxItemsPerPage) : 1;
69
for (var i = 0; i < numberOfPages; i++) {
70
itemsHTML += "<div class='page'>";
71
for (var j = 0; j < options.maxItemsPerPage; j++) {
72
if (((i * options.maxItemsPerPage) + j) < options.numItems)
73
itemsHTML += items[(i * options.maxItemsPerPage) + j];
78
mainHTML = mainHTML.replace('[itemsTemplate]', itemsHTML);
79
$("#content").append(mainHTML);
81
var duration = (options.durationIsPerPage) ? options.duration : options.duration / numberOfPages;
83
// Make sure the speed is something sensible
84
options.speed = (options.speed <= 200) ? 1000 : options.speed;
86
// Timeout is the duration in ms
87
var timeout = (duration * 1000) - (options.speed * 0.7);
89
var slides = (numberOfPages > 1) ? ".page" : ".item";
91
// Set the content div to the height of the original window
92
$("#cycle-container").css("height", height);
94
// Set the width on the cycled slides
95
$(slides, "#cycle-container").css({
100
// Cycle handles this for us
101
$("#cycle-container").cycle({
103
speed: options.speed,
105
slides: "> " + slides
108
// Protect against images that don't load
109
$(this).find("img").error(function() {
110
$(this).unbind("error").attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNiYAAAAAkAAxkR2eQAAAAASUVORK5CYII=");
b'\\ No newline at end of file'