diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js
index 009267f1..07cccbdf 100644
--- a/build/js/ox.ui.js
+++ b/build/js/ox.ui.js
@@ -177,6 +177,7 @@ requires
}
function loadImages(callback) {
+ window.OxImageCache = [];
$.getJSON(oxui.path + 'json/ox.ui.images.json', function(data) {
var counter = 0,
length = data.length;
@@ -186,6 +187,7 @@ requires
image.onload = function() {
(++counter == length) && callback();
}
+ window.OxImageCache.push(image);
});
});
}
@@ -10718,6 +10720,103 @@ requires
};
+ Ox.Flipbook = function(options, self) {
+
+ var self = self || {},
+ frame = $('').css({
+ 'position': 'absolute',
+ 'width': '100%',
+ 'height': 'auto'
+ })
+ .hide(),
+ icon = $('').css({
+ 'position': 'absolute',
+ 'width': '100%',
+ 'height': 'auto'
+ }),
+ frames = {},
+ timestamp = $('
').css({
+ 'position': 'absolute',
+ 'text-align': 'center',
+ 'width': '100%',
+ })
+ .hide(),
+ that = new Ox.Element('div', self)
+ .defaults({
+ frames: {},
+ duration: 0,
+ icon: '',
+ })
+ .options(options || {})
+ .append(icon)
+ .append(frame)
+ .append(timestamp)
+ .mouseover(function() {
+ frame.show();
+ timestamp.show();
+ icon.hide();
+ })
+ .mousemove(function(event) {
+ var position = getPosition(event),
+ image = getFrame(position),
+ frameHeight = image.height;
+ frame.attr('src', image.src);
+ timestamp.html(Ox.formatDuration(position, 'short'));
+
+ var height = (that.height() - frameHeight)/2;
+ frame.css({'top': height + 'px'});
+ timestamp.css({'top': (frameHeight + height) + 'px'});
+ })
+ .mouseout(function() {
+ frame.hide();
+ timestamp.hide();
+ icon.show();
+ })
+ .mousedown(function(event) {
+ that.triggerEvent('click', {
+ 'position': getPosition(event)
+ });
+ });
+
+ function getPosition(event) {
+ var position = Math.floor(event.clientX - that.offset().left);
+ position = (position / that.width()) * self.options.duration;
+ return position;
+ }
+
+ function getFrame(position) {
+ var frame;
+ $.each(frames, function(i, img) {
+ if(!frame || i <= position)
+ frame = img;
+ });
+ return frame;
+ }
+
+ function cacheFrames() {
+ $.each(self.options.frames, function(i, src) {
+ frames[i] = new Image();
+ frames[i].onload = function() {
+ frameHeight = frames[i].height / frames[i].width * that.width();
+ }
+ frames[i].src = src;
+ });
+ }
+
+ self.onChange = function(key, value) {
+ if (key == 'frames') {
+ cacheFrames();
+ } else if (key == 'icon') {
+ icon.attr('src', value);
+ }
+ }
+
+ if(options.icon)
+ icon.attr('src', options.icon);
+ cacheFrames();
+ return that;
+ };
+
Ox.LargeTimeline = function(options, self) {
var self = self || {},