Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * cinematic fullscreen gallery
- * autoplayer with thumb-strip; json is optional
- *
- * dom input
- *
- * <div id="target" />
- * <ul>
- * <li data-json='{"foo":"myfoo","bar":"mybar"}'><a href"link/to/hires-image,jpg" /></li>
- * <li><a href"http://youtube.com/foo" /></li>
- * </ul>
- *
- * optional attributes:
- * data-json: create additional divs in decorontwerp with object.key as class-suffix
- * data-css-bioscoop: css conditions for animation between images
- *
- * dom output;
- *
- * <div id="target" class="tri4m-app-cinematic-bioscoop">
- * <div class="tri4m-app-cinematic-decorontwerp">
- * <img class="tri4m-app-cinematic-image" />
- * <div class="tri4m-app-cinematic-data">
- * <div class="tri4m-app-cinematic-data-foo">
- * <span>myfoo</span>
- * </div>
- * <div class="tri4m-app-cinematic-data-bar">
- * <span>mybar</span>
- * </div>
- * </div>
- * </div>
- * </div>
- * <div class="tri4m-ui-scrollroller-x tri4m-app-cinematics tri4m-ui-scrollroller">
- * <div class="tri4m-ui-scrollroller-wrapper">
- * <ul class="tri4m-app-cinematic-list tri4m-ui-scrollroller-list ui-helper-clearfix">
- * <li class="tri4m-ui-scrollroller-listitem tri4m-app-cinematic-resourceitem tri4m-app-cinematic-resourcehires-image tri4m-ui-scrollroller-listitem-active">
- * <img src="link/to/thumb-image.jpg" />
- * <a class="tri4m-app-cinematic-resourcelink" href="link/to/hires-image.jpg" />
- * <a class="tri4m-app-cinematic-resourcethumb" href="link/to/thumb-image.jpg" />
- * <div class="tri4m-app-cinematic-overlay" />
- * </li>
- * <li class="tri4m-ui-scrollroller-listitem tri4m-app-cinematic-resourceitem tri4m-app-cinematic-resourcehires-youtube tri4m-ui-scrollroller-listitem-active">
- * <img src="http://youtube.com/link/to/thumb-image.jpg" />
- * <a class="tri4m-app-cinematic-resourcelink" href="http://youtube.com/foo" />
- * <a class="tri4m-app-cinematic-resourcethumb" href="http://youtube.com/link/to/thumb-image.jpg" />
- * <div class="tri4m-app-cinematic-overlay" />
- * </li>
- * </ul>
- * </div>
- * </div>
- *
- * public api
- *
- * ul.tri4m-app-cinematic-list
- * tri4m.app.cinematic.container.insertItemAfter*
- * tri4m.app.cinematic.container.insertItemBefore*
- * tri4m.app.cinematic.container.appendItem
- * tri4m.app.cinematic.container.appendItems
- * tri4m.app.cinematic.container.prependItem*
- * tri4m.app.cinematic.container.prependItems*
- * tri4m.app.cinematic.container.removeItem
- * tri4m.app.cinematic.container.nextItem
- * tri4m.app.cinematic.container.firstItem
- * tri4m.app.cinematic.container.prevItem
- * tri4m.app.cinematic.container.play
- * tri4m.app.cinematic.container.stop
- * tri4m.app.cinematic.container.prev
- * tri4m.app.cinematic.container.next
- *
- * ul.tri4m-app-cinematic-list li.tri4m-app-cinematic-resourceitem
- * click
- * mouseover
- * mouseout
- * tri4m.app.cinematic.listitem.activate
- * tri4m.app.cinematic.listitem.deactivate
- *
- * ul.tri4m-app-cinematic-list li.tri4m-app-cinematic-resourceitem a.tri4m-app-cinematic-resourcelink
- * tri4m.app.cinematic.reslink.preloadImage
- *
- * ul.tri4m-app-cinematic-list li.tri4m-app-cinematic-resourceitem img.tri4m-app-cinematic-resourcethumb
- * tri4m.app.cinematic.thumblink.preloadImage
- *
- * ul.tri4m-app-cinematic-list li.tri4m-app-cinematic-resourceitem div.tri4m-app-cinematic-overlay
- * tri4m.app.cinematic.listitem.overlay.show
- * tri4m.app.cinematic.listitem.overlay.hide
- * tri4m.app.cinematic.listitem.overlay.activate
- * tri4m.app.cinematic.listitem.overlay.complete
- *
- * div.tri4m-app-cinematic-bioscoop div.tri4m-app-cinematic-decorontwerp
- * tri4m.app.cinematic.data.show
- * tri4m.app.cinematic.data.hide
- *
- * window
- * resize.resolutionchange
- *
- *
- *
- * @todo pagination not working for append.items correctly
- *
- * static
- * sequence 1 0,1,2
- * sequence 2 3,4,5
- * sequence 3 6
- *
- * dynamic
- * sequence 1 7,8,9
- * sequence 2 10
- *
- *
- *
- * expected
- * sequence 1 0,1,2
- * sequence 2 3,4,5
- * sequence 3 6
- * sequence 4 7,8,9
- * sequence 5 10
- *
- * actual
- * sequence 1 0,1,2
- * sequence 2 3,4,5
- * sequence 3 6,7,8,9
- * sequence 4 10
- *
- *
- */
- cinematic : function(__SELF, SETTINGS)
- {
- var regName = 'app-cinematic',
- log =
- {
- n : function(t, l)
- {
- $.tri4m.log('tri4m.app.cinematic: ' + t, l);
- },
- t : function(t, l)
- {
- log.n('trigger: ' + t, l);
- },
- t107 : function(t, l)
- {
- log.t('preload-cinematic-thumb:' + t, l);
- },
- t108 : function(t, l)
- {
- log.t('preload-cinematic-image:' + t, l);
- },
- t109 : function(t, l)
- {
- log.t('-- event: ' + t, l);
- },
- t110 : function(t, l)
- {
- log.t('-- callback: ' + t, l);
- },
- t111 : function(t, l)
- {
- log.t('-- push: ' + t, l);
- }
- },
- __settings = jQuery.extend
- (
- true,
- {
- bioscoop : null, // id or $(target)
- timer : null, // id or $(target)
- autoplay :
- {
- enabled : true,
- interval : 10000,
- autostart : true
- },
- usekeys : true,
- thumbs :
- {
- preloadPerQueue : 5, // split queue in sequences; 0 = disabled; default: 5
- enabled : true, // false: bypass thumbs; default: true
- preloadAllBeforeShow : true, // false: display; true: fetch -> display; default: true
- asCssBackgroundImage : false // false: img-tag; default: false
- },
- images :
- {
- asCssBackgroundImage : false, // false: img-tag; default: false
- scaleAsInlineObject : true // true: resize Image by next parent props; false: by window; default: true
- },
- callback :
- {
- thumbs :
- {
- ready : function(list) { log.t110('thumbs.ready: ' + ILLI.fn.o2s(list)); },
- beforeShow : function(item, index) { log.t110('thumbs.beforeShow: index ' + index); },
- afterShow : function(item, index) { log.t110('thumbs.afterShow: index ' + index); }
- },
- images :
- {
- firstInit : function() { log.t110('images.firstInit'); },
- beforeShow : function() { log.t110('images.beforeShow'); },
- afterShow : function() { log.t110('images.afterShow'); }
- }
- },
- loader :
- {
- lines : 16,
- length : 50,
- width : 1,
- radius : 40,
- rotate : 0,
- color : '#00FF1A',
- speed : 1.9,
- trail : 100,
- shadow : false,
- hwaccel : true,
- className : 'ddlsl',
- zIndex : -1,//2e9,
- top : 0,
- left : 'auto'
- }
- },
- SETTINGS
- ),
- __instance = function(element)
- {
- var _element = element, _queue = [], _removed = [], _reg = {}, _bnd = {},
- _pagination =
- {
- perQueue : __settings.thumbs.preloadPerQueue,
- curQueue : 0,
- maxQueues : 0,
- startItem : 0,
- curItem : 0,
- length : 0,
- sliced : [],
- last : true
- },
- _c =
- {
- w : function()
- {
- var p = {width: $(window).width(), height: $(window).height()};
- return p;
- },
- t : function(t)
- {
- var p = {width: 0, height: 0};
- if(t.innerWidth() > 0)
- {
- p.width = t.innerWidth();
- }
- else
- if(t.innerWidth() === 0
- && t.parent().innerWidth() > 0)
- {
- p.width = t.parent().innerWidth();
- }
- if(t.innerHeight() > 0)
- {
- p.height = t.innerHeight();
- }
- else
- if(t.innerHeight() === 0
- && t.parent().innerHeight() > 0)
- {
- p.height = t.parent().innerHeight();
- }
- return p;
- },
- o : function(t)
- {
- var p = {width: 0, height: 0}, w = _c.w(), t = _c.t(t);
- p.width = (t.width === 0) ? w.width : t.width;
- p.height = (t.height === 0) ? w.height : t.height;
- if(true === __settings.images.scaleAsInlineObject)
- {
- return t;
- }
- return p;
- },
- p : function(iw, ih, ir, w, ww, wh, wr)
- {
- var p = {width: 0, height: 0, left: 0, top: 0};
- if(wr > ir)
- {
- p.width = Math.round(wh/ir);
- p.height = wh;
- }
- else
- {
- if($('body.fit-images').size())
- {
- // allways fit
- var j = wh / ih;
- p.width = Math.round(iw * j);
- p.height = wh;
- }
- else
- {
- if(ir > 1 || ir == 1)
- {
- // portrait
- var j = wh / ih;
- p.width = Math.round(iw * j);
- p.height = wh;
- }
- else
- {
- // landscape
- p.height = Math.round( ww * ir );
- p.width = ww;
- }
- }
- }
- p.left = Math.round((ww - p.width) / 2);
- p.top = Math.round((wh - p.height) / 2);
- return p;
- },
- i : function(image, target)
- {
- if(typeof image !== 'object'
- || typeof image.width === 'undefined'
- || typeof image.height === 'undefined') return p;
- var iw = image.width, ih = image.height, ir = ih / iw,
- w = (true === __settings.images.scaleAsInlineObject) ? _c.t(target) : _c.w(),
- ww = w.width, wh = w.height, wr = wh / ww;
- return _c.p(iw, ih, ir, w, ww, wh, wr);
- },
- l : function(image, target)
- {
- if(typeof image !== 'object'
- || typeof image.width === 'undefined'
- || typeof image.height === 'undefined') return p;
- var iw = image.width, ih = image.height, ir = ih / iw,
- w = _c.t(target), ww = (w.width === 0) ? image.width : w.width,
- wh = (w.height === 0) ? image.height : w.height, wr = wh / ww;
- return _c.p(iw, ih, ir, w, ww, wh, wr);
- },
- f : function(frame, target)
- {
- var p = {width: 0, height: 0, left: 0, top: 0};
- var c = _c.o(target);
- p.width = c.width;
- p.height = c.height;
- return p;
- }
- },
- _j =
- {
- __isw : false,
- window : function()
- {
- var d = _reg.j.get('d'), wait = setInterval(function()
- {
- clearInterval(wait);
- _j.__isw = false;
- d.find('img:visible')
- .each(function()
- {
- $(this).animate(_c.i(
- {
- width : $(this).width(),
- height : $(this).height()
- }, d), 500, 'easeOutCubic');
- });
- d.find('iframe')
- .each(function()
- {
- var p = _c.f(
- {
- width : $(this).width(),
- height : $(this).height()
- }, d);
- $(this).animate(
- {
- width : p.width,
- height : p.height
- }, 500, 'easeOutCubic', function()
- {
- $(this)
- .attr('width', $(this).width())
- .attr('height', $(this).height());
- });
- });
- }, 600);
- if(true === _j.__isw)
- clearInterval(wait);
- _j.__isw = true;
- }
- },
- _sequency = function(arr)
- {
- _pagination.length = _pagination.sliced.length + _pagination.length;
- _pagination.maxQueues = Math.ceil(_pagination.length / _pagination.perQueue);
- _pagination.startItem = Math.ceil((_pagination.curQueue - 1) * _pagination.perQueue);
- _pagination.sliced = arr.slice(_pagination.startItem, _pagination.perQueue);
- log.t107(' -- paginas: ' + ILLI.fn.o2s(_pagination), 1);
- },
- _update = function()
- {
- var __i = 'li', __a = 'a', _a = '<a />', __d = 'div', _d = '<div />';
- var sequence = function()
- {
- log.t107(' -- sequence: ' + _pagination.curQueue, 1);
- if(false === _reg.j.isset('x'))
- {
- log.t107(' -- sequence: -- nothing to do');
- return;
- }
- if(_reg.j.get('x').length === 0 || typeof _reg.j.get('x').length === 'undefined')
- {
- log.t107(' -- sequence: -- nothing to do');
- return;
- }
- _sequency(_reg.j.get('x'));
- _pagination.curQueue++;
- log.t107(' -- sequence: ' + _pagination.curQueue + ', x =' + ILLI.fn.o2s(_reg.j.get('x')));
- var arr = [], attr = [];
- _pagination.last = false;
- _reg.j.get('x').each(function(index)
- {
- if(index < _pagination.perQueue)
- {
- $(this).removeClass('tri4m-app-cinematic-resourceitem-insert');
- var a = {};
- $.each(this.attributes, function(i, attrib){
- var name = attrib.name;
- var value = attrib.value;
- a[name] = value;
- });
- attr[index] = a;
- arr[index] = $(this).html();
- }
- });
- _reg.j.get('x').each(function(index)
- {
- if(index < _pagination.perQueue)
- {
- log.t107('sequence: ' + _pagination.curQueue + ', splice ' + index + ' with 0,1 for ' + _pagination.perQueue);
- _reg.j.get('x').splice(0, 1);
- }
- });
- if(_reg.j.get('x').length === 0)
- {
- _pagination.curQueue = 0;
- _pagination.maxQueues = 0;
- _pagination.startItem = 0;
- _pagination.curItem = 0;
- //_pagination.sliced = [];
- _pagination.last = true;
- }
- log.t107('sequence: ' + _pagination.curQueue + ', x = ' + ILLI.fn.o2s(_reg.j.get('x')));
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.appendItems', [arr]);
- $(__i + '.tri4m-ui-scrollroller-listitem-insert', _reg.j.get('l')).each(function(index)
- {
- if(typeof attr[index] !== 'undefined')
- {
- for(var i in attr[index])
- {
- $(this).attr(i, attr[index][i]);
- }
- }
- });
- $(__i, _reg.j.get('l')).removeClass('tri4m-ui-scrollroller-listitem-insert');
- };
- sequence();
- var i = $(__i, _reg.j.get('l')), a = $(__a + ':eq(0)', i),
- ba = _bnd.a.toValueObject(), bi = _bnd.i.toValueObject(), bt = _bnd.t.toValueObject(), bo = _bnd.o.toValueObject();
- _reg.j.set('a', a);
- _reg.j.set('i', i);
- _reg.j.get('a').addClass('tri4m-app-cinematic-resourcelink').hide();
- _reg.j.get('i').addClass('tri4m-app-cinematic-resourceitem');
- a.each(function(index)
- {
- for(var i in ba) $(this).unbind(i).bind(i, ba[i]);
- });
- i.each(function(index)
- {
- var t = $(this);
- t.addClass('tri4m-app-cinematic-resourceitem');
- //t.trigger('mouseout');
- for(var i in bi) t.unbind(i).bind(i, bi[i]);
- var it = $(this).find(__a + '.tri4m-app-cinematic-resourcethumb').eq(0);
- if(it.length === 0) t.append($(_a).addClass('tri4m-app-cinematic-resourcethumb').hide());
- var ol = $(this).find(__d + '.tri4m-app-cinematic-overlay').eq(0);
- if(ol.length === 0) t.append($(_d).addClass('tri4m-app-cinematic-overlay'));
- var ds = t.data(_reg.n.get('dos')), dd = {}; dd.i = index;
- if(typeof ds === 'undefined')
- {
- dd.locked = false;
- t.data(_reg.n.get('dos'), dd);
- ds = dd;
- }
- dij = t.data(_reg.n.get('dij'));
- if(typeof dij === 'undefined')
- {
- var json = t.attr('data-json'), data = {};
- if(json !== '') { try{ data = $.parseJSON(json); } catch(e){} }
- t.data(_reg.n.get('dij'), data).attr('data-json', null);
- }
- dob = t.data(_reg.n.get('dob'));
- if(typeof dob === 'undefined')
- {
- var json = t.attr('data-css-bioscoop'), data = {};
- if(json !== '') { try{ data = $.parseJSON(json); } catch(e){} }
- t.data(_reg.n.get('dob'), data).attr('data-css-bioscoop', null);
- }
- });
- _reg.j.set('t', $(__a + '.tri4m-app-cinematic-resourcethumb', i), false);
- _reg.j.get('t').each(function(index)
- {
- var t = $(this);
- for(var i in bt) t.unbind(i).bind(i, bt[i]);
- var ds = t.data(_reg.n.get('dts')), dd = {}; dd.i = index;
- if(typeof ds === 'undefined')
- {
- ds = dd;
- t.data(_reg.n.get('dts'), dd);
- }
- if(typeof ds.qs === 'undefined')
- t.trigger('tri4m.app.cinematic.thumblink.preloadImage', [(true === _reg.j.isset('x') && _reg.j.get('x').length > 0 ? _update : null)]);
- });
- _reg.j.set('o', $(__d + '.tri4m-app-cinematic-overlay', i), false);
- _reg.j.get('o').each(function(index)
- {
- var t = $(this);
- /*
- var ds = t.data(_reg.n.get('dos')), dd = {}; dd.i = index;
- if(typeof ds === 'undefined')
- {
- dd.locked = false;
- t.data(_reg.n.get('dos'), dd);
- ds = dd;
- }
- */
- for(var i in bo) t.unbind(i).bind(i, bo[i]);
- });
- },
- _d =
- {
- ii : function(index, src, callback)
- {
- if(typeof src === 'undefined') return;
- var i = $('<a href="' + src + '" />').addClass('tri4m-app-cinematic-resourceitem-insert');
- if(typeof index === 'undefined' || index === null)
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.appendItem', [i]);
- _update();
- if(typeof callback === 'function')
- callback();
- },
- ia : function(index, srcArr, callback)
- {
- log.t111(ILLI.fn.o2s(srcArr), 1);
- if(typeof srcArr === 'undefined') return;
- var c = new Array(), __i = 'li';
- for(var i in srcArr)
- {
- var a = $('<a href="' + srcArr[i] + '" />').addClass('tri4m-app-cinematic-resourceitem-insert');
- //var d = $('<div />').addClass('tri4m-app-cinematic-overlay');
- //var j = $(d).add(a);
- c[i] = a;
- }
- if(typeof index === 'undefined' || index === null)
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.appendItems', [c]);
- if(_pagination.perQueue > 0)
- {
- log.t111(' -- x.length was ' + _reg.j.get('x').length, 1);
- _reg.j.set('x', $(__i + '.tri4m-ui-scrollroller-listitem-insert', _reg.j.get('l')));
- $(__i + '.tri4m-ui-scrollroller-listitem-insert', _reg.j.get('l')).remove();
- log.t111(' -- x.length is now ' + _reg.j.get('x').length, 1);
- }
- _update();
- if(typeof callback === 'function')
- callback();
- }
- },
- _dom = function()
- {
- var j = _reg.j, _d = '<div />', _l = '<ul />',
- _b = (typeof __settings.bioscoop === 'string') ? $('#' + __settings.bioscoop) : __settings.bioscoop,
- __d = 'div', __i = 'li', __a = 'a', _a = '<a />', __l = 'ul',
- d = _b.find(__d).eq(0),
- l = _element.find(__l).eq(0); // 0: cur is ul
- j.register('b', _b, true);
- j.register('d', ((d.length === 0) ? $(_d).appendTo(j.get('b')) : d), true);
- j.register('l', ((l.length === 0) ? $(_element).wrap(_d) : l), false);
- j.register('c', j.get('l').parent());
- j.register('x', {}, false);
- j.register('i', $(__i, _reg.j.get('l')), false);
- j.register('a', $(__a, _reg.j.get('l')), false);
- j.register('t', $(__a + '.tri4m-app-cinematic-resourcethumb', _reg.j.get('i')), false);
- j.register('o', $(__d + '.tri4m-app-cinematic-overlay', _reg.j.get('i')), false);
- j.register('j', $(_d).addClass('tri4m-app-cinematic-data').css({opacity : 0}));
- j.get('c').addClass('tri4m-ui-scrollroller-x tri4m-app-cinematics')
- j.get('l').addClass('tri4m-app-cinematic-list');
- j.get('b').addClass('tri4m-app-cinematic-bioscoop').append($(_d).addClass('tri4m-app-cinematic-doek'));
- j.get('d').addClass('tri4m-app-cinematic-decorontwerp')
- .css({overflow: 'hidden'})
- .data(_reg.n.get('dcs'), { initialized : false });
- if(_pagination.perQueue > 0)
- {
- _reg.j.set('x', $(__i, _reg.j.get('l')));
- $(__i, _reg.j.get('l')).remove();
- }
- $.tri4m.global.__PROTO__.__TRI4M__.__LAYOUT__.__SCROLLROLLER__(j.get('c'),
- {
- sensitive: true,
- easing :
- {
- duration : 400,
- callback :
- {
- item :
- {
- deactivate : function(e)
- {
- $(this).trigger('tri4m.ui.scrollroller.container.activateFirst');
- }
- }
- }
- }
- });
- if(true === __settings.autoplay.enabled)
- $.tri4m.global.__PROTO__.__TRI4M__.__LAYOUT__.__TIMER__(_reg.j.get('c'),
- {
- timer : __settings.timer,
- autostart : __settings.autoplay.autostart,
- interval : __settings.autoplay.interval,
- methods :
- {
- action : _bnd.l.get('tri4m.app.cinematic.container.nextItem')
- }
- });
- },
- _type = function(src)
- {
- var type = null;
- if(src.match(/png/i))
- {
- log.t108('try load: PNG ' + src);
- type = 'png';
- }
- else
- if(src.match(/jpg/i))
- {
- log.t108('try load: JPG ' + src);
- type = 'jpg';
- }
- else
- if(src.match(/gif/i))
- {
- log.t108('try load: GIF ' + src);
- type = 'gif';
- }
- else
- if(src.match(/flv/i))
- {
- log.t108('try load: FLV ' + src);
- type = 'flv';
- }
- else
- if(src.match(/mp3/i))
- {
- log.t108('try load: MP3 ' + src);
- type = 'mp3';
- }
- else
- if(src.match(/avi/i))
- {
- log.t108('try load: AVI ' + src);
- type = 'avi';
- }
- else
- if(src.match(/youtu/i))
- {
- log.t108('try load: YOUTUBE ' + src);
- type = 'youtube';
- }
- else
- {
- log.t108('try load: unknown source ' + src);
- }
- return type;
- },
- _ctrl =
- {
- onActivation : function(scrollrollerItem)
- {
- var l = scrollrollerItem.parent().data('tri4m.ui.scrollroller.listitem.state'),
- i = scrollrollerItem.data('tri4m.ui.scrollroller.listitem.state');
- if(typeof l !== 'undefined')
- {
- if(typeof l.ai !== 'undefined')
- {
- l.ai.trigger('tri4m.app.cinematic.listitem.deactivate');
- }
- }
- //_reg.j.get('c').trigger('tri4m.data.timer.container.stop');
- scrollrollerItem.parent().data('tri4m.ui.scrollroller.listitem.state', {ai : scrollrollerItem});
- scrollrollerItem.trigger('tri4m.app.cinematic.listitem.activate');
- scrollrollerItem.find('a.tri4m-app-cinematic-resourcelink:eq(0)').trigger('tri4m.app.cinematic.reslink.preloadImage', [function()
- {
- _reg.j.get('c').trigger('tri4m.data.timer.container.run');
- }]);
- }
- };
- (function()
- {
- _reg.j = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _reg.n = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.a = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.t = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.i = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.l = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.r = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.o = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _bnd.d = new $.tri4m.global.__CLASS__.__VARIABLE__.__REGISTRY__();
- _reg.n.register('dcs', 'tri4m.app.cinematic.state');
- _reg.n.register('dts', 'tri4m.app.cinematic.thumbstate');
- _reg.n.register('dos', 'tri4m.app.cinematic.overlaystate');
- _reg.n.register('dij', 'tri4m.app.cinematic.json');
- _reg.n.register('dob', 'tri4m.app.cinematic.css.bioscoop');
- _reg.n.register('dcb', 'tri4m.app.cinematic.cache.css.bioscoop');
- _bnd.o
- .register('tri4m.app.cinematic.listitem.overlay.show', function(e, a, c)
- {
- log.t109('tri4m.app.cinematic.listitem.overlay.show', 1);
- var t = $(this), o = (a && a > 0 && a < 1) ? a : 1,
- ds = t.parent().data(_reg.n.get('dos'));
- if(false === ds.locked)
- {
- t.stop().animate({opacity: 0.5}, 500, 'easeOutQuad');
- $('img', t.parent()).stop().animate({opacity: 0.4}, 500, 'easeOutQuad');
- }
- })
- .register('tri4m.app.cinematic.listitem.overlay.hide', function(e, a, c)
- {
- log.t109('tri4m.app.cinematic.listitem.overlay.hide', 1);
- var t = $(this), o = (a && a > 0 && a < 1) ? a : 0, h = 0,
- ds = t.parent().data(_reg.n.get('dos'));
- if(false === ds.locked)
- {
- /*
- $('img', t.parent()).stop().animate({opacity: 0.7}, 50, 'easeOutQuad');
- t.stop().animate({opacity: 0}, 50, 'easeOutQuad', function()
- {
- //$(this).css({height: h});
- });
- */
- t.stop().css({opacity: 0});
- $('img', t.parent()).stop().css({opacity: 0.7});
- }
- })
- .register('tri4m.app.cinematic.listitem.overlay.activate', function(e, a, c)
- {
- log.t109('tri4m.app.cinematic.listitem.overlay.loading', 1);
- var t = $(this), o = (a && a > 0 && a < 1) ? a : 0, h = 0,
- ds = t.parent().data(_reg.n.get('dos'));
- if(false === ds.locked)
- {
- $('img', t.parent()).stop().animate({opacity: 1}, 500, 'easeOutQuad');
- t.stop().animate({opacity: 0}, 500, 'easeOutQuad', function()
- {
- //$(this).css({height: h});
- });
- }
- })
- .register('tri4m.app.cinematic.listitem.overlay.complete', function(e, a, c)
- {
- log.t109('tri4m.app.cinematic.listitem.overlay.complete', 1);
- var t = $(this);
- $('img', t.parent()).stop().animate({opacity: 0.8}, 800, 'easeOutQuad');
- t.stop().animate({opacity: 0.3}, 800, 'easeOutQuad');
- });
- _bnd.d
- .register('tri4m.app.cinematic.data.show', function(e, c)
- {
- log.t109('tri4m.app.cinematic.data.show', 1);
- var t = $(this);
- t.animate({opacity : 0.7}, 2500, c);
- })
- .register('tri4m.app.cinematic.data.hide', function(e, c)
- {
- log.t109('tri4m.app.cinematic.data.hide', 1);
- var t = $(this);
- var b = t.css('bottom');
- t.animate({opacity : 0, bottom : parseInt(t.css('bottom'), 10) + 50}, 200, 'easeOutQuad', function()
- {
- $(this).css({bottom : b});
- if(typeof c === 'function') c();
- });
- });
- _bnd.i
- .register('click', function()
- {
- log.t109('tri4m.app.cinematic.listitem.click', 1);
- var t = $(this);
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.stop');
- t.trigger('tri4m.ui.scrollroller.listitem.activate', [_ctrl.onActivation]);
- })
- .register('mouseover', function()
- {
- log.t109('tri4m.app.cinematic.listitem.mouseenter', 1);
- var t = $(this);
- t.find('div.tri4m-app-cinematic-overlay:eq(0)').trigger('tri4m.app.cinematic.listitem.overlay.hide');
- })
- .register('mouseout', function()
- {
- log.t109('tri4m.app.cinematic.listitem.mouseleave', 1);
- var t = $(this);
- t.find('div.tri4m-app-cinematic-overlay:eq(0)').trigger('tri4m.app.cinematic.listitem.overlay.show');
- })
- .register('tri4m.app.cinematic.listitem.activate', function()
- {
- log.t109('tri4m.app.cinematic.listitem.activate', 1);
- var t = $(this), ds = t.data(_reg.n.get('dos'));
- t.find('div.tri4m-app-cinematic-overlay:eq(0)').trigger('tri4m.app.cinematic.listitem.overlay.activate');
- ds.locked = true; t.data(_reg.n.get('dos'), ds);
- })
- .register('tri4m.app.cinematic.listitem.deactivate', function()
- {
- log.t109('tri4m.app.cinematic.listitem.deactivate', 1);
- var t = $(this), ds = t.data(_reg.n.get('dos'));
- ds.locked = false; t.data(_reg.n.get('dos'), ds);
- t.find('div.tri4m-app-cinematic-overlay:eq(0)').trigger('tri4m.app.cinematic.listitem.overlay.show');
- });
- _bnd.l
- .register('tri4m.app.cinematic.container.insertItemAfter', function(e, i, c)
- {
- log.t109('tri4m.app.cinematic.container.insertItemAfter', 1);
- }, true)
- .register('tri4m.app.cinematic.container.insertItemBefore', function(e, i, c)
- {
- log.t109('tri4m.app.cinematic.container.insertItemBefore', 1);
- }, true)
- .register('tri4m.app.cinematic.container.appendItem', function(e, imgSrc, c)
- {
- log.t109('tri4m.app.cinematic.container.appendItem', 1);
- _d.ii(null, imgSrc, c);
- }, true)
- .register('tri4m.app.cinematic.container.appendItems', function(e, imgSrcArray, c)
- {
- log.t109('tri4m.app.cinematic.container.appendItems' + ILLI.fn.o2s(imgSrcArray), 1);
- _d.ia(null, imgSrcArray, c);
- }, true)
- .register('tri4m.app.cinematic.container.prependItem', function(e, i, item, c)
- {
- log.t109('tri4m.app.cinematic.container.prependItems', 1);
- }, true)
- .register('tri4m.app.cinematic.container.prependItems', function(e, i, itemArray, c)
- {
- log.t109('tri4m.app.cinematic.container.prependItems', 1);
- }, true)
- .register('tri4m.app.cinematic.container.removeItem', function(e, i, c)
- {
- log.t109('tri4m.app.cinematic.container.removeItem', 1);
- var t = $(e.target);
- t.trigger('click');
- t.trigger('tri4m.ui.scrollroller.container.removeItem', [i, function()
- {
- t.trigger('tri4m.app.cinematic.container.nextItem');
- }]);
- }, true)
- .register('tri4m.app.cinematic.container.nextItem', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.nextItem', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.activateNextOrFirst', [_ctrl.onActivation]);
- }, true)
- .register('tri4m.app.cinematic.container.firstItem', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.firstItem', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.activateFirst', [_ctrl.onActivation]);
- }, true)
- .register('tri4m.app.cinematic.container.prevItem', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.prevItem', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.activatePrevOrLast', [_ctrl.onActivation]);
- }, true)
- .register('tri4m.app.cinematic.container.play', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.play', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.container.play');
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.nextItem');
- }, true)
- .register('tri4m.app.cinematic.container.stop', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.stop', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.container.stop');
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- }, true)
- .register('tri4m.app.cinematic.container.prev', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.prev', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.container.stop');
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.prevItem');
- }, true)
- .register('tri4m.app.cinematic.container.next', function(e, c)
- {
- log.t109('tri4m.app.cinematic.container.next', 1);
- _reg.j.get('c').trigger('tri4m.data.timer.container.stop');
- _reg.j.get('c').trigger('tri4m.data.timer.bar.reset');
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.nextItem');
- }, true);
- _bnd.t
- .register('tri4m.app.cinematic.thumblink.preloadImage', function(e, c)
- {
- log.t109('tri4m.app.cinematic.thumblink.preloadImage', 1);
- if(typeof ILLI === 'undefined')
- {
- $(this).parent().prepend('<span>where is ILLI?</span>');
- log.t107('ILLI is undefined (required for thumb-url)', 3);
- return;
- }
- var t = $(this), p = t.parent().css({opacity : 0}),
- i = parseInt(t.data(_reg.n.get('dts')).i, 10), href = $('a.tri4m-app-cinematic-resourcelink', p).attr('href'),
- ds = t.data(_reg.n.get('dts')),
- c = c;
- log.t107('init ' + i);
- if(typeof _queue[i] === 'undefined')
- {
- log.t107('push to queue ' + i);
- _queue[i] =
- {
- status : false,
- error : false,
- append : false,
- kicked : false,
- lookup : null,
- islooking : false,
- attempt : 0,
- thumb : t,
- parent : p,
- src : null,
- image : $('<img />').addClass('tri4m-app-cinematic-thumbnail'),
- props : {}
- };
- }
- if(_queue[i].status === true)
- {
- log.t107(' -- nothing to do ' + i);
- return;
- }
- ds.qs = _queue[i];
- t.data(_reg.n.get('dts'), ds);
- var islast = (_queue.length === _reg.j.get('t').length), isfirst = (i === 0),
- shutdown =
- {
- dts : function(i)
- {
- var ds = _queue[i].thumb.data(_reg.n.get('dts'));
- ds.qs = _queue[i];
- _queue[i].append = true;
- _queue[i].status = true;
- _queue[i].thumb.data(_reg.n.get('dts'), ds);
- },
- cbs : function(i)
- {
- __settings.callback.thumbs.beforeShow(_queue[i].parent, i);
- _queue[i].thumb.trigger('mouseout');
- },
- spl : function()
- {
- },
- vis : function(i)
- {
- /*
- provide width:auto
- t.id (width) in scrollroller-update returns 0 on init if the list.-item-width has no defination in css.
- execute it again to calculate the new container with
- */
- _reg.j.get('l').trigger('tri4m.ui.scrollroller.container.update');
- if(__settings.thumbs.asCssBackgroundImage === false)
- {
- }
- else
- {
- }
- _queue[i].parent.css({overflow: 'hidden'});
- if(typeof ILLI === 'undefined'
- || false === __settings.thumbs.preloadAllBeforeShow)
- {
- _queue[i].parent.animate({opacity : 1}, 500, function()
- {
- __settings.callback.thumbs.afterShow(_queue[i].parent, i);
- shutdown.spl();
- });
- return;
- }
- ILLI.fn.idle(_queue[i].parent, (i + 1) * 100, function()
- {
- _queue[i].parent.animate({opacity : 1}, 500, function()
- {
- __settings.callback.thumbs.afterShow(_queue[i].parent, i);
- shutdown.spl();
- });
- });
- },
- cfs : function(i)
- {
- __settings.callback.images.firstInit();
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.nextItem');
- },
- clt : null,
- cls : function(i)
- {
- log.t110(' -- stack complete ');
- if(typeof c === 'function')
- {
- log.t110('tri4m.app.cinematic.thumblink.preloadImage: ' + ILLI.fn.o2s(c), 1);
- c();
- }
- //if(_pagination.curQueue === _pagination.maxQueues)
- log.t107(' -- last item, pagination is ' + ILLI.fn.o2s(_pagination), 1);
- if(true === _pagination.last)
- {
- if(shutdown.clt === null)
- shutdown.clt = setInterval(function()
- {
- clearInterval(shutdown.clt);
- shutdown.clt = null;
- log.t110('_settings.callback.thumbs.ready: ' + ILLI.fn.o2s(__settings.callback.thumbs.ready));
- __settings.callback.thumbs.ready(_reg.j.get('l'), 1);
- }, (_pagination.perQueue) * 500);
- }
- }
- },
- dequeue = function()
- {
- log.t107('try dequeue: caller is ' + i);
- if(true === __settings.thumbs.preloadAllBeforeShow)
- {
- if(false === islast)
- return;
- log.t107('try dequeue: preloadAllBeforeShow = true');
- var success = true;
- for(var idx in _queue)
- if(_queue[idx].status === false)
- success = false;
- if(false === success)
- {
- log.t107('try dequeue: success = false');
- var refetch = setInterval(function()
- {
- clearInterval(refetch);
- log.t107('try again; attempt = ' + _queue[i].attempt );
- dequeue();
- }, 500);
- return;
- }
- }
- log.t107('try dequeue: start iteration');
- for(var idx in _queue)
- {
- idx = parseInt(idx, 10);
- if(true === _queue[idx].error)
- {
- log.t107('try dequeue: error: ' + _queue[idx].src, 3);
- log.t107('try dequeue: -- continue');
- continue;
- }
- (function(curIndex, caller)
- {
- var islast = (_queue.length === (curIndex + 1));
- var isfirst = curIndex === 0;
- log.t107('dequeue index ' + curIndex + ' === isfirst = ' + isfirst, (true === isfirst ? 1 : 0));
- log.t107('dequeue index ' + curIndex + ' === islast = ' + islast, (true === islast ? 1 : 0));
- if(null !== _queue[curIndex].lookup)
- return;
- _queue[curIndex].lookup = setInterval(function()
- {
- if(true === _queue[curIndex].kicked)
- {
- log.t107('try dequeue: waiting: -- -- index ' + curIndex + ' already kicked');
- clearInterval(_queue[curIndex].lookup);
- return;
- }
- if(_queue[curIndex].status === false)
- {
- log.t107('try dequeue: waiting: preloadAllBeforeShow = ' + __settings.thumbs.preloadAllBeforeShow + ', status = '+ _queue[curIndex].status +', try = ' + _queue[curIndex].attempt + ' of ' + _queue.length + ', index = ' + curIndex + ', caller = ' + caller, 0);
- if(_queue[curIndex].attempt > _queue.length || _queue[curIndex].attempt === _queue.length)
- {
- log.t107('try dequeue: waiting: -- error: ' + _queue[curIndex].src);
- log.t107('try dequeue: waiting: -- preloadAllBeforeShow = ' + __settings.thumbs.preloadAllBeforeShow + ', status = '+ _queue[curIndex].status +', max.attempts = '+_queue.length+', index = ' + curIndex + ', caller = ' + caller, 3);
- log.t107('try dequeue: waiting: -- index ' + curIndex + ' was kicked from #list (idle flood), caller = ' + caller + ' in try = ' + _queue[curIndex].attempt + ' of ' + _queue.length, 3);
- log.t107('try dequeue: waiting: -- remove ' + ILLI.fn.o2s(_queue[curIndex]), 3);
- _queue[curIndex].kicked = true;
- _queue[curIndex].error = true;
- clearInterval(_queue[curIndex].lookup);
- _removed[curIndex] = _queue[curIndex];
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.removeItem', [curIndex]);
- }
- _queue[curIndex].attempt++;
- return;
- }
- clearInterval(_queue[curIndex].lookup);
- if(true === _queue[curIndex].append)
- return;
- shutdown.dts(curIndex);
- log.t107('try display: index ' + curIndex + ' isFirst ' + isfirst + ' type ' + ILLI.fn.type(curIndex));
- log.t107('try dequeue: asCssBackgroundImage = ' + __settings.thumbs.asCssBackgroundImage + ', index ' + curIndex);
- var p = _queue[curIndex].props;
- if(true === __settings.thumbs.asCssBackgroundImage)
- {
- _queue[curIndex].parent.css({'background-image' : 'url("' + _queue[curIndex].src + '")',
- // width : p.width, height: p.height, 'background-position' : 'center'
- });
- }
- else
- {
- //_queue[curIndex].image.css({left : p.left, top: p.top, position: 'absolute'});
- _queue[curIndex].parent.prepend(_queue[curIndex].image);
- }
- shutdown.cbs(curIndex);
- shutdown.vis(curIndex);
- if(true === isfirst)
- shutdown.cfs(curIndex);
- if(true === islast)
- shutdown.cls(curIndex);
- }, 700);
- })(idx, i);
- }
- },
- load = function(src)
- {
- log.t107('try load: ' + src);
- if(__settings.thumbs.enabled === false)
- {
- log.t107(' -- disabled: thumbs', 1);
- shutdown.dts(i);
- shutdown.cbs(i);
- shutdown.vis(i);
- if(true === isfirst)
- shutdown.cfs(i);
- if(true === islast)
- shutdown.cls(i);
- return;
- }
- var IMG = new Image(), src = src;
- $(IMG)
- .addClass('dummy')
- .hide()
- .load(function()
- {
- log.t107('try load: -- complete: ' + src, 1);
- $(IMG).remove();
- t.wait = setInterval(function()
- {
- clearInterval(t.wait);
- log.t107('try append: ' + src);
- _queue[i].image.attr('src', src);
- _queue[i].src = src;
- _queue[i].status = true;
- //_queue[i].props = _c.l(IMG, _queue[i].thumb);
- _queue[i].props = _c.i(IMG, _queue[i].thumb);
- dequeue();
- }, 100);
- IMG.onload = function(){};
- })
- .error(function()
- {
- log.t107('try load: error: ' + src, 3);
- _queue[i].image.attr('src', src);
- _queue[i].src = src;
- _queue[i].status = true;
- _queue[i].error = true;
- dequeue();
- IMG.onerror = function(){};
- });
- $(IMG).attr('src', src);
- t.append(IMG);
- };
- log.t107('index ' + i + ' === isfirst = ' + isfirst, (true === isfirst ? 1 : 0));
- log.t107('index ' + i + ' === islast = ' + islast, (true === islast ? 1 : 0));
- t.idle = setInterval(function()
- {
- clearInterval(t.idle);
- log.t107('try POST: thumb for ' + i + ': ' + href);
- var provider = _type(href), url = null;
- switch(provider)
- {
- case 'jpg':
- case 'png':
- case 'gif':
- p.addClass('tri4m-app-cinematic-resourcehires-image');
- // create thumb from img-href
- var h = p.height(), w = p.width();
- try
- {
- ILLI.router.create.thumb(href, h, w, function(url, route, data)
- {
- log.t107('try POST: -- complete: thumb ' + i + ' is ' + url, 1);
- t.attr('href', url);
- load(url);
- })
- }
- catch(e)
- {
- if(e instanceof ILLI.router.error)
- {
- switch(e.number)
- {
- case 101:
- case 102:
- case 103:
- log.t107(' -- index ' + i + ': ' + e.name + ': ' + e.description + '. Update your CSS @li-element to solve this problem.', 3);
- break;
- default:
- log.t107(' -- index ' + i + ': ' + e.name + ': ' + (e.description || 'Unknown Error') + '.', 3);
- break;
- }
- }
- }
- break;
- case 'youtube':
- p.addClass('tri4m-app-cinematic-resourcehires-youtube');
- // get json from video-href
- ILLI.router.create.json(href, provider, function(json, data)
- {
- log.t107('try POST: -- complete: thumb ' + i + ' is ' + ILLI.fn.o2s(json), 1);
- t.data('youtube.json', json.data);
- t.attr('title', t.data('youtube.json').title);
- t.attr('duration', t.data('youtube.json').duration);
- var url = t.data('youtube.json').thumbnail.hqDefault;
- t.attr('href', url);
- load(url);
- });
- break;
- case 'flv':
- p.addClass('tri4m-app-cinematic-resourcehires-flv');
- break;
- case 'avi':
- p.addClass('tri4m-app-cinematic-resourcehires-avi');
- break;
- case 'mp3':
- p.addClass('tri4m-app-cinematic-resourcehires-mp3');
- break;
- }
- }, 50);
- });
- _bnd.a
- .register('tri4m.app.cinematic.reslink.preloadImage', function(e, c)
- {
- log.t109('tri4m.app.cinematic.reslink.preloadImage', 1);
- var t = $(this), src = t.attr('href'),
- data = t.parent().data(_reg.n.get('dij')),
- bioscoopoptions = t.parent().data(_reg.n.get('dob')), callback = c,
- load = function()
- {
- log.t108('try load: ' + src);
- _reg.j.get('d').html('');
- //_reg.j.get('j').html('').attr('style', null);
- //alert(_reg.j.get('b').attr('id'));
- switch(_type(src))
- {
- case 'jpg':
- case 'png':
- case 'gif':
- if(_reg.j.get('d').children('img' + "[src='" + src + "']").length === 0)
- {
- var IMG = new Image(), img = $('<img />')
- .css({position: 'absolute'})
- .addClass('tri4m-app-cinematic-image')
- .css('position', 'absolute');
- $(IMG).hide()
- .load(function()
- {
- //$(IMG).show(); _reg.j.get('d').css({opacity : 1}); return;
- log.t108('try load: -- complete: ' + src, 1);
- var css = _c.i(IMG, _reg.j.get('d')), size = 0;
- $(IMG).remove();
- _reg.j.get('j').html('').css({opacity : 0});
- if(typeof data !== 'undefined') for(var i in data)
- {
- _reg.j.get('j').append($('<div />').addClass('tri4m-app-cinematic-data-' + i).html($('<span />').html(data[i])));
- size++;
- }
- if(size > 0)
- {
- var bd = _bnd.d.toValueObject();
- for(var i in bd) { _reg.j.get('j').unbind(i).bind(i, bd[i]); }
- _reg.j.get('d').append(_reg.j.get('j'));
- }
- t.prependHTML = setInterval(function()
- {
- clearInterval(t.prependHTML);
- log.t108('try load: append: ' + src);
- log.t108('try dequeue: asCssBackgroundImage = ' + __settings.images.asCssBackgroundImage);
- (true === __settings.images.asCssBackgroundImage)
- ? _reg.j.get('d').css({'background-image' : 'url("' + src + '")'})
- : _reg.j.get('d').prepend(img.attr('src', src).css(css));
- t.parent().find('div.tri4m-app-cinematic-overlay:eq(0)').trigger('tri4m.app.cinematic.listitem.overlay.complete');
- _reg.j.get('d').animate({opacity : 1}, 500, function()
- {
- log.t108('try load: -- success (new source): ' + src + '::' + _reg.j.get('j').attr('class'));
- _reg.j.get('j').trigger('tri4m.app.cinematic.data.show');
- if(typeof callback === 'function') callback();
- });
- }, 100);
- IMG.onload = function(){};
- })
- .error(function()
- {
- log.t108('try load: -- error: ' + src, 3);
- IMG.onerror = function(){};
- $(IMG).remove(); IMG = null;
- });
- $(IMG).attr('src', src);
- _reg.j.get('d').prepend(IMG);
- }
- else
- {
- log.t108('try load: known source ' + src);
- var img = _reg.j.get('d').children('img' + "[src='" + src + "']");
- img.show();
- _reg.j.get('d').animate({opacity : 1}, 500, function()
- {
- log.t108('try load: -- success (known source): ' + src);
- _reg.j.get('j').trigger('tri4m.app.cinematic.data.show');
- });
- }
- break;
- case 'youtube':
- // http://stackoverflow.com/questions/7865904/jquery-fade-in-youtube-iframe-embed
- var css = _c.f((new Image()), _reg.j.get('d'));
- var vid = $('<iframe frameborder="0" allowfullscreen></iframe>').attr('src', src).attr('height', css.height).attr('width', css.width);
- _reg.j.get('d').html(vid).animate({opacity : 1}, 500);
- break;
- default:
- break;
- }
- },
- construct = function()
- {
- log.t108('try load: bioscoop has no images -- construct sequence');
- _reg.j.get('d').css({opacity : 0});
- var css = null;
- if(ILLI.fn.length(bioscoopoptions) > 0)
- {
- var cache = _reg.j.get('b').data('dcb'), c = {};
- if(typeof cache === 'undefined')
- {
- for(var i in bioscoopoptions)
- {
- c[i] = _reg.j.get('b').css(i);
- }
- cache = c;
- log.t108('try load: save css defaults bioscoop: ' + ILLI.fn.o2s(cache));
- _reg.j.get('b').data('dcb', cache);
- }
- log.t108('try load: apply css options bioscoop: ' + ILLI.fn.o2s(bioscoopoptions));
- css = bioscoopoptions;
- }
- else
- {
- var cache = _reg.j.get('b').data('dcb');
- if(typeof cache !== 'undefined' && ILLI.fn.length(cache) > 0)
- {
- log.t108('try load: restore css defaults bioscoop: ' + ILLI.fn.o2s(cache));
- css = cache;
- //_reg.j.get('b').data('dcb', {});
- }
- }
- if(null === css)
- load()
- else
- _reg.j.get('b').stop().animate(css, 250, load);
- },
- restruct = function()
- {
- log.t108('try load: bioscoop has images -- restruct sequence');
- var j = $('div.tri4m-app-cinematic-data:eq(0)', _reg.j.get('d'));
- if(j.length > 0)
- {
- _reg.j.get('j').stop().trigger('tri4m.app.cinematic.data.hide', [
- function()
- {
- _reg.j.get('d').stop().animate({opacity : 0}, 500, function()
- {
- $('img', _reg.j.get('d')).remove();
- construct();
- });
- }
- ]);
- }
- else
- {
- _reg.j.get('d').stop().animate({opacity : 0}, 500, function()
- {
- $('img', _reg.j.get('d')).remove();
- construct();
- });
- }
- },
- destruct = function()
- {
- log.t108('try load: bioscoop has images -- destruct sequence');
- _reg.j.get('d').stop().animate({opacity : 0}, 500, function()
- {
- $('img', _reg.j.get('d')).remove();
- });
- };
- log.t108('init ' + src);
- (_reg.j.get('d').find('img').length === 0 && !_reg.j.get('d').css('background-image'))
- ? construct()
- : restruct();
- }, true);
- _bnd.r
- .register('resize.resolutionchange', _j.window, true);
- _dom();
- var br = _bnd.r.toValueObject(), bl = _bnd.l.toValueObject();
- for(var i in br) { $(window).bind(i, br[i]); }
- for(var i in bl) { _reg.j.get('l').unbind(i).bind(i, bl[i]); }
- if(true === __settings.usekeys)
- $(document).keydown(function(e)
- {
- var t = $(this), k = e.keyCode;
- log.t109('tri4m.app.cinematic.listitem.keydown ' + k, 1);
- switch(k)
- {
- case 37: // left
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.prev');
- break;
- case 39: // right
- _reg.j.get('l').trigger('tri4m.app.cinematic.container.next');
- break;
- case 38: // up
- break;
- case 40: // down
- break;
- }
- });
- _update();
- })();
- };
- $.tri4m.log('initialize tri4m.app.cinematic: tri4m LABS, http://tri4m.com', 1);
- $.tri4m.log('-- config tri4m.app.cinematic: ' + ILLI.fn.o2s(__settings), 1);
- if(true === $.tri4m.global.__INSTANCE_REGISTRY__.isset(__SELF, regName)) return;
- var instance = new __instance(__SELF);
- $.tri4m.global.__INSTANCE_REGISTRY__.register(__SELF, regName, instance);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement