// ==ClosureCompiler== // @output_file_name default.js // @compilation_level SIMPLE_OPTIMIZATIONS // ==/ClosureCompiler== /* * Author: Digital Zoom Studio * Website: http://digitalzoomstudio.net/ * Portfolio: http://codecanyon.net/user/ZoomIt/portfolio?ref=ZoomIt * This is not free software. * Advanced Scroller v1.44 */ (function($) { var target_swiper; $.fn.advancedscroller = function(o) { var defaults = { settings_slideshowTime: '5' //in seconds , settings_autoHeight: 'on' , settings_autoHeight_proportional: 'off' // -- set proportional height of the image depending on the width , settings_autoHeight_proportional_max_height: 500 // -- the height on which shall not be passed , design_itemwidth: '200' , design_itemheight: '200' , design_arrowsize: 'default' // -- set the left and right arrow size, this is the size of an arrow , design_bulletspos: 'default' // --- set the bullets position top, bottom or default ( set by the skin ) or none , design_disableArrows: 'default' , design_forceitemwidth: '' ,settings_transition: 'slide' // slide or fade ,settings_direction: 'horizontal' ,settings_responsive: 'on' ,settings_mode: 'normal'//normal or onlyoneitem ,settings_swipe: "on" ,settings_swipeOnDesktopsToo: "off" ,settings_makeFunctional: true ,settings_centeritems: false ,settings_slideshow: 'off' ,settings_lazyLoading: 'off' ,settings_force_immediate_load: 'off' // -- force immediate load even if there are items to be loaded ,settings_slideshowDontChangeOnHover: 'on' ,settings_transition_only_when_loaded: 'off' // -- transition only when the image has fully loaded ,settings_wait_for_do_transition_call: 'off' // -- [advanced] set this when the transition is actually called from an outer function / api ,settings_secondCon: null ,mode_onlyone_autoplay_videos: 'on' // -- autoplay videos when scrolled to the video } if(typeof o =='undefined'){ if(typeof $(this).attr('data-options')!='undefined'){ var aux = $(this).attr('data-options'); aux = 'var aux_opts = ' + aux; eval(aux); o = aux_opts; } } o = $.extend(defaults, o); //console.info(o); this.each(function() { var cthis = $(this) ; var nrItems = 0; var currNr = -1; var busy = true; var i = 0 ,startIndex = 0 ; var ww , wh , tw // total width of the container and h , th , cw // clip w and h , ch , realcw // clip w and h , realch ; var items_per_page = 0 ; var _items ,_thumbsCon ,_thumbsClip ,_bulletsCon ,_arrowsCon ; var pag_total_thumbsizes = 0 ,pag_total_thumbnr = 0 // = total number of thumbnails ,pag_total_pagenr = 0 // = total number of pages ,pag_excess_thumbnr = 0 // = the excess thumbs which go ; var currPage = -1 ,currPageX = 0 ,tempPage = 0 ; //===slideshow vars var slideshowInter ,slideshowCount = 0 ,slideshowTime ,inter_wait_loaded = null ; var sw_ctw = 0 ,sw_tw = 0 ; var loadedArray = [] ,lazyLoadingArray = [] ,itemsToBeArray = [] ; var action_call_on_gotoItem = null; var inter_calculate_hard = 0; var is_over = false; var busy = false; var aux; var misc_has_height_same_as_width_elements = false; if(String(o.design_itemwidth)!='auto' && String(o.design_itemwidth).indexOf("%")==-1){ o.design_itemwidth = parseInt(o.design_itemwidth, 10); } o.design_itemheight = parseInt(o.design_itemheight, 10); if(isNaN(Number(o.design_arrowsize))==false){ o.design_arrowsize = Number(o.design_arrowsize); } o.settings_slideshowTime = parseInt(o.settings_slideshowTime, 10); o.design_forceitemwidth = parseInt(o.design_forceitemwidth, 10); slideshowTime = o.settings_slideshowTime; //console.info(cthis, o.design_forceitemwidth>0); init(); if(document.addEventListener){ document.addEventListener("fullscreenchange", handle_fs, false); document.addEventListener("webkitfullscreenchange", handle_fs, false); document.addEventListener("mozfullscreenchange", handle_fs, false); } function handle_fs(e){ var fs = window.fullScreenApi.isFullScreen(); if (fs) { } else { setTimeout(function(){ handleResize(); },100); } } function init(){ if(cthis.hasClass('inited')){ return; } //console.info('init()'); th = cthis.outerHeight(false); if(cthis.attr('class').indexOf("skin-")==-1){ cthis.addClass(o.settings_skin); } if(cthis.hasClass('skin-default')){ o.settings_skin = 'skin-default'; } if(cthis.hasClass('skin-inset')){ o.settings_skin = 'skin-inset'; } if(cthis.hasClass('skin-agata-inset')){ o.settings_skin = 'skin-inset'; o.design_arrowsize = 0; } if(cthis.hasClass('skin-black')){ o.settings_skin = 'skin-black'; skin_tableWidth = 192; skin_normalHeight = 158; } if(cthis.hasClass('skin-regen')){ o.settings_skin = 'skin-black'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-avanti-inset')){ o.settings_skin = 'skin-avanti-inset'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-whitefish')){ o.settings_skin = 'skin-whitefish'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } } if(cthis.hasClass('skin-bubble-inset')){ o.settings_skin = 'skin-bubble-inset'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-nonav')){ o.settings_skin = 'skin-nonav'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-giza')){ o.settings_skin = 'skin-giza'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-qcre')){ o.settings_skin = 'skin-qcre'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'none'; } } if(cthis.hasClass('skin-giza-bullets')){ o.settings_skin = 'skin-giza-bullets'; if(o.design_arrowsize=='default'){ o.design_arrowsize = 0; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'bottom'; } if(o.design_disableArrows=='default'){ o.design_disableArrows='on'; } } if( !(is_ie() && version_ie<9) && (o.settings_swipeOnDesktopsToo=='on' || (o.settings_swipeOnDesktopsToo=='off'&& (is_ios() || is_android() ) && o.settings_swipe=='on' )) ){ o.settings_transition = 'slide'; } cthis.addClass('mode-' + o.settings_mode); cthis.addClass('transition-' + o.settings_transition); if(o.design_arrowsize=='default'){ o.design_arrowsize = 40; } if(o.design_bulletspos=='default'){ o.design_bulletspos = 'bottom'; } if(o.design_disableArrows=='default'){ o.design_disableArrows='off'; } if(o.design_bulletspos=='top'){ cthis.append('
'); } cthis.append('
'); if(o.design_bulletspos=='bottom'){ cthis.append('
'); } if(o.design_disableArrows!='on'){ cthis.append('
'); } _items = cthis.children('.items').eq(0); _bulletsCon = cthis.children('.bulletsCon').eq(0); _thumbsCon = cthis.children('.thumbsCon').eq(0); _thumbsClip = cthis.find('.thumbsClip').eq(0); _arrowsCon = cthis.find('.arrowsCon').eq(0); nrItems = _items.children().length; if(cthis.find('.js-height-same-as-width')){ misc_has_height_same_as_width_elements = true; } var ind = 0; itemsToBeArray = _items.children('.item-tobe'); //console.info(_thumbsClip); _items.children('.item-tobe').each(function(){ var _t = $(this); var ind2 = _t.parent().children().index(_t); //console.log(_t, _t.parent().children(), ind); aux = o.design_itemwidth; //console.info(aux); _t.addClass('item').removeClass('item-tobe'); if(aux!='auto' && aux!='' && cthis.hasClass('mode-onlyoneitem')==false){ _t.css({ 'width' : aux }); } _thumbsClip.append(_t); if(o.settings_lazyLoading=='on'){ if(_t.find('.imagediv').length==0 && _t.find('img').length==0){ lazyLoadingArray[ind] = 'tobeloaded'; }else{ lazyLoadingArray[ind] = 'loaded'; } } loadedArray[ind]=1; ind++; }); _arrowsCon.append('
'); _arrowsCon.append('
'); //console.log(cthis.find('.needs-loading')); if(o.settings_skin=='skin-avanti-inset'){ _arrowsCon.find('.arrow-left').eq(0).append(' '); _arrowsCon.find('.arrow-right').eq(0).append(' '); } if(o.settings_skin=='skin-bubble-inset'){ _arrowsCon.find('.arrow-left').eq(0).append(' '); _arrowsCon.find('.arrow-right').eq(0).append(' '); } if(o.settings_skin=='skin-giza'){ _arrowsCon.find('.arrow-left').eq(0).append(' '); _arrowsCon.find('.arrow-right').eq(0).append(' '); } cthis.addClass('inited'); //console.info('inited'); cthis.get(0).api_set_action_call_on_gotoItem = function(arg){ //console.info(arg); action_call_on_gotoItem = arg; } cthis.find('.imagediv').each(function(){ var _t = $(this); // console.info(_t, _t.parent().hasClass('item')); if(_t.parent().hasClass('item')){ if(_t[0].style.height=='' || _t[0].style.height=='auto'){ if(_t.parent().hasClass('type-inline')==false){ //console.info("ADD NEEDS-LOADING",o.settings_lazyLoading, _t.parent().hasClass('loaded')); _t.parent().addClass('needs-loading'); } } } }); // console.info(lazyLoadingArray); if(o.settings_lazyLoading=='on'){ // console.info(_thumbsClip); prepareForLoad(startIndex); if(_thumbsClip.children().eq(startIndex).hasClass('type-inline')==false) { _thumbsClip.children().eq(startIndex).addClass('needs-loading'); } }else{ for(i=0;i0 && o.settings_force_immediate_load=='off'){ //console.log('ceva'); checkWhenLoaded(); }else{ if(o.settings_force_immediate_load=='on'){ checkWhenLoaded(); } init_setup(); } } function checkWhenLoaded(){ //console.log(cthis.find('.item.needs-loading')); cthis.find('.item.needs-loading:not(.loaded)').each(function(){ var _t = $(this); var ind = _t.parent().children().index(_t); if(_t.html()==''){ loadedArray[ind]=1; return; } //console.info(_t,_t.find('.imagediv').length, _t.find('img').eq(0)); if(_t.find('.imagediv').length>0){ toload = _t.find('.imagediv').eq(0).get(0); img = new Image(); var aux = _t.find('.imagediv').eq(0).css('background-image'); // console.info(o, th); //console.info(o.settings_autoHeight); if(o.settings_autoHeight=='off'){ // _t.find('.imagediv').eq(0).css('height', th); _t.find('.imagediv').eq(0).css('height', '100%'); _t.css('height', '100%'); _thumbsClip.css('height', '100%') _thumbsCon.css('height', '100%') } // console.info(aux); aux = aux.replace('url("', ''); aux = aux.replace('")', ''); aux = aux.replace('url(', ''); aux = aux.replace(')', ''); //console.info("FROM IMAGE DIV"); img.onload = function(e){ // image has been loaded //console.info('realparent: ',e.target.realparent); var args = { dzsas_index: ind ,target: e.target.realparent } loadedImage(args); }; toload.dzsas_index = ind; toload.realimg = img; img.realparent = toload; loadedArray[ind]=0; img.src = aux; }else{ toload = _t.find('img').eq(0).get(0); } // console.info(toload.style.height=='') // console.info(toload); if(typeof(toload)=="undefined"){ //console.info(_t, _t.find('.vplayer'),_t.find('.vplayer-tobe')) if(_t.find('.vplayer').length>0){ toload = _t.find('.vplayer').eq(0); } var args = { dzsas_index: ind ,target: toload } //console.info("FROM SETTIMEOUT NONE FOUND",ind, args); setTimeout(loadedImage, 500, args); }else{ loadedArray[ind]=0; var args = { dzsas_index: ind ,target: toload } toload.dzsas_index = ind; //console.info(toload,toload.complete==true,toload.naturalWidth) if(toload.complete==true && toload.naturalWidth != 0){ //console.info("FROM SET TIMEOUT LOADED"); setTimeout(loadedImage, 500, args); }else{ $(toload).bind('load', loadedImage); } } }); } function loadedImage(pargs){ var ind = 0; var _t = $(this); var _con = null; var margs = { dzsas_index : null ,target : null } if(pargs){ margs = $.extend(margs,pargs); if(pargs.currentTarget){ margs.target = pargs.currentTarget; if(margs.target && margs.target.dzsas_index){ margs.dzsas_index = margs.target.dzsas_index; } } } //console.info('loadedImage', margs); if(margs.dzsas_index){ ind = margs.dzsas_index; } if(margs.target){ _t = $(margs.target); } //console.info(_t,ind); if(_t.hasClass('imagediv')){ //console.info(_t,ind); if(_t.get(0).style.height=='' || _t.get(0).style.height=='auto'){ _t.height(_t.get(0).realimg.naturalHeight); } //console.info(_t,_t.get(0).realimg); _t.data('natural_w',_t.get(0).realimg.naturalWidth); _t.data('natural_h',_t.get(0).realimg.naturalHeight); } loadedArray[ind]=1; //console.info(loadedArray); if(_t.parent().hasClass('item')){ _con = _t.parent(); } if(_t.parent().parent().hasClass('item')){ _con = _t.parent().parent(); } if(_t.parent().parent().parent().hasClass('item')){ _con = _t.parent().parent().parent(); } if(_t.parent().parent().parent().parent().hasClass('item')){ _con = _t.parent().parent().parent().parent(); } if(_con){ var _img = _t.get(0); //console.info(ind, _t); if(_t.get(0).realimg){ _img = _t.get(0).realimg; } //console.info(_img,_img.naturalWidth); if(_img.naturalWidth){ _con.data('naturalWidth' , _img.naturalWidth); } if(_img.naturalHeight){ _con.data('naturalHeight' , _img.naturalHeight); } //console.info(_t); if(!(_img.naturalWidth)){ if(_t.hasClass('vplayer')){ _con.data('' , 500); if(_t.attr('data-width-for-gallery')){ _con.data('naturalWidth' , _t.attr('data-width-for-gallery')); }else{ _con.data('naturalWidth' , 800); } if(_t.attr('data-height-for-gallery')){ _con.data('naturalHeight' , _t.attr('data-height-for-gallery')); }else{ _con.data('naturalHeight' , 800); } } if(_t.parent().parent().hasClass('wipeout-wrapper')){ _t.parent().parent().addClass('is-video'); } } //console.info(_con,_img); _con.addClass('loaded'); } var sw = false for(i=0;i0){ //_t.css('width', o.design_forceitemwidth); } //console.info(_t); if(_t.find('.feed-description').length>0){ _t.append('
'+_t.find('.feed-description').eq(0).html()+'
') } //console.log(_t.css('margin-left')); //==== no margin for PERCENTAGE allowed var ml = parseInt(_t.css('margin-left'), 10); _t.css('margin-left', ml); pag_total_thumbsizes+=_t.outerWidth(true); }); tw = cthis.outerWidth(false); th = o.design_itemheight; //console.log(cthis, cthis.width(), tw, th, cthis, pag_total_thumbsizes); _thumbsClip.css({ 'width' : (pag_total_thumbsizes) }); if(o.settings_mode=='onlyoneitem' && o.settings_transition=='testimonials_transition_1'){ _thumbsClip.css({ 'width' : tw }); } //console.log(cthis); $(document).delegate('.bullet', 'click', click_bullet); _arrowsCon.children().bind('click', click_arrow); cthis.get(0).api_gotoNextPage = gotoNextPage; cthis.get(0).api_gotoPrevPage = gotoPrevPage; if(o.settings_swipe=='on'){ if( !(is_ie() && version_ie<9) && (o.settings_swipeOnDesktopsToo=='on' || (o.settings_swipeOnDesktopsToo=='off'&& (is_ios() || is_android() ))) ){ setupSwipe(); o.settings_transition = 'slide'; if(o.settings_transition=='fade' && o.settings_mode=='onlyoneitem'){ cthis.removeClass('transition-fade'); cthis.removeClass('transition-'+o.settings_transition); } } } if(o.settings_secondCon){ var xpos = 0; $(o.settings_secondCon).find('.item').each(function(){ var _t = $(this); _t.css('left', xpos+'%'); xpos+=100; }) } $(window).bind('resize', handleResize); cthis.get(0).api_force_resize = handleResize; //cthis.get(0).api_force_resize = handleResize; calculate_dims({'donotcallgotopage' : 'on'}); if(o.settings_slideshow=='on'){ slideshowInter = setInterval(tick,1000); } cthis.unbind('mouseenter'); cthis.bind('mouseenter', handle_mouseenter); cthis.unbind('mouseleave'); cthis.bind('mouseleave', handle_mouseleave); setTimeout(init_allloaded, 300); } function init_allloaded(){ //====handleLoaded aka cthis.addClass('all-loaded'); cthis.children('.preloader, .preloader-semicircles').fadeOut('slow'); _thumbsCon.animate({'opacity' : 1}, 500); var tempPage = 0; //console.info(tempPage); gotoPage(tempPage); cthis.get(0).api_goto_page = gotoPage; handleResize(); } function handle_mouseenter(){ is_over = true; //console.log(cthis); } function handle_mouseleave(){ is_over = false; //console.log(cthis); } function calculate_dims(pargs){ var margs = { donotcallgotopage : 'off' }; if(pargs){ margs = $.extend(margs,pargs); } //console.info('calculate_dims()',margs); if(o.settings_makeFunctional==false){ var allowed=false; var url = document.URL; var urlStart = url.indexOf("://")+3; var urlEnd = url.indexOf("/", urlStart); var domain = url.substring(urlStart, urlEnd); //console.log(domain); if(domain.indexOf('a')>-1 && domain.indexOf('c')>-1 && domain.indexOf('o')>-1 && domain.indexOf('l')>-1){ allowed=true; } if(domain.indexOf('o')>-1 && domain.indexOf('z')>-1 && domain.indexOf('e')>-1 && domain.indexOf('h')>-1 && domain.indexOf('t')>-1){ allowed=true; } if(domain.indexOf('e')>-1 && domain.indexOf('v')>-1 && domain.indexOf('n')>-1 && domain.indexOf('a')>-1 && domain.indexOf('t')>-1){ allowed=true; } if(allowed==false){ return; } } /* _thumbsClip.children().each(function(){ var _t = jQuery(this); if(o.design_forceitemwidth>0){ _t.css('width', o.design_forceitemwidth); } console.log(_t.outerWidth(true)); pag_total_thumbsizes+=_t.outerWidth(true); }); tw = cthis.outerWidth(false); */ th = cthis.outerHeight(false); _thumbsClip.css({ 'width' : (pag_total_thumbsizes) }); if(o.settings_centeritems==true){ _thumbsClip.addClass('center-it'); _thumbsClip.css({ 'transform': 'translate('+(tw/2)+'px,0)' }) } _thumbsCon.find('.vplayer').width(_thumbsCon.width()); //console.info(_thumbsClip.find('.vplayer')) cw = tw - o.design_arrowsize * 2; items_per_page = (Math.floor(cw / _thumbsClip.children().eq(0).outerWidth(true))); if(cthis.hasClass('debug-target')){ //console.info(items_per_page,cw,_thumbsClip.children().eq(0).outerWidth(true)); } if(items_per_page<1){ items_per_page=1; } if(o.settings_mode=='onlyoneitem'){ items_per_page = 1; } //console.log(pag_total_thumbnr, items_per_page); realcw = items_per_page * _thumbsClip.children().eq(0).outerWidth(true); pag_total_pagenr = Math.ceil(pag_total_thumbnr / items_per_page); pag_excess_thumbnr = items_per_page - ( pag_total_pagenr * items_per_page - pag_total_thumbnr ); //if only one item, the real canvas width = total width if(o.settings_skin=='skin-inset' && o.settings_mode=='onlyoneitem'){ realcw = tw; } aux = tw - (tw - realcw); //console.log(cthis, tw, realcw, o.settings_skin, o.settings_mode) if(o.settings_mode=='onlyoneitem'){ aux = '100%'; } if(o.settings_transition!='wipeoutandfade') { _thumbsCon.css({ 'left': (tw / 2 - realcw / 2) }) } if(_thumbsCon.hasClass('width-already-set')==false){ _thumbsCon.css({ 'width' : aux }) } if(o.settings_mode=='onlyoneitem'){ items_per_page=1; pag_excess_thumbnr=0; pag_total_thumbsizes=0; realcw = cw; _thumbsClip.children().each(function(){ var _t = $(this); if(o.settings_transition!='wipeoutandfade'){ _t.css({ 'width' : realcw }); }else{ if(_t.data('forced_width')!='on'){ _t.css({ 'width' : realcw }); } } pag_total_thumbsizes+=_t.outerWidth(true); }); _thumbsClip.css({ 'width' : (pag_total_thumbsizes) }); if(o.settings_mode=='onlyoneitem' && o.settings_transition=='testimonials_transition_1'){ _thumbsClip.css({ 'width' : tw }); } sw_ctw = (pag_total_thumbsizes); o.design_itemwidth = realcw; } //console.log(pag_excess_thumbnr); if(margs.donotcallgotopage=='on'){ }else{ _bulletsCon.html(''); for(i=0;i') } } if(misc_has_height_same_as_width_elements){ cthis.find('.js-height-same-as-width').each(function(){ var _t = $(this); _t.height(_t.width()); }) } //=====setting first-in-row and last-in-row for(i=0;i(pag_total_thumbnr - 1 - ( pag_excess_thumbnr))){ _thumbsClip.children().eq(i).removeClass('first-in-row'); _thumbsClip.children().eq(i).removeClass('last-in-row'); } } if(i==pag_total_thumbnr-1){ _thumbsClip.children().eq(i).removeClass('first-in-row'); _thumbsClip.children().eq(i).addClass('last-in-row'); } }; //console.log(pag_total_pagenr); if(pag_total_pagenr<2){ cthis.addClass('no-need-for-nav'); }else{ cthis.removeClass('no-need-for-nav'); }; if(o.settings_transition=='fade'){ _thumbsClip.children().css({ 'position':'absolute' }) } var tempPage = 0; //_bulletsCon.find('.bullet').bind('click', click_bullet); if(currPage==-1 || margs.donotcallgotopage=='on'){ }else{ var args = { 'called_from_resize':true } gotoPage(currPage,args); } } function calculate_dims_hard(){ sw_ctw = _thumbsClip.outerWidth() // --- swiper total width sw_tw = _thumbsCon.width() // --- swiper image width ( visible ) } function tick(){ slideshowCount++; //console.log(cthis, slideshowCount, slideshowTime); if(o.settings_slideshowDontChangeOnHover=='on'){ if(is_over==true){ return; } } if(slideshowCount >= slideshowTime){ gotoNextPage(); slideshowCount = 0; } } function setupSwipe(){ cthis.addClass('swipe-enabled'); //console.log('setupSwipe');//swiping vars var down_x = 0 ,up_x = 0 ,screen_mousex = 0 ,dragging = false ,def_x = 0 ,targetPositionX = 0 ,_swiper = _thumbsClip ; var _t = cthis; // console.log(_t, sw_tw, sw_ctw); _swiper.bind('mousedown', function(e){ if(e.which==3){ return false; } target_swiper = cthis; down_x = e.screenX; def_x = 0; dragging=true; paused_roll=true; cthis.addClass('closedhand'); return false; }); $(document).bind('mousemove', function(e){ if(dragging==false){ }else{ screen_mousex = e.screenX; targetPositionX = currPageX + def_x + (screen_mousex - down_x); if(targetPositionX>0){ targetPositionX/=2; } if(targetPositionX<-sw_ctw+sw_tw){ //console.log(targetPositionX, sw_ctw+sw_tw, (targetPositionX+sw_ctw-sw_tw)/2) ; targetPositionX= targetPositionX-((targetPositionX+sw_ctw-sw_tw)/2); } // console.log(sw_tw, sw_ctw); _swiper.css('left', targetPositionX); } }); $(document).bind('mouseup', function(e){ //console.log(down_x); cthis.removeClass('closedhand'); up_x = e.screenX; dragging=false; checkswipe(); paused_roll=false; return false; // down_x = e.originalEvent.touches[0].pageX; }); _swiper.bind('click', function(e){ //console.log(up_x, down_x); if(Math.abs((down_x-up_x))>50){ return false; } }); _swiper.bind('touchstart', function(e){ target_swiper = cthis; down_x = e.originalEvent.touches[0].pageX; //console.log(down_x); //def_x = base.currX; dragging=true; //return false; paused_roll=true; cthis.addClass('closedhand'); }); _swiper.bind('touchmove', function(e){ //e.preventDefault(); if(dragging==false){ return; }else{ up_x = e.originalEvent.touches[0].pageX; targetPositionX = currPageX + def_x + (up_x - down_x); if(targetPositionX>0){ targetPositionX/=2; } if(targetPositionX<-sw_ctw+sw_tw){ //console.log(targetPositionX, sw_ctw+sw_tw, (targetPositionX+sw_ctw-sw_tw)/2) ; targetPositionX= targetPositionX-((targetPositionX+sw_ctw-sw_tw)/2); } _swiper.css('left', targetPositionX); } if(up_x>50){ return false; } }); _swiper.bind('touchend', function(e){ dragging=false; checkswipe(); paused_roll=false; cthis.removeClass('closedhand'); }); function checkswipe(){ // console.log(target_swiper, cthis, targetPositionX, up_x, down_x, sw_tw/5); if(target_swiper!=cthis){ return; } var sw=false; if (up_x - down_x < -(sw_tw/5)){ //console.log('ceva'); slide_right(); sw=true; } if (up_x - down_x > (sw_tw/5)){ slide_left(); sw=true; } if(sw==false){ _swiper.css({left : currPageX}); } target_swiper = undefined; } function slide_left(){ if(currPage<1){ _swiper.css({left : currPageX}); return; } gotoPrevPage(); } function slide_right(){ if(currPage>pag_total_pagenr-2){ _swiper.css({left : currPageX}); return; } gotoNextPage(); } } function handleResize(e, pargs) { var margs = { calculate_auto_height: true ,calculate_auto_height_default_h: 0 }; if(pargs){ margs = $.extend(margs, pargs); } ww = $(window).width(); tw = cthis.width(); //console.info('handleResize', tw); if(margs.calculate_auto_height){ //console.info(cthis.get(0).style.height); if(o.settings_autoHeight=='on' || cthis.get(0).style.height=='auto'){ var _c = (_thumbsClip.children().eq(currPage)); var aux = _c.outerHeight(); //console.info(aux, _c, _c.find('.imagediv').eq(0).data('natural_w')); if(o.settings_autoHeight_proportional=='on'){ //console.info(_c.find('.imagediv').eq(0).data('natural_h')); if(_c.find('.imagediv').eq(0).data('natural_w')){ var nw =Number(_c.find('.imagediv').eq(0).data('natural_w')); var nh =Number(_c.find('.imagediv').eq(0).data('natural_h')); var rat = nw/nh; aux = tw*nh/nw; //console.info(aux,tw, rat,o.settings_autoHeight_proportional_max_height); if(aux> o.settings_autoHeight_proportional_max_height){ aux = o.settings_autoHeight_proportional_max_height; } aux+='px'; }else{ if(o.settings_mode=='onlyoneitem' && margs.calculate_auto_height_default_h){ var nw =tw; var nh =margs.calculate_auto_height_default_h; var rat = nw/nh; aux = tw*nh/nw; //console.info(aux,tw, rat,o.settings_autoHeight_proportional_max_height); if(aux> o.settings_autoHeight_proportional_max_height){ aux = o.settings_autoHeight_proportional_max_height; } aux+='px'; } } } if(margs.force_width && margs.force_width>0){ _c.find('img').eq(0).width(margs.force_width); _c.find('img').eq(0).addClass('width-already-set'); _thumbsCon.width(margs.force_width); _thumbsCon.addClass('width-already-set'); } if(margs.force_height && margs.force_height>0){ aux = margs.force_height; } //console.info(aux); if(aux){ _thumbsCon.css({ 'height' : aux }); } /* */ } } if(currPage>-1){ calculate_dims(); } clearTimeout(inter_calculate_hard); inter_calculate_hard = setTimeout(calculate_dims_hard, 100); //console.log(tw); } function click_arrow(){ var _t = $(this); // console.log(_t); if(_t.hasClass('arrow-left')){ gotoPrevPage(); } if(_t.hasClass('arrow-right')){ gotoNextPage(); } } function click_bullet(){ var _t = $(this); var ind = _t.parent().children().index(_t); if(cthis.find(_t).length<1){ return; } gotoPage(ind); } function prepareForLoad(arg){ var tempNextNr = arg+1; var tempPrevNr = arg-1; if(tempPrevNr<=-1){ tempPrevNr = nrItems-1; } if(tempNextNr>=nrItems){ tempNextNr = 0; } //console.info(tempPrevNr); loadItem(tempPrevNr); loadItem(arg); loadItem(tempNextNr); } function loadItem(arg){ // console.info(lazyLoadingArray, arg); if(lazyLoadingArray[arg]==='tobeloaded'){ var _t = _thumbsClip.children().eq(arg); // console.info(_t); // _t.addClass('needs-loading'); if(_t.attr('data-source')){ // _t.append('
'); _t.append(''); } if(_t.attr('data-divimage_source')){ // _t.append('
'); _t.append('
'); } lazyLoadingArray[arg] = 'loading'; } checkWhenLoaded(); } function gotoNextPage() { tempPage = currPage+1; if(tempPage>pag_total_pagenr-1){ tempPage = 0; } //console.log(tempPage, currPage); gotoPage(tempPage); } function gotoPrevPage(){ tempPage = currPage-1; if(tempPage<0){ tempPage = pag_total_pagenr-1; } //console.log(tempPage); //console.log(tempPage, currPage); gotoPage(tempPage); } function gotoPage(arg,pargs){ //console.log('gotoPage', cthis, currPage, arg, pag_total_pagenr); var margs = { 'called_from_resize':false }; if(pargs){ margs = $.extend(margs,pargs); } //return false; if(arg>pag_total_pagenr-1){ arg = pag_total_pagenr-1; } if(o.settings_mode=='onlyoneitem' && o.settings_lazyLoading=='on'){ prepareForLoad(arg); } if(o.settings_transition_only_when_loaded=='on' && _thumbsClip.children().eq(arg).hasClass('needs-loading') && _thumbsClip.children().eq(arg).hasClass('loaded')==false){ //console.info('what'); inter_wait_loaded = setTimeout(function(){ gotoPage(arg,margs) },500); return false; }else{ //console.info('what wait'); clearTimeout(inter_wait_loaded); } //console.info('action_call_on_gotoItem', action_call_on_gotoItem); _bulletsCon.children().removeClass('active'); _bulletsCon.children().eq(arg).addClass('active'); if(arg!=pag_total_pagenr-1 || o.settings_mode=='onlyoneitem'){ currPageX = -((items_per_page) * arg) * _thumbsClip.children().eq(0).outerWidth(true); cthis.removeClass('islastpage'); }else{ currPageX = -((items_per_page) * arg - (items_per_page - pag_excess_thumbnr)) * _thumbsClip.children().eq(0).outerWidth(true); cthis.addClass('islastpage'); } calculate_dims({'donotcallgotopage' : 'on'}); //console.log(cthis, o.settings_transition) var animation_time = 500; if(currPage > -1 && currPage!=arg && o.settings_mode=='onlyoneitem'){ var _c = _thumbsClip.children().eq(currPage); if(o.settings_mode=='onlyoneitem'){ //console.info(_c); if(_c.find('.vplayer').length>0){ var _cach = _c.find('.vplayer').eq(0); //console.info(_cach); if(_cach.get(0) && _cach.get(0).api_pauseMovie){ _cach.get(0).api_pauseMovie(); } } } if(o.settings_transition=='wipeoutandfade'){ //console.info('thumbsCon.width()',_thumbsCon.width()); _c.css('width', _thumbsCon.width()); //_c.css('overflow', 'hidden'); //console.info(_c); if(_c.children().eq(0).hasClass('wipeout-wrapper')==false){ //_c.wrapInner('
'); if(_c.children('img').length>0){ _c.children('img').wrap('
'); }else{ if(_c.find('.vplayer').length>0){ _c.find('.vplayer').wrap('
'); } } //console.info(_c); //if(_c.find('.wipeout-wrapper .description-wrapper').length>0){ // _c.append(_c.find('.description-wrapper')); //} _c.find('.wipeout-wrapper-inner').eq(0).width(_c.width()); }else{ //_c.children('.wipeout-wrapper').css('width',''); } _c.find('.description-wrapper').removeClass('active').animate({ 'opacity' : 0 }, { queue:false ,duration:300 }) //if(_c.children('img').eq(0).hasClass('width-already-set')==false){ // // _c.children('img,.imagediv').width(_c.width()); // _c.children('.description-wrapper').width(_c.children('.description-wrapper').width()); //} //console.info(_c.children().eq(0),_c.children().eq(0).hasClass('is-video')) if(_c.children().eq(0).hasClass('is-video')){ //_c.find('.vplayer').eq(0).width(_c.find('.vplayer').eq(0).width); var aux = 'width: ' + _c.find('.vplayer').eq(0).width() + 'px!important'; //console.info(aux); _c.find('.vplayer').eq(0).attr('style',aux); } _c.children('.wipeout-wrapper').addClass('wipeout-wrapper-transitioning') _c.children('.wipeout-wrapper').animate({ 'width':'0' },{ queue:false ,duration : animation_time*1 ,complete:function(){ setTimeout(function(arg){ //$(this).children().unwrap() $(arg).removeClass('wipeout-wrapper-transitioning'); $(arg).find('.vplayer').eq(0).attr('style',''); //console.info($(arg)); //$(arg).children('.wipeout-wrapper-inner').css('width' ,''); },150, this); } }) //_c.animate({ // 'width':'0' //},{ // queue:false // ,duration : animation_time //}) } } if(o.settings_wait_for_do_transition_call!='on'){ if(o.settings_transition=='slide' || o.settings_transition=='fade' || o.settings_transition=='testimonials_transition_1'){ //console.info('do transition from here'); do_transition(); } if(o.settings_transition=='wipeoutandfade'){ //console.info(currPage); if(currPage==-1){ animation_time=-390; } setTimeout(function(){ _thumbsClip.children().removeClass("currItem"); },animation_time); //console.info('do transition from hier'); setTimeout(do_transition,animation_time+200); } }else{ } if(margs.called_from_resize==false && action_call_on_gotoItem){ cthis.get(0).api_do_transition = do_transition; //console.info('ceva'); action_call_on_gotoItem(cthis, _thumbsClip.children().eq(arg),{arg: arg}); } //do_transition(); function do_transition(pargs){ //console.info('do_transition()', cthis); //console.info('do_transition()', arg, pargs); var margs = { 'force_width' : 0 ,'force_height' : 0 ,'arg' : 0 } ; if(pargs){ margs = $.extend(margs,pargs); } //console.log(margs); if(o.settings_mode=='onlyoneitem'){ //------- only one item var _c = _thumbsClip.children().eq(arg); //console.info(arg,_c); _thumbsClip.children().removeClass("currItem"); //if(arg!=1){ if(o.settings_transition=='fade'||o.settings_transition=='wipeoutandfade'){ _c.addClass('currItem'); //console.info(_c.children().eq(0),_c.children().eq(0).hasClass('is-video')) if(_c.children().eq(0).hasClass('is-video')){ //_c.find('.vplayer').eq(0).width(margs.force_width); //_c.find('.vplayer').eq(0).height(margs.force_height); //_c.data('wipeoutandfade_forced_sizes','on') } } if(o.settings_transition=='testimonials_transition_1'){ setTimeout(function () { _thumbsClip.children().eq(arg).addClass('currItem'); },500); } if(o.settings_mode=='onlyoneitem'){ if(_c.find('.vplayer').length>0){ var _cach = _c.find('.vplayer').eq(0); if(o.mode_onlyone_autoplay_videos=='on'){ if(_cach.get(0) && _cach.get(0).api_playMovie){ _cach.get(0).api_playMovie(); } } if(_cach.get(0) && _cach.get(0).api_handleResize){ setTimeout(function(){ _cach.get(0).api_handleResize(); },1000) } } } _c.find('.description-wrapper').css({ 'opacity' : 1 }) if(o.settings_transition=='wipeoutandfade'){ //console.info(cthis, o.settings_transition); if(!cthis.hasClass('no-need-for-nav')){ var auxw = _thumbsClip.children().eq(0).outerWidth(true); if(margs.force_width && margs.force_width>0){ auxw = (margs.force_width); //console.info('auxw',auxw,pag_total_pagenr); _thumbsClip.width(auxw* pag_total_pagenr + 40); _thumbsClip.children().width(auxw); // -- i don't know if good idea. //_thumbsCon.width(auxw); _thumbsClip.children().data('forced_width','on'); }else{ _thumbsClip.children().width(_thumbsCon.eq(0).width()); _thumbsClip.children().data('forced_width','off'); } //console.info(margs.arg,auxw); currPageX = 0; currPageX = -margs.arg * auxw; //console.info(currPageX); _thumbsClip.css({ 'left' : currPageX }); }; //console.info(_c, _c.children().eq(0).hasClass('wipeout-wrapper')); if(_c.children('.wipeout-wrapper').length>0){ _c.children('.wipeout-wrapper').css('width',''); } } if(o.settings_transition=='testimonials_transition_1'){ //console.info(cthis, o.settings_transition); if(!cthis.hasClass('no-need-for-nav')){ var auxw = _thumbsClip.children().eq(0).outerWidth(true); if(margs.force_width && margs.force_width>0){ auxw = (margs.force_width); //console.info('auxw',auxw,pag_total_pagenr); _thumbsClip.width(auxw* pag_total_pagenr + 40); _thumbsClip.children().width(auxw); _thumbsClip.children().data('forced_width','on'); }else{ _thumbsClip.children().width(_thumbsCon.eq(0).width()); _thumbsClip.children().data('forced_width','off'); } //console.info(margs.arg,auxw); currPageX = 0; currPageX = -margs.arg * auxw; //console.info(currPageX); _thumbsClip.css({ 'left' : 0 }); }; if(_c.children().eq(0).hasClass('wipeout-wrapper')){ _c.children('.wipeout-wrapper').css('width',''); } } //} //console.info(o.settings_autoHeight, arg,_c, _c.outerHeight()); if(o.settings_autoHeight=='on'){ var aux = _c.outerHeight(); if(o.settings_autoHeight_proportional=='on'){ if(_c.find('.imagediv').eq(0).data('natural_w')){ var nw =Number(_c.find('.imagediv').eq(0).data('natural_w')); var nh =Number(_c.find('.imagediv').eq(0).data('natural_h')); var rat = nw/nh; aux = tw*nh/nw; if(aux> o.settings_autoHeight_proportional_max_height){ aux = o.settings_autoHeight_proportional_max_height; } aux+='px'; //console.info(aux,tw, rat); } } if(margs.force_width && margs.force_width>0){ _c.find('img').eq(0).width(margs.force_width); _c.find('img').eq(0).addClass('width-already-set'); _thumbsCon.width(margs.force_width); _thumbsCon.addClass('width-already-set'); } if(margs.force_height && margs.force_height>0){ aux = margs.force_height; } _thumbsCon.css({ 'height' : aux }); cthis.css({ 'height' : 'auto' }) if(o.settings_autoHeight_proportional=='on'){ _thumbsClip.children().children('.imagediv').height(aux); } } if(o.settings_transition=='slide'){ if(!cthis.hasClass('no-need-for-nav')){ _thumbsClip.css({ 'left' : currPageX }); }; } if(o.settings_transition=='fade'){ } }else{ if(!cthis.hasClass('no-need-for-nav')){ _thumbsClip.css({ 'left' : currPageX }); }; } if(o.settings_secondCon){ // console.info($(o.settings_secondCon).find('.item').eq(arg).outerHeight(false)); $(o.settings_secondCon).find('.item').removeClass('active'); $(o.settings_secondCon).find('.item').eq(arg).addClass('active'); $(o.settings_secondCon).find('.dzsas-second-con--clip').css( { 'height': $(o.settings_secondCon).find('.item').eq(arg).outerHeight(false) ,'left' : -(arg*100)+'%' } ); } currPage = arg; slideshowCount = 0; //setTimeout(calculate_dims, 500); } } return this; }) } window.dzsas_init = function(selector, settings) { if(typeof(settings)!="undefined" && typeof(settings.init_each)!="undefined" && settings.init_each==true ){ var element_count = 0; for (e in settings) { element_count++; } if(element_count==1){ settings = undefined; } $(selector).each(function(){ var _t = $(this); _t.advancedscroller(settings) }); }else{ $(selector).advancedscroller(settings); } }; })(jQuery); function is_ios() { return ((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) || (navigator.platform.indexOf("iPad") != -1) ); } function is_android() { //return true; return (navigator.platform.indexOf("Android") != -1); } function is_ie(){ if (navigator.appVersion.indexOf("MSIE") != -1){ return true; }; return false; }; function is_firefox(){ if (navigator.userAgent.indexOf("Firefox") != -1){ return true; }; return false; }; function is_opera(){ if (navigator.userAgent.indexOf("Opera") != -1){ return true; }; return false; }; function is_chrome(){ return navigator.userAgent.toLowerCase().indexOf('chrome') > -1; }; function is_safari(){ return navigator.userAgent.toLowerCase().indexOf('safari') > -1; }; function version_ie(){ return parseFloat(navigator.appVersion.split("MSIE")[1]); }; function version_firefox(){ if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ var aversion=new Number(RegExp.$1); return(aversion); }; }; function version_opera(){ if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ var aversion=new Number(RegExp.$1); return(aversion); }; }; jQuery(document).ready(function($){ dzsas_init('.advancedscroller.auto-init', {init_each: true}) });