PageSourceSearch

https://www.indrenionline.com/wp-content/plugins/NetcomGallery/videogallery/vplayer.js?ver=1790994862

js indrenionline.com collected 2026-10-03 02:34:58 UTC 341,150 bytes, 9,293 lines download raw bytes

1/*
2 * Author: Digital Zoom Studio
3 * Website: http://digitalzoomstudio.net/
4 * Portfolio: http://codecanyon.net/user/ZoomIt/portfolio?ref=ZoomIt
5 * This is not free software.
6 * Video Gallery
7 * Version: 9.64
8 */
9
10"use strict";
11
12var vgsettings = {
13    protocol: 'https'
14    , vimeoprotocol: 'https:'
15};
16
17var youtubeid_array = []; // -- an array to hold inited youtube videos
18var dzsvp_players_arr = []; // -- an array to hold video players
19var dzsvp_yt_iframe_settoload = false;
20var _global_youtubeIframeAPIReady  = false;
21
22
23window.backup_onYouTubePlayerReady = null;
24
25
26window.dzsvg_self_options = {};
27window.dzsvp_self_options = {};
28
29//VIDEO GALLERY
30(function($) {
31
32
33
34    Math.easeIn = function(t, b, c, d) {
35
36        return -c *(t/=d)*(t-2) + b;
37
38    };
39
40
41
42    $.fn.prependOnce = function(arg, argfind) {
43        var _t = $(this) // It's your element
44
45
46//        console.info(argfind);
47        if(typeof(argfind) =='undefined'){
48            var regex = new RegExp('class="(.*?)"');
49            var auxarr = regex.exec(arg);
50
51
52            if(typeof auxarr[1] !='undefined'){
53                argfind = '.'+auxarr[1];
54            }
55        }
56
57
58
59        // we compromise chaining for returning the success
60        if(_t.children(argfind).length<1){
61            _t.prepend(arg);
62            return true;
63        }else{
64            return false;
65        }
66    };
67    $.fn.appendOnce = function(arg, argfind) {
68        var _t = $(this) // It's your element
69
70
71        if(typeof(argfind) =='undefined'){
72            var regex = new RegExp('class="(.*?)"');
73            var auxarr = regex.exec(arg);
74
75
76            if(typeof auxarr[1] !='undefined'){
77                argfind = '.'+auxarr[1];
78            }
79        }
80//        console.info(_t, _t.children(argfind).length, argfind);
81        if(_t.children(argfind).length<1){
82            _t.append(arg);
83            return true;
84        }else{
85            return false;
86        }
87    };
88    $.fn.vGallery = function(o) {
89
90        var defaults = {
91            totalWidth: ""
92            ,totalHeight: ""
93            ,init_on: "init"
94            ,totalHeightDifferenceOnParent: ""
95            ,forceVideoWidth: ''
96            ,forceVideoHeight: ''
97            ,menuSpace: 0 //deprecated replaced by nav_space
98            ,randomise: "off"
99            ,autoplay: "off"
100            ,autoplayNext: "on" // -- play the next video when one finishes
101            ,loop_playlist: "on" // -- loop the playlist from the beggining when the end has been reached
102            ,autoplay_ad: "on"
103            ,playorder: "normal" // -- normal or reverse
104            ,menu_position: 'right'
105            ,menuitem_width: "200"
106            ,menuitem_height: "71"
107            ,menuitem_space: "0"
108            ,nav_type: "thumbs"//thumbs or thumbsandarrows or scroller
109            ,nav_space: '0'
110            ,transition_type: "slideup"
111            ,design_skin: 'skin-default'
112            ,videoplayersettings: {}
113            ,embedCode: ''
114            ,shareCode: ''
115            ,php_media_data_retriever: '' // -- this can help get the video meta data for youtube and vimeo
116            ,cueFirstVideo: 'on'
117            ,design_navigationUseEasing: 'off'
118            ,logo: ''
119            ,logoLink: ''
120            ,settings_enable_linking : 'off' // -- enable deeplinking on video gallery items
121            ,settings_mode: 'normal' /// -- normal / wall / rotator / rotator3d / slider
122            ,settings_disableVideo: 'off' //disable the video area
123            ,settings_enableHistory : 'off' // html5 history api for link type items
124            ,settings_enableHistory_fornormalitems : 'off' // html5 history api for normal items
125            ,settings_ajax_extraDivs : '' // extra divs to pull in the ajax request
126            ,startItem:'default'
127            ,settings_separation_mode: 'normal' // === normal ( no pagination ) or pages or scroll or button
128            ,settings_separation_pages: []
129            ,settings_separation_pages_number: '5' //=== the number of items per 'page'
130            ,nav_type_outer_grid: 'dzs-layout--4-cols' // -- four-per-row
131            ,nav_type_outer_max_height: '' // -- enable a scroller if menu height bigger then max_height
132            ,settings_menu_overlay: 'off' // -- an overlay to appear over the menu
133            ,search_field: 'off' // an overlay to appear over the menu
134            ,search_field_con: null // an overlay to appear over the menu
135            ,disable_videoTitle: "off" // -- do not auto set the video title
136            ,settings_trigger_resize: '0' // -- a force trigger resize every x ms
137            ,settings_go_to_next_after_inactivity: '0' // -- go to next track if no action
138            ,modewall_bigwidth: '800' // -- the mode wall video ( when opened ) dimensions
139            ,modewall_bigheight: '500'
140            ,settings_secondCon: null
141            ,settings_outerNav: null
142            ,extra_class_slider_con: ''
143            ,menu_description_format: '' // -- use something like "{{number}}{{menuimage}}{{title}}{{desc}}"
144            ,masonry_options:{}
145        };
146
147
148
149        if(typeof o =='undefined'){
150            if(typeof $(this).attr('data-options')!='undefined' && $(this).attr('data-options')!=''){
151                var aux = $(this).attr('data-options');
152                aux = 'window.dzsvg_self_options = ' + aux;
153                eval(aux);
154                o = $.extend({},window.dzsvg_self_options);
155                window.dzsvg_self_options = $.extend({},{});
156            }
157        }
158
159        o = $.extend(defaults, o);
160
161        this.each(function() {
162
163            var cgallery = $(this)
164                ,cid = ''
165                ;
166            var nrChildren = 0;
167            var _sliderMain
168                , _sliderCon
169                , _navMain
170                , _navCon
171                , _adSpace
172                , _mainNavigation
173                , _searchField
174                ;
175            //gallery dimensions
176            var videoWidth
177                , videoHeight
178                , totalWidth
179                , totalHeight
180                , last_totalWidth = 0 // -- so we can compare to the last values
181                , last_totalHeight = 0
182                , navWidth = 0 // the _navCon width
183                , navHeight = 0
184                , ww
185                , wh
186                ,last_height_for_videoheight = 0 // -- last responsive_ratio height known
187                ;
188
189            var inter_start_the_transition = null
190                ,inter_mouse_move = null
191                ,inter_relayout_masonry = null
192                ,inter_try_to_init_scroller = null
193                ;
194
195            var nav_main_totalsize = 0 // the total size of the thumbs
196                , nav_main_consize = 0 // the total size of the container
197                , nav_page_size = 0 // the total size of a page of thumbs
198                , nav_max_pages = 0 // max number of pages
199                , nav_pages_visible = 0 // max number of pages
200                , nav_excess_thumbs = 0 // the total size of the last page of thumbs
201                , nav_arrow_size = 40
202                ;
203            var thumbs_thumb_var = 0
204                , thumbs_thumb_var_sec = 0
205                , thumbs_total_var = 0
206                , thumbs_total_var_sec = 0
207                , thumbs_css_main = "top"
208                ,thumbs_per_page = 0
209                ,ultra_responsive_last_layout = 'normal'
210                ;
211
212            var nav_thumbs_dir_ver = false
213                ,nav_thumbs_dir_hor = false
214                ;
215
216
217            var backgroundY;
218            var used = new Array();
219            var content = new Array();
220            var currNr = -1
221                , nextNr = -1
222                , prevNr = -1
223                , currPage = 0
224                , last_arg = 0
225                ;
226            var currVideo;
227            var arr_inlinecontents = [];
228
229            var _rparent
230                , _con
231                , ccon
232                , currScale = 1
233                ,initial_h = -1
234                ;
235            var conw = 0;
236            var conh = 0;
237
238            var wpos = 0
239                , hpos = 0
240                , nav_max_pages = 0
241                ,navMain_mousex = 0
242                ,navMain_mousey = 0
243                ;
244            var lastIndex = 99;
245
246            var busy_transition = false
247                ,sw_transition_started = false
248                ,busy_ajax = false
249                ,loaded = false//===gallery loaded sw, when dimensions are set, will take a while if wall
250                ;
251            var firsttime = true; // firsttime changed item
252            var embed_opened = false
253                , share_opened = false
254                , ad_playing = false
255                , search_added = false
256                , first_played = false
257                , first_transition = false // -- first transition made
258                ;
259
260
261            var i = 0;
262
263            var aux = 0
264                , aux1 = 0
265                ;
266
267            var down_x = 0
268                , up_x = 0;
269
270
271            var menuitem_width = 0
272                ,menuitem_height = 0
273                ,menuitem_space = 0;
274
275            var menu_position = 'right';
276
277            var settings_separation_nr_pages = 0;
278            var ind_ajaxPage = 0;
279
280
281
282
283            var duration_viy = 20
284                ,target_viy = 0
285                ,target_vix = 0
286                ,begin_viy = 0
287                ,begin_vix = 0
288                ,finish_viy = 0
289                ,finish_vix = 0
290                ,change_viy = 0
291                ,change_vix = 0
292                ;
293
294            var init_settings = {};
295
296
297
298            init_settings = $.extend({}, o);
299            if(o.nav_type=='outer'){
300                if(o.forceVideoHeight==''){
301                    o.forceVideoHeight = '300';
302                }
303            }
304
305
306
307
308            if(o.settings_mode=='slider'){
309
310                o.menu_position = 'none';
311                o.nav_type = 'none';
312                // o.videoplayersettings.responsive_ratio = 'default';
313
314            }
315
316//            console.info(o.menuitem_width);
317            if(isNaN(parseInt(o.menuitem_width, 10))==false && String(o.menuitem_width).indexOf('%')==-1){
318                o.menuitem_width = parseInt(o.menuitem_width, 10);
319            }
320//            console.info(o.menuitem_width);
321
322            o.menuitem_height = parseInt(o.menuitem_height, 10);
323            o.settings_go_to_next_after_inactivity = parseInt(o.settings_go_to_next_after_inactivity, 10);
324            //o.menuitem_space = ;
325
326            if(isNaN(Number(o.menuitem_space))==false){
327                menuitem_space = Number(o.menuitem_space);
328                //console.log('ceva');
329            }
330
331            if(o.startItem!='default'){
332                o.startItem = parseInt(o.startItem, 10);
333            }
334
335            o.settings_separation_pages_number = parseInt(o.settings_separation_pages_number, 10);
336            o.settings_trigger_resize = parseInt(o.settings_trigger_resize, 10);
337
338            menu_position = o.menu_position;
339
340            if(!isNaN(parseInt(o.forceVideoWidth,10))){
341                o.forceVideoWidth = parseInt(o.forceVideoWidth,10);
342            }
343            if(!isNaN(parseInt(o.forceVideoHeight,10))){
344                o.forceVideoHeight = parseInt(o.forceVideoHeight,10);
345            }
346
347            nrChildren = cgallery.children('.vplayer,.vplayer-tobe').length;
348
349
350            var masonry_options_default = {
351                columnWidth: 1
352                ,containerStyle: {position: 'relative'}
353                ,isFitWidth: false
354                ,isAnimated:true
355            };
356
357            //console.info(o.masonry_options);
358
359            o.masonry_options = $.extend(masonry_options_default, o.masonry_options);
360
361
362            if(can_history_api()==false){
363                o.settings_enable_linking = 'off';
364            }
365
366
367
368            if(o.init_on=='init'){
369
370                init();
371            }
372            if(o.init_on=='scroll'){
373
374
375                $(window).on('scroll',handle_scroll);
376                handle_scroll();
377            }
378
379            var _gbuttons = cgallery.children('.gallery-buttons');
380
381            function init(){
382
383
384                // console.info('init() -');
385
386
387
388
389                ccon = cgallery.parent();
390                _rparent = cgallery.parent();
391
392
393
394
395                //console.log($.fn.urlParam(window.location.href, 'dzsvgpage'));
396
397
398                // ==== separation - PAGES
399                var elimi = 0;
400                //console.info(o.settings_separation_mode)
401                if(o.settings_separation_mode=='pages'){
402                    //var dzsvg_page = $.fn.urlParam(window.location.href, 'dzsvgpage');
403                    var dzsvg_page = get_query_arg(window.location.href, 'dzsvgpage');
404                    //console.info(dzsvg_page, o.settings_separation_pages_number, nrChildren);
405
406                    if(typeof dzsvg_page== "undefined"){
407                        dzsvg_page=1;
408                    }
409                    dzsvg_page = parseInt(dzsvg_page,10);
410
411
412                    if(dzsvg_page == 0 || isNaN(dzsvg_page)){
413                        dzsvg_page = 1;
414                    }
415
416                    if(dzsvg_page > 0 && o.settings_separation_pages_number < nrChildren){
417                        //console.log(cgallery.children());
418                        var aux;
419                        if(o.settings_separation_pages_number * dzsvg_page <= nrChildren){
420                            for(elimi = o.settings_separation_pages_number * dzsvg_page - 1; elimi >= o.settings_separation_pages_number * (dzsvg_page-1);elimi--){
421                                cgallery.children().eq(elimi).addClass('from-pagination-do-not-eliminate');
422                            }
423                        }else{
424                            for(elimi = nrChildren - 1; elimi >= nrChildren - o.settings_separation_pages_number;elimi--){
425                                cgallery.children().eq(elimi).addClass('from-pagination-do-not-eliminate');
426                            }
427                        }
428
429                        cgallery.children().each(function(){
430                            var _t = $(this);
431                            if(!_t.hasClass('from-pagination-do-not-eliminate')){
432                                _t.remove();
433                            }
434                        })
435
436                        var str_pagination = '<div class="con-dzsvg-pagination">';
437                        settings_separation_nr_pages = Math.ceil(nrChildren / o.settings_separation_pages_number);
438                        //console.info(settings_separation_nr_pages)
439                        nrChildren = cgallery.children().length;
440
441                        for(i=0;i<settings_separation_nr_pages;i++){
442                            var str_active = '';
443                            if((i+1)==dzsvg_page){
444                                str_active = ' active';
445                            }
446                            str_pagination+='<a class="pagination-number '+str_active+'" href="'+add_query_arg(window.location.href, 'dzsvgpage', (i+1))+'">'+(i+1)+'</a>'
447                        }
448
449                        str_pagination+='</div>';
450                        cgallery.after(str_pagination);
451
452                    }
453                }
454
455
456
457                if(is_touch_device()){
458                    cgallery.addClass('is-touch');
459                }
460
461                cgallery.children().each(function(){
462                    var _t = $(this);
463
464                    //console.info(_t);
465
466                    if (_t.attr('data-type')=='youtube' && _t.attr('data-thumb')==undefined){
467                        _t.attr('data-thumb', '//img.youtube.com/vi/' + _t.attr('data-src') + '/0.jpg');
468                    }
469
470                    if (_t.attr('data-previewimg') == undefined) {
471                        if (_t.attr('data-thumb') != undefined){
472                            _t.attr('data-previewimg', _t.attr('data-thumb'));
473                        }
474
475                        if (_t.attr('data-img') != undefined){
476                            _t.attr('data-previewimg', _t.attr('data-img'));
477                        }
478                    }
479                    if (_t.attr('data-src') == undefined) {
480
481                        if (_t.attr('data-source') != undefined){
482                            _t.attr('data-src', _t.attr('data-source'));
483                        }
484                    }
485                    if(o.settings_mode=='wall'){
486
487                        if (_t.find('.videoDescription').length == 0) {
488                            if (_t.find('.menuDescription').length > 0) {
489                                _t.append('<div class="videoDescription">'+_t.find('.menuDescription').html()+'</div>')
490                            }
491                        }
492                    }
493                });
494
495                if(o.settings_mode=='wall' || o.settings_mode=='videowall'){
496                    o.design_shadow = 'off';
497                    o.logo = '';
498
499                }
500
501                if(_rparent.hasClass("skin-laptop")){
502                    o.totalWidth = '62%';
503                    cgallery.height(_rparent.height() * 0.686)
504                    o.totalHeightDifferenceOnParent = '-0.30';
505                }
506
507
508                //==some sanitizing of the videoWidth and videoHeight parameters
509
510
511
512
513
514
515
516
517                if (o.totalWidth=='' || o.totalWidth == 0) {
518                    totalWidth = cgallery.width();
519                } else {
520                    totalWidth = o.totalWidth;
521                    cgallery.css('width', totalWidth);
522                }
523
524                if (o.totalHeight=='' || o.totalHeight == 0) {
525                    totalHeight = cgallery.height();
526                } else {
527                    totalHeight = o.totalHeight;
528                }
529                //console.info(totalWidth);
530
531                //=== some sanitizing
532                if(isNaN(totalWidth)){
533                    totalWidth = 800;
534                }
535
536                if(isNaN(totalHeight)){
537                    totalHeight = 400;
538                }
539
540
541                cid = cgallery.attr('id');
542                if(typeof cid=='undefined' || cid==''){
543                    var auxnr = 0;
544                    var temps = 'vgallery'+auxnr;
545
546                    while($('#'+temps).length>0){
547                        auxnr++;
548                        temps = 'vgallery'+auxnr;
549                    }
550
551                    cid = temps;
552                    cgallery.attr('id', cid);
553                }
554
555                //console.info(totalWidth);
556
557
558                cgallery.get(0).var_scale = 1;
559
560                backgroundY = o.backgroundY;
561
562                cgallery.addClass('mode-' + o.settings_mode);
563                cgallery.addClass('nav-' + o.nav_type);
564
565                var mainClass = '';
566
567                if (typeof(cgallery.attr('class')) == 'string') {
568                    mainClass = cgallery.attr('class');
569                } else {
570                    mainClass = cgallery.get(0).className;
571                }
572                if (mainClass.indexOf('skin-') == -1) {
573                    cgallery.addClass(o.design_skin);
574                }
575
576                if (o.videoplayersettings.design_skin == 'sameasgallery') {
577                    o.videoplayersettings.design_skin = o.design_skin;
578                }
579
580
581
582
583
584
585
586                for (i = 0; i < nrChildren; i++) {
587
588                    // console.info()
589                    content[i] = cgallery.children().eq(i);
590                    //_sliderCon.append(content[i]);
591                    if (o.randomise == 'on'){
592                        randomise(0, nrChildren);
593                    }else{
594                        used[i] = i;
595                    }
596
597                }
598
599
600                if(o.search_field_con){
601                    _searchField = o.search_field_con;
602                    search_added=true;
603                }
604
605                var aux ='<div class="main-navigation"><div class="navMain"><div class="videogallery--navigation-container">';
606
607                if(!search_added && o.search_field=='on'){
608
609                    aux+='<div class="dzsvg-search-field"><input type="text" placeholder="search..."/><svg class="search-icon" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="15px" viewBox="230.042 230.042 15 15" enable-background="new 230.042 230.042 15 15" xml:space="preserve"> <g> <path fill="#898383" d="M244.708,243.077l-3.092-3.092c0.746-1.076,1.118-2.275,1.118-3.597c0-0.859-0.167-1.681-0.501-2.465 c-0.333-0.784-0.783-1.46-1.352-2.028s-1.244-1.019-2.027-1.352c-0.785-0.333-1.607-0.5-2.466-0.5s-1.681,0.167-2.465,0.5 s-1.46,0.784-2.028,1.352s-1.019,1.244-1.352,2.028s-0.5,1.606-0.5,2.465s0.167,1.681,0.5,2.465s0.784,1.46,1.352,2.028 s1.244,1.019,2.028,1.352c0.784,0.334,1.606,0.501,2.465,0.501c1.322,0,2.521-0.373,3.597-1.118l3.092,3.083 c0.217,0.229,0.486,0.343,0.811,0.343c0.312,0,0.584-0.114,0.812-0.343c0.228-0.228,0.342-0.499,0.342-0.812 C245.042,243.569,244.931,243.3,244.708,243.077z M239.241,239.241c-0.79,0.79-1.741,1.186-2.853,1.186s-2.062-0.396-2.853-1.186 c-0.79-0.791-1.186-1.741-1.186-2.853s0.396-2.063,1.186-2.853c0.79-0.791,1.741-1.186,2.853-1.186s2.062,0.396,2.853,1.186 s1.186,1.741,1.186,2.853S240.032,238.45,239.241,239.241z"/> </g> </svg> </div>';
610
611
612                }else{
613                }
614                aux+='</div></div></div>';
615                if( menu_position!='bottom' ){
616
617
618
619                    cgallery.append(aux);
620                    cgallery.append('<div class="sliderMain"><div class="sliderCon"></div></div>');
621
622
623                }else{
624                    ////=== normal positioning -> video + navigation
625
626
627
628                    cgallery.append('<div class="sliderMain"><div class="sliderCon"></div></div>');
629                    cgallery.append(aux);
630
631                }
632                if(!search_added && o.search_field=='on') {
633                    _searchField = cgallery.find('.dzsvg-search-field > input');
634                }
635
636                //console.info(cgallery);
637                cgallery.append('<div class="gallery-buttons"></div>');
638                cgallery.append('<div class="videogallery--adSpace" style="display:none;"></div>');
639                if (o.design_shadow == 'on') {
640                    cgallery.prepend('<div class="shadow"></div>');
641                }
642
643                _sliderMain = cgallery.find('.sliderMain');
644                _sliderCon = cgallery.find('.sliderCon');
645                _adSpace = cgallery.find('.videogallery--adSpace').eq(0);
646                _mainNavigation = cgallery.find('.main-navigation');
647
648                _sliderCon.addClass(o.extra_class_slider_con);
649
650                if(o.settings_mode=='slider'){
651                    _sliderMain.after(_mainNavigation);
652                }
653
654                //console.info(cgallery, _sliderCon, o.extra_class_slider_con);
655
656                if(o.settings_disableVideo=='on'){
657                    _sliderMain.remove();
658                    //cgallery.children('.shadow').remove();
659
660                }
661
662                if (is_ie8()) {
663                    $('html').addClass('ie8-or-lower');
664                    cgallery.addClass('ie8-or-lower');
665                    _sliderCon.addClass('sliderCon-ie8');
666                }
667                if (can_translate()) {
668                    $('html').addClass('supports-translate');
669                }
670
671                _navMain = cgallery.find('.navMain');
672                _navCon = cgallery.find('.videogallery--navigation-container').eq(0);
673
674
675                if(o.design_navigationUseEasing=='on'){
676//                _navCon.addClass('use-easing');
677                }
678
679
680                //console.info(nrChildren, cgallery.children().length);
681                if (o.settings_mode == 'normal') {
682                    reinit();
683                }
684                if (o.settings_mode == 'slider') {
685
686                    _navMain.append('<div class="rotator-btn-gotoNext"><svg enable-background="new 0 0 32 32" height="32px" id="Layer_1" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M24.291,14.276L14.705,4.69c-0.878-0.878-2.317-0.878-3.195,0l-0.8,0.8c-0.878,0.877-0.878,2.316,0,3.194  L18.024,16l-7.315,7.315c-0.878,0.878-0.878,2.317,0,3.194l0.8,0.8c0.878,0.879,2.317,0.879,3.195,0l9.586-9.587  c0.472-0.471,0.682-1.103,0.647-1.723C24.973,15.38,24.763,14.748,24.291,14.276z" fill="#515151"/></svg></div><div class="rotator-btn-gotoPrev"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"                width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve"><path fill="#515151" d="M7.927,17.729l9.619,9.619c0.881,0.881,2.325,0.881,3.206,0l0.803-0.804c0.881-0.88,0.881-2.323,0-3.204l-7.339-7.342l7.34-7.34c0.881-0.882,0.881-2.325,0-3.205l-0.803-0.803c-0.881-0.882-2.325-0.882-3.206,0l-9.619,9.619                C7.454,14.744,7.243,15.378,7.278,16C7.243,16.621,7.452,17.256,7.927,17.729z"/></svg>                </div>');
687                }
688                if (o.settings_mode == 'rotator') {
689                    _navMain.append('<div class="rotator-btn-gotoNext"></div><div class="rotator-btn-gotoPrev"></div>');
690                    _navMain.append('<div class="descriptionsCon"></div>');
691                }
692
693
694
695                for (i = 0; i < nrChildren; i++) {
696
697                    // console.info('content[used[i]] - ',content[used[i]]);
698                    _sliderCon.append(content[used[i]]);
699                }
700
701
702                for (i = 0; i < nrChildren; i++) {
703                    var autoplaysw = 'off';
704                    if (i == 0 && o.autoplay == 'on'){
705                        autoplaysw = 'on';
706                    }
707                }
708
709//            console.info(menu_position);
710
711
712                _mainNavigation.addClass('menu-' + menu_position);
713
714                if (o.nav_type == 'thumbsandarrows') {
715                    _mainNavigation.append('<div class="thumbs-arrow-left inactive"></div>');
716                    _mainNavigation.append('<div class="thumbs-arrow-right"></div>');
717
718
719                    //_navCon.addClass('static');
720                    _mainNavigation.find('.thumbs-arrow-left').bind('click', gotoPrevPage);
721                    _mainNavigation.find('.thumbs-arrow-right').bind('click', gotoNextPage);
722                }
723
724
725                if(o.search_field=='on'){
726                    //console.info(_searchField);
727                    _searchField.bind('keyup', change_search_field);
728                }
729
730
731                //(o.menuitem_width + o.menuitem_space) * nrChildren
732                //console.info('ceva', is_ios());
733                if (is_ios() || is_android()){
734                    // _navMain.css('overflow', 'auto');
735                };
736
737                var hpos = 0;
738
739
740                //console.info(totalWidth, videoWidth);
741
742                if (o.settings_mode == 'rotator3d') {
743                    menu_position = 'none';
744                    o.menu_position = 'none';
745
746                    _sliderCon.children().each(function() {
747                        var _t = $(this);
748                        _t.addClass('rotator3d-item');
749                        _t.css({'width': videoWidth, 'height': videoHeight})
750                        _t.append('<div class="previewImg" style="background-image:url(' + _t.attr('data-previewimg') + ');"></div>');
751                        _t.children('.previewImg').bind('click', mod_rotator3d_clickPreviewImg);
752
753                    })
754                }
755                if (o.settings_mode == 'wall') {
756
757                    //jQuery('body').zoomBox();
758
759                    if (cgallery.parent().hasClass('videogallery-con')) {
760                        cgallery.parent().css({'width': 'auto', 'height': 'auto'})
761                    }
762                    cgallery.css({'width': 'auto', 'height': 'auto'});
763                    //return;
764                    _sliderCon.children().each(function() {
765                        //====each item
766                        var _t = $(this);
767
768                        _t.addClass('vgwall-item').addClass('clearfix');
769                        _t.css({'width': o.menuitem_width, 'height': 'auto', 'position': 'relative', 'top': 'auto', 'left': 'auto'});
770                        //console.log(totalWidth, totalHeight);
771                        _t.attr('data-bigwidth', o.modewall_bigwidth);
772                        _t.attr('data-bigheight', o.modewall_bigheight);
773                        _t.attr('data-biggallery', cgallery.attr('id'));
774
775
776                        _t.addClass('zoombox');
777
778
779                        var desc = _t.find('.menuDescription').html();
780
781
782                        if(desc){
783
784                            if (desc.indexOf('{ytthumb}') > -1) {
785                                desc = desc.split("{ytthumb}").join('<img src="//img.youtube.com/vi/' + _t.attr('data-src') + '/0.jpg" class="imgblock"/>');
786                            }
787                            if (desc.indexOf('{ytthumbimg}') > -1) {
788                                desc = desc.split("{ytthumbimg}").join('//img.youtube.com/vi/' + _t.attr('data-src') + '/0.jpg');
789                            }
790                            _t.find('.menuDescription').html(desc);
791                        }
792
793
794                        _t.find('.menuDescription .imgblock').after(_t.children('.videoTitle').clone());
795
796
797                        var str_menu_width = '';
798
799                        if(String(o.menuitem_width).indexOf('%')>-1 || String(o.menuitem_width).indexOf('auto')>-1){
800                            str_menu_width = ' width: '+ o.menuitem_width+';';
801                        }else{
802                            str_menu_width = ' width: '+ o.menuitem_width+'px;';
803                        }
804
805                        if (_t.attr('data-videoTitle') != undefined && _t.attr('data-videoTitle') != '') {
806                            _t.prepend('<div class="videoTitle">' + _t.attr('data-videoTitle') + '</div>');
807                        }
808                        if (_t.attr('data-previewimg') != undefined) {
809                            var aux2 = _t.attr('data-previewimg');
810
811                            if (aux2 != undefined && aux2.indexOf('{ytthumbimg}') > -1) {
812                                //console.log(_t.attr('data-src'));
813                                aux2 = aux2.split("{ytthumbimg}").join('//img.youtube.com/vi/' + _t.attr('data-src') + '/0.jpg');
814                            }
815
816
817                            var aux7 = '';
818
819
820                            if(String(o.menuitem_height)!=''){
821                                aux7+='<div class="previewImg divimg" style="background-image:url(' + aux2 + '); width: 100%; ';
822                                if(String(o.menuitem_height).indexOf('%')>-1 || String(o.menuitem_width).indexOf('auto')>-1){
823                                    aux7+=' height:'+o.menuitem_height+';';
824                                }else{
825                                    aux7+=' height:'+o.menuitem_height+'px;';
826                                }
827                                aux7+='"></div>';
828                            }else{
829                                aux7+='<img class="previewImg" src="' + aux2 + '"';
830                                aux7+= '/>';
831                            }
832
833
834                            _t.prepend(aux7);
835
836                        }
837
838                        //console.log(jQuery.fn.masonry);
839
840
841                        var args = {};
842                        if( window.init_zoombox_settings){
843                            args = window.init_zoombox_settings;
844                        }
845
846
847                        _t.zoomBox(args);
848                    });
849
850
851
852                    setTimeout(function() {
853                        if ($.fn.masonry != undefined) {
854                            _sliderCon.masonry(o.masonry_options);
855                            _sliderCon.addClass('masonry-inited');
856                            cgallery.parent().children('.preloader').fadeOut('slow');
857
858                        } else {
859                            alert('vplayer.js - warning: masonry not included')
860                        }
861                        setTimeout(handleResize, 1000);
862                        loaded = true;
863                    }, 1500);
864                }
865
866
867                if (o.settings_mode == 'videowall') {
868
869                    //jQuery('body').zoomBox();
870
871                    if (cgallery.parent().hasClass('videogallery-con')) {
872                        cgallery.parent().css({'width': 'auto', 'height': 'auto'})
873                    }
874                    cgallery.css({'width': 'auto', 'height': 'auto'});
875                    //return;
876                    _sliderCon.children().each(function() {
877                        //====each item
878                        var _t = $(this);
879
880                        _t.wrap('<div class="dzs-layout-item"></div>');
881
882                        // console.info(o.videoplayersettings);
883
884                        o.videoplayersettings.responsive_ratio = 'detect';
885                        o.videoplayersettings.cueVideo = 'off';
886
887                        _t.vPlayer(o.videoplayersettings);
888
889                        //console.log(jQuery.fn.masonry);
890
891                        // _t.zoomBox();
892                    });
893
894                }
895
896                // --- go to video 0 <<<< the start of the gallery
897                cgallery.get(0).videoEnd = handleVideoEnd;
898                cgallery.get(0).init_settings = init_settings;
899                cgallery.get(0).turnFullscreen = turnFullscreen;
900                cgallery.get(0).api_play_currVideo = play_currVideo;
901                cgallery.get(0).external_handle_stopCurrVideo = handle_stopCurrVideo;
902                cgallery.get(0).api_gotoNext = gotoNext;
903                cgallery.get(0).api_gotoPrev = gotoPrev;
904                cgallery.get(0).api_gotoItem = gotoItem;
905                cgallery.get(0).api_responsive_ratio_resize_h = responsive_ratio_resize_h;
906                cgallery.get(0).api_ad_block_navigation = ad_block_navigation;
907                cgallery.get(0).api_ad_unblock_navigation = ad_unblock_navigation;
908
909
910                if (o.logo) {
911                    cgallery.append('<img class="the-logo" src="' + o.logo + '"/>');
912                    if (o.logoLink != undefined && o.logoLink != '') {
913                        cgallery.children('.the-logo').css('cursor', 'pointer');
914                        cgallery.children('.the-logo').click(function() {
915                            window.open(o.logoLink);
916                        });
917                    }
918                }
919
920                _gbuttons = cgallery.children('.gallery-buttons');
921                if (o.embedCode != '') {
922                    _gbuttons.append('<div class="embed-button"><div class="handle"><svg width="32.00199890136719" height="32" viewBox="0 0 32.00199890136719 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g><path d="M 23.586,9.444c 0.88,0.666, 1.972,1.064, 3.16,1.064C 29.648,10.508, 32,8.156, 32,5.254 C 32,2.352, 29.648,0, 26.746,0c-2.9,0-5.254,2.352-5.254,5.254c0,0.002,0,0.004,0,0.004L 8.524,11.528 C 7.626,10.812, 6.49,10.38, 5.254,10.38C 2.352,10.38,0,12.734,0,15.634s 2.352,5.254, 5.254,5.254c 1.048,0, 2.024-0.312, 2.844-0.84 l 13.396,6.476c0,
9220.002,0,0.004,0,0.004c0,2.902, 2.352,5.254, 5.254,5.254c 2.902,0, 5.254-2.352, 5.254-5.254 c0-2.902-2.352-5.254-5.254-5.254c-1.188,0-2.28,0.398-3.16,1.064L 10.488,16.006c 0.006-0.080, 0.010-0.158, 0.012-0.238L 23.586,9.444z"></path></g></svg></div><div class="contentbox" style="display:none;"><textarea class="thetext">' + o.embedCode + '</textarea></div></div>');
923                    _gbuttons.find('.embed-button .handle').click(click_embedhandle)
924                    _gbuttons.find('.embed-button .contentbox').css({
925                        'right': 50
926                    })
927                }
928                if (o.shareCode != '') {
929                    _gbuttons.append('<div class="share-button"><div class="handle"><svg width="32" height="33.762001037597656" viewBox="0 0 32 33.762001037597656" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g><path d="M 22,6c0-3.212-2.788-6-6-6S 10,2.788, 10,6c0,3.212, 2.788,6, 6,6S 22,9.212, 22,6zM 16,14c-5.256,0-10,5.67-10,12.716s 20,7.046, 20,0S 21.256,14, 16,14z"></path></g></svg></div><div class="contentbox" style="display:none;"><div class="thetext">' + o.shareCode + '</div></div></div>');
930                    _gbuttons.find('.share-button .handle').click(click_sharehandle)
931                    _gbuttons.find('.share-button .contentbox').css({
932                        'right': 50
933                    })
934                }
935
936
937                if(o.nav_type=='outer'){
938                    _navCon.addClass(o.nav_type_outer_grid);
939
940
941                    _navCon.children().addClass('dzs-layout-item');
942
943
944                    if(o.menuitem_width){
945                        o.menuitem_width ='';
946                    }
947
948
949
950                    if(o.nav_type_outer_max_height){
951                        var nto_mh = Number(o.nav_type_outer_max_height);
952
953
954                        _navMain.css('max-height', nto_mh+'px');
955                        _navMain.addClass('scroller-con skin_apple inner-relative');
956                        _navCon.addClass('inner');
957
958                        _navMain.css({
959                            'height' : 'auto'
960                        })
961
962                        try_to_init_scroller();
963                    }
964                }
965
966                calculateDims({
967
968
969
970                    'call_from':'init'
971                });
972
973
974
975                if (o.nav_type == 'scroller') {
976                    _navMain.addClass('scroller-con skin_apple');
977                    _navCon.addClass('inner');
978
979                    if ((menu_position == 'right' || menu_position == 'left') && nrChildren > 1) {
980                        //console.log((o.menuitem_height + o.menuitem_space) * nrChildren);
981                        _navCon.css({
982                            // 'width' : menuitem_width
983                        })
984                    }
985                    if ((menu_position == 'bottom' || menu_position == 'top') && nrChildren > 1) {
986                        _navCon.css({
987                            'height' : (menuitem_height)
988                        })
989                    }
990
991                    _navMain.css({
992                        'height' : '100%'
993                    })
994
995                    _navMain.scroller({
996                        'enable_easing':'on'
997                    });
998                }
999
1000
1001                //====== NO FUNCTION HIER
1002
1003
1004
1005                //console.log('hier');
1006
1007                cgallery.on('click','.rotator-btn-gotoNext,.rotator-btn-gotoPrev', handle_mouse);
1008
1009
1010                window.addEventListener("orientationchange",handle_orientationchange);
1011                $(window).on('resize', handleResize);
1012                handleResize();
1013
1014                setTimeout(function(){
1015                    calculateDims({
1016
1017                        'call_from':'first_timeout'
1018                    })
1019                }, 3000);
1020                setTimeout(init_start,100);
1021
1022
1023                if(o.settings_trigger_resize>0){
1024                    setInterval(function(){
1025
1026                        // console.info("HMM");
1027                        calculateDims({
1028                            'call_from':'recheck_sizes'
1029                        });
1030                    },o.settings_trigger_resize);
1031                };
1032
1033
1034
1035                if(o.startItem=='default'){
1036                    o.startItem=0;
1037                    if(o.playorder=='reverse'){
1038                        o.startItem = nrChildren-1;
1039                    }
1040                }
1041
1042                // --- gotoItem
1043                if (o.settings_mode != 'wall' && o.settings_mode != 'videowall') {
1044
1045                    loaded = true;
1046
1047                    //console.info(o.startItem, get_query_arg(window.location.href,'dzsvg_startitem_'+cid));
1048
1049
1050
1051                    if( window.location.href,'dzsvg_startitem_'+cid ) {
1052                        o.startItem = Number(get_query_arg(window.location.href, 'dzsvg_startitem_'+cid));
1053                    }
1054                    if(get_query_arg(window.location.href,'the-video') && $('.videogallery').length==1){
1055                        o.startItem = Number(get_query_arg(window.location.href, 'the-video'));
1056                    }
1057                    if(get_query_arg(window.location.href,'the-video-'+cid)){
1058                        o.startItem = Number(get_query_arg(window.location.href, 'the-video-'+cid));
1059
1060
1061                        if(cgallery.parent().parent().parent().hasClass('categories-v
1061ideogallery')){
1062
1063
1064                            var _cach = cgallery.parent().parent().parent();
1065
1066                            //console.error('_cach - ',_cach);
1067                            var ind = _cach.find('.videogallery').index(cgallery);
1068
1069
1070                            //console.error('_cach - ',_cach, ind);
1071
1072                            if(ind){
1073                                setTimeout(function(){
1074                                    _cach.get(0).api_goto_category(ind,{
1075                                        'call_from':'deeplink'
1076                                    });
1077                                },100);
1078                            }
1079                        }
1080                    }
1081
1082                    if(isNaN(o.startItem)){
1083                        o.startItem = 0;
1084                    }
1085                    //console.log(_navMain, _sliderCon.children().eq(o.startItem).attr('data-type'));
1086                    console.info('startItem - ',o.startItem);
1087                    if(_sliderCon.children().eq(o.startItem).attr('data-type')=='link'){
1088                        gotoItem(o.startItem, {donotopenlink: "on", 'call_from': 'init'});
1089
1090                    }else{
1091                        gotoItem(o.startItem, {'call_from': 'init'});
1092                    }
1093                    if(o.nav_type=='scroller'){
1094                        var aux = parseInt(_navCon.children().eq(o.startItem).css('top'),10);
1095                        if(typeof _navMain.get(0).fn_scrolly_to != 'undefined'){
1096                            console.info('focescroll to', aux);
1097                            _navMain.get(0).fn_scrolly_to(aux);
1098                        }
1099
1100                    }
1101
1102
1103                    if(o.settings_go_to_next_after_inactivity){
1104                        setInterval(function(){
1105                            if(first_played==false){
1106
1107                                gotoNext();
1108                            }
1109                        },o.settings_go_to_next_after_inactivity*1000);
1110                    }
1111                }
1112
1113                if(o.settings_separation_mode=='scroll'){
1114                    $(window).bind('scroll', handle_scroll);
1115                }
1116                if(o.settings_separation_mode=='button'){
1117                    cgallery.append('<div class="btn_ajax_loadmore">Load More</div>');
1118                    cgallery.children('.btn_ajax_loadmore').bind('click', click_btn_ajax_loadmore);
1119                }
1120
1121
1122                // console.warn(cgallery);
1123                cgallery.get(0).api_handleResize = handleResize;
1124                cgallery.get(0).api_gotoItem = gotoItem;
1125                cgallery.get(0).api_handleResize_currVideo = handleResize_currVideo;
1126                cgallery.get(0).api_pause_currVideo = pause_currVideo;
1127                cgallery.get(0).api_currVideo_refresh_fsbutton = api_currVideo_refresh_fsbutton;
1128                cgallery.get(0).api_video_ready = the_transition;
1129
1130                cgallery.get(0).api_setup_ad = setup_ad;
1131                cgallery.get(0).api_played_video = function(){
1132                    first_played = true;
1133                    //console.info('first_played - ',first_played);
1134                };
1135
1136
1137
1138            }
1139
1140            function try_to_init_scroller(){
1141
1142                if(window.dzsscr_init){
1143
1144
1145                    window.dzsscr_init(_navMain, {
1146
1147                        'enable_easing':'on'
1148                        ,'settings_skin':'skin_apple'
1149                    });
1150
1151                }else{
1152
1153
1154
1155
1156                    var baseUrl = '';
1157                    var baseUrl_arr = get_base_url_arr();
1158                    for(var i24=0;i24<baseUrl_arr.length-2; i24++){
1159                        baseUrl+=baseUrl_arr[i24]+'/';
1160                    }
1161                    //var src = scripts[scripts.length-1].src;
1162
1163
1164                    console.warn(baseUrl);
1165
1166
1167                    var url = baseUrl+'dzsscroller/scroller.js';
1168                    //console.warn(scripts[i23], baseUrl, url);
1169
1170                    $('head').append('<link rel="stylesheet" type="text/css" href="'+baseUrl+'dzsscroller/scroller.css">');
1171                    $.ajax({
1172                        url: url,
1173                        dataType: "script",
1174                        success: function(arg){
1175
1176
1177                            try_to_init_scroller();
1178
1179
1180
1181                        }
1182                    });
1183                }
1184            }
1185
1186            function init_scroller(){
1187
1188            }
1189
1190
1191            function ad_block_navigation(){
1192
1193                // console.info('blocked');
1194                cgallery.addClass('ad-blocked-navigation');
1195
1196            }
1197            function ad_unblock_navigation(){
1198
1199                cgallery.removeClass('ad-blocked-navigation');
1200            }
1201
1202            function init_start(){
1203
1204                // console.info('init_start() - ');
1205
1206                if(o.settings_mode=='wall'){
1207
1208                    setTimeout(init_showit,1500);
1209
1210                }else{
1211
1212                    init_showit();
1213                }
1214
1215                if(o.nav_type=='thumbs' && o.design_navigationUseEasing=='on'){
1216                    handle_frame();
1217                }
1218
1219
1220                if(o.settings_secondCon){
1221                    var xpos = 0;
1222                    $(o.settings_secondCon).find('.item').each(function(){
1223                        var _t = $(this);
1224                        _t.css('left', xpos+'%');
1225                        xpos+=100;
1226                    })
1227                }
1228
1229                //console.info(o.settings_outerNav);
1230                if(o.settings_outerNav){
1231
1232                    var xpos = 0;
1233                    o.settings_outerNav.find('.videogallery--navigation-outer--bigblock').each(function(){
1234                        var _t = $(this);
1235                        _t.css('left', xpos+'%');
1236                        xpos+=100;
1237                    })
1238                }
1239
1240                setInterval(tick, 1000);
1241
1242                handleResize();
1243
1244                cgallery.addClass('inited');
1245
1246                //setTimeout(handleResize,1000);
1247            }
1248
1249            function handle_mouse(e){
1250
1251                var _t = $(this);
1252                if(_t.hasClass('rotator-btn-gotoNext')){
1253
1254                    gotoNext();
1255                }
1256                if(_t.hasClass('rotator-btn-gotoPrev')){
1257
1258                    gotoPrev();
1259                }
1260            }
1261
1262            function init_showit(){
1263
1264                // console.error('init_showit()');
1265
1266                cgallery.parent().children('.preloader').fadeOut('fast');
1267                cgallery.parent().children('.css-preloader').fadeOut('fast');
1268
1269
1270                if(o.init_on=='scroll'&& cgallery.hasClass('transition-sli
1270dein')){
1271                    setTimeout(function(){
1272
1273                        cgallery.addClass('dzsvg-loaded');
1274                    },300);
1275                }else{
1276
1277                    cgallery.addClass('dzsvg-loaded');
1278                }
1279            }
1280            function reinit(){
1281                //console.log('reinit()', cgallery.children('.vplayer-tobe').length);
1282
1283                var len = cgallery.children('.vplayer-tobe').length;
1284
1285
1286                if (o.settings_mode == 'normal') {
1287
1288
1289
1290
1291
1292                    for (i = 0; i < nrChildren; i++) {
1293                        var _c = cgallery.children('.vplayer-tobe').eq(used[i]);
1294                        var desc = ' no description';
1295
1296                        if(_c.find('.menuDescription').length){
1297                            desc = _c.find('.menuDescription').html();
1298                        }
1299
1300                        //console.info(desc, used[i], cgallery.children().eq(used[i]));
1301                        if( !(_c.attr('data-videoTitle')) ){
1302                            if(_c.find('.menuDescription').find('.the-title').html()){
1303
1304                                if(o.disable_videoTitle!='on'){
1305
1306                                    _c.attr('data-videoTitle',_c.find('.menuDescription').find('.the-title').html());
1307                                }
1308
1309                            }
1310                        }
1311                        _c.find('.menuDescription').remove();
1312                        if (desc == null) {
1313
1314
1315
1316                            if(o.menu_description_format){
1317                                //console.info(o.menu_description_format, _c.find('.feed-menu-number').html());
1318
1319                                var aux = o.menu_description_format;
1320
1321
1322                                aux = aux.replace('{{number}}', '<div class="menu-number"><span class="the-number">'+_c.find('.feed-menu-number').html()+'</span></div>');
1323                                aux = aux.replace('{{menuimage}}', '<div class="divimage imgblock" style="background-image: url('+_c.find('.feed-menu-image').html()+')"></div>');
1324                                aux = aux.replace('{{menutitle}}', '<div class="menu-title" style="">'+_c.find('.feed-menu-title').html()+'</div>');
1325                                aux = aux.replace('{{menudesc}}', '<div class="menu-desc" style="">'+_c.find('.feed-menu-desc').html()+'</div>');
1326                                aux = aux.replace('{{menutime}}', '<div class="menu-time" style="">'+_c.find('.feed-menu-time').html()+'</div>');
1327                                desc = aux;
1328                            }else{
1329
1330                                continue;
1331                            }
1332
1333                        }
1334
1335                        var _c2 = _c;
1336
1337
1338                        //console.info(_c2, o.videoplayersettings.responsive_ratio);
1339                        if(typeof _c2.attr('data-src')!='undefined'){
1340                            if(String(_c2.attr('data-src')).indexOf('youtube.com/watch')){
1341
1342                                var dataSrc = _c2.attr('data-src');
1343                                var auxa = String(dataSrc).split('youtube.com/watch?v=');
1344//                            console.info(auxa);
1345                                if(auxa[1]){
1346
1347                                    dataSrc = auxa[1];
1348                                    if(auxa[1].indexOf('&')>-1){
1349                                        var auxb = String(auxa[1]).split('&');
1350                                        dataSrc = auxb[0];
1351                                    }
1352
1353                                    _c2.attr('data-src', dataSrc);
1354                                }
1355                            }
1356                        }
1357                        if (desc.indexOf('{ytthumb}') > -1) {
1358                            desc = desc.split("{ytthumb}").join('<img src="//img.youtube.com/vi/' + _c2.attr('data-src') + '/0.jpg" class="imgblock"/>');
1359                        }
1360                        if (desc.indexOf('{ytthumbimg}') > -1) {
1361                            desc = desc.split("{ytthumbimg}").join('//img.youtube.com/vi/' + _c2.attr('data-src') + '/0.jpg');
1362                        }
1363
1364
1365
1366                        var aux = '';
1367
1368                        //console.info(cgallery.children('.vplayer-tobe').eq(i));
1369
1370
1371                        var _ci = cgallery.children('.vplayer-tobe').eq(i);
1372
1373
1374                        //console.info(_ci.attr('data-type'));
1375
1376
1377                        // -- this is inside video gallery
1378                        if( (_ci.attr('data-type')=='youtube' || _ci.attr('data-type')=='vimeo') && o.videoplayersettings.responsive_ratio=='detect' && !(_ci.attr('data-responsive_ratio'))){
1379
1380
1381                            _ci.attr('data-responsive_ratio', '0.562');
1382
1383
1384                            _ci.attr('data-responsive_ratio-not-known-for-sure', 'on');
1384  // -- we set this until we know the responsive ratio for sure , 0.562 is just 16/9 ratio so should fit to most videos
1385
1386
1387                            if(o.php_media_data_retriever){
1388
1389                                //console.info(o.php_media_data_retriever);
1390                                setTimeout(function(arg){
1391
1392                                    var _cach = _sliderCon.children().eq(arg);
1393                                    //console.info(arg, _cach);
1394
1395                                    var src = _cach.attr('data-src');
1396
1397                                    $.get( o.php_media_data_retriever+"?action=dzsvg_action_get_responsive_ratio&type="+_cach.attr('data-type')+"&source="+src, function( data ){
1398
1399                                        //console.info(data);
1400
1401                                        var json = JSON.parse(data);
1402
1403                                        //console.info(json);
1404
1405
1406                                        var rr = 0;
1407
1408                                        rr = json.height / json.width;
1409
1410                                        //console.info(rr,rr.toFixed(3));
1411
1412                                        if(rr.toFixed(3)!='0.563'){
1413                                            _cach.attr('data-responsive_ratio',rr.toFixed(3));
1414                                        }
1415                                        _cach.attr('data-responsive_ratio-not-known-for-sure', 'off');
1416
1417
1418                                        if(_cach.get(0) && _cach.get(0).api_get_responsive_ratio){
1419                                            _cach.get(0).api_get_responsive_ratio({
1420                                                'reset_responsive_ratio':true
1421                                            })
1422
1423                                            setTimeout(function(){
1424                                                handleResize_currVideo();
1425                                            },100);
1426                                        }
1427
1428
1429
1430
1431                                        //_cach.attr('data-responsive_ratio')
1432                                    });
1433                                },100,i);
1434                            }
1435
1436                        }
1437
1438                        if(_ci.attr('data-type')=='link'){
1439
1440
1441                            aux+='<a class="navigationThumb"';
1442
1443                            if(cgallery.children('.vplayer-tobe').eq(i).attr('data-source')){
1444                                aux+=' href="'+_ci.attr('data-source')+'"';
1445                            }
1446                            if(cgallery.children('.vplayer-tobe').eq(i).attr('data-target')){
1447                                aux+=' target="'+_ci.attr('data-target')+'"';
1448                            }
1449
1450                            aux+='>';
1451                        }else{
1452                            aux+='<div class="navigationThumb">';
1453                        }
1454
1455
1456                        aux+='<div class="navigationThumb-content">';
1457                        if(o.settings_menu_overlay=='on'){
1458                            aux+='<div class="menuitem-overlay"></div>';
1459                        }
1460
1461                        // console.warn(desc);
1462
1463                        if(cgallery.hasClass('skin-boxy')){
1464                            desc = desc.replace(/\<img src=\"(.+?)".*?\/{0,1}>/g, '<div class="big-thumb" style=\'background-image:url("$1");\'></div>');
1465                        }
1466                        // console.info(desc);
1467                        aux+=desc + '</div>';
1468
1469
1470
1471
1472                        if(_ci.attr('data-type')=='link'){
1473
1474                            aux+='</a>';
1475                        }else{
1476
1477                            aux+='</div>';
1478                        }
1479                        _navCon.append(aux);
1480                        _navCon.children().last().find('.imgblock.divimage').addClass('big-thumb');
1481                    }
1482
1483
1484                    if(o.nav_type=='none'){
1485                        _mainNavigation.hide();
1486                    }
1487
1488
1489
1490                    /*
1491                     var initnavConlen = _navCon.children().length;
1492                     wpos = 0;
1493                     hpos =0 ;
1494                     for (i = 0; i < len; i++) {
1495                     var _c = cgallery.children('.vplayer-tobe').eq(i);
1496
1497
1498
1499                     var desc = _c.find('.menuDescription').html();
1500
1501
1502                     _c.find('.menuDescription').remove();
1503                     if (desc == null) {
1504
1505
1506                     if(o.menu_description_format){
1507                     console.info('ceva');
1508                     }else{
1509
1510                     continue;
1511                     }
1512
1513
1514                     }else{
1515
1516                     }
1517                     if (desc.indexOf('{ytthumb}') > -1) {
1518                     desc = desc.split("{ytthumb}").join('<img src="//img.youtube.com/vi/' + cgallery.children().eq(used[i]).attr('data-src') + '/0.jpg" class="imgblock"/>');
1519                     }
1520                     if (desc.indexOf('{ytthumbimg}') > -1) {
1521                     desc = desc.split("{ytthumbimg}").join('//img.youtube.com/vi/' + cgallery.children().eq(used[i]).attr('data-src') + '/0.jpg');
1522                     }
1523
1524
1525                     _navCon.append('<div><div class="navigationThumb-content">' + desc + '</div></div>')
1526                     _navCon.children().eq(initnavConlen + i).addClass("navigationThumb");
1527                     _navCon.children().eq(initnavConlen + i).css({
1528                     'width': o.menuitem_width,
1529                     'height': o.menuitem_height
1530                     });
1531
1532                     _navCon.children('.navigationThumb').eq(initnavConlen + i).click(handleButton);
1533
1534
1535
1536
1537                     if (o.nav_type == 'scroller') {
1538
1539                     }
1540
1541                     hpos += o.menuitem_height + menuitem_space;
1542                     wpos += o.menuitem_width + menuitem_space;
1543                     }
1544
1545                     */
1546
1547                }
1548
1549                for (i = 0; i < len; i++) {
1550                    var _t = cgallery.children('.vplayer-tobe').eq(0);
1551                    //console.log(_t)
1552                    _sliderCon.append(_t);
1553                }
1554
1555
1556
1557
1558                if (o.settings_mode == 'wall') {
1559
1560                    _sliderCon.children().each(function() {
1561                        //====each item
1562                        var _t = $(this);
1563
1564
1565
1566                        if (_t.find('.videoDescription').length == 0) {
1567                            if (_t.find('.menuDescription').length > 0) {
1568                                _t.append('<div class="videoDescription">'+_t.find('.menuDescription').html()+'</div>')
1569                            }
1570                        }
1571
1572
1573                        _t.addClass('vgwall-item').addClass('clearfix');
1574                        _t.css({'width': o.menuitem_width, 'height': 'auto', 'position': 'relative'});
1575                        //console.log(totalWidth, totalHeight);
1576                        _t.attr('data-bigwidth', o.modewall_bigwidth);
1577                        _t.attr('data-bigheight', o.modewall_bigheight);
1578
1579                        if (_t.attr('data-videoTitle') != undefined && _t.attr('data-videoTitle') != '') {
1580                            _t.prependOnce('<div class="videoTitle">' + _t.attr('data-videoTitle') + '</div>', '.videoTitle');
1581                        }
1582                        if (_t.attr('data-previewimg') != undefined) {
1583                            var aux2 = _t.attr('data-previewimg');
1584
1585                            if (aux2 != undefined && aux2.indexOf('{ytthumbimg}') > -1) {
1586                                //console.log(_t.attr('data-src'));
1587                                aux2 = aux2.split("{ytthumbimg}").join('//img.youtube.com/vi/' + _t.attr('data-src') + '/0.jpg');
1588                            }
1589
1590                            _t.prependOnce('<img class="previewImg" style="" src="' + aux2 + '"/>', '.previewImg');
1591
1592                        }
1593
1594                        if (jQuery.fn.masonry != undefined) {
1595
1596                            if(_sliderCon.hasClass('masonry-inited')){
1597                                _sliderCon.masonry('reload');
1598                            }
1599                            cgallery.parent().children('.preloader').fadeOut('slow');
1600                            setTimeout(handleResize, 1000);
1601                        }else{
1602                            alert('vplayer.js - warning: masonry not included')
1603                        }
1604
1605                        _t.zoomBox();
1606                    });
1607                }
1608
1609
1610
1611                //console.info('o.nav_type - ',o.nav_type);
1612                if(o.nav_type=='outer'){
1613                    _navCon.children().addClass('dzs-layout-item');
1614                }
1615
1616
1617                nrChildren = _sliderCon.children().length;
1618
1619                if(nrChildren==1){
1620                    //console.info("one child");
1621                }
1622            }
1623
1624            function gotoNextPage() {
1625                var tempPage = currPage;
1626
1627                tempPage++;
1628                gotoPage(tempPage);
1629
1630            }
1631
1632            function gotoPrevPage() {
1633                if (currPage == 0)
1634                    return;
1635
1636                currPage--;
1637                gotoPage(currPage);
1638
1639            }
1640
1641            function change_search_field(){
1642                var _t = $(this);
1643
1644                // console.info(_t.val());
1645
1646                if(o.settings_mode=='wall'){
1647                    _sliderCon.children().each(function() {
1648                        var _t2 = $(this);
1649
1650
1651                        if(_t.val() == '' || String(String(_t2.find('.menuDescription').eq(0).html()).toLowerCase()).indexOf(_t.val().toLowerCase())>-1){
1652
1653                            _t2.show();
1654                        }else{
1655
1656                            _t2.hide();
1657                        }
1658
1659                        if(inter_relayout_masonry){
1660                            clearTimeout(inter_relayout_masonry);
1661                        }
1662                        inter_relayout_masonry = setTimeout(function(){
1663
1664                            if (jQuery.fn.masonry != undefined) {
1665
1666
1667                                // console.warn("MASONRY LAYOUT");
1668                                if(_sliderCon.hasClass('masonry-inited')) {
1669                                    _sliderCon.masonry('layout');
1670                                }
1671
1672                            }
1673                        },500);
1674                    });
1675                }
1676
1677                _navCon.children().each(function(){
1678                    var _t2 = $(this);
1679
1680                    // console.warn(_t2);
1681
1682                    //console.info(_t2.find('.navigationThumb-content').eq(0).html(),_t.val());
1683                    if(_t.val() == '' || String(String(_t2.find('.navigationThumb-content').eq(0).html()).toLowerCase()).indexOf(_t.val().toLowerCase())>-1){
1684
1685                        _t2.show();
1686                    }else{
1687
1688                        if(_t2.hasClass('dzsvg-search-field')==false){
1689
1690                            _t2.hide();
1691                        }
1692                    }
1693                });
1694
1695                handleResize();
1696            }
1697
1698            function responsive_ratio_resize_h(arg, pargs){
1699
1700                // -- gallery
1701//                return false;
1702//                videoHeight = arg;
1703
1704
1705                var margs = {
1706                    caller: null
1707                    ,'call_from':'default'
1708                }
1709
1710                if(pargs){
1711                    margs = $.extend(margs,pargs);
1712                }
1713
1714                if(margs.caller==null){
1715                    return false;
1716                }
1717
1718                //console.info('responsive_ratio_resize_h - ', arg, cgallery,  margs);
1719
1720                if(initial_h===-1){
1721                    initial_h=_sliderMain.height();
1722                }else{
1723//                    console.info(initial_h);
1724                }
1725//                console.info(menu_position);
1726
1727                //console.info(arg);
1728                // console.info('menu_position - ',menu_position)
1729                if(menu_position=='left'||menu_position=='right'||menu_position=='none'){
1730                    totalHeight = arg;
1731                    cgallery.height(arg);
1732
1733                    if(o.settings_mode!='slider'){
1734
1735                        _mainNavigation.height(arg);
1736                    }
1737
1738
1739                    if(menu_position=='none' || menu_position=='right' || menu_position=='left'){
1740                        currVideo.height(arg);
1741                    }
1742
1743                    // console.info("LETS ASSIGN VIDEOHEIGHT",arg);
1744                    videoHeight = arg;
1745//                    console.info(arg, cgallery.height());
1746                }else{
1747                    cgallery.css('height', 'auto');
1748//                    console.info(arg, cgallery.height());
1749
1750                    // totalHeight = arg;
1751                    videoHeight = arg;
1752                    currVideo.height(arg);
1753
1754                }
1755
1756
1757                if(margs.caller){
1758                    margs.caller.data('height_for_videoheight',arg);
1759                    calculateDims({
1760                        call_from: 'height_for_videoheight'
1761                    });
1762                }
1763
1764                if(o.nav_type=='scroller'){
1765                    setTimeout(function(){
1766
1767
1768                        if(_navMain.get(0) && _navMain.get(0).api_toggle_resize){
1769                            _navMain.get(0).api_toggle_resize();
1770                        }
1771                    },100)
1772                }
1773
1774
1775                //console.info(initial_h);
1776
1777                // console.info('adjusting _sliderMain height',arg, videoHeight);
1778                // _sliderMain.height(arg);
1779//                console.info(arg, cgallery.height());
1780            }
1781            function gotoPage(arg) {
1782                if (arg > nav_max_pages || o.nav_type != 'thumbsandarrows'){
1783                    return;
1784                }
1785
1786
1787                console.info("gotoPage ..",arg, ' ... nav type ', o.nav_type, '... nav_max_pages', nav_max_pages);
1788
1789
1790                var thumbsSlider = _navCon;
1791
1792                _mainNavigation.find('.thumbs-arrow-left').removeClass('inactive');
1793                _mainNavigation.find('.thumbs-arrow-right').removeClass('inactive');
1794                if (arg == 0) {
1795                    _mainNavigation.find('.thumbs-arrow-left').addClass('inactive');
1796                }
1797                if (arg == nav_max_pages ) {
1798                    _mainNavigation.find('.thumbs-arrow-right').addClass('inactive');
1799                }
1800
1801                if (arg == nav_max_pages ) {
1802
1803                    if (menu_position == "right" || menu_position == "left"){
1804
1805
1806                        thumbsSlider.animate({
1807                            'top': thumbs_thumb_var * -arg
1808                            ,'left': 0
1809                        }, {
1810                            duration: 400,
1811                            queue: false
1812                        });
1813                    }
1814
1815                    if (menu_position == "bottom" || menu_position == "top"){
1816                        thumbsSlider.animate({
1817                            'left': thumbs_thumb_var * -arg
1818                            ,'top': 0
1819                        }, {
1820                            duration: 400,
1821                            queue: false
1822                        });
1823                    }
1824
1825                } else {
1826
1827
1828                    if (menu_position == "right" || menu_position == "left"){
1829                        thumbsSlider.animate({
1830                            'top': thumbs_thumb_var * -arg
1831                            ,'left': 0
1832                        }, {
1833                            duration: 400,
1834                            queue: false
1835                        });
1836
1837                        console.info('nav_page_size * -arg', nav_page_size * -arg, menuitem_height);
1838                    }
1839
1840                    if (menu_position == "bottom" || menu_position == "top"){
1841                        thumbsSlider.animate({
1842                            'left': thumbs_thumb_var * -arg
1843                            ,'top': 0
1844                        }, {
1845                            duration: 400,
1846                            queue: false
1847                        });
1848                    }
1849
1850                }
1851
1852                currPage = arg;
1853            }
1854
1855            function tick(){
1856
1857
1858            }
1859            function calculateDims(pargs){
1860
1861                // -- gallery
1862
1863
1864
1865                var margs = {
1866                    'call_from':'default'
1867                };
1868                if(pargs){
1869                    margs = $.extend(margs,pargs);
1870                }
1871
1872
1873                // console.info(margs);
1874
1875
1876                totalWidth = cgallery.outerWidth();
1877                totalHeight = cgallery.height();
1878
1879                //console.log('vgallery calculateDims()', margs, totalWidth, totalHeight);
1880
1881                // console.info(margs);
1882                if(margs.call_from=='recheck_sizes'){
1883
1884                    // console.info(Math.abs(last_totalWidth-totalWidth), Math.abs(last_totalHeight-totalHeight));
1885                    if(Math.abs(last_totalWidth-totalWidth)<4 && Math.abs(last_totalHeight-totalHeight)<4){
1886
1887
1888                        console.info("SAME SIZES");
1889                        return false;
1890                    }
1891
1892                }
1893
1894                // console.info('passed test');
1895
1896                last_totalWidth = totalWidth;
1897                last_totalHeight = totalHeight;
1898
1899
1900                if(totalWidth<721){
1901                    cgallery.addClass('under-720');
1902
1903
1904
1905                }else{
1906                    cgallery.removeClass('under-720');
1907                }
1908
1909
1910                if(totalWidth<601){
1911                    cgallery.addClass('under-600');
1912                }else{
1913                    cgallery.removeClass('under-600');
1914                }
1915
1916
1917                if( String(cgallery.get(0).style.height).indexOf('%')>-1){
1918
1919                    totalHeight = cgallery.height();
1920                }else{
1921
1922                    if(cgallery.data('init-height')){
1923
1924                        totalHeight = cgallery.data('init-height');
1925                    }else{
1926
1927                        totalHeight = cgallery.height();
1928                        //cgallery.data('init-height',totalHeight);
1929
1930                        setTimeout(function(){
1931                            //console.log(cgallery.height(), cgallery.outerHeight());
1932                        })
1933
1934                        //console.info(cgallery, totalHeight);
1935                    }
1936                }
1937
1938                // console.log( 'checking total height',cgallery.outerHeight(), totalHeight, cgallery);
1939
1940                if(o.totalHeightDifferenceOnParent!=''){
1941                    //console.info('ceva');
1942                    var aux = parseFloat(o.totalHeightDifferenceOnParent);
1943                    //console.log(aux);
1944                    var aux2 = 1 + aux;
1945                    //console.log(aux2);
1946
1947                    totalHeight = aux2 * _rparent.outerHeight(false);
1948                    //console.info(totalHeight);
1949                }
1950
1951//
1952//                if(cgallery.attr('id')=='vg1'){
1953//                }
1954
1955
1956                //return;
1957
1958                // console.warn('totalHeight is', totalHeight);
1959//                console.info(cgallery.height(), totalHeight);
1960
1961                videoWidth = totalWidth;
1962                videoHeight = totalHeight;
1963
1964
1965                //console.info('videoHeight -- ',videoHeight);
1966
1967//                console.info(videoHeight);
1968
1969                menuitem_width = o.menuitem_width;
1970                menuitem_height = o.menuitem_height;
1971
1972                if(isNaN(menuitem_height)){ menuitem_height = 0; }
1973
1974//                console.info(videoHeight);
1975
1976
1977                // -- ultra-responsive
1978                if (o.settings_disableVideo!='on'&& (o.menu_position == 'right' || o.menu_position == 'left') && nrChildren > 1) {
1979//                    console.info(menuitem_width, menuitem_space, totalWidth/2);
1980                    if(menuitem_width + menuitem_space > totalWidth/2){
1981                        ultra_responsive_last_layout = 'movedup';
1982                        //menu_position='top'
1983
1984                        cgallery.addClass('ultra-responsive');
1985
1986                        //console.warn('videoHeight - ',videoHeight, _sliderMain);
1987
1988
1989
1990                    }else{
1991                        ultra_responsive_last_layout = 'normal';
1992                        //cgallery.removeClass('force-ultra-responsive-top');
1993
1994                        cgallery.removeClass('ultra-responsive');
1995                    }
1996
1997                }
1998
1999
2000
2001                if(o.settings_mode=='normal'){
2002
2003
2004                    if(o.nav_type=='thumbs'){
2005
2006                        if(menu_position == 'right'){
2007
2008                            if(menuitem_space){
2009
2010
2011
2012                                _navCon.children('.navigationThumb').css({
2013                                    'margin-bottom':menuitem_space
2014                                    ,'margin-top':''
2015                                });
2016
2017
2018                                if(cgallery.hasClass('skin-boxy--rounded')){
2019
2020                                    _navCon.css({
2021                                        'padding-top':menuitem_space
2022                                        ,'padding-bottom':menuitem_space
2023                                    });
2024
2025                                    cgallery.appendOnce(' <svg class="svg_rounded" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1px" height="1px" viewBox="0 0 1 1" enable-background="new 0 0 1 1" xml:space="preserve"> <g id="Layer_1"> </g> <g id="Layer_2"> <g> <defs> <path id="SVGID_1_" d="M1,0.99C1,0.996,0.996,1,0.99,1H0.01C0.004,1,0,0.996,0,0.99V0.01C0,0.004,0.004,0,0.01,0h0.98 C0.996,0,1,0.004,1,0.01V0.99z"/> </defs> <clipPath id="SVGID_2_"  clipPathUnits="objectBoundingBox"> <use xlink:href="#SVGID_1_" overflow="visible"/> </clipPath> <path clip-path="url(#SVGID_2_)" fill="#2A2F3F" d="M3,1.967C3,1.985,2.984,2,2.965,2h-3.93C-0.984,2-1,1.985-1,1.967v-2.934 C-1-0.985-0.984-1-0.965-1h3.93C2.984-1,3-0.985,3-0.967V1.967z"/> </g> </g> </svg>  ')
2026                                }
2027
2028                            }else{
2029
2030
2031                                _navCon.children('.navigationThumb').css({
2032                                    'margin-bottom':''
2033                                });
2034                            }
2035                        }
2036
2037                        if(menu_position == 'bottom'){
2038
2039                            if(menuitem_space){
2040
2041
2042
2043                                _navCon.children('.navigationThumb').css({
2044                                    'margin-right':menuitem_space
2045                                });
2046
2047
2048                                if(cgallery.hasClass('skin-boxy--rounded')){
2049
2050                                    _navCon.css({
2051                                        // 'padding-top':menuitem_space
2052                                        // ,'padding-bottom':menuitem_space
2053                                    });
2054
2055                                    cgallery.appendOnce(' <svg class="svg_rounded" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1px" height="1px" viewBox="0 0 1 1" enable-background="new 0 0 1 1" xml:space="preserve"> <g id="Layer_1"> </g> <g id="Layer_2"> <g> <defs> <path id="SVGID_1_" d="M1,0.99C1,0.996,0.996,1,0.99,1H0.01C0.004,1,0,0.996,0,0.99V0.01C0,0.004,0.004,0,0.01,0h0.98 C0.996,0,1,0.004,1,0.01V0.99z"/> </defs> <clipPath id="SVGID_2_"  clipPathUnits="objectBoundingBox"> <use xlink:href="#SVGID_1_" overflow="visible"/> </clipPath> <path clip-path="url(#SVGID_2_)" fill="#2A2F3F" d="M3,1.967C3,1.985,2.984,2,2.965,2h-3.93C-0.984,2-1,1.985-1,1.967v-2.934 C-1-0.985-0.984-1-0.965-1h3.93C2.984-1,3-0.985,3-0.967V1.967z"/> </g> </g> </svg>  ')
2056                                }
2057
2058                            }else{
2059
2060
2061                            }
2062                        }
2063                    }
2064                }
2065
2066
2067
2068
2069                _mainNavigation.removeClass('menu-top menu-bottom menu-right menu-left');
2070                _mainNavigation.addClass('menu-'+menu_position);
2071
2072                cgallery.removeClass('menu-top menu-bottom menu-right menu-left');
2073                cgallery.addClass('menu-'+menu_position);
2074
2075                // console.info(menu_position, nrChildren);
2076
2077                //console.info('menuitem_space - ',menuitem_space);
2078
2079                if ((menu_position == 'right' || menu_position == 'left') && nrChildren > 1) {
2080                    videoWidth -= (menuitem_width + menuitem_space);
2081
2082
2083                }
2084
2085                // console.info("TEMP VIDEO HEIGHT", videoHeight);
2086                if (o.nav_type!='outer' && (menu_position == 'bottom' || menu_position == 'top') && nrChildren > 1 && cgallery.get(0).style &&  cgallery.get(0).style.height!='auto') {
2087                    //console.info(videoHeight);
2088                    videoHeight -= (menuitem_height + menuitem_space );
2089
2090                }
2091
2092
2093                // console.groupCollapsed('currVideo data height');
2094
2095                //console.log('currVideo - ',currVideo, o.videoplayersettings.responsive_ratio);
2096
2097                if(currVideo && currVideo.data('height_for_videoheight')){
2098
2099                    // console.info("GET videoHeight from currVideo data", currVideo.data('height_for_videoheight'));
2100                    videoHeight = currVideo.data('height_for_videoheight');
2101
2102                    last_height_for_videoheight = videoHeight;
2103                }else{
2104                    // -- lets try to get the last value known for responsive ratio if the height of the current video is now currently known
2105                    if(o.videoplayersettings.responsive_ratio && o.videoplayersettings.responsive_ratio == 'detect'){
2106
2107                        if(last_height_for_videoheight){
2108
2109                            videoHeight = last_height_for_videoheight;
2110                        }
2111
2112                    }else{
2113                        if(menu_position=='left' || menu_position =='right'){
2114
2115                            videoHeight = 300;
2116                        }
2117                        //console.info("HMM menu_position - ",menu_position);
2118                    }
2119                }
2120
2121
2122
2123                // console.groupEnd();
2124
2125                //console.info('o.forceVideoHeight - ',o.forceVideoHeight);
2126                if(o.forceVideoHeight!='' && (!o.videoplayersettings || o.videoplayersettings.responsive_ratio!='detect') ){
2127                    videoHeight = o.forceVideoHeight;
2128                }
2129
2130                if (o.settings_mode == 'rotator3d') {
2131                    videoWidth = totalWidth / 2;
2132                    videoHeight = totalHeight * 0.8;
2133                    menuitem_width = 0;
2134                    menuitem_height = 0;
2135                    menuitem_space = 0;
2136                    o.transition_type = 'rotator3d';
2137                }
2138
2139                //console.warn('videoHeight - ',videoHeight);
2140
2141                cgallery.addClass('transition-'+ o.transition_type)
2142
2143
2144
2145                // === if there is only one video we hide the nav
2146                if (nrChildren == 1) {
2147                    //totalWidth = videoWidth;
2148                    _mainNavigation.hide();
2149                }
2150
2151
2152
2153                if(typeof(currVideo)!='undefined'){
2154                    /// === why ?
2155                    /*
2156                     currVideo.css({
2157                     'width': videoWidth
2158                     ,'height': videoHeight
2159                     })
2160                     */
2161                };
2162
2163                hpos = 0;
2164                for (i = 0; i < nrChildren; i++) {
2165                    //if(is_ios())	break;
2166
2167                    _sliderCon.children().eq(i).css({
2168                    })
2169                    hpos += totalHeight;
2170                }
2171
2172                //console.warn('videoHeight - ',videoHeight);
2173                // console.warn('menu_position - ',menu_position);
2174                if (o.settings_mode != 'wall' && o.settings_mode != 'videowall') {
2175                    // console.info(videoHeight);
2176
2177
2178                    // console.info('adjusting slidermain dims for !wall', videoHeight)
2179                    _sliderMain.css({
2180                        'width': videoWidth
2181                    })
2182
2183
2184                    if( (menu_position=='left' || menu_position == 'right')  && nrChildren>1){
2185                        _sliderMain.css('width','auto');
2186
2187                        if(cgallery.hasClass('ultra-responsive')){
2188
2189                            _sliderMain.css('height',videoHeight+'px');
2190                            //_navMain.css('height',(o.design_item_height * nrChildren)+'px');
2191                        }else{
2192
2193                            _sliderMain.css({
2194                                'height': ''
2195                            })
2196                        }
2197                    }else{
2198
2199
2200                        // console.info("SLIDERMAIN videoHeight", videoHeight);
2201                        _sliderMain.css({
2202                            'height': videoHeight
2203                        })
2204                    }
2205
2206                }
2207
2208                if (o.settings_mode == 'rotator3d') {
2209                    _sliderMain.css({
2210                        'width': totalWidth,
2211                        'height': totalHeight
2212                    })
2213                    _sliderCon.children().css({
2214                        'width': videoWidth,
2215                        'height': videoHeight
2216                    })
2217                }
2218                if (menu_position == 'right') {
2219
2220                    //console.info('o.nav_space - ',o.nav_space);
2221                    if(cgallery.hasClass('ultra-responsive')) {
2222
2223                        _mainNavigation.css({
2224
2225                            'margin-left': ''
2226                            , 'margin-right': ''
2227                            , 'height': '' // height is auto in ultra-responsive
2228                        });
2229                    }else{
2230                        _mainNavigation.css({
2231                            'width': menuitem_width
2232                            ,'height': totalHeight
2233                            ,'position':'relative'
2234                            ,'margin-left' : o.nav_space + 'px'
2235                            ,'margin-right' : 0
2236                            ,'margin-top' : 0
2237                            ,'margin-bottom' : 0
2238                        })
2239                    }
2240
2241                }
2242                if (menu_position == 'left') {
2243
2244                    //console.log(totalHeight);
2245                    if(cgallery.hasClass('ultra-responsive')) {
2246
2247                        _mainNavigation.css({
2248
2249                            'margin-left': ''
2250                            , 'margin-right': ''
2251                        });
2252                    }else {
2253                        _mainNavigation.css({
2254                            'width': menuitem_width,
2255                            'height': totalHeight,
2256                            'left': 0
2257                            , 'position': 'relative'
2258                            , 'margin-left': 0
2259                            , 'margin-right': o.nav_space+'px'
2260                            , 'margin-top': 0
2261                            , 'margin-bottom': 0
2262                        })
2263                        _sliderMain.css({
2264//                        'left': menuitem_width + o.nav_space
2265                        })
2266                    }
2267                }
2268                if (menu_position == 'bottom') {
2269                    _mainNavigation.css({
2270                        'width': totalWidth,
2271                        'height': menuitem_height
2272                        ,'margin-left' : 0
2273                        ,'margin-right' : 0
2274                        ,'margin-top' : o.nav_space + 'px'
2275                        ,'margin-bottom' : 0
2276                    })
2277                }
2278                if (menu_position == 'top') {
2279                    _mainNavigation.css({
2280                        'width': totalWidth
2281                        ,'height': ''
2282                        ,'margin-left' : 0
2283                        ,'margin-right' : 0
2284                        ,'margin-top' : 0
2285                        ,'margin-bottom' : o.nav_space + 'px'
2286                    })
2287                    _sliderMain.css({
2288
2289                    })
2290                }
2291
2292
2293
2294
2295
2296                //===calculate dims for navigation / mode-normal
2297                if (o.nav_type == 'thumbsandarrows') {
2298
2299                    navWidth = (totalWidth - nav_arrow_size * 2);
2300                    navHeight = (totalHeight - nav_arrow_size * 2);
2301
2302
2303
2304
2305                    if (menu_position == 'bottom' || menu_position == 'top') {
2306                        thumbs_thumb_var = menuitem_width;
2307                        thumbs_thumb_var_sec = menuitem_height;
2308                        thumbs_total_var = totalWidth;
2309                        thumbs_total_var_sec = totalHeight;
2310                        thumbs_css_main = 'left';
2311                        _navMain.css({
2312                            'left': nav_arrow_size
2313                            ,'top': ''
2314                            , 'width': navWidth
2315                            , 'height': '100%'
2316                        });
2317
2318                        var auxs = 0;
2319                        _navCon.children().each(function(){
2320                            var _t = $(this);
2321                            auxs+=_t.outerWidth();
2322                        })
2323                        _navCon.css('width', auxs);
2324
2325                        _mainNavigation.children('.thumbs-arrow-left').css({
2326                            'left': nav_arrow_size / 2
2327                            ,'top': ''
2328                        });
2329                        _mainNavigation.children('.thumbs-arrow-right').css({
2330                            'left': navWidth + nav_arrow_size + nav_arrow_size / 2
2331                            ,'top': ''
2332                        });
2333                        nav_main_consize = navWidth;
2334                    }
2335                    if (menu_position == 'left' || menu_position == 'right') {
2336                        thumbs_thumb_var = menuitem_height;
2337                        thumbs_thumb_var_sec = menuitem_width;
2338                        thumbs_total_var = totalHeight;
2339                        thumbs_total_var_sec = totalWidth;
2340                        thumbs_css_main = 'top';
2341//                        console.info(navHeight);
2342                        _navMain.css({'top': nav_arrow_size
2343                            , 'height': navHeight, 'width': '100%'
2344                            , 'left': ''
2345                        });
2346                        _mainNavigation.children('.thumbs-arrow-left').css({
2347                            'top': nav_arrow_size / 2
2348                            ,'left': ''
2349                        });
2350                        _mainNavigation.children('.thumbs-arrow-right').css({
2351                            'top': 'auto'
2352                            , 'bottom': nav_arrow_size / 2 - 10
2353                            ,'left': ''
2354                        });
2355                        nav_main_consize = navHeight;
2356                    }
2357
2358
2359                    nav_main_totalsize = nrChildren * thumbs_thumb_var + (nrChildren - 1) * menuitem_space;
2360                    aux1 = (((((thumbs_total_var - nav_arrow_size * 2) / (thumbs_thumb_var + menuitem_space)) * (thumbs_thumb_var + menuitem_space)))) - ((((parseInt((thumbs_total_var - nav_arrow_size * 2) / (thumbs_thumb_var + menuitem_space))) * (thumbs_thumb_var + menuitem_space))));
2361
2362                    nav_page_size = menuitem_width+menuitem_space ;
2363                    nav_max_pages = nav_main_totalsize / thumbs_thumb_var;
2364
2365                    nav_pages_visible = Math.floor(nav_main_consize / thumbs_thumb_var) ;
2366
2367                    thumbs_per_page = Math.floor(nav_page_size / (thumbs_thumb_var + menuitem_space));
2368                    nav_max_pages = (Math.ceil(nav_max_pages));
2369                    nav_max_pages = nav_max_pages - nav_pages_visible;
2370                    nav_excess_thumbs = (nav_main_totalsize - (nav_max_pages - 1) * nav_page_size);
2371
2372
2373                    // console.info(cgallery, 'nav_main_totalsize --- ',nav_main_totalsize, thumbs_thumb_var, 'nav_pages_visible - ',nav_pages_visible);
2374    
2374                // console.info('nav_page_size vars - ', thumbs_total_var, nav_arrow_size, aux1);
2375                    // console.info('nav_max_pages - ',nav_max_pages);
2376
2377                    if (nav_main_totalsize < nav_main_consize) {
2378                        _mainNavigation.children('.thumbs-arrow-left').hide();
2379                        _mainNavigation.children('.thumbs-arrow-right').hide();
2380                    }
2381
2382
2383
2384                }
2385
2386
2387                if(o.nav_type=='thumbs'){
2388                    if (menu_position == 'bottom' || menu_position == 'top') {
2389                        //console.log(_navCon.width())
2390                        navWidth = 0;
2391                        _navCon.children().each(function(){
2392                            var _t = $(this);
2393                            navWidth+=_t.outerWidth(true);
2394                        });
2395
2396
2397
2398                        if(navWidth > totalWidth){
2399                            _navMain.unbind('mousemove', handleMouse);
2400                            _navMain.bind('mousemove', handleMouse);
2401
2402                        }else{
2403
2404                            cgallery.addClass('navWidth-bigger-then-totalWidth')
2405                            _navCon.css({'left' : ''})
2406                            _navMain.unbind('mousemove', handleMouse);
2407
2408                        }
2409                    }
2410                    if (menu_position == 'left' || menu_position == 'right') {
2411
2412
2413
2414
2415                        //console.log(_navCon.width())
2416                        navHeight = 0;
2417                        navHeight = _navCon.outerHeight();
2418
2419                        //console.info('navHeight - ',navHeight);
2420//                        console.info(navHeight);
2421                        if(navHeight > totalHeight){
2422                            _navMain.unbind('mousemove', handleMouse);
2423                            _navMain.bind('mousemove', handleMouse);
2424                        }else{
2425                            _navCon.css({'top' : ''})
2426                            _navMain.unbind('mousemove', handleMouse);
2427                        }
2428                    }
2429
2430                }
2431                //===END calculate dims for navigation / mode-normal
2432
2433
2434                if(o.nav_type=='outer'){
2435                    _mainNavigation.css({
2436                        'top':0,
2437                        'left':0,
2438                        'height':'auto'
2439                    });
2440                    _navMain.css({
2441                        //'height':'auto'
2442                    })
2443                    _sliderMain.css({
2444                        'top':0,
2445                        'left':0
2446                    })
2447                    cgallery.css({
2448                        'height':'auto'
2449                    })
2450                    _navCon.children().css({
2451                        'top' : 0,
2452                        'left' : 0,
2453                        'width' : '',
2454                        'height' : ''
2455                    });
2456
2457                    if(menu_position=='right'){
2458                        _sliderMain.css({
2459                            'overflow':'hidden'
2460                        })
2461                    }
2462                    if(menu_position=='left'){
2463                        _sliderMain.css({
2464                            'overflow':'hidden'
2465                        })
2466                    }
2467                }
2468
2469
2470
2471
2472                if (o.settings_mode == 'normal') {
2473                    hpos = 0;
2474                    wpos =0 ;
2475
2476                    _navCon.children('.navigationThumb').unbind('click', click_navCon_item);
2477                    _navCon.children('.navigationThumb').bind('click', click_navCon_item);
2478
2479
2480                    _navCon.children('.navigationThumb').css({
2481                        'width': menuitem_width,
2482                        'height': menuitem_height
2483                    });
2484
2485                    //console.info('menuitem_height - ',menuitem_height);
2486
2487                    if(menuitem_height==0){
2488                        _navCon.children('.navigationThumb').css({
2489                            'height':''
2490                        });
2491                    }
2492
2493                    if(isNaN(menuitem_height) == false && menuitem_height>0){
2494                        if(cgallery.hasClass('skin-aurora')){
2495                            _navCon.find('.navigationThumb .menu-desc').css({
2496                                'max-height': menuitem_height
2497                            })
2498                        }
2499                    }
2500                }
2501
2502                if(o.nav_type=='scroller'){
2503
2504                    if(menu_position=='top' || menu_position=='bottom'){
2505                        navWidth = 0;
2506                        _navCon.children().each(function(){
2507                            var _t = $(this);
2508                            navWidth+=_t.outerWidth(true);
2509                        });
2510                        _navCon.width(navWidth);
2511                    }
2512                }
2513
2514
2515                if(o.settings_mode=='normal'){
2516                    if(menu_position=='right' || menu_position=='bottom' || menu_position=='left'){
2517                        cgallery.find('.gallery-buttons').css({
2518                            'top':0
2519                        });
2520                        cgallery.find('.the-logo').css({
2521                            'top':10
2522                        });
2523                    }
2524                    if(menu_position=='top' || menu_position=='bottom' || menu_position=='left'){
2525                        cgallery.find('.gallery-buttons').css({
2526                            'right':0
2527                        });
2528                        cgallery.find('.the-logo').css({
2529                            'right':50
2530                        });
2531                    }
2532
2533                    //console.info(menu_position,  (Number(o.menuitem_width) + Number(o.nav_space)));
2534
2535                    if (menu_position == 'right') {
2536
2537                        _gbuttons.css({
2538                            'right': (Number(o.menuitem_width) + Number(o.nav_space)) + 'px'
2539                        });
2540                        if (cgallery.find('.the-logo').length > 0) {
2541                            cgallery.find('.the-logo').css({
2542                                'right': (Number(o.menuitem_width) + Number(o.nav_space) + 60) + 'px'
2543                            });
2544                        }
2545                    }
2546                    if (menu_position == 'top') {
2547                        _gbuttons.css({
2548                            'top': (Number(o.menuitem_height) + Number(o.nav_space)) + 'px'
2549                        });
2550                        if (cgallery.find('.the-logo').length > 0) {
2551                            cgallery.find('.the-logo').css({
2552                                'top': (Number(o.menuitem_height) + Number(o.nav_space) + 10) + 'px'
2553                                , 'right': (60) + 'px'
2554                            });
2555                        }
2556                    }
2557                }
2558
2559
2560
2561
2562
2563
2564
2565
2566                //====== calculateDims() END
2567            }
2568
2569            function handle_orientationchange(){
2570                setTimeout(function(){
2571                    handleResize();
2572                },1000);
2573            }
2574
2575            function handleResize(e,pargs) {
2576                ww = $(window).width();
2577                wh = $(window).height();
2578
2579                conw = _rparent.width();
2580
2581
2582
2583
2584
2585
2586                if(cgallery.hasClass('try-breakout')){
2587                    cgallery.css('width',ww+'px');
2588
2589                    cgallery.css('margin-left','0');
2590
2591                    //console.info(cgallery, cgallery.get(0).offsetLeft, cgallery.offset().left, _theTarget.offset().left)
2592
2593                    if(cgallery.offset().left>0){
2594                        cgallery.css('margin-left','-'+cgallery.offset().left+'px');
2595                    }
2596                }
2597
2598
2599
2600                if(cgallery.hasClass('try-height-as-window-minus-offset')){
2601
2602                    var aux = wh - cgallery.offset().top;
2603
2604                    if(aux<300){
2605
2606                        cgallery.css('height',aux+'px');
2607                    }else{
2608                        cgallery.css('height','90vh')
2609                    }
2610                    //console.info('ceva', aux);
2611
2612                }
2613
2614                // console.info('handleResize() gallery - ', cgallery);
2615
2616                //console.log('ceva', ww, wh, conw, conh, totalWidth, totalHeight, (conw/totalWidth));
2617                //console.log(o.responsive_mode, totalWidth, totalHeight);
2618                calculateDims();
2619
2620
2621                if (o.settings_mode == 'wall') {
2622
2623                    if($.fn.masonry){
2624
2625                        if(_sliderCon.hasClass('masonry-inited')) {
2626                            _sliderCon.masonry('layout');
2627                        }
2628                        // _sliderCon.masonry("layout");
2629                    }
2630                }
2631
2632                //alert(currVideo);
2633                if(currVideo){
2634                    handleResize_currVideo();
2635                }
2636
2637            }
2638
2639            function handleResize_currVideo(e, pargs){
2640
2641
2642
2643
2644                var margs = {
2645                    'force_resize_gallery' : true
2646                    ,'call_from' : 'default'
2647                };
2648
2649                if(pargs){
2650                    margs = $.extend(margs,pargs);
2651                }
2652
2653
2654                margs.call_from+='_handleResize_currVideo';
2655
2656                // console.info(currVideo);
2657                if((currVideo) && currVideo.get(0) && (currVideo.get(0).api_handleResize)){
2658
2659
2660                    // console.info('call resize from vgallery');
2661                    currVideo.get(0).api_handleResize(null,margs);
2662                }
2663            }
2664
2665            function pause_currVideo(e, pargs){
2666
2667
2668
2669
2670                var margs = {
2671                    'force_resize_gallery' : true
2672                    ,'call_from' : 'default'
2673                };
2674
2675                if(pargs){
2676                    margs = $.extend(margs,pargs);
2677                }
2678
2679
2680                margs.call_from+='_pause_currVideo';
2681
2682                if((currVideo) && (currVideo.get(0).api_pauseMovie)){
2683
2684
2685                    // console.info('call resize from vgallery');
2686                    currVideo.get(0).api_pauseMovie(margs);
2687                }
2688            }
2689
2690
2691            function api_currVideo_refresh_fsbutton(argcol){
2692                if(typeof(currVideo)!="undefined" && typeof(currVideo.get(0))!="undefined" && typeof(currVideo.get(0).api_currVideo_refresh_fsbutton)!="undefined"){
2693                    currVideo.get(0).api_currVideo_refresh_fsbutton(argcol);
2694                }
2695            }
2696
2697
2698            function randomise(arg, max) {
2699                arg = parseInt(Math.random() * max);
2700                var sw = 0;
2701                for (var j = 0; j < used.length; j++) {
2702                    if (arg == used[j])
2703                        sw = 1;
2704                }
2705                if (sw == 1) {
2706                    randomise(0, max);
2707                    return;
2708                } else
2709                    used.push(arg);
2710                return arg;
2711            }
2712
2713
2714            function animate_menu_x(viewIndex){
2715
2716
2717
2718                //console.info(finish_viy);
2719
2720                if(is_ios()==false && is_android()==false){
2721                    if(o.design_navigationUseEasing!='on'){
2722
2723                        if ($('html').hasClass('supports-translate')) {
2724
2725
2726                            _navCon.css({
2727                                '-webkit-transform': 'translate3d('+finish_vix+'px, '+0+'px, 0)'
2728                                ,'transform': 'translate3d('+finish_vix+'px, '+0+'px, 0)'
2729                            });
2730                        }else{
2731                            _navCon.css({
2732                                'left': finish_vix
2733                            });
2734                        }
2735                    }
2736
2737
2738                }
2739            }
2740
2741
2742            function animate_menu_y(viewIndex){
2743
2744
2745
2746                //console.info(finish_viy);
2747
2748                if(is_ios()==false && is_android()==false){
2749                    if(o.design_navigationUseEasing!='on'){
2750
2751                        if ($('html').hasClass('supports-translate')) {
2752                            _navCon.css({
2753                                '-webkit-transform': 'translate3d(0, '+finish_viy+'px, 0)'
2754                                ,'transform': 'translate3d(0, '+finish_viy+'px, 0)'
2755                            });
2756                        }else{
2757                            _navCon.css({
2758                                'top': finish_viy
2759                            });
2760                        }
2761                    }
2762
2763
2764                }
2765            }
2766
2767            function handle_frame(){
2768
2769
2770                if(isNaN(target_viy)){
2771                    target_viy=0;
2772                }
2773
2774                if(duration_viy===0){
2775                    requestAnimFrame(handle_frame);
2776                    return false;
2777                }
2778
2779                if(nav_thumbs_dir_ver){
2780                    begin_viy = target_viy;
2781                    change_viy = finish_viy - begin_viy;
2782
2783
2784                    target_viy = Number(Math.easeIn(1, begin_viy, change_viy, duration_viy).toFixed(4));;
2785
2786
2787                    //console.info(finish_viy);
2788
2789                    if(is_ios()==false && is_android()==false){
2790                        _navCon.css({
2791                            'transform': 'translate3d(0,'+target_viy+'px,0)'
2792                        });
2793                    }
2794
2795                }
2796
2797                // console.info(nav_thumbs_dir_hor);
2798                if(nav_thumbs_dir_hor){
2799                    begin_vix = target_vix;
2800                    change_vix = finish_vix - begin_vix;
2801
2802
2803                    target_vix= Number(Math.easeIn(1, begin_vix, change_vix, duration_viy).toFixed(4));;
2804
2805
2806                    // console.info(finish_vix);
2807
2808                    if(is_ios()==false && is_android()==false){
2809                        _navCon.css({
2810                            'transform': 'translate3d('+target_vix+'px,0,0)'
2811                        });
2812                    }
2813
2814                }
2815
2816                //console.info(_blackOverlay,target_bo);;
2817
2818                requestAnimFrame(handle_frame);
2819            }
2820
2821            function handleMouse(e) {
2822                //handle mouse for the _navCon element
2823                var menuAnimationSw = true;
2824                var offsetBuffer = 70;
2825                navMain_mousey = (e.pageY - _navMain.offset().top)
2826                navMain_mousex = (e.pageX - _navMain.offset().left)
2827                var viewIndex = 0
2828                    , viewMaxH
2829                    ;
2830//                console.info(mouseX,mouseY, is_android())
2831                if (is_ios() == false && is_android() == false) {
2832                    if (menu_position == 'right' || menu_position == 'left') {
2833                        viewMaxH = (navHeight) - totalHeight;
2834                        finish_viy = (navMain_mousey / totalHeight) * -(viewMaxH + offsetBuffer * 2) + offsetBuffer;
2835                        //finish_viy = parseInt(viewIndex, 10);
2836
2837
2838                        //console.info(finish_viy);
2839                        if (finish_viy > 0)
2840                            finish_viy = 0;
2841                        if (finish_viy < -viewMaxH)
2842                            finish_viy = -viewMaxH;
2843
2844
2845                        if(o.design_navigationUseEasing=='on'){
2846
2847                        }else{
2848
2849
2850
2851                            animate_menu_y(viewIndex);
2852                        }
2853
2854                        nav_thumbs_dir_ver = true;
2855                        nav_thumbs_dir_hor = false;
2856
2857
2858
2859                    }
2860                    if (menu_position == 'bottom' || menu_position == 'top') {
2861
2862                        // console.info('navWidth - ',navWidth);
2863                        // console.info('totalWidth - ',totalWidth);
2864                        viewMaxH = navWidth - totalWidth;
2865                        finish_vix = ((navMain_mousex / totalWidth) * -(viewMaxH + offsetBuffer * 2) + offsetBuffer) / currScale;
2866                        finish_vix = parseInt(finish_vix, 10);
2867
2868
2869                        // console.info('finish_vix - ',finish_vix);
2870
2871
2872                        if (finish_vix > 0)
2873                            finish_vix = 0;
2874                        if (finish_vix < -viewMaxH)
2875                            finish_vix = -viewMaxH;
2876
2877                        // console.info('finish_vix - ',finish_vix);
2878
2879
2880
2881
2882
2883                        if(o.design_navigationUseEasing=='on'){
2884
2885                        }else{
2886
2887
2888
2889                            animate_menu_x(viewIndex);
2890                        }
2891
2892                        nav_thumbs_dir_hor = true;
2893                        nav_thumbs_dir_ver = false;
2894                        //_navCon.animate({'left' : -((e.pageX-_navMain.offset().left)/totalWidth * (((o.menuitem_width + o.menuitem_space)*nrChildren) - totalWidth))	}, {queue:false, duration:100});
2895                    }
2896
2897                }else{
2898//                    console.info('ceva');
2899                    return false;
2900                }
2901
2902            }
2903
2904            function click_navCon_item(e) {
2905                //console.info('click_navCon_item')
2906                var _t = $(this);
2907
2908                var cclass= '';
2909
2910                if(_t.hasClass('navigationThumb')){
2911                    cclass='.navigationThumb';
2912                }
2913
2914                if(_t.get(0) && _t.get(0).nodeName!="A"){
2915                    gotoItem(_navCon.children(cclass).index(_t));
2916
2917                }else{
2918                    if(currVideo && currVideo.get(0) && typeof(currVideo.get(0).api_pauseMovie)!="undefined"){
2919                        currVideo.get(0).api_pauseMovie({
2920                            'call_from':'click_navCon_item()'
2921                        });
2922                    }
2923
2924                }
2925
2926            }
2927
2928            function handle_scroll(){
2929                //console.log(loaded);
2930                if(loaded==false){
2931
2932
2933
2934
2935                    var st = $(window).scrollTop();
2936                    var cthis_ot = cgallery.offset().top;
2937
2938                    var wh = window.innerHeight;
2939
2940
2941                    // console.info(cthis_ot, st+wh);
2942
2943
2944                    if(cthis_ot<st+wh+50){
2945                        init();
2946                    }
2947
2948
2949                    return;
2950                }else{
2951
2952                    var _t = $(this);//==window
2953                    wh = $(window).height();
2954                    //console.log(_t.scrollTop(), wh, cgallery.offset().top, cgallery.height(), ind_ajaxPage, o.settings_separation_pages, _t.scrollTop() + wh, (cgallery.offset().top + cgallery.height() - 10), (_t.scrollTop() + wh) > (cgallery.offset().top + cgallery.height() - 10), ind_ajaxPage, o.settings_separation_pages.length ) ;
2955
2956                    if(busy_ajax==true || ind_ajaxPage >= o.settings_separation_pages.length){
2957                        return;
2958                    }
2959
2960
2961
2962                    if( (_t.scrollTop() + wh) > (cgallery.offset().top + cgallery.height() - 10) ){
2963                        //console.info('ALCEVA');
2964                        ajax_load_nextpage();
2965                    }
2966                }
2967
2968            }
2969            function click_btn_ajax_loadmore(e){
2970
2971                if(busy_ajax==true || ind_ajaxPage >= o.settings_separation_pages.length){
2972                    return;
2973                }
2974                ajax_load_nextpage();
2975            }
2976
2977            function ajax_load_nextpage(){
2978
2979                //console.log('ajax_load_nextpage');
2980                cgallery.parent().children('.preloader').fadeIn('slow');
2981
2982                $.ajax({
2983                    url : o.settings_separation_pages[ind_ajaxPage],
2984                    success: function(response) {
2985                        if(window.console !=undefined ){ console.log('Got this from the server: ' + response); }
2986                        setTimeout(function(){
2987
2988                            cgallery.append(response);
2989                            //setTimeout(reinit, 1000);
2990                            reinit();
2991                            setTimeout(function(){
2992                                busy_ajax = false ;
2993                                cgallery.parent().children('.preloader').fadeOut('slow');
2994                                ind_ajaxPage++;
2995
2996
2997                                if(ind_ajaxPage >= o.settings_separation_pages.length){
2998                                    cgallery.children('.btn_ajax_loadmore').fadeOut('slow');
2999                                }
3000
3001
3002
3003
3004                            }, 1000);
3005                        }, 1000);
3006                    },
3007                    error:function (xhr, ajaxOptions, thrownError){
3008                        if(window.console !=undefined ){ console.error('not found ' + ajaxOptions); }
3009                        ind_ajaxPage++;
3010                        cgallery.parent().children('.preloader').fadeOut('slow');
3011
3012                    }
3013                });
3014
3015                busy_ajax = true ;
3016            }
3017
3018            function gotoItem(arg, pargs) {
3019//                console.log(_sliderCon.children().eq(arg), currNr, arg, busy_transition);
3020//                 console.log('gotoItem() - ', currNr, arg, busy_transition);
3021
3022
3023
3024
3025
3026                var margs = {
3027
3028                    'ignore_arg_currNr_check' : false
3029                    ,'ignore_linking' : false // -- does not change the link if set to true
3030                    ,donotopenlink : "off"
3031                    ,call_from : "default"
3032                }
3033
3034                if(pargs){
3035                    margs = $.extend(margs,pargs);
3036                }
3037
3038
3039
3040                if (currNr == arg || busy_transition == true || ad_playing){
3041                    return false;
3042                }
3043                var transformed = false; //if the video is already transformed there is no need to wait
3044
3045
3046
3047
3048
3049                var _c = _sliderCon.children().eq(arg);
3050                currVideo = _c;
3051                var index = _c.parent().children().index(_c);
3052
3053
3054                // console.info(index, _c);
3055
3056
3057
3058
3059                if(_c.attr('data-type')=='link' && (margs.donotopenlink!='on')){
3060
3061
3062                    // --- history API ajax cool stuff
3063                    if(o.settings_enableHistory=='on' && can_history_api()){
3064                        var stateObj = { foo: "bar" };
3065                        history.pushState(stateObj, "Gallery Video", _c.attr('data-src'));
3066
3067                        //jQuery('.history-video-element').load(_c.attr('data-src') + ' .history-video-element');
3068
3069                        $.ajax({
3070                            url : _c.attr('data-src'),
3071                            success: function(response) {
3072                                if(window.console !=undefined ){ console.info('Got this from the server: ' + response); }
3073                                setTimeout(function(){
3074                                    //console.log(jQuery(response).find('.history-video-element').eq(0).get(0).innerHTML);
3075
3076                                    $('.history-video-element').eq(0).html($(response).find('.history-video-element').eq(0).html());
3077
3078
3079                                    $('.toexecute').each(function(){
3080                                        var _t = $(this);
3081                                        if(_t.hasClass('executed')==false){
3082                                            eval(_t.text());
3083                                            _t.addClass('executed');
3084                                        }
3085                                    });
3086
3087
3088                                    if(o.settings_ajax_extraDivs!=''){
3089                                        var extradivs = String(o.settings_ajax_extraDivs).split(',');
3090
3091                                        for(i=0;i<extradivs.length;i++){
3092                                            //console.log(extradivs[i], jQuery(response).find(extradivs[i]));
3093                                            $(extradivs[i]).eq(0).html(jQuery(response).find(extradivs[i]).eq(0).html());
3094                                        }
3095                                    }
3096
3097                                    //console.log(jQuery(response)); console.log(jQuery('.toexecute'));
3098                                    //jQuery('.history-video-element').eq(0).get(0).innerHTML = jQuery(response).find('.history-video-element').eq(0).get(0).innerHTML;
3099                                    //eval(jQuery('.toexecute').text());
3100                                }, 100);
3101                            },
3102                            error:function (xhr, ajaxOptions, thrownError){
3103                                if(window.console !=undefined ){ console.error('not found ' + ajaxOptions); }
3104                                ind_ajaxPage++;
3105                                cgallery.children('.preloader').fadeOut('slow');
3106
3107                            }
3108                        });
3109                        /*
3110                         */
3111
3112                        return false;
3113                    }else{
3114                        //window.location = _c.attr('data-src');
3115                    }
3116//                    return;
3117
3118
3119                }
3120
3121
3122                console.warn('margs - ',margs);
3123                if(_c.attr('data-type')!='link'){
3124                    if(margs.ignore_linking==false && o.settings_enable_linking=='on' && margs.call_from!='init'){
3125                        var stateObj = { foo: "bar" };
3126
3127
3128
3129                        //console.info('$(\'.videogallery\').length -  ', $('.videogallery').length);
3130
3131                        //console.warn('first_played - ',first_played);
3132                        if($('.videogallery').length==1){
3133
3134                            history.pushState(stateObj, null, add_query_arg(window.location.href, 'the-video', (arg)));
3135                        }else{
3136
3137                            history.pushState(stateObj, null, add_query_arg(window.location.href, 'the-video-'+cid, (arg)));
3138                        }
3139                    }
3140                }
3141
3142
3143                if (currNr > -1) {
3144                    var _c2 = _sliderCon.children().eq(currNr);
3145                    //console.log(_c2);
3146
3147                    // --- if on iPad or iPhone, we disable the video as it had runed in a iframe and it wont pause otherwise
3148
3149                    //console.log(_c2.attr('data-type'))
3150                    _c2.addClass('transitioning-out');
3151
3152                    if (_c2.attr('data-type') == 'inline' || (_c2.attr('data-type') == 'youtube' && o.videoplayersettings['settings_youtube_usecustomskin']!='on')){
3153
3154                    }
3155                    //console.log(_c2, arr_inlinecontents);
3156
3157                    //console.log(o.videoplayersettings);
3158
3159
3160                    //console.info(o.videoplayersettings['settings_youtube_usecustomskin']);
3161                    if (o.settings_mode=='normal' && ( is_ios() || _c2.data('isflash') == 'on' || _c2.attr('data-type') == 'inline' || (_c2.attr('data-type') == 'youtube' && o.videoplayersettings['settings_youtube_usecustomskin']!='on')  || (_c2.attr('data-type') == 'youtube' && is_android() ) ) ) {
3162                        setTimeout(function() {
3163                            _c2.find('.video-description').remove();
3164                            arr_inlinecontents[currNr] = _c2.html();
3165                            _c2.html('');
3166                            _c2.removeClass('vplayer');
3167                            _c2.addClass('vplayer-tobe');
3168
3169                        }, 1000);
3170                    }
3171                    ;
3172                }
3173
3174
3175                // console.info('o.autoplay_ad - ',o.autoplay_ad)
3176                if(o.autoplay_ad=='on'){
3177
3178                    setup_ad(_c);
3179
3180                    _c.data('adplayed','on');
3181                }else{
3182
3183                    _c.data('adplayed','off');
3184                }
3185
3186
3187
3188
3189                //console.error('currNr - ',currNr);
3190                if (_c.hasClass('vplayer')) {
3191                    transformed = true;
3192                }
3193
3194
3195                // console.info('_c - ',_c);
3196                _c.addClass('transitioning-in');
3197                if (_c.hasClass('vplayer-tobe')) {
3198
3199                    //console.log(_c);
3200                    _c.addClass('in-vgallery');
3201                    o.videoplayersettings['videoWidth'] = videoWidth;
3202                    o.videoplayersettings['videoHeight'] = '';
3203
3204                    if(o.logo){
3205                        _c.children('.vplayer-logo').remove();
3206                    }
3207
3208                    //console.log(videoWidth, videoHeight);
3209                    //console.log(currNr, o.cueFirstVideo, o.autoplay);
3210                    if (currNr == -1 && o.cueFirstVideo == 'off') {
3211                        o.videoplayersettings.cueVideo = 'off';
3212                    } else {
3213                        o.videoplayersettings.cueVideo = 'on';
3214                    }
3215                    //var sw_autoplay = 'off';
3216                    //console.error('currNr - ',currNr);
3217                    if (currNr == -1) {
3218                        if (o.autoplay == 'on') {
3219                            //console.warn('hmm from dzs');
3220                            //console.warn(cgallery);
3221
3222                            if(cgallery.parent().parent().hasClass('gallery-precon')){
3223
3224                                if(cgallery.parent().parent().hasClass('curr-gallery')){
3225
3226                                    o.videoplayersettings['autoplay'] = 'on';
3227                                }else{
3228
3229                                    o.videoplayersettings['autoplay'] = 'off';
3230                                }
3231                            }else{
3232
3233                                o.videoplayersettings['autoplay'] = 'on';
3234                            }
3235
3236
3237                        } else {
3238                            o.videoplayersettings['autoplay'] = 'off';
3239                        }
3240
3241                    }
3242                    //-- if it's not the first video
3243                    if (currNr > -1) {
3244                        if (o.autoplayNext == 'on') {
3245                            o.videoplayersettings['autoplay'] = 'on';
3246                            o.videoplayersettings['cueVideo'] = 'on';
3247                        } else {
3248                            o.videoplayersettings['autoplay'] = 'off';
3249                        }
3250                    }
3251                    if (ad_playing == true) {
3252                        o.videoplayersettings['autoplay'] = 'off';
3253                    }
3254
3255
3256                    o.videoplayersettings['settings_disableControls'] = 'off';
3257
3258
3259                    if (typeof(arr_inlinecontents[arg]) != 'undefined' && arr_inlinecontents[arg] != '') {
3260                        //console.log(arr_inlinecontents, arr_inlinecontents[arg]);
3261                        o.videoplayersettings.htmlContent = arr_inlinecontents[arg];
3262                    } else {
3263                        o.videoplayersettings.htmlContent = '';
3264                    }
3265
3266                    o.videoplayersettings.gallery_object = cgallery;
3267
3268                    //console.log(o.videoplayersettings);
3269
3270                    // console.info("CONVERT IT");
3271                    if(o.settings_disableVideo=='on'){
3272                    }else{
3273                        //console.log(o.videoplayersettings);
3274
3275                        //console.info(_c);
3276                        _c.vPlayer(o.videoplayersettings);
3277
3278                    }
3279                }else{
3280
3281                    if (o.autoplayNext == 'on') {
3282                        if(typeof _c.get(0)!='undefined' && typeof _c.get(0).externalPlayMovie!='undefined'){
3283                            _c.get(0).externalPlayMovie({
3284                                'call_from':'autoplayNext'
3285                            });
3286                        }
3287
3288                    }
3289
3290                    // -- we force a resize on the player just in case it has an responsive ratio
3291
3292
3293                    setTimeout(function(){
3294                        if(typeof _c.get(0)!='undefined' && _c.get(0).api_handleResize){
3295
3296                            _c.get(0).api_handleResize(null,{
3297                                force_resize_gallery : true
3298                            })
3299                        }
3300                    },250)
3301
3302                }
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312                prevNr = arg - 1;
3313                if (prevNr < 0) {
3314                    prevNr = _sliderCon.children().length - 1;
3315                }
3316                nextNr = arg + 1;
3317                if (nextNr > _sliderCon.children().length - 1) {
3318                    nextNr = 0;
3319                }
3320
3321
3322                if (o.nav_type == 'thumbsandarrows') {
3323
3324                }
3325                if (o.settings_mode == 'normal') {
3326                    _c.css('display','');
3327                }
3328                if (o.settings_mode == 'rotator3d') {
3329                    _sliderCon.children().removeClass('nextItem currItem hide-preview-img').removeClass('prevItem');
3330                    _sliderCon.children().eq(nextNr).addClass('nextItem');
3331                    _sliderCon.children().eq(prevNr).addClass('prevItem');
3332                }
3333                if (o.settings_mode == 'rotator') {
3334
3335                    if (currNr > -1) {
3336
3337                    }
3338                    var _descCon = _navMain.children('.descriptionsCon');
3339                    _descCon.children('.currDesc').removeClass('currDesc').addClass('pastDesc');
3340                    _descCon.append('<div class="desc">' + _c.find('.menuDescription').html() + '</div>');
3341                    setTimeout(function() {
3342                        _descCon.children('.desc').addClass('currDesc');
3343                    }, 20)
3344
3345                    //console.log(_c);
3346                }
3347
3348
3349
3350
3351//                console.info(currNr, transformed);
3352
3353                last_arg = arg;
3354                if (currNr == -1 || transformed) {
3355                    the_transition();
3356                    if(o.settings_mode == 'rotator3d') {
3357                        _sliderCon.children().eq(arg).addClass('hide-preview-img');
3358                    }
3359                } else {
3360                    cgallery.parent().children('.preloader').fadeIn('fast');
3361//                    the_transition();
3362
3363                    var delay = 500;
3364
3365                    console.info("DO IT NOW");
3366                    if(o.settings_mode == 'rotator3d'){
3367                        delay = 10;
3368                        _sliderCon.children().eq(arg).addClass('currItem');
3369                        setTimeout(function(){
3370
3371                            _sliderCon.children().eq(arg).addClass('hide-preview-img');
3372                        },300);
3373                    }
3374
3375                    inter_start_the_transition = setTimeout(the_transition, delay, arg);
3376
3377                }
3378
3379
3380                if(o.settings_secondCon){
3381//                    console.info($(o.settings_secondCon).find('.item').eq(arg).outerHeight(false));
3382                    $(o.settings_secondCon).find('.item').removeClass('active');
3383                    $(o.settings_secondCon).find('.item').eq(arg).addClass('active');
3384                    $(o.settings_secondCon).find('.dzsas-second-con--clip').css(
3385                        {
3386                            'height': $(o.settings_secondCon).find('.item').eq(arg).outerHeight(false)
3387                            ,'left' : -(arg*100)+'%'
3388                        }
3389                    );
3390                }
3391                if(o.settings_outerNav){
3392                    $(o.settings_outerNav).find('.videogallery--navigation-outer--block ').removeClass('active');
3393                    $(o.settings_outerNav).find('.videogallery--navigation-outer--block ').eq(arg).addClass('active');
3394                }
3395
3396                if(cgallery.hasClass('responsive-ratio-smooth')){
3397                    if(!_c.attr('data-responsive_ratio')){
3398                        responsive_ratio_resize_h(initial_h);
3399                    }else{
3400                        $(window).trigger('resize');
3401                    }
3402//                    responsive_ratio_resize_h(initial_h);
3403                }
3404
3405
3406                /*
3407                 if(is_ios()){
3408                 //	console.log(currNr, arg);
3409
3410                 }else{
3411                 if(currNr>-1) {
3412
3413
3414
3415
3416                 }
3417                 */
3418
3419                cgallery.removeClass('hide-players-not-visible-on-screen');
3420                setTimeout(function(){
3421
3422                    cgallery.addClass('hide-players-not-visible-on-screen');
3423                    _sliderCon.find('.transitioning-in').removeClass('transitioning-in');
3424                    _sliderCon.find('.transitioning-out').removeClass('transitioning-out');
3425                },400);
3426                firsttime = false;
3427                busy_transition = true;
3428
3429                return true;
3430            }
3431
3432            function hide_all_videos_but_curr(){
3433                if(o.settings_mode=='normal'){
3434
3435                    _sliderCon.children().each(function(){
3436                        var _t = $(this);
3437
3438                        if(_t.hasClass('currItem')==false){
3439                            _t.hide();
3440                        }
3441                    })
3442                }
3443            }
3444
3445
3446            function setup_ad(arg){
3447                // -- challery
3448
3449                // console.info("SETUP_AD()");
3450
3451                var _c = arg;
3452
3453                // console.info('adding ad - ',_c.attr('data-adsource'), _c.find('.adSource').length>0,(_c.attr('data-adsource') ||  _c.find('.adSource').length>0 ), ( is_ios() && o.videoplayersettings.settings_ios_usecustomskin=='on' ) );
3454
3455
3456                //!is_ios() ||
3457
3458                if ( (_c.attr('data-adsource') ||  _c.find('.adSource').length>0 ) && !( is_ios() && o.videoplayersettings.settings_ios_usecustomskin!='on' )) {
3459                    // console.info('adding ad');
3460                    //advertisment
3461                    var aux = '<div class="vplayer-tobe"';
3462
3463                    //data-source="video/test.m4v"
3464                    if (_c.attr('data-adsource') != undefined) {
3465                        aux += ' data-src="' + _c.attr('data-adsource') + '"';
3466                    }
3467                    if (_c.attr('data-adsource_ogg') != undefined) {
3468                        aux += ' data-sourceogg="' + _c.attr('data-adsource_ogg') + '"';
3469                    }
3470                    if (_c.attr('data-adtype') != undefined) {
3471                        aux += ' data-type="' + _c.attr('data-adtype') + '"';
3472                    }
3473                    if (_c.attr('data-adlink') != undefined) {
3474                        aux += ' data-adlink="' + _c.attr('data-adlink') + '"';
3475                    }
3476                    if (_c.attr('data-adtitle') != undefined) {
3477                        aux += ' data-videoTitle="' + _c.attr('data-adtitle') + '"';
3478                    }
3479                    if (_c.attr('data-adskip_delay') != undefined) {
3480                        aux += ' data-adskip_delay="' + _c.attr('data-adskip_delay') + '"';
3481                    }
3482
3483
3484                    aux += '>';
3485
3486
3487                    if (_c.attr('data-adtype') == 'inline') {
3488
3489                        if(_c.find('.adSource').length>0){
3490                            aux+= _c.find('.adSource').eq(0).html();
3491                        }else{
3492                            aux+= _c.attr('data-adsource');
3493                        }
3494                    }
3495
3496                    aux+='</div>';
3497                    _adSpace.show();
3498                    _adSpace.append(aux);
3499//                    console.info(aux);
3500
3501
3502                    var auxoptions = $.extend(true,{},o.videoplayersettings);;
3503                    auxoptions['videoWidth'] = totalWidth;
3504                    auxoptions['videoHeight'] = totalHeight;
3505                    auxoptions['is_ad'] = 'on';
3506
3507
3508                    auxoptions.autoplay= 'on';
3509                    auxoptions.settings_disableControls = 'on';
3510                    auxoptions.gallery_object = cgallery;
3511
3512
3513
3514                    ad_playing = true;
3515//                    console.info(auxoptions);
3516
3517                    if(is_android()){
3518                        auxoptions['autoplay']='off';
3519                    }
3520
3521
3522                    _adSpace.children('.vplayer-tobe').addClass('is-ad');
3523                    _adSpace.children('.vplayer-tobe').vPlayer(auxoptions);
3524
3525//                    console.info(_adSpace);
3526//                    return;
3527                }
3528            }
3529
3530
3531
3532            function the_transition() {
3533                if(sw_transition_started){
3534                    return;
3535                }
3536
3537                var arg = last_arg;
3538
3539
3540                var _c = _sliderCon.children().eq(arg);
3541
3542                sw_transition_started = true;
3543                clearTimeout(inter_start_the_transition);
3544                cgallery.parent().children('.preloader').fadeOut('fast');
3545
3546
3547                _sliderCon.children().removeClass('currItem');
3548
3549
3550                console.info('the_transition - ', _c, currNr);
3551                if(currNr==-1){
3552                    _c.addClass('currItem');
3553                    _c.addClass('no-transition');
3554                    setTimeout(function(){
3555                        _sliderCon.children().eq(currNr).removeClass('no-transition')
3556                    })
3557                }else{
3558
3559                    if(currNr!=arg){
3560
3561                        _sliderCon.children().eq(currNr).addClass('transition-sli
3561deup-gotoTop')
3562                    }else{
3563
3564                        _sliderCon.children().eq(currNr).addClass('currItem');
3565                    }
3566
3567
3568
3569                }
3570
3571                setTimeout(setCurrVideoClass, 100);
3572                _navCon.children().removeClass('active');
3573                _navCon.children().eq(arg).addClass('active');
3574
3575                if(o.nav_type=='thumbs' || o.nav_type=='scroller' || o.nav_type=='thumbsandarrows'){
3576
3577                    _navCon.children('.navigationThumb').removeClass('active');
3578                    _navCon.children('.navigationThumb').eq(arg).addClass('active');
3579                }
3580
3581
3582//                console.info(arg, _navCon.children().eq(arg));
3583
3584                setTimeout(function(){
3585                    $('window').trigger('resize');
3586                    _sliderCon.children().removeClass('transition-slideup-gotoTop');
3587                },1000);
3588
3589                if (is_ios() && currNr > -1) {
3590                    if (_sliderCon.children().eq(currNr).children().eq(0).length > 0 && _sliderCon.children().eq(currNr).children().eq(0)[0] != undefined) {
3591                        if (_sliderCon.children().eq(currNr).children().eq(0)[0].tagName == 'VIDEO') {
3592                            _sliderCon.children().eq(currNr).children().eq(0).get(0).pause();
3593                        }
3594                    }
3595                }
3596
3597                if(first_transition){
3598
3599                    handle_stopCurrVideo({
3600                        'call_from':'the_transition'
3601                    });
3602                }
3603
3604                if(currNr > -1){
3605
3606
3607                    first_transition = true;
3608
3609                    //console.error('currNr - - ',currNr);
3610
3611                }
3612                currNr = arg;
3613
3614                setTimeout(function(){
3615
3616                    busy_transition = false;
3617                    sw_transition_started = false;
3618                    hide_all_videos_but_curr();
3619                }, 400);
3620            } // end the_transition()
3621
3622            function setCurrVideoClass(){
3623                currVideo.addClass('currItem');
3624            }
3625
3626
3627            function play_currVideo(){
3628
3629                if (_sliderCon.children().eq(currNr).get(0) && _sliderCon.children().eq(currNr).get(0).externalPauseMovie){
3630                    _sliderCon.children().eq(currNr).get(0).api_playMovie({
3631                        'call_from':'api_playMovie'
3632                    });
3633                }
3634            }
3635            function handle_stopCurrVideo(pargs) {
3636
3637                var margs = {
3638                    'call_from':'default'
3639                }
3640
3641                if(pargs){
3642                    margs = $.extend(margs,pargs);
3643                }
3644
3645                if (!is_ios() && !is_ie8() && currNr > -1) {
3646                    if (_sliderCon.children().eq(currNr).get(0) && _sliderCon.children().eq(currNr).get(0).externalPauseMovie){
3647                        _sliderCon.children().eq(currNr).get(0).externalPauseMovie({
3648                            'call_from':'external_handle_stopCurrVideo() - '+margs.call_from
3649                        });
3650                    }
3651                }
3652            }
3653            function click_embedhandle() {
3654                if (embed_opened == false) {
3655                    _gbuttons.find('.embed-button .contentbox').animate({
3656                        'right': 60
3657                    }, {queue: false, duration: 300});
3658
3659                    _gbuttons.find('.embed-button .contentbox').fadeIn('fast');
3660                    embed_opened = true;
3661                } else {
3662                    _gbuttons.find('.embed-button .contentbox').animate({
3663                        'right': 50
3664                    }, {queue: false, duration: 300});
3665
3666                    _gbuttons.find('.embed-button .contentbox').fadeOut('fast');
3667                    embed_opened = false;
3668                }
3669            }
3670            function click_sharehandle() {
3671                if (share_opened == false) {
3672                    _gbuttons.find('.share-button .contentbox').animate({
3673                        'right': 60
3674                    }, {queue: false, duration: 300});
3675
3676                    _gbuttons.find('.share-button .contentbox').fadeIn('fast');
3677                    share_opened = true;
3678                } else {
3679                    _gbuttons.find('.share-button .contentbox').animate({
3680                        'right': 50
3681                    }, {queue: false, duration: 300});
3682
3683                    _gbuttons.find('.share-button .contentbox').fadeOut('fast');
3684                    share_opened = false;
3685                }
3686            }
3687            function gotoPrev() {
3688                //console.log(cgallery);
3689
3690                if(o.playorder=='reverse'){
3691                    gotoNext();
3692                    return;
3693                }
3694
3695                var tempNr = currNr - 1;
3696                if (tempNr < 0) {
3697                    tempNr = _sliderCon.children().length - 1;
3698                }
3699                gotoItem(tempNr);
3700
3701
3702                if (o.nav_type == 'thumbsandarrows') {
3703                    if (Math.floor((tempNr) / thumbs_per_page) != currPage) {
3704                        gotoPage(Math.floor((tempNr) / thumbs_per_page))
3705                    }
3706
3707                }
3708
3709            }
3710            function gotoNext() {
3711                //console.log(cgallery);
3712
3713                if(o.playorder=='reverse'){
3714                    gotoPrev();
3715                    return;
3716                }
3717
3718                var goforwardwithnext = true;
3719                var tempNr = currNr + 1;
3720                if (tempNr >= _sliderCon.children().length) {
3721                    tempNr = 0;
3722
3723
3724                    if(o.loop_playlist!='on'){
3725                        goforwardwithnext = false;
3726                    }
3727                }
3728
3729
3730                if(goforwardwithnext){
3731
3732                    gotoItem(tempNr);
3733                }
3734
3735
3736                if (o.nav_type == 'thumbsandarrows') {
3737                    if (Math.floor((tempNr) / thumbs_per_page) != currPage) {
3738                        gotoPage(Math.floor((tempNr) / thumbs_per_page))
3739                    }
3740
3741
3742                }
3743            }
3744            function handleVideoEnd() {
3745                // -- cgallery
3746                //console.info(ad_playing);
3747
3748                //console.info('video end - ', ad_playing);
3749                if (ad_playing == true) {
3750                    _adSpace.children().animate({opacity: 0}, 300);
3751                    setTimeout(function() {
3752                        _adSpace.html('');
3753                        _adSpace.hide();
3754                    }, 400)
3755                    ad_playing = false;
3756
3757//                    console.info(currVideo);
3758                    if(currVideo && typeof currVideo.get(0).externalPlayMovie!='undefined' && o.autoplayNext=='on' && is_ios()==false && is_android()==false){
3759                        currVideo.get(0).externalPlayMovie({
3760                            'call_from':'gallery - video end()'
3761                        });
3762                    }
3763                } else {
3764
3765                    if(o.autoplayNext=='on'){
3766
3767                        gotoNext();
3768                    }
3769                }
3770
3771
3772            }
3773
3774            function turnFullscreen() {
3775                var _t = jQuery(this);
3776                //console.log(_t);
3777                return;
3778                _t.css({
3779                    'position': 'static'
3780                })
3781                _sliderMain.css({
3782                    'position': 'static'
3783                })
3784            }
3785
3786            function mod_rotator3d_clickPreviewImg() {
3787                var _t = $(this);
3788                var ind = _t.parent().parent().children().index(_t.parent());
3789                //console.log(_t, ind);
3790                gotoItem(ind);
3791            }
3792            $.fn.turnNormalscreen = function() {
3793                $(this).css({
3794                    'position': 'relative'
3795                })
3796                _sliderMain.css({
3797                    'position': 'relative'
3798                })
3799                for (i = 0; i < nrChildren; i++) {
3800                    _sliderCon.children().eq(i).css({
3801                        'position': 'absolute'
3802                    })
3803                }
3804            }
3805            $.fn.vGallery.gotoItem = function(arg) {
3806//                gotoItem(arg);
3807            }
3808            return this;
3809
3810        }); // end each
3811    }
3812    window.dzsvg_init = function(selector, settings) {
3813
3814        if(typeof(settings)!="undefined" && typeof(settings.init_each)!="undefined" && settings.init_each==true ){
3815            var element_count = 0;
3816            for (var e in settings) { element_count++; }
3817            if(element_count==1){
3818                settings = undefined;
3819            }
3820
3821            $(selector).each(function(){
3822                var _t = $(this);
3823                _t.vGallery(settings)
3824            });
3825        }else{
3826            $(selector).vGallery(settings);
3827        }
3828    };
3829    //==== deprecated
3830    window.zsvg_init = function(selector, settings) {
3831        $(selector).vGallery(settings);
3832    };
3833
3834})(jQuery);
3835
3836
3837
3838function vgcategories(arg){
3839    var ccat = jQuery(arg);
3840    var currCatNr = -1;
3841    //console.log(ccat);
3842    ccat.find('.gallery-precon').each(function(){
3843        var _t = jQuery(this);
3844        //console.log(_t);
3845        _t.css({'display' : 'none'});
3846        ccat.find('.the-categories-con').append('<span class="a-category">'+_t.attr('data-category')+'</span>')
3847    });
3848
3849    ccat.find('.the-categories-con').find('.a-category').eq(0).addClass('active');
3850    ccat.find('.the-categories-con').find('.a-category').bind('click', click_category);
3851    function click_category(){
3852        var _t = jQuery(this);
3853        var ind = _t.parent().children('.a-category').index(_t);
3854
3855        //console.warn('ind - ',ind);
3856        gotoCategory(ind);
3857        setTimeout(function(){
3858            jQuery(window).trigger('resize');
3859        },100);
3860    }
3861
3862    //console.info(ccat);
3863
3864    var i2 = 0;
3865
3866    ccat.find('.gallery-precon').each(function(){
3867        var _t = jQuery(this);
3868
3869        //console.info(_t);
3870
3871        _t.find('.pagination-number').each(function(){
3872            var _t2 = jQuery(this);
3873            //console.log(_t2);
3874
3875            var auxurl = _t2.attr('href');
3876
3877            //console.log(auxurl);
3878
3879            auxurl = add_query_arg(auxurl, ccat.attr('id')+'_cat', NaN);
3880
3881            //console.log(auxurl);
3882
3883            auxurl = add_query_arg(auxurl, ccat.attr('id')+'_cat', i2);
3884
3885            _t2.attr('href', auxurl);
3886        })
3887
3888        i2++;
3889    })
3890
3891    var tempCat = 0;
3892
3893    //console.info(window.location.href, ccat.attr('id')+'_cat', get_query_arg(window.location.href, ccat.attr('id')+'_cat'))
3894
3895    if(get_query_arg(window.location.href, ccat.attr('id')+'_cat')){
3896        tempCat = Number(get_query_arg(window.location.href, ccat.attr('id')+'_cat'));
3897    }
3898
3899
3900    ccat.get(0).api_goto_category = gotoCategory;
3901
3902    gotoCategory(tempCat,{
3903        'call_from':'init'
3904    });
3905    function gotoCategory(arg,pargs){
3906
3907
3908
3909        var margs = {
3910            'call_from':'default'
3911        };
3912
3913
3914        if(pargs){
3915            margs = jQuery.extend(margs,pargs);
3916        }
3917
3918        //console.error('gotoCategory() -', arg, margs);
3919
3920        if(currCatNr>-1 && ccat.find('.gallery-precon').eq(currCatNr).find('.videogallery').eq(0).get(0)!=undefined && ccat.find('.gallery-precon').eq(currCatNr).find('.videogallery').eq(0).get(0).external_handle_stopCurrVideo!=undefined ){
3921
3922
3923            var ind = 0;
3924            ccat.find('.gallery-precon').each(function(){
3925
3926
3927                //console.info(jQuery(this));
3928                if(ind!=arg){
3929
3930                    jQuery(this).find('.videogallery').eq(0).get(0).external_handle_stopCurrVideo();
3931                }
3932                ind++;
3933            })
3934
3935
3936        }
3937        ccat.find('.gallery-precon').removeClass('curr-gallery');
3938        ccat.find('.the-categories-con').find('.a-category').removeClass('active');
3939        ccat.find('.the-categories-con').find('.a-category').eq(arg).addClass('active');
3940        ccat.find('.gallery-precon').addClass('disabled');
3941        ccat.find('.gallery-precon').eq(arg).css('display','').removeClass('disabled');
3942
3943        var _cach = ccat.find('.gallery-precon').eq(arg);
3944        var _cachg =_cach.find('.videogallery').eq(0);
3945
3946        //console.info('_cach - ',_cach);
3947        //console.info('_cachg - ',_cachg);
3948
3949        if(_cachg.get(0) && _cachg.get(0).init_settings){
3950
3951            //console.info('_cachg.get(0).init_settings - ',_cachg.get(0).init_settings.autoplay);
3952
3953            if(_cachg.get(0).init_settings.autoplay=='on'){
3954                setTimeout(function(){
3955
3956                    _cachg.get(0).api_play_currVideo();
3957                },10);
3958
3959                if(margs.call_from=='deeplink' || margs.call_from=='init'){
3960
3961                    setTimeout(function(){
3962
3963                        //_cachg.get(0).api_play_currVideo();
3964                    },1000);
3965                    setTimeout(function(){
3966
3967                        _cachg.get(0).api_play_currVideo();
3968                    },1500);
3969                }
3970            }
3971        }
3972
3973        setTimeout(function(){
3974            ccat.children('.dzsas-second-con').hide();
3975            ccat.children('.dzsas-second-con').eq(arg).show();
3976
3977
3978            //console.info(ccat.find('.gallery-precon').eq(arg));
3979
3980            ccat.find('.gallery-precon').eq(arg).addClass('curr-gallery');
3981
3982
3983
3984
3985            currCatNr = arg;
3986
3987            //console.log(ccat.find('.gallery-precon').eq(arg).find('.videogallery').eq(0));
3988            if(typeof ccat.find('.gallery-precon').eq(arg).find('.videogallery').eq(0).get(0) != 'undefined' && typeof ccat.find('.gallery-precon').eq(arg).find('.videogallery').eq(0).get(0).api_handleResize != 'undefined'){
3989                ccat.find('.gallery-precon').eq(arg).find('.videogallery').eq(0).get(0).api_handleResize();
3990                ccat.find('.gallery-precon').eq(arg).find('.videogallery').eq(0).get(0).api_handleResize_currVideo();
3991            }
3992            setTimeout(function(){
3993
3994                jQuery(window).trigger('resize');
3995            },1500);
3996
3997
3998        },50);
3999
4000
4001
4002
4003
4004    }
4005}
4006
4007
4008
4009
4010//-------VIDEO PLAYER
4011var ytplayer;
4012(function($) {
4013    $.fn.vPlayer = function(o) {
4014
4015        var defaults = {
4016            type: 'normal'
4017            ,autoplay: "off"
4018            ,autoplay_on_mobile_too_with_video_muted: "off" // -- will attempt to autoplay on mobile too, but with no sound
4019            ,videoWidth: 0
4020            ,videoHeight: 0
4021            ,design_scrubbarWidth: 'default'
4022            ,gallery_object: null // -- the gallery which invoked this
4023            ,parent_player: null // -- the player which invoked this
4024            ,design_skin: 'skin_default'
4025            , design_background_offsetw: 0
4026            , settings_youtube_usecustomskin: 'on'
4027            , settings_ios_usecustomskin: 'on'
4028            , cueVideo: 'on'
4029            , settings_disableControls: 'off'
4030            , is_ad: 'off'
4031            , settings_hideControls: 'off'
4032            , ad_link: ''
4033            , ad_show_markers: 'off' // -- show markers on the scrubbar
4034            , settings_suggestedQuality: 'hd720'
4035            , design_enableProgScrubBox: 'default'
4036            , settings_enableTags: 'on'
4037            , settings_disableVideoArray: 'off'
4038            , settings_makeFunctional: false
4039            ,settings_video_overlay: "off" //-- an overlay over the video that you can press for pause / unpause
4040            ,settings_big_play_btn: "off" // -- show a big play button centered on video paused
4041            ,video_description_style: "none" // -- choose how Video Description text shows
4042            , htmlContent: ''
4043            , settings_swfPath: 'preview.swf'
4044            ,settings_disable_mouse_out:'off'  // -- disable the normal mouse-is-out behaviour when mouse leaves the player
4045            ,settings_disable_mouse_out_for_fullscreen:'off'  // -- disable the normal mouse-is-out behaviour when mouse is in the player / fullscreen
4046            , controls_fscanvas_bg: '#aaa'
4047            , controls_fscanvas_hover_bg: '#ddd'
4048            , touch_play_inline: 'on'
4049            , google_analytics_send_play_event: 'off'
4050            , settings_video_end_reset_time: 'on' // -- when the video has ended, reset the time to 0
4051            ,settings_trigger_resize: '0' // -- a force trigger resize every x ms
4052            ,settings_mouse_out_delay: 100
4053            ,settings_mouse_out_delay_for_fullscreen: 1100
4054            ,rtmp_streamServer : '' // -- only for rtmp use ( advanced ) if you have a rtmp server
4055            ,playfrom : 'default' // play from a index , default means that this will be decided by the data-playfrom
4056            ,settings_subtitle_file : '' // -- set a subtitle file
4057            ,responsive_ratio : 'default' // -- set a responsive ratio height/ratio 0.5 means that the player height will resize to 0.5 of the gallery width
4058            ,action_video_play: null
4059            ,action_video_view: null // -- an external function that you can set to record a view of the video - will be only cast once on play
4060            ,action_video_contor_5secs: null // -- apply a function which fires once per second
4061            ,action_video_contor_10secs: null
4062            ,try_to_pause_zoomsounds_players: 'off'
4063        }
4064
4065
4066        if(typeof o =='undefined'){
4067            if(typeof $(this).attr('data-options')!='undefined' && $(this).attr('data-options')!=''){
4068                var aux = $(this).attr('data-options');
4069                aux = 'window.dzsvp_self_options = ' + aux;
4070                eval(aux);
4071                o = $.extend({},window.dzsvp_self_options);
4072                window.dzsvp_self_options = $.extend({},{});
4073            }
4074        }
4075
4076
4077        o = $.extend(defaults, o);
4078        //console.info(o);
4079
4080        /*
4081         * the way the plugin works is.
4082         * first the markup is analyzed
4083         * then the init function
4084         * then the init_readyVideo function
4085         *
4086         */
4087        this.each(function() {
4088
4089            var cthis
4090                ,cid = ''
4091                ,_cmedia
4092                ;
4093            var the_player_id = ''; // -- this is set only if the player actually has an id
4094
4095            var controlsDiv;
4096            var videoWidth
4097                ,videoHeight
4098                ,last_videoWidth = 0
4099                ,last_videoHeight = 0
4100                , totalWidth
4101                , totalHeight;
4102            var video;
4103            var aux = 0;
4104            var aux2 = 0;
4105            var is_fullscreen = 0;
4106            var inter_videoReadyState // interval to check for time
4107                ,inter_checkytadend // interval to check on when the youtube video ad has ended
4108                ,inter_removeFsControls // interval to remove fullscreen controls when no action is detected
4109                ,inter_mousedownscrubbing = 0 // interval to apply mouse down scrubbing on the video
4110                ;
4111            var lastVolume;
4112            var defaultVolume;
4113            var infoPosX;
4114            var infoPosY;
4115            var wasPlaying = false;
4116            var autoplay = "off";
4117            var fScreenControls
4118                , playcontrols
4119                , _volumeControls
4120                , _volumeControls_real
4121                , info
4122                , infotext
4123                , scrubbar
4124                , _scrubBg
4125                , _timetext
4126                , _vpInner = null
4127                , _btnhd
4128                , _adSkipCon = null
4129                , _controlsBackground = null
4130                , _muteControls = null
4131                , _adContainer = null
4132
4133                ;
4134            var paused = true
4135                ,played = false
4136                ,ad_playing = false
4137                ,mouseover = false // -- the mouse is over the vplayer
4138                ,initial_played = false
4139                ,google_analytics_sent_play_event = false
4140                ,volume_mouse_down = false
4141                ,scrub_mouse_down = false
4142                ,controls_are_hovered = false
4143                ,view_sent = false
4144                ,fullscreen_just_pressed = false
4145                ,play_commited = false // -- this will apply play later on
4146                ,has_ad_to_play = false
4147                ,loop = 'off'
4148                ,suspend_state_2_for_loop = false
4149                ;
4150
4151            var scrubbar_moving_x = 0
4152                ,scrubbar_moving = false // -- touch
4153                ;
4154
4155            var ie8paused = true;
4156            var totalDuration = 0;
4157            var time_curr = 0;
4158            var dataType = '';
4159            var dataFlash = '';
4160            var dataSrc = '';
4161            var dataVideoDesc = '';
4162
4163            var video_title = '';
4164
4165            var dash_player = null
4166                ,dash_context = null
4167                ,dash_inter_check_sizes = 0
4168                ;
4169            //responsive vars
4170            var conw
4171                , conh
4172                , newconh
4173                , _rparent
4174                , _vgparent
4175                , currScale = 1
4176                ;
4177            var ww
4178                , wh
4179                ;
4180            var yt_qualArray = []
4181                , yt_qualCurr
4182                , hasHD = false
4183                ;
4184
4185            var arrTags = [];
4186
4187            var ad_array = [];
4188
4189            var bufferedLength = -1
4190                , bufferedWidthOffset = 0
4191                , volumeLength = 0
4192                , volumeWidthOffset = 0
4193                ,scrubbg_width = 0
4194                ;
4195            var time_counter_skipad = 0
4196                ,ad_status = 'undefined'
4197                ,inter_time_counter_skipad = 0
4198                ,inter_check_yt_iframe_ready = 0
4199                ,inter_clear_playpause_mistake = 0
4200                ;
4201
4202
4203            var busy_playpause_mistake = false
4204                ;
4205
4206            var _controls_fs_canvas;
4207
4208            var vimeo_data, vimeo_url;
4209
4210
4211            var dzsvg_translate_youcanskipto = 'you can skip to video in ';
4212            var translate_skipad = 'Skip Ad';
4213
4214            var inter_10_secs_contor = 0
4215                ,inter_5_secs_contor = 0
4216                ;
4217
4218
4219
4220            var svg_aurora_play_btn = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 13.75 12.982" enable-background="new 0 0 13.75 12.982" xml:space="preserve"> <path d="M11.889,5.71L3.491,0.108C3.389,0.041,3.284,0,3.163,0C2.834,0,2.565,0.304,2.565,0.676H2.562v11.63h0.003 c0,0.372,0.269,0.676,0.597,0.676c0.124,0,0.227-0.047,0.338-0.115l8.389-5.595c0.199-0.186,0.326-0.467,0.326-0.781 S12.088,5.899,11.889,5.71z"/> </svg>';
4221
4222
4223
4224            var original_scrubwidth = 0;
4225
4226
4227            if(window.dzsvg_translate_youcanskipto!=undefined){ dzsvg_translate_youcanskipto = window.dzsvg_translate_youcanskipto;  }
4228            if(window.dzsvg_translate_skipad){ translate_skipad = window.dzsvg_translate_skipad; }
4229
4230            cthis = $(this);
4231
4232
4233            if(typeof(cthis.attr('id'))!='undefined'){
4234                the_player_id = cthis.attr('id');
4235            }
4236
4237            if(typeof cthis.attr('id')!='undefined' && cthis.attr('id')!=''){
4238                cid = cthis.attr('id');
4239            }else{
4240                cid = 'dzsvp'+parseInt(Math.random()*1000,10)
4241            }
4242
4243
4244
4245
4246            if (cthis.parent().parent().parent().hasClass('videogallery')) {
4247                _vgparent = cthis.parent().parent().parent();
4248            }
4249
4250
4251            //console.log(cthis, cthis.css('width'));
4252
4253            autoplay = o.autoplay;
4254
4255            //console.log(o);
4256
4257            //==some sanitizing of the videoWidth and videoHeight parameters
4258
4259
4260
4261
4262
4263            if (o.videoWidth == 0) {
4264                videoWidth = cthis.width();
4265            } else {
4266                videoWidth = o.videoWidth;
4267            }
4268
4269            if (o.videoHeight == 0) {
4270                videoHeight = cthis.height();
4271            } else {
4272                videoHeight = o.videoHeight;
4273            }
4274
4275            if(o.autoplay=='on'){
4276                autoplay = 'on';
4277            }
4278
4279            if(is_mobile()){
4280
4281
4282                if(o.autoplay_on_mobile_too_with_video_muted=='on'){
4283
4284                }else{
4285
4286                    autoplay = 'off';
4287                }
4288                // o.autoplay='off';
4289
4290            }
4291
4292
4293            //console.info(cthis, o.responsive_ratio);
4294
4295//            console.info(Number(o.playfrom));
4296            if(o.playfrom=='default'){
4297                if(typeof cthis.attr('data-playfrom')!='undefined' && cthis.attr('data-playfrom')!=''){
4298                    o.playfrom = cthis.attr('data-playfrom');
4299                }
4300            }
4301            if(isNaN(Number(o.playfrom))==false){
4302                o.playfrom = Number(o.playfrom);
4303            }
4304
4305            if(o.is_ad=='on'){
4306//                console.info(cthis);
4307
4308                if(o.type=='youtube'){
4309
4310                }
4311            }
4312
4313
4314            init();
4315            function init() {
4316                //console.info('init()', cthis);
4317
4318                if (cthis.hasClass('vplayer-tobe')) {
4319
4320                    //alert('ceva');
4321                    var _c = cthis;
4322                    _c.removeClass('vplayer-tobe');
4323                    _c.addClass('vplayer');
4324
4325                    //console.log(autoplay, cthis);
4326
4327
4328                    if(o.settings_disableVideoArray!='on'){
4329                        dzsvp_players_arr.push(cthis);
4330                    }
4331
4332
4333                    var mainClass = '';
4334                    if (typeof(cthis.attr('class')) == 'string') {
4335                        mainClass = cthis.attr('class');
4336                    } else {
4337                        mainClass = cthis.get(0).className;
4338                    }
4339
4340                    if (mainClass.indexOf('skin_') == -1) {
4341                        cthis.addClass(o.design_skin);
4342                        mainClass += ' ' + o.design_skin;
4343                    }
4344
4345
4346                    //console.info('scrubbar width - ',cthis, o.design_scrubbarWidth);
4347                    //-setting skin specific vars
4348                    if (mainClass.indexOf('skin_aurora') > -1) {
4349                        o.design_skin = 'skin_aurora';
4350                        bufferedWidthOffset = -2;
4351                        volumeWidthOffset = -2;
4352                        if (o.design_enableProgScrubBox == 'default') {
4353                            o.design_enableProgScrubBox = 'on';
4354                        }
4355                        if (o.design_scrubbarWidth == 'default') {
4356                            o.design_scrubbarWidth = -113;
4357                        }
4358                    }
4359                    if (mainClass.indexOf('skin_pro') > -1) {
4360                        o.design_skin = 'skin_pro';
4361                        bufferedWidthOffset = 0;
4362                        volumeWidthOffset = -2;
4363                        if (o.design_enableProgScrubBox == 'default') {
4364                            o.design_enableProgScrubBox = 'off';
4365                        }
4366                        if (o.design_scrubbarWidth == 'default') {
4367                            o.design_scrubbarWidth = 0;
4368                        }
4369                    }
4370                    if (mainClass.indexOf('skin_bigplay') > -1) {
4371                        o.design_skin = 'skin_bigplay';
4372                    }
4373                    if (mainClass.indexOf('skin_bigplay_pro') > -1) {
4374                        o.design_skin = 'skin_bigplay_pro';
4375                    }
4376                    if (mainClass.indexOf('skin_bluescrubtop') > -1) {
4377                        o.design_skin = 'skin_bluescrubtop';
4378
4379                        if (o.design_scrubbarWidth == 'default') {
4380                            o.design_scrubbarWidth = 0;
4381                        }
4382                    }
4383                    if (mainClass.indexOf('skin_avanti') > -1) {
4384                        o.design_skin = 'skin_avanti';
4385
4386                        if (o.design_scrubbarWidth == 'default') {
4387                            o.design_scrubbarWidth = -125;
4388                        }
4389                    }
4390                    if (mainClass.indexOf('skin_noskin') > -1) {
4391                        o.design_skin = 'skin_noskin';
4392                    }
4393
4394
4395
4396                    if(cthis.hasClass('skin_white')){
4397                        o.design_skin='skin_white';
4398                    }
4399                    if(cthis.hasClass('skin_reborn')){
4400                        o.design_skin='skin_reborn';
4401                        if (o.design_scrubbarWidth == 'default') {
4402                            o.design_scrubbarWidth = -312;
4403
4404                        }
4405                    }
4406
4407//                    console.info(o.design_scrubbarWidth);
4408                    if (o.design_scrubbarWidth == 'default') {
4409                        o.design_scrubbarWidth = -201;
4410                    }
4411
4412                    if(is_mobile()){
4413                        cthis.addClass('disable-volume');
4414
4415                        if(o.design_skin=='skin_aurora'){
4416                            o.design_scrubbarWidth+=50;
4417                        }
4418                        if(o.design_skin=='skin_reborn'){
4419                            o.design_scrubbarWidth+=65;
4420                        }
4421                    }
4422
4423                    original_scrubwidth = o.design_scrubbarWidth;
4424
4425
4426
4427
4428                    if (typeof _c.attr('data-src') == 'undefined' && typeof _c.attr('data-source') != 'undefined' && _c.attr('data-source') != '') {
4429                        _c.attr('data-src', _c.attr('data-source'));
4430                    }
4431
4432                    var aux = '';
4433                    if(cthis.attr('data-ad-array')){
4434                        aux = cthis.attr('data-ad-array')
4435                        try{
4436
4437
4438                            // temp - try to remove slashes manually
4439                            aux = aux.replace(/{\\"/g,'{"');
4440                            aux = aux.replace(/\\":/g,'":');
4441                            aux = aux.replace(/:\\"/g,':"');
4442                            aux = aux.replace(/\\",/g,'",');
4443                            aux = aux.replace(/\\"}/g,'"}');
4444                            aux = aux.replace(/,\\"/g,',"');
4445                            ad_array = JSON.parse(aux);
4446                        }catch(err){
4447                            console.log('ad array parse error', aux);
4448                        }
4449                    }
4450
4451                    //console.info('ad_array - ', aux);
4452
4453
4454
4455                    if(typeof _c.attr('data-type')=='undefined' || _c.attr('data-type')=='' || _c.attr('data-type')=='detect'){
4456                        if(typeof _c.attr('data-src')){
4457                            if(String(_c.attr('data-src')).indexOf('youtube.com/watch?')>-1){
4458                                _c.attr('data-type','youtube');
4459
4460
4461
4462                            }
4463
4464                            if(String(_c.attr('data-src')).indexOf('youtube.com/embed')>-1){
4465                                _c.attr('data-type','youtube');
4466
4467
4468
4469                            }
4470                            if(String(_c.attr('data-src')).indexOf('vimeo.com/')>-1){
4471                                _c.attr('data-type','vimeo');
4472
4473
4474
4475                            }
4476
4477
4478                            if(String(_c.attr('data-src')).indexOf('.mp4')>-1){
4479                                _c.attr('data-type','normal');
4480
4481                            }
4482                            if(String(_c.attr('data-src')).indexOf('.mpd')>String(_c.attr('data-src')).length-5){
4483                                _c.attr('data-type','dash');
4484
4485                            }
4486
4487                        }
4488                    }
4489
4490
4491
4492                    //console.info('type is ',_c.attr('data-type'));
4493
4494                    if (_c.attr('data-type') == 'youtube') {
4495                        o.type = 'youtube';
4496                    }
4497                    if (_c.attr('data-type') == 'video') {
4498                        o.type = 'normal';
4499                    }
4500                    if (_c.attr('data-type') == 'dash') {
4501                        o.type = 'dash';
4502                    }
4503                    if (_c.attr('data-type') == 'vimeo') {
4504                        o.type = 'vimeo';
4505                    }
4506                    if (_c.attr('data-type') == 'image') {
4507                        o.type = 'image';
4508                    }
4509                    if (_c.attr('data-type') == 'audio') {
4510                        o.type = 'audio';
4511                    }
4512                    if (_c.attr('data-type') == 'inline') {
4513                        o.type = 'inline';
4514                    }
4515                    // console.log('ad_link1 - ' ,o.ad_link);
4516                    if (_c.attr('data-adlink')) {
4517
4518
4519
4520                        o.ad_link = _c.attr('data-adlink');
4521                    }
4522                    _rparent = cthis.parent();
4523
4524                    // console.log('ad_link2 - ' ,o.ad_link);
4525
4526
4527                    if(cthis.attr('data-type')=='youtube'){
4528
4529                        if(_global_youtubeIframeAPIReady==false && dzsvp_yt_iframe_settoload==false){
4530                            var head= document.getElementsByTagName('head')[0];
4531                            var script= document.createElement('script');
4532                            script.type= 'text/javascript';
4533                            script.src= 'https://www.youtube.com/iframe_api';
4534                            head.appendChild(script);
4535                            dzsvp_yt_iframe_settoload=true;
4536                        }
4537                    }
4538
4539//                    console.info(cthis, o, o.settings_disableControls);
4540
4541                    if (o.type == 'inline') {
4542
4543                        //console.info(o);
4544                        if (o.htmlContent != '') {
4545                            cthis.html(o.htmlContent);
4546                        }
4547
4548                        if (cthis.children().length > 0) {
4549                            var _cach = cthis.children().eq(0);
4550                            if (_cach.get(0) != undefined) {
4551                                if (_cach.get(0).nodeName == 'IFRAME') {
4552                                    _cach.attr('width', '100%');
4553                                    _cach.attr('height', '100%');
4554                                }
4555                            }
4556                        }
4557                    }
4558
4559
4560                    if(o.is_ad=='on'){
4561//                console.info(cthis);
4562
4563                        if(o.type=='youtube' && is_touch_device() && $(window).width()<700){
4564
4565                            cthis.addClass('is-touch-device type-youtube');
4566
4567                        }
4568                        o.settings_video_overlay= 'on';
4569                    }
4570
4571
4572
4573
4574
4575                    if(_c.children('.vp-inner').length){
4576
4577                    }else{
4578
4579                        //&& o.type != 'vimeo'
4580                        if (o.type != 'inline' ) {
4581
4582                            _c.append('<div class="vp-inner"></div>');
4583
4584                            _vpInner = _c.children('.vp-inner').eq(0);
4585                        }
4586                    }
4587                    if (_c.attr('data-type') != undefined) {
4588                        dataType = _c.attr('data-type');
4589                    }
4590                    if (_c.attr('data-src') != undefined) {
4591                        dataSrc = _c.attr('data-src');
4592                    } else {
4593
4594                        if(o.type=='normal'){
4595                            if (_c.attr('data-sourcemp4')) {
4596                                dataSrc = _c.attr('data-sourcemp4');
4597                            }else{
4598                                if (_c.attr('data-sourcem')) {
4599                                    dataSrc = _c.attr('data-source');
4600                                }
4601                            }
4602                        }
4603
4604
4605                    }
4606
4607
4608
4609
4610
4611
4612                    var aux33= '<div class="controls"></div>';
4613
4614                    if(cthis.children('.cover-image').length>0){
4615                        //console.info('ceva',aux33);
4616                        cthis.children('.cover-image').eq(0).before(aux33);
4617                    }else{
4618
4619                        if(_vpInner){
4620
4621                            _vpInner.append(aux33);
4622                        }
4623                    }
4624                    setTimeout(function(){
4625                        cthis.addClass('cover-image-loaded');
4626                    },600);
4627
4628                    controlsDiv = cthis.find('.controls');
4629
4630
4631
4632
4633                    if(o.design_skin == 'skin_aurora'){
4634                        //console.info('ceva');
4635
4636
4637                        if(is_touch_device()){
4638
4639                            //cthis.append('<div class="touch-play-btn"></div>');
4640                        }
4641
4642                    }
4643
4644                    //console.log('ceva');
4645
4646
4647
4648                    //console.log(videoWidth);
4649                    totalWidth = videoWidth;
4650                    totalHeight = videoHeight;
4651
4652                    //console.log(cthis, videoWidth);
4653                    cthis.css({
4654                        //'width': videoWidth,
4655                        //'height': videoHeight
4656                    })
4657
4658                    if(videoWidth=='100%'){
4659
4660                    }
4661
4662                    if (cthis.attr('data-videoTitle')) {
4663                        if(_vpInner) {
4664                            _vpInner.append('<div class="video-description"></div>')
4665
4666                        }
4667                        cthis.find('.video-description').eq(0).append('<div class="video-title">' + cthis.attr('data-videoTitle') + '</div>');
4668                        if (dataVideoDesc != '') {
4669                            cthis.find('.video-description').eq(0).append('<div class="video-subdescription">' + dataVideoDesc + '</div>');
4670                        }
4671                        cthis.find('.video-subdescription').eq(0).css('width', (0.7 * videoWidth));
4672                        video_title = cthis.attr('data-videoTitle');
4673                    }
4674
4675                    if(video_title==''){
4676
4677                        //console.warn(cthis.children());
4678                    }
4679
4680                    //console.warn(video_title);
4681
4682                    //if (cthis.css('position') != 'absolute' && cthis.css('position') != 'fixed') {
4683                    //    cthis.css('position', 'relative')
4684                    //}
4685
4686                    //console.log(o.type);
4687
4688
4689                    if (o.type != 'vimeo' && o.type != 'image' && o.type != 'inline') {
4690                        var aux34 = '<div class="background"></div><div class="playcontrols"></div><div class="scrubbar"></div><div class="timetext"><span class="curr-timetext"></span><span class="total-timetext"></span></div><div class="volumecontrols"></div><div class="fscreencontrols"></div>';
4691                        controlsDiv.append(aux34);
4692
4693                        if(o.design_skin=='skin_avanti'){
4694                            controlsDiv.append('<div class="mutecontrols-con"><div class="btn-mute"></div><div class="btn-mute-hover"></div><div class="btn-unmute"></div><div class="btn-unmute-hover"></div></div>');
4695
4696                            _muteControls = controlsDiv.find('.mutecontrols-con').eq(0);
4697                        }
4698                    }
4699
4700
4701                    _controlsBackground = controlsDiv.find('.background').eq(0);
4702
4703                    if (o.type == 'image') {
4704                        cthis.attr('data-img', cthis.attr('data-src'));
4705
4706
4707                    }
4708
4709                    if(cthis.children('.vplayer-logo')){
4710                        cthis.append(cthis.children('.vplayer-logo'));
4711                    }
4712                    if(cthis.children('.extra-controls')){
4713                        if(o.design_skin=='skin_aurora'){
4714                            cthis.children('.extra-controls').children().each(function(){
4715                                var _t = $(this);
4716
4717                                cthis.find('.timetext').eq(0).after(_t);
4718                            });
4719
4720                        }
4721                    }
4722
4723
4724                    if (typeof cthis.attr('data-img') != 'undefined' && cthis.attr('data-img')!='') {
4725                        _vpInner.prepend('<div class="cover-image from-type-'+o.type+'"><div class="the-div-image" style="background-image:url(' + cthis.attr('data-img') + ');"/></div>');
4726                    }
4727
4728                    if(cthis.attr('data-loop')=='on'){
4729                        loop = 'on';
4730                    }
4731
4732
4733                    if (o.type == 'image') {
4734
4735                        cthis.addClass('dzsvp-loaded');
4736
4737
4738                        if (o.ad_link) {
4739
4740                            var _c = cthis.children().eq(0);
4741                            _c.css({'cursor': 'pointer'})
4742                            _c.bind('click', function() {
4743                                if(cthis.find('.controls').eq(0).css('pointer-events')!='none'){
4744
4745                                    window.open(o.ad_link);
4746                                }
4747                            })
4748                        }
4749                        setup_skipad();
4750                        return;
4751                    }
4752
4753
4754                    if (o.type == 'inline') {
4755
4756                        // if (o.settings_disableControls == 'on') {
4757                        //     if (o.ad_link != '') {
4758                        //
4759                        //         var _c = cthis.children().eq(0);
4760                        //         _c.css({'cursor': 'pointer'})
4761                        //         _c.bind('click', function() {
4762                        //             window.open(o.ad_link);
4763                        //         })
4764                        //     }
4765                        //
4766                        // }
4767                        cthis.find('.cover-image').bind('click',function(){
4768
4769
4770                            $(this).fadeOut('slow');
4771                        });
4772                        setup_skipad();
4773
4774                        var aux_preloader = '<div class="dzsvg-preloader preloader-fountain" > <div id="fountainG_1" class="fountainG"></div> <div id="fountainG_2" class="fountainG"></div> <div id="fountainG_3" class="fountainG"></div> <div id="fountainG_4" class="fountainG"></div> </div>';
4775
4776                        if(cthis.find('.cover-image').length){
4777                            cthis.find('.cover-image').before(aux_preloader);
4778                        }else{
4779                            cthis.append(aux_preloader);
4780                        }
4781
4782                        cthis.addClass('dzsvp-loaded');
4783
4784                        setTimeout(function(){
4785
4786                            cthis.addClass('dzsvp-really-loaded');
4787
4788
4789                        },2000);
4790
4791                        return;
4792                    }
4793
4794
4795
4796                    if (o.type == 'video') {
4797
4798                        if (o.settings_disableControls == 'on') {
4799                            // -- for youtube ads we force enable the custom skin because we need to know when the video ended
4800                            o.cueVideo = 'on';
4801                            o.settings_youtube_usecustomskin='on';
4802                            autoplay='off';
4803                        }
4804
4805
4806                        // && isNaN(Number(cthis.attr('data-adskip_delay')))==false  && Number(cthis.attr('data-adskip_delay'))>0
4807                        if(o.is_ad=='on' && is_mobile() && cthis.attr('data-adskip_delay')){
4808
4809                            // console.info(cthis);
4810
4811
4812                            // -- TBC - skip ad notice on mobile
4813                            cthis.appendOnce('<div class="skipad-con"></div>', '.skinad-con');
4814                            _adSkipCon = cthis.find('.skipad-con').eq(0);
4815                            _adSkipCon.html("Play the ad for the skip ad counter to appear");
4816
4817                            ad_status = 'waiting_for_play';
4818                        }else{
4819
4820                            setup_skipad();
4821                        }
4822                    }
4823
4824                    if (o.type == 'vimeo') {
4825
4826                        setup_skipad();
4827                    }
4828                    if (o.type == 'youtube') {
4829                        if (o.settings_disableControls == 'on') {
4830                            // -- for youtube ads we force enable the custom skin because we need to know when the video ended
4831                            o.cueVideo = 'on';
4832                            o.settings_youtube_usecustomskin='on';
4833                            autoplay='off';
4834                        }
4835
4836
4837                        if (o.ad_link != '') {
4838
4839//                             if(cthis.parent().hasClass('videogallery--adSpace')){
4840//                                 cthis.parent().css({'cursor': 'pointer'});
4841//                                 cthis.parent().unbind('click');
4842// //                                console.info(cthis.parent());
4843//                                 cthis.parent().bind('click', function(e) {
4844//                                     if(cthis.find('.controls').eq(0).css('pointer-events')!='none') {
4845//                                         if($(e.target).hasClass('skipad')){
4846//
4847//                                             return ;
4848//
4849//                                         }
4850//
4851//                                         if($(e.target).parent().hasClass('volumecontrols')){
4852//                                             return;
4853//                                         }
4854//
4855//                                         //console.log(e.target);
4856//                                         window.open(o.ad_link);
4857//                                     }
4858//                                 })
4859//                             }
4860
4861                        }
4862
4863
4864                        if(o.is_ad=='on' && is_mobile()  && (cthis.attr('data-adskip_delay') || videoplayersettings.settings_youtube_usecustomskin!='on') ){
4865
4866                            // console.info(cthis);
4867
4868                            cthis.appendOnce('<div class="skipad-con"></div>', '.skipad-con');
4869                            _adSkipCon = cthis.find('.skipad-con').eq(0);
4870                            _adSkipCon.html("Play the ad for the skip ad counter to appear");
4871                            ad_status = 'waiting_for_play';
4872                        }else{
4873
4874                            setup_skipad();
4875                        }
4876                        // console.info("SETTING UP SKIP AD");
4877                    }
4878                    info = cthis.find('.info');
4879                    infotext = cthis.find('.infoText');
4880
4881                    ////info
4882
4883
4884
4885                    var aux = '';
4886
4887
4888                    playcontrols = cthis.find('.playcontrols');
4889
4890
4891
4892                    aux = '<div class="playSimple">';
4893
4894
4895
4896                    if(o.design_skin=='skin_bigplay_pro'){
4897
4898                        aux+='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="120px" height="120px" viewBox="0 0 120 120" enable-background="new 0 0 120 120" xml:space="preserve"> <path fill-rule="evenodd" clip-rule="evenodd" fill="#D0ECF3" d="M79.295,56.914c2.45,1.705,2.45,4.468,0,6.172l-24.58,17.103 c-2.45,1.704-4.436,0.667-4.436-2.317V42.129c0-2.984,1.986-4.022,4.436-2.318L79.295,56.914z M0.199,54.604 c-0.265,2.971-0.265,7.821,0,10.792c2.57,28.854,25.551,51.835,54.405,54.405c2.971,0.265,7.821,0.265,10.792,0 c28.854-2.57,51.835-25.551,54.405-54.405c0.265-2.971,0.265-7.821,0-10.792C117.231,25.75,94.25,2.769,65.396,0.198 c-2.971-0.265-7.821-0.265-10.792,0C25.75,2.769,2.769,25.75,0.199,54.604z M8.816,65.394c-0.309-2.967-0.309-7.82,0-10.787 c2.512-24.115,21.675-43.279,45.79-45.791c2.967-0.309,7.821-0.309,10.788,0c24.115,2.512,43.278,21.675,45.79,45.79 c0.309,2.967,0.309,7.821,0,10.788c-2.512,24.115-21.675,43.279-45.79,45.791c-2.967,0.309-7.821,0.309-10.788,0 C30.491,108.672,11.328,89.508,8.816,65.394z"/> </svg>';
4899                    }
4900                    if(o.design_skin=='skin_aurora' || o.design_skin=='skin_bigplay'){
4901
4902                        aux+=svg_aurora_play_btn;
4903                    }
4904
4905
4906
4907
4908                    aux+='</div>
4908<div class="playHover"></div><div class="pauseSimple">';
4909
4910
4911                    if(o.design_skin=='skin_aurora' || o.design_skin=='skin_bigplay'){
4912
4913                        aux+='<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="13.75px" height="12.982px" viewBox="0 0 13.75 12.982" enable-background="new 0 0 13.75 12.982" xml:space="preserve"> <g> <path d="M5.208,11.982c0,0.55-0.45,1-1,1H3c-0.55,0-1-0.45-1-1V1c0-0.55,0.45-1,1-1h1.208c0.55,0,1,0.45,1,1V11.982z"/> </g> <g> <path d="M12.208,11.982c0,0.55-0.45,1-1,1H10c-0.55,0-1-0.45-1-1V1c0-0.55,0.45-1,1-1h1.208c0.55,0,1,0.45,1,1V11.982z"/> </g> </svg> ';
4914                    }
4915
4916
4917                    aux+='</div><div class="pauseHover"></div>';
4918
4919                    playcontrols.append(aux);
4920
4921
4922
4923
4924                    var aux_scrub = '<div class="scrub-bg"></div><div class="scrub-buffer"></div><div class="scrub">';
4925
4926
4927                    if(o.design_skin=='skin_aurora'){
4928
4929                        ;
4930                    }
4931
4932
4933                    aux_scrub+='</div><div class="scrubBox"></div><div class="scrubBox-prog"></div>';
4934
4935
4936                    scrubbar = cthis.find('.scrubbar');
4937                    scrubbar.append(aux_scrub);
4938
4939                    _scrubBg = scrubbar.children('.scrub-bg');
4940//                    console.info(scrubbar, _scrubBg);
4941
4942                    _timetext = cthis.find('.timetext').eq(0);
4943
4944
4945
4946
4947                    _volumeControls = cthis.find('.volumecontrols');
4948                    _volumeControls_real = cthis.find('.volumecontrols');
4949
4950                    aux = '<div class="volumeicon">';
4951
4952
4953
4954                    if(o.design_skin=='skin_aurora'){
4955                        aux+='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="10px" height="12px" viewBox="0 0 10 12" enable-background="new 0 0 10 12" xml:space="preserve"> <path fill-rule="evenodd" clip-rule="evenodd" fill="#200C34" d="M8.475,0H7.876L5.323,1.959c0,0-0.399,0.667-1.157,0.667H1.454 c0,0-1.237,0.083-1.237,1.334v3.962c0,0-0.159,1.334,1.277,1.334h2.553c0,0,0.877,0.167,1.316,0.667l2.513,1.959l0.638,0.083 c0,0,0.678,0,0.678-0.667V0.667C9.193,0.667,9.153,0,8.475,0z"/> </svg>';
4956                    }
4957
4958
4959                    aux+='</div><div class="volume_static">';
4960
4961
4962                    if(o.design_skin=='skin_reborn'){
4963                        for(var i2=0;i2<10;i2++){
4964                            aux+='<div class="volbar"></div>';
4965                        }
4966                    }
4967
4968
4969                    aux+='</div><div class="volume_active">';
4970
4971
4972
4973                    if(o.design_skin=='skin_aurora'){
4974                        ;
4975                    }
4976
4977
4978                    aux+='</div><div class="volume_cut"></div>';
4979
4980
4981                    if(o.design_skin=='skin_reborn') {
4982                        aux+='<div class="volume-tooltip">VOLUME: 100</div>';
4983                    }
4984
4985                    _volumeControls.append(aux);
4986
4987                    fScreenControls = cthis.find('.fscreencontrols');
4988
4989                    aux = '<div class="full">';
4990
4991
4992
4993                    if(o.design_skin=='skin_rebornTRYDIFFERENT') {
4994                        aux += '<svg class="for-fullscreen-inactive" version="1.1" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 14 14" overflow="auto" xml:space="preserve"> <path fill-rule="evenodd" fill="none" d="M14,14V9h-1v4H9v1H14z M0,14h5v-1H1V9H0V14z M14,0H9v1h4v4h1V0z M0,0v5h1V1h4V0H0z"/> </svg>';
4995
4996                        aux+='<svg class="for-fullscreen-active" version="1.1" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 14 14" xml:space="preserve"> <path fill-rule="evenodd" fill="none" d="M5,5V0H4v4H0v1H5z M9,5h5V4h-4V0H9V5z M5,9H0v1h4v4h1V9z M9,9v5h1v-4h4V9H9z"/> </svg>';
4997                    }
4998
4999                    if(o.design_skin=='skin_aurora') {
5000                        aux += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"> <g id="Layer_3"> <polygon fill="#FFFFFF" points="2.404,2.404 0.057,4.809 0.057,0 4.751,0 "/> <polygon fill="#FFFFFF" points="13.435,2.404 11.03,0.057 15.839,0.057 15.839,4.751 "/> <polygon fill="#FFFFFF" points="2.404,13.446 4.809,15.794 0,15.794 0,11.1 "/> <polygon fill="#FFFFFF" points="13.435,13.446 15.781,11.042 15.781,15.851 11.087,15.851 "/> </g> <g id="Layer_2"> <rect x="4.255" y="4.274" fill="#FFFFFF" width="7.366" height="7.442"/> </g> </svg>';
5001
5002                    }
5003
5004
5005                    aux+='</div><div class="fullHover"></div>';
5006
5007
5008
5009                    if(o.design_skin=='skin_reborn') {
5010                        aux+='<div class="full-tooltip">FULLSCREEN</div>';
5011                    }
5012
5013
5014                    fScreenControls.append(aux);
5015
5016
5017                    if (o.design_skin == 'skin_pro' || o.design_skin == 'skin_bigplay') {
5018                        playcontrols.find('.pauseSimple').eq(0).append('<div class="pause-part-1"></div><div class="pause-part-2"></div>');
5019                        fScreenControls.find('.full').eq(0).append('<canvas width="15" height="15" class="fullscreen-button"></canvas>');
5020
5021
5022                        //console.log(fScreenControls.find('.full').eq(0));
5023
5024                        _controls_fs_canvas=fScreenControls.find('.full').eq(0).find('canvas.fullscreen-button').eq(0)[0];
5025                        if( (!is_ie() || (is_ie() && version_ie()>8)) && _controls_fs_canvas!=undefined){
5026//                            console.info(o.controls_fscanvas_bg);
5027                            draw_fs_canvas(o.controls_fscanvas_bg);
5028                            $(_controls_fs_canvas).bind('mouseover', handleMouseover);
5029                            $(_controls_fs_canvas).bind('mouseout', handleMouseout);
5030                        }
5031                    }
5032
5033
5034
5035
5036                    if (_c.find('.videoDescription').length > 0) {
5037                        dataVideoDesc = _c.find('.videoDescription').html();
5038                        _c.find('.videoDescription').remove();
5039                    }
5040
5041                    if (is_ie8() || o.type=='vimeo') {
5042                        o.cueVideo='on';
5043                    }
5044
5045
5046                    if(cthis.get(0)){
5047                        //cthis.get(0).fn_change_mainColor = fn_change_mainColor; cthis.get(0).fn_change_mainColor('#aaa');
5048                        cthis.get(0).fn_change_color_highlight = fn_change_color_highlight; //cthis.get(0).fn_change_mainColor('#aaa');
5049
5050                        cthis.get(0).api_handleResize = handleResize;
5051                        cthis.get(0).api_seek_to_perc = seek_to_perc;
5052
5053                        cthis.get(0).api_currVideo_refresh_fsbutton = draw_fs_canvas;
5054                        cthis.get(0).api_reinit_cover_image = reinit_cover_image;
5055                        cthis.get(0).api_restart_video = restart_video;
5056
5057
5058
5059                        cthis.get(0).api_ad_end = ad_end;
5060
5061                        //console.log('ceva');
5062                    }
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072                    //===setup player colors
5073
5074
5075
5076
5077
5078                    //console.log(cthis, o.cueVideo, o.type);
5079
5080                    //===if cueVideo is not on then, init_readyControls on click
5081
5082
5083                    //console.log("FIREFOX YOU BASTARD");
5084                    if(o.cueVideo=='on' || (!is_ie8() && ( !is_ios() || o.settings_ios_usecustomskin=='on') && (o.type=='normal'||o.type=='youtube') )){
5085
5086                        if(o.type=='youtube'){
5087                            inter_check_yt_iframe_ready = setInterval(check_if_yt_iframe_ready, 100);
5088                        }else{
5089                            init_readyControls();
5090                        }
5091                    }else{
5092
5093                        resizePlayer(videoWidth, videoHeight);
5094                        cthis.bind('click', init_readyControls);
5095
5096                        cthis.addClass('dzsvp-loaded');
5097
5098                    }
5099
5100                    if (o.cueVideo != 'on') {
5101
5102
5103                        //--------------normal
5104                        if (!is_ie8() && ( !is_ios() || o.settings_ios_usecustomskin=='on')) {
5105                        }
5106
5107
5108                    } else {
5109                        //console.log(o.type);
5110
5111                    }
5112
5113
5114
5115                    if (o.settings_enableTags == 'on') {
5116                    }
5117
5118                    setInterval(check_one_sec, 1000);
5119                    check_one_sec();
5120
5121
5122                    handleResize();
5123                }
5124
5125                if(inter_10_secs_contor==0 && o.action_video_contor_10secs){
5126                    inter_10_secs_contor = setInterval(count_10secs, 10000);
5127                }
5128
5129                console.info(o,inter_5_secs_contor,o.action_video_contor_5secs);
5130                if(inter_5_secs_contor==0 && o.action_video_contor_5secs){
5131                    inter_5_secs_contor = setInterval(count_5secs, 3000);
5132                    setTimeout(function(){
5133
5134                        count_5secs();
5135                    },500)
5136                }
5137
5138
5139                //console.info(cthis, autoplay, o.autoplay);
5140            }
5141
5142
5143            function check_one_sec(){
5144
5145                // console.info('check_on_sec',ad_playing,paused,ad_array, ad_array.length, typeof ad_array);
5146
5147                if(ad_playing==false && paused==false){
5148                    // console.info('ad_array - ',ad_array);
5149
5150                    if(typeof ad_array =='object' && ad_array.length>0){
5151
5152                        for(var i2 in ad_array){
5153                            // console.info('ad vars - ',time_curr, ad_array[i2].time, totalDuration);
5154                            if(totalDuration && time_curr >= ad_array[i2].time * totalDuration){
5155
5156                                ad_setup(i2);
5157
5158                            }
5159                        }
5160                    }
5161
5162                }
5163
5164                if (o.settings_enableTags == 'on') {
5165                    check_tags();
5166                }
5167
5168            }
5169
5170            function ad_setup(arg){
5171
5172                var source = ad_array[arg].source;
5173                var type = ad_array[arg].type;
5174                var skip_delay = ad_array[arg].skip_delay;
5175                var ad_link = ad_array[arg].ad_link;
5176
5177
5178                ad_array.splice(arg, 1);
5179
5180                cthis.appendOnce('<div class="ad-container"></div>');
5181
5182                _adContainer = cthis.find('.ad-container').eq(0);
5183
5184
5185                // console.info('adding ad');
5186                //advertisment
5187                var aux = '<div class="vplayer-tobe"';
5188
5189                //data-source="video/test.m4v"
5190                if(type!='inline'){
5191
5192                    aux += ' data-src="' + source + '"';
5193                }
5194
5195                if (type) {
5196                    aux += ' data-type="' + type + '"';
5197                }
5198
5199                if (ad_link) {
5200                    aux += ' data-adlink="' + ad_link + '"';
5201                }
5202
5203                if (skip_delay) {
5204                    aux += ' data-adskip_delay="' + skip_delay + '"';
5205                }
5206                aux += '>';
5207
5208
5209                if(type=='inline'){
5210                    // aux+='<div class="adSource">' + source + '</div>';
5211                    aux+=source;
5212                }
5213
5214
5215
5216                aux+='</div>';
5217                _adContainer.show();
5218                _adContainer.append(aux);
5219//                    console.info(aux);
5220
5221
5222                var auxoptions = {};
5223
5224
5225                auxoptions.design_skin= o.design_skin;
5226                auxoptions.autoplay= 'on';
5227                auxoptions.settings_disableControls = 'on';
5228                auxoptions.is_ad = 'on';
5229                auxoptions.parent_player = cthis;
5230
5231
5232
5233                ad_playing = true;
5234
5235
5236                _adContainer.children('.vplayer-tobe').addClass('is-ad');
5237                _adContainer.children('.vplayer-tobe').vPlayer(auxoptions);
5238
5239
5240                if(o.gallery_object){
5241                    if(o.gallery_object.get(0) && o.gallery_object.get(0).api_ad_block_navigation){
5242
5243                        o.gallery_object.get(0).api_ad_block_navigation();
5244
5245                    }
5246                }
5247
5248
5249
5250//                    console.info(_adSpace);
5251//                    return;
5252
5253
5254                setTimeout(function(){
5255
5256                    cthis.addClass('ad-playing');
5257                },100);
5258                ad_playing=true;
5259                pauseMovie();
5260            }
5261
5262            function ad_end(){
5263
5264                if(_adContainer.children().get(0) && _adContainer.children().get(0).api_destroy_listeners){
5265
5266                    _adContainer.children().get(0).api_destroy_listeners();
5267                }
5268
5269                playMovie();
5270                cthis.addClass('ad-transitioning-out');
5271
5272
5273
5274                if(o.gallery_object){
5275                    if(o.gallery_object.get(0) && o.gallery_object.get(0).api_ad_unblock_navigation){
5276
5277                        o.gallery_object.get(0).api_ad_unblock_navigation();
5278
5279                    }
5280                }
5281
5282                setTimeout(function(){
5283
5284                    cthis.removeClass('ad-playing');
5285                    cthis.removeClass('ad-transitioning-out');
5286                    _adContainer.children().remove();
5287                    ad_playing=false;
5288                },300)
5289            }
5290
5291            function count_10secs(){
5292                if(o.action_video_contor_10secs && cthis.hasClass('is-playing')){
5293                    o.action_video_contor_10secs(cthis,video_title);
5294                }
5295            }
5296            function count_5secs(){
5297                if(o.action_video_contor_5secs){
5298                    o.action_video_contor_5secs(cthis,video_title);
5299                }
5300            }
5301
5302            function restart_video(){
5303
5304
5305                //console.info(o.type);
5306                if(o.type=='video'){
5307                    seek_to_perc(0);
5308                }
5309                if(o.type=='vimeo'){
5310
5311                    seek_to_perc(0);
5312                }
5313                if(o.type=='youtube'){
5314
5315
5316
5317                    if (video && video.pauseVideo) {
5318                        //console.info(dataSrc);
5319                    }
5320
5321                }
5322
5323                reinit_cover_image();
5324            }
5325
5326            function check_if_yt_iframe_ready(){
5327
5328//                console.info(o.type);
5329                if( (window.YT && window.YT.Player ) || _global_youtubeIframeAPIReady){
5330                    init_readyControls();
5331                    clearInterval(inter_check_yt_iframe_ready);
5332                }
5333            }
5334
5335            function setup_skipad(pargs){
5336
5337
5338                var margs = {
5339                    'call_from': 'default'
5340                }
5341
5342                if(pargs){
5343                    margs = $.extend(margs,pargs);
5344                }
5345
5346
5347                if(ad_status=='first_played'){
5348                    return false;
5349                }
5350                //console.info('setup_skipad()');
5351                if (o.settings_disableControls == 'on') {
5352                    var skipad_timer = 0;
5353
5354                    if(o.type=='image' || o.type=='inline'){
5355                        skipad_timer=0;
5356                    }
5357                    if(o.type=='normal' || o.type=='youtube'){
5358                        skipad_timer=1001;
5359                    }
5360
5361                    cthis.appendOnce('<div class="skipad-con"></div>', '.skipad-con');
5362                    _adSkipCon = cthis.find('.skipad-con').eq(0);
5363
5364                    if(typeof cthis.attr('data-adskip_delay')!='undefined'){
5365                        skipad_timer = Number(cthis.attr('data-adskip_delay')) ;
5366                    }
5367                    //console.info(skipad_timer);
5368
5369//                    console.info(cthis, cthis.attr('data-adskip_delay'), skipad_timer);
5370                    time_counter_skipad = skipad_timer;
5371//                    console.info(cthis, time_counter_skipad);
5372                    if(skipad_timer!=1001){
5373                        setTimeout(function(){
5374//                            console.info(cthis.find('.skipad-con').eq(0))
5375                            time_counter_skipad=0;
5376                            _adSkipCon.html('<div class="skipad">'+translate_skipad+'</div>');
5377                            _adSkipCon.children('.skipad').bind('click', function() {
5378                                handleVideoEnd();
5379                            })
5380                        }, skipad_timer*1000);
5381
5382                        if(skipad_timer>0){
5383                            inter_time_counter_skipad = setInterval(tick_counter_skipad, 1000);
5384                        }
5385                    }
5386
5387
5388                }
5389
5390                ad_status = 'first_played';
5391            }
5392            function tick_counter_skipad(){
5393
5394//                console.info(cthis, time_counter_skipad);
5395                if(time_counter_skipad>0){
5396                    time_counter_skipad= time_counter_skipad-1;
5397                    if(_adSkipCon){
5398                        _adSkipCon.html(dzsvg_translate_youcanskipto + time_counter_skipad);
5399                    }
5400
5401                }else{
5402                    clearInterval(inter_time_counter_skipad);
5403                }
5404            }
5405            function draw_fs_canvas(argcol){
5406
5407//                console.info(o.design_skin, argcol);
5408                if(o.design_skin!='skin_pro'){
5409                    return;
5410                }
5411                var ctx=_controls_fs_canvas.getContext("2d");
5412                var ctx_w = _controls_fs_canvas.width;
5413                var ctx_h = _controls_fs_canvas.height;
5414                var ctx_pw = ctx_w/100;
5415                var ctx_ph = ctx_w/100;
5416                //console.log(ctx_pw, c.width);
5417                ctx.fillStyle= argcol;
5418                var borderw = 30;
5419                ctx.fillRect(25*ctx_pw,25*ctx_ph,50*ctx_pw,50*ctx_ph
5419);
5420                ctx.beginPath();
5421                ctx.moveTo(0*ctx_pw,0*ctx_ph);
5422                ctx.lineTo(0*ctx_pw,borderw*ctx_ph);
5423                ctx.lineTo(borderw*ctx_pw,0*ctx_ph);
5424                ctx.fill();
5425                ctx.moveTo(0*ctx_pw,100*ctx_ph);
5426                ctx.lineTo(0*ctx_pw,(100-borderw)*ctx_ph);
5427                ctx.lineTo(borderw*ctx_pw,100*ctx_ph);
5428                ctx.fill();
5429                ctx.moveTo((100)*ctx_pw,(100)*ctx_ph);
5430                ctx.lineTo((100-borderw)*ctx_pw,(100)*ctx_ph);
5431                ctx.lineTo((100)*ctx_pw,(100-borderw)*ctx_ph);
5432                ctx.fill();
5433                ctx.moveTo((100)*ctx_pw,(0)*ctx_ph);
5434                ctx.lineTo((100-borderw)*ctx_pw,(0)*ctx_ph);
5435                ctx.lineTo((100)*ctx_pw,(borderw)*ctx_ph);
5436                ctx.fill();
5437            }
5438            function fn_change_color_highlight(arg){
5439                cthis.find('.scrub').eq(0).css({
5440                    'background' : arg
5441                })
5442                cthis.find('.volume_active').eq(0).css({
5443                    'background' : arg
5444                })
5445                cthis.find('.hdbutton-hover').eq(0).css({
5446                    'color' : arg
5447                })
5448            }
5449            function check_tags() {
5450                var roundTime = Number(time_curr);
5451
5452
5453                //console.log(arrTags.length);
5454                if (arrTags.length == 0) {
5455                    return;
5456                }
5457
5458                arrTags.removeClass('active');
5459                arrTags.each(function() {
5460                    var _t = $(this);
5461                    //console.log(_t);
5462                    if (Number(_t.attr('data-starttime')) <= roundTime && Number(_t.attr('data-endtime')) >= roundTime) {
5463                        _t.addClass('active');
5464                    }
5465                })
5466                //jQuery('.dzstag[data-starttime=' + roundTime + ']').addClass('active');
5467            }
5468
5469
5470            function init_readyControls() {
5471                console.warn('init_readyControls()', cthis);
5472
5473
5474
5475                var _c = cthis;
5476                _c.unbind();
5477
5478                if(_c.attr('data-type')=='youtube' && String(dataSrc).indexOf('youtube.com/watch?') > -1){
5479                    var auxa = String(dataSrc).split('youtube.com/watch?v=');
5480                    //console.info(auxa);
5481                    dataSrc = auxa[1];
5482                    if(auxa[1].indexOf('&')>-1){
5483                        var auxb = String(auxa[1]).split('&');
5484                        dataSrc = auxb[0];
5485                    }
5486                }
5487                if(_c.attr('data-type')=='youtube' && String(dataSrc).indexOf('youtube.com/embed') > -1){
5488                    var auxa = String(dataSrc).split('youtube.com/embed/');
5489                    //console.info(auxa);
5490                    dataSrc = auxa[1];
5491                }
5492
5493
5494                if(_c.attr('data-type')=='vimeo' && String(dataSrc).indexOf('vimeo.com/') > -1){
5495                    var auxa = String(dataSrc).split('vimeo.com/');
5496                    //console.info(auxa);
5497                    dataSrc = auxa[1];
5498                }
5499
5500
5501                if (_c.attr('data-sourceflash') != undefined) {
5502                    dataFlash = _c.attr('data-sourceflash');
5503                }
5504
5505                //console.log(cthis.find('.preview'))
5506
5507
5508
5509                if (_c.attr('data-sourceflash') == undefined) {
5510                    dataFlash = _c.attr('data-sourcemp4');
5511                    _c.attr('data-sourceflash', dataSrc);
5512                }
5513
5514                if (o.type == 'audio' && _c.attr('data-sourcemp3') != undefined && _c.attr('data-sourceflash') == undefined) {
5515                    dataFlash = _c.attr('data-sourcemp3');
5516                }
5517
5518
5519
5520                //--------------ie8
5521                if (is_ie8()) {
5522                    _c.find('.controls').remove();
5523                    _c.addClass('vplayer-ie8');
5524                    //_c.html('<div class="vplayer"></div>')
5525                    if (o.type == 'normal') {
5526                        _c.prepend('<div><object type="application/x-shockwave-flash" data="'+o.settings_swfPath+'" width="' + videoWidth + '" height="' + videoHeight + '" id="flashcontent" style="visibility: visible;"><param name="movie" value="'+o.settings_swfPath+'"><param name="menu" value="false">
5526<param name="allowScriptAccess" value="always"><param name="scale" value="noscale"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="video='+dataFlash+ '"></object></div>');
5527
5528                    }
5529                    if (o.type == 'audio') {
5530                        _c.prepend('<div><object type="application/x-shockwave-flash" data="'+o.settings_swfPath+'" width="' + videoWidth + '" height="' + videoHeight + '" id="flashcontent" style="visibility: visible;"><param name="movie" value="'+o.settings_swfPath+'"><param name="menu" value="false"><param name="allowScriptAccess" value="always"><param name="scale" value="noscale"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="video=' + dataFlash + '&types=audio"></object></div>');
5531
5532                    }
5533                    if (o.type == 'vimeo') {
5534                        var src = dataSrc;
5535                        _c.append('<iframe scrolling="no" width="100%" height="100%" src="//player.vimeo.com/video/' + src + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen style=""></iframe>');
5536                        //_c.attr('data-ytid', aux);
5537                    }
5538                    if (o.type == 'youtube') {
5539                        o.type = 'youtube';
5540                        _c.children().remove();
5541                        var aux = 'ytplayer' + dataSrc;
5542                        _c.append('<iframe type="text/html" style="position:relative; top:0; left:0; width:100%; height:100%;" width="100%" height="100%" src="//www.youtube.com/embed/' + dataSrc + '?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>');
5543                        _c.attr('data-ytid', aux);
5544                    }
5545
5546                    return;
5547                }
5548
5549
5550
5551                //console.info('type is ', o.type, dataSrc);
5552
5553
5554
5555                // -- ios video setup
5556
5557                //console.info(o.settings_ios_usecustomskin!='on',is_ios() )
5558                if (o.settings_ios_usecustomskin!='on' && is_ios()) {
5559                    var str_poster = '';
5560
5561
5562                    if (cthis.attr('data-img')) {
5563                        str_poster = ' poster="'+cthis.attr('data-img')+'"';
5564                    }
5565
5566                    if (o.type == 'normal') {
5567
5568                        console.warn("HERE we will setup ios not custom skin");
5569                        // _c.prepend('<video class="the-video" width="100%" height="100%" controls preload="metadata" '+str_poster+'></video>');
5570                        _vpInner.prepend('<video class="the-video" width="100%" height="100%" controls preload="metadata" '+str_poster+'></video>');
5571                        //_c.children().eq(0).attr('width', videoWidth);
5572                        //_c.children().eq(0).attr('height', videoHeight);
5573                        if (dataSrc) {
5574                            _c.find('video.the-video').eq(0).append('<source src="' + dataSrc + '"/>');
5575                        }
5576                    }
5577                    if (o.type == 'audio') {
5578                        _c.prepend('<audio controls preload '+str_poster+'></audio>');
5579                        _c.children().eq(0).attr('width', videoWidth);
5580                        _c.children().eq(0).attr('height', videoHeight);
5581                        if (_c.attr('data-sourcemp3') != undefined) {
5582                            _c.children().eq(0).append('<source src="' + _c.attr('data-src') + '" type="audio/mp3" style="width:100%; height:100%;"/>');
5583                        }
5584                    }
5585                    if (o.type == 'youtube') {
5586                        o.type = 'youtube';
5587                        _c.children().remove();
5588                        _c.append('<iframe src="//www.youtube.com/embed/' + dataSrc + '?rel=0&showinfo=0" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen style="width:100%; height:100%;"></iframe>');
5589                        //_c.attr('data-ytid', aux);
5590                    }
5591                    if (o.type == 'vimeo') {
5592                        _c.children().remove();
5593                        var src = dataSrc;
5594                        _c.append('<iframe width="100%" height="100%" src="//player.vimeo.com/video/' + src + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen style=""></iframe>');
5595
5596                    }
5597
5598
5599
5600                    _vpInner.find('.controls').remove();
5601
5602                    cthis.find('.cover-image').remove();
5603                    //console.log(cthis, cthis.find('.cover-image'));
5604                    //cthis.find('.cover-image').fadeOut('slow');
5605                    /*
5606                     if(typeof cthis.find('.cover-image').get(0)!='undefined'){
5607                     cthis.find('.cover-image').get(0).addEventListener('touchstart', function(){
5608                     console.log('ceva');
5609                     }, false);
5610                     }
5611                     */
5612
5613                    // console.info("iOS so we dont medley", o.responsive_ratio);
5614
5615                    if(o.responsive_ratio=='default'){
5616                        // console.info("YES");
5617                        get_responsive_ratio();
5618                        o.responsive_ratio=0.562;
5619                    }
5620
5621                    cthis.addClass('dzsvp-loaded');
5622
5623                    handleResize();
5624                    //return;//our job on the iphone / ipad has been done, we exit the function.
5625                }
5626
5627
5628
5629                // -- normal
5630                if (!is_ie8() && ( !is_ios() || o.settings_ios_usecustomskin=='on')) {
5631
5632                    //--normal video on modern browsers
5633                    if (o.settings_enableTags == 'on') {
5634                        cthis.find('.dzstag-tobe').each(function() {
5635                            var _t = $(this);
5636                            var auxhtml = _t.html();
5637                            var w = 100;
5638                            var h = 100;
5639                            var acomlink = '';
5640                            if (_t.attr('data-width') != undefined) {
5641                                w = _t.attr('data-width');
5642                            }
5643                            if (_t.attr('data-height') != undefined) {
5644                                h = _t.attr('data-height');
5645                            }
5646                            if (_t.attr('data-link') != undefined) {
5647                                acomlink = '<a href="' + _t.attr('data-link') + '"></a>';
5648                            }
5649
5650                            _t.html('');
5651                            _t.css({'left': (_t.attr('data-left') + 'px'), 'top': (_t.attr('data-top') + 'px')});
5652                            //console.log(_t);
5653                            _t.append('<div class="tag-box" style="width:' + w + 'px; height:' + h + 'px;">' + acomlink + '</div>');
5654                            _t.append('<span class="tag-content">' + auxhtml + '</span>');
5655                            _t.removeClass('dzstag-tobe').addClass('dzstag');
5656                            //_t.remove();
5657                        })
5658                        arrTags = cthis.find('.dzstag');
5659                    }
5660                    aux = '';
5661                    if (o.type == 'audio') {
5662                        if (_c.attr('data-audioimg') != undefined) {
5663                            aux = '<div style="background-image:url(' + _c.attr('data-audioimg') + ')" class="div-full-image"/>';
5664                            _c.prepend(aux);
5665                        }
5666                    }
5667                    //console.log(_c);
5668                    if (o.type == 'normal') {
5669
5670                        //console.info(o.cueVideo);
5671                        //setup_local_video();
5672
5673
5674
5675                        // console.info(o);
5676                        //console.info("SETUP VIDEO")
5677                        if(o.cueVideo!='on'){
5678                            // o.autoplay = 'off';
5679                            autoplay = 'off';
5680
5681
5682                            setup_local_video({
5683                                'preload':'metadata'
5684                            })
5685                        }else{
5686
5687                            setup_local_video();
5688                        }
5689                    }
5690
5691
5692
5693                    if (o.type == 'rtmp') {
5694
5695                        //- --- setup the type
5696                        var str_type = '';
5697
5698
5699                        var aux = '<object type="application/x-shockwave-flash" data="'+o.settings_swfPath+'" width="100%" height="100%" id="flashcontent" style="visibility: visible;"><param name="movie" value="'+o.settings_swfPath+'"><param name="menu" value="false">
5699<param name="allowScriptAccess" value="always"><param name="scale" value="noscale"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="video='+_c.attr('data-source')+'&types=rtmp&streamServer='+ o.rtmp_streamServer+'"></object>';
5700
5701//                            console.info(can_play_mp4());
5702
5703                        _c.html(aux);
5704                        _c.data('isflash', 'on')
5705
5706
5707                    }
5708
5709                    // ---type audio
5710                    if (o.type == 'audio') {
5711                        var aux = '<audio class="the-video" controls';
5712                        if (videoWidth != 0) {
5713                            aux += ' width="' + videoWidth + '"';
5714                            aux += ' height="' + videoHeight + '"';
5715                        }
5716                        aux += '></audio>';
5717                        _c.prepend(aux);
5718                        if (_c.attr('data-src')) {
5719                            //console.log(_c.attr('data-sourcemp4'));
5720                            _c.children().eq(0).append('<source src="' + _c.attr('data-src') + '" type="audio/mp3"/>');
5721                            if (is_ie9()) {
5722                                _c.html('<audio><source src="' + _c.attr('data-src') + '" type="audio/mp3"/></audio>');
5723                                //_c.children().eq(0).attr('src', _c.attr('data-sourcemp4'));
5724                                //_c.children().eq(0).append('<source src="'+_c.attr('data-sourcemp4')+'"/>');
5725                            }
5726                        }
5727                        if (_c.attr('data-sourceogg') != undefined) {
5728                            _c.children().eq(0).append('<source src="' + _c.attr('data-sourceogg') + '" type="audio/ogg"/>');
5729                        }
5730                        if (_c.attr('data-sourcewav') != undefined) {
5731                            _c.children().eq(0).append('<source src="' + _c.attr('data-sourcewav') + '" type="audio/wav"/>');
5732                        }
5733                        if (_c.attr('data-sourceflash') != undefined && !(is_ie() && version_ie() > 8)) {
5734                            dataFlash = _c.attr('data-sourcemp3');
5735                            var aux = ('<object type="application/x-shockwave-flash" data="'+o.settings_swfPath+'" width="100%" height="100%" id="flashcontent" style="visibility: visible;"><param name="movie" value="'+o.settings_swfPath+'"><param name="menu" value="false"><param name="allowScriptAccess" value="always"><param name="scale" value="noscale"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="video=' + dataFlash + '&types=audio"></object>');
5736
5737
5738                            //===if opera or firefox and no ogg defined, we force flash
5739                            if ((_c.attr('data-sourcewav') == undefined && _c.attr('data-sourceogg') == undefined && (!can_play_mp3() || is_opera()))) {
5740                                _c.html(aux);
5741                            } else {
5742                                _c.children().eq(0).append(aux);
5743                            }
5744                        }
5745                    }
5746                    //console.info(o.type,o.settings_youtube_usecustomskin)
5747
5748
5749
5750                    // --- type youtube
5751                    if (o.type == 'youtube') {
5752                        o.type = 'youtube';
5753                        //console.log(o.settings_youtube_usecustomskin)
5754
5755                        //console.info(is_android(), o.settings_youtube_usecustomskin)
5756
5757
5758
5759                        // ---- no skin youtube
5760                        if (o.settings_youtube_usecustomskin != 'on' || ( o.settings_ios_usecustomskin!='on' && is_ios() )) {
5761
5762                            _vpInner.children(':not(.cover-image)').remove();
5763                            var aux = 'ytplayer' + dataSrc;
5764                            var param_autoplay = 0;
5765                            //console.log(o);
5766                            if(o.autoplay=='on'){
5767                                param_autoplay = 1
5768                            }
5769
5770                            //_c.append('<iframe type="text/html" style="position:relative; top:0; left:0; width:100%; height:100%;" src="//www.youtube.com/embed/' + dataSrc + '?modestbranding=1&rel=0&showinfo=0'+param_autoplay+'" frameborder="0" allowfullscreen></iframe>');
5771                            _c.attr('data-ytid', aux);
5772
5773
5774                            _vpInner.prepend('<span class="cmedia-con"><span id="the-media-'+cid+'"></span></span>');
5775
5776                            //console.info(param_autoplay, o.autoplay, o);
5777                            if(o.cueVideo=='off'){
5778                                // o.autoplay='off';
5779                                autoplay = 'off';
5780                            }
5781
5782
5783
5784                            // default yt skin
5785                            video = new YT.Player('the-media-'+cid, {
5786                                height: '100%',
5787                                width: '100%',
5788                                playerVars: { 'autoplay': param_autoplay, controls: 1, 'showinfo': 0, 'playsinline' : 1, rel:0, autohide: 0, wmode: 'transparent', iv_load_policy: '3'},//, 'playsinline' : 0, enablejsapi : 1
5789                                videoId: dataSrc,
5790
5791                                suggestedQuality: o.settings_suggestedQuality,
5792                                events: {
5793                                    'onReady': yt_onPlayerReady,
5794                                    'onStateChange': yt_onPlayerStateChange
5795                                }
5796                            });
5797                            _cmedia = video;
5798
5799                        } else {
5800
5801                            //ytplayer= document.getElementById("flashcontent");
5802                            //ytplayer.loadVideoById('L7ANahx7aF0')
5803
5804                            _vpInner.prepend('<span class="cmedia-con"><span id="the-media-'+cid+'"></span></span>');
5805
5806
5807                            if(o.cueVideo=='off'){
5808                                // o.autoplay='off';
5809                                autoplay = 'off';
5810                            }
5811                            //console.info(o.settings_suggestedQuality);
5812
5813
5814
5815                            var playfrom = '';
5816
5817
5818                            if(o.playfrom!='default') {
5819
5820//                    console.info(the_player_id, o.playfrom);
5821
5822                                if (o.playfrom == 'last' && the_player_id != '') {
5823                                    if (typeof Storage != 'undefined') {
5824
5825                                        if (typeof localStorage['dzsvp_' + the_player_id + '_lastpos'] != 'undefined') {
5826
5827                                            playfrom = (Number(localStorage['dzsvp_' + the_player_id + '_lastpos']))
5828                                        }
5829                                    }
5830                                }
5831
5832                                if (isNaN(Number(o.playfrom)) == false) {
5833
5834                                    playfrom = Number(o.playfrom);
5835                                }
5836                            }
5837
5838                            // console.info(playfrom);
5839
5840
5841
5842                            // console.info('quality - ',o.settings_suggestedQuality);
5843                            video = new YT.Player('the-media-'+cid, {
5844                                height: '100%',
5845                                width: '100%',
5846                                playerVars: { 'autoplay': 0, controls: 0, 'showinfo': 0, 'playsinline' : 1, rel:0, autohide: 1, start: playfrom,wmode: 'transparent', iv_load_policy: '3', modestbranding: 1},//, 'playsinline' : 0, enablejsapi : 1
5847                                videoId: dataSrc,
5848                                suggestedQuality: o.settings_suggestedQuality,
5849                                events: {
5850                                    'onReady': yt_onPlayerReady,
5851                                    'onStateChange': yt_onPlayerStateChange
5852                                }
5853                            });
5854
5855                            setTimeout(function(){
5856                                // console.info('captions - ', video.captions);
5857                            },5000);
5858
5859                            _cmedia = video;
5860
5861
5862                            // console.info(cthis.find('#the-media-'+cid));
5863                            cthis.find('#the-media-'+cid).bind('mousemove', handle_mousemove);
5864                        }
5865                    }
5866                    if (o.type == 'vimeo') {
5867                        //_c.children().remove();
5868                        var src = dataSrc;
5869                        var str_autoplay = '';
5870
5871
5872                        if(autoplay=='on'){
5873                            str_autoplay = '&autoplay=1';
5874                        }
5875                        if(_vpInner) {
5876                            _vpInner.children('.controls').remove();
5877                        }
5878                        //console.info(autoplay, o.autoplay);
5879                        _vpInner.prepend('<iframe scrolling="no" src="'+vgsettings.vimeoprotocol+'//player.vimeo.com/video/' + src + '?api=1&player_id=vimeoplayer' + src +str_autoplay+ '" width="100%" height="100%" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen style=""></iframe>');
5880
5881
5882                        //ytplayer= document.getElementById("flashcontent");
5883                        //ytplayer.loadVideoById('L7ANahx7aF0')
5884                    }
5885
5886
5887
5888
5889                    if (o.type == 'dash') {
5890
5891
5892                        console.warn("Reading from source ", dataSrc);
5893
5894
5895
5896
5897
5898
5899                        setup_local_video();
5900                        video = cthis.find('.the-video').eq(0).get(0);
5901
5902
5903
5904                        if(window.Webm){
5905                            dash_context = new Webm.di.WebmContext();
5906                            dash_player = new MediaPlayer(dash_context);
5907                            dash_player.startup();
5908                            dash_player.attachView(video);
5909
5910                            if(autoplay=='on'){
5911                                dash_player.setAutoPlay(true);
5912                            }else{
5913
5914                                dash_player.setAutoPlay(false);
5915                            }
5916
5917                            dash_player.attachSource(dataSrc);
5918
5919
5920                            //console.info(video.naturalWidth);
5921                        }else{
5922
5923
5924                            var baseUrl = '';
5925                            var baseUrl_arr = get_base_url_arr();
5926                            for(var i24=0;i24<baseUrl_arr.length-1; i24++){
5927                                baseUrl+=baseUrl_arr[i24]+'/';
5928                            }
5929                            //var src = scripts[scripts.length-1].src;
5930
5931
5932                            var url = baseUrl+'dash.js';
5933                            //console.warn(scripts[i23], baseUrl, url);
5934                            $.ajax({
5935                                url: url,
5936                                dataType: "script",
5937                                success: function(arg){
5938                                    //console.info(arg);
5939
5940                                    dash_context = new Webm.di.WebmContext();
5941                                    dash_player = new MediaPlayer(dash_context);
5942                                    dash_player.startup();
5943                                    dash_player.attachView(video);
5944                                    if(autoplay=='on'){
5945                                        dash_player.setAutoPlay(true);
5946                                    }else{
5947
5948                                        dash_player.setAutoPlay(false);
5949                                    }
5950                                    dash_player.attachSource(dataSrc);
5951
5952
5953                                }
5954                            });
5955                        }
5956
5957                    }
5958
5959
5960
5961                }
5962
5963                if (o.type == 'normal') {
5964                    video = cthis.find('.the-video').eq(0)[0];
5965
5966                    // console.info(video);
5967                    if (video != undefined) {
5968                        video.controls = false;
5969                    }
5970                }
5971                if (o.type == 'audio') {
5972                    video = cthis.find('.the-video').eq(0)[0];
5973                    if(video!=undefined){
5974                        video.controls = false;
5975                    }
5976                }
5977                if (o.type == 'youtube') {
5978//                    video = cthis.children('object')[0];
5979
5980//                    console.info(video);
5981                }
5982
5983                if (o.type == 'vimeo') {
5984                    video = cthis.find('iframe')[0];
5985                    //console.log(video);
5986                    //
5987
5988                    if (window.addEventListener) {
5989                        window.addEventListener('message', vimeo_windowMessage, false);
5990                    }
5991
5992                }
5993
5994                if (o.type == 'normal') {
5995                    $(video).css({
5996                        'position': 'absolute',
5997                        'background-color': '#000000'
5998                    })
5999                }
6000
6001                if (autoplay == 'on') {
6002                    wasPlaying = true;
6003                }else{
6004
6005                }
6006
6007
6008                if(cthis.attr('data-adsource') &&  cthis.data('adplayed')!='on'){
6009                    has_ad_to_play = true;
6010                }
6011
6012                // console.info('has_ad_to_play - ',has_ad_to_play, cthis.attr('data-adsource'), cthis.data('adplayed'));
6013
6014
6015                get_responsive_ratio();
6016
6017                // cthis.find('.cover-image').bind('click',click_coverImage);
6018
6019                cthis.on('click','.cover-image:not(.from-type-image)', click_coverImage);
6020
6021                cthis.addClass('dzsvp-loaded');
6022
6023                // console.info("type -", o.type);
6024
6025
6026                inter_videoReadyState = setInterval(check_videoReadyState, 50);
6027                cthis.get(0).externalPauseMovie = pauseMovie;
6028                cthis.get(0).externalPlayMovie = playMovie;
6029                cthis.get(0).api_pauseMovie = pauseMovie;
6030                cthis.get(0).api_playMovie = playMovie;
6031                cthis.get(0).api_get_responsive_ratio = get_responsive_ratio;
6032
6033
6034                //console.info(cthis, o.type, o.responsive_ratio, cthis.attr('data-responsive_ratio'));
6035
6036
6037                $(window).on('resize', handleResize);
6038
6039
6040
6041
6042                var _scrubbar = cthis.find('.scrubbar').eq(0);
6043
6044                _scrubbar.on('touchstart', function(e) {
6045                    scrubbar_moving = true;
6046                })
6047
6048                if(o.ad_show_markers=='on'){
6049                    for(var i2 = 0;i2<ad_array.length;i2++){
6050                        // console.info(_scrubBg, (ad_array[i2].time*100));
6051                        //  _scrubBg.append('<span class="ad-marker" style="left: '+(ad_array[i2].time*100)+'%"></span>');
6052                        _scrubbar.find('.scrub').eq(0).before('<span class="reclam-marker" style="left: '+(ad_array[i2].time*100)+'%"></span>');
6053                        // _scrubbar.find('.scrub-buffer').append('<span class="ad-marker" style="left: '+(Number(ad_array[i2].time)*_scrubBg)+'%"></span>');
6054                    }
6055                }
6056
6057                $(document).on('touchmove', function(e) {
6058                    if (scrubbar_moving) {
6059                        scrubbar_moving_x = e.originalEvent.touches[0].pageX;
6060
6061
6062                        var aux3 = scrubbar_moving_x - _scrubbar.offset().left;
6063
6064                        if (aux3 < 0) {
6065                            aux3 = 0;
6066                        }
6067                        if (aux3 > _scrubbar.width()) {
6068                            aux3 = _scrubbar.width();
6069                        }
6070
6071                        seek_to_perc(aux3 / _scrubbar.width());
6072
6073
6074                        //console.info(aux3);
6075
6076
6077                    }
6078                });
6079
6080                $(document).on('touchend', function(e) {
6081                    scrubbar_moving = false;
6082                })
6083
6084
6085
6086
6087
6088                o.settings_trigger_resize = parseInt(o.settings_trigger_resize, 10);
6089                if(o.settings_trigger_resize>0){
6090                    setInterval(function(){
6091
6092                        // console.info("HMM");
6093                        handleResize(null, {
6094                            'call_from':'recheck_sizes'
6095                        });
6096                    },o.settings_trigger_resize);
6097                };
6098
6099                if(is_touch_device()){
6100                    cthis.addClass('is-touch');
6101                }
6102
6103            }
6104
6105
6106
6107
6108            function get_responsive_ratio(pargs){
6109
6110
6111                var margs = {
6112                    'reset_responsive_ratio' : false
6113                };
6114                // console.info('get_responsive_ratio()',pargs, o.responsive_ratio);
6115
6116                if(pargs){
6117                    margs = $.extend(margs,pargs);
6118                }
6119
6120                if(margs.reset_responsive_ratio){
6121                    o.responsive_ratio='default';
6122                }
6123
6124                if(o.responsive_ratio=='default' || (o.type=='youtube' && o.responsive_ratio=='detect')){
6125
6126                    if(cthis.attr('data-responsive_ratio')){
6127                        o.responsive_ratio= cthis.attr('data-responsive_ratio');
6128                    }
6129                }
6130
6131                if(o.responsive_ratio=='detect'){
6132
6133                    // console.info('lets calculate responsive ratio', o.type, video, video.videoWidth,video.videoHeight);
6134                    if(o.type=='normal'||o.type=='video'||o.type=='dash'){
6135                        if(video && video.videoHeight){
6136
6137                            o.responsive_ratio = video.videoHeight / video.videoWidth ;
6138                        }else{
6139                            o.responsive_ratio = 0.567;
6140                        }
6141
6142                        //console.info(o.responsive_ratio);
6143                        if(video.addEventListener){
6144                            video.addEventListener('loadedmetadata',function(){
6145                                o.responsive_ratio = video.videoHeight / video.videoWidth ;
6146//                                console.info(o.responsive_ratio);
6147                                handleResize();
6148                            })
6149                        }
6150
6151                        if(o.type=='dash'){
6152                            dash_inter_check_sizes = setInterval(function(){
6153
6154                                //console.info(o.type, video, video.videoWidth,video.videoHeight);
6155
6156                                if(video && video.videoHeight) {
6157                                    if (video.videoWidth > 0) {
6158
6159                                        o.responsive_ratio = video.videoHeight / video.videoWidth;
6160                                        handleResize();
6161
6162                                        clearInterval(dash_inter_check_sizes);
6163                                    }
6164                                }
6165                            },1000);
6166                        }
6167
6168                    }
6169                    if(o.type=='audio'){
6170
6171                        if(cthis.find('.div-full-image').length){
6172
6173                            var _cach = cthis.find('.div-full-image').eq(0);
6174
6175                            var aux = _cach.css('background-image');
6176
6177                            aux = aux.replace(/"/g, '');
6178                            aux = aux.replace("url(", '');
6179                            aux = aux.replace(")", '');
6180
6181                            var img = new Image();
6182
6183                            img.onload = function(){
6184                                //console.info(this, this.naturalWidth, this.naturalHeight);
6185
6186                                o.responsive_ratio = this.naturalHeight / this.naturalWidth ;
6187//                                console.info(o.responsive_ratio);
6188                                handleResize();
6189
6190                            };
6191
6192
6193                            img.src = aux;
6194
6195                            //console.info(aux);
6196                            //
6197                            //console.info(cthis.find('.div-full-image').eq(0))
6198                        }
6199
6200
6201
6202                    }
6203                    if(o.type=='youtube'){
6204
6205                        o.responsive_ratio=0.562;
6206                    }
6207                    if(o.type=='vimeo'){
6208
6209                        o.responsive_ratio=0.562;
6210                    }
6211
6212                }
6213                o.responsive_ratio = Number(o.responsive_ratio);
6214            }
6215
6216            function setup_local_video(pargs){
6217
6218                //console.info('setup_local_video()', pargs);
6219
6220                var margs = {
6221                    'preload' : 'auto'
6222                    ,'is_dash' : false
6223                };
6224
6225                if(pargs){
6226                    margs = $.extend(margs,pargs);
6227                }
6228
6229                aux = '<video class="the-video" preload="'+margs.preload+'" ';
6230
6231
6232                //console.info('is_mobile - '+is_mobile() );
6233                if(is_mobile() && o.autoplay=='on' && o.autoplay_on_mobile_too_with_video_muted=='on'){
6234                    aux+= ' muted';
6235                }
6236
6237
6238                if(o.touch_play_inline=='on'){
6239                    aux+=' webkit-playsinline playsinline';
6240                }else{
6241
6242                    aux+=' controls="false"';
6243                }
6244
6245                if (videoWidth != 0) {
6246                    aux += ' width="100%"';//aux += ' width="' + videoWidth + '"';
6247                    aux += ' height="100%"';//aux += ' height="' + videoHeight + '"';
6248                }
6249                aux += '></video>';
6250
6251
6252
6253                if (!is_ie9()) {
6254                    // cthis.prepend(aux);
6255                    _vpInner.prepend(aux);
6256                }
6257                if(margs.is_dash==true){
6258
6259                    return false;
6260                }
6261                //var obj = document.createElement('video');
6262                //obj.src='ceva';
6263                //console.log('ceva', cthis, cthis.attr('data-src'), cthis.attr('data-source'));
6264
6265
6266                if ( (cthis.attr('data-src') || cthis.attr('data-source')) && margs.is_dash==false) {
6267                    if (cthis.attr('data-src') && (cthis.attr('data-src').indexOf('.ogg') > -1 || cthis.attr('data-src').indexOf('.ogv') > -1) ) {
6268                        cthis.attr('data-sourceogg', cthis.attr('data-src'));
6269                    }
6270                    if (cthis.attr('data-src') && ( cthis.attr('data-src').indexOf('.m4v') > -1 || cthis.attr('data-src').indexOf('.mp4') > -1 ) ) {
6271                        cthis.attr('data-sourcemp4', cthis.attr('data-src'));
6272                    }
6273
6274
6275
6276                    //console.warn((cthis.attr('data-source'))==true);
6277                    if (cthis.attr('data-source') && ( cthis.attr('data-source').indexOf('.m4v') > -1 || cthis.attr('data-source').indexOf('.mp4') > -1 ) ) {
6278                        cthis.attr('data-sourcemp4', cthis.attr('data-source'));
6279                    }
6280                }
6281
6282
6283                ///console.log(cthis.attr('data-sourcemp4'));
6284                if (cthis.attr('data-sourcemp4') && margs.is_dash==false) {
6285
6286
6287
6288                    cthis.find('.the-video').eq(0).append('<source src="' + cthis.attr('data-sourcemp4') + '"/>');
6289                    if (is_ie9()) {
6290                        var auxdiv = cthis.find('.controls');
6291                        cthis.prepend('<video controls preload><source src="' + cthis.attr('data-sourcemp4') + '" type="video/mp4"/></video>');
6292                        //cthis.append('<div class="controls"></div>');
6293                        //cthis.children('.controls') = auxdiv;
6294                    }
6295                }
6296
6297
6298
6299                if (cthis.attr('data-sourceogg') != undefined) {
6300                    cthis.find('.the-video').eq(0).append('<source src="' + cthis.attr('data-sourceogg') + '" type="video/ogg"/>');
6301                }
6302                if (cthis.attr('data-sourcewebm') != undefined) {
6303                    cthis.find('.the-video').eq(0).append('<source src="' + cthis.attr('data-sourcewebm') + '" type="video/webm"/>');
6304                }
6305                //console.log(cthis.attr('data-sourceflash'), cthis.attr('data-sourcewebm'), cthis.attr('data-sourceogg'), $.browser.mozilla, (cthis.attr('data-sourceflash')!=undefined && cthis.attr('data-sourcewebm')==undefined && cthis.attr('data-sourceogg')==undefined && $.browser.mozilla))
6306
6307                //- --- setup the type
6308                var str_type = '';
6309
6310//                        console.info(o, cthis.attr('data-sourceflash'));
6311
6312                if ((cthis.attr('data-sourceflash') != undefined && !(is_ie() && version_ie() > 8))  && margs.is_dash==false) {
6313                    //console.log('cevaaaa', cthis.children().eq(0));
6314
6315
6316                    var aux = '<object type="application/x-shockwave-flash" data="'+o.settings_swfPath+'" width="100%" height="100%" id="flashcontent" style="visibility: visible;"><param name="movie" value="'+o.settings_swfPath+'"><param name="menu" value="false">
6316<param name="allowScriptAccess" value="always"><param name="scale" value="noscale"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="video='+cthis.attr('data-sourceflash')+'"></object>';
6317
6318//                            console.info(can_play_mp4());
6319
6320                    //===if opera or firefox and no ogg defined, we force flash
6321                    if ((cthis.attr('data-sourcewebm') == undefined && cthis.attr('data-sourceogg') == undefined && (!can_play_mp4() || is_opera()))) {
6322                        cthis.html(aux);
6323                        cthis.data('isflash', 'on')
6324
6325
6326                        //-- if the flash player goes in we have no reliable way atm to find out when the ad ended
6327                        if (o.settings_disableControls == 'on') {
6328                            handleVideoEnd();
6329                            return;
6330                        }
6331
6332                    } else {
6333                        //cthis.children().eq(0).append(aux);
6334                    }
6335                }
6336            }
6337
6338
6339            function check_videoReadyState() {
6340                if (!video ) {
6341                    return;
6342                }
6343                //console.log('check_videoReadyState', video, video.readyState);
6344                if (o.type == 'youtube' && video.getPlayerState) {
6345                    if (is_ie8()) {
6346                        clearInterval(inter_videoReadyState);
6347                        setTimeout(init_readyVideo, 1000);
6348                        return;
6349                    }
6350                    clearInterval(inter_videoReadyState);
6351                    init_readyVideo();
6352                }
6353
6354                //console.info(video.readyState);
6355
6356
6357                if (is_firefox() && o.cueVideo!='on' && (o.type == 'normal' || o.type == 'audio') && Number(video.readyState) >= 2) {
6358                    clearInterval(inter_videoReadyState);
6359                    init_readyVideo({
6360                        'call_from' : 'check_videoReadyState'
6361                    });
6362                    return false;
6363                }
6364                if ((o.type == 'normal' || o.type == 'audio') && Number(video.readyState) >= 3) {
6365                    clearInterval(inter_videoReadyState);
6366                    init_readyVideo({
6367                        'call_from' : 'check_videoReadyState'
6368                    });
6369                    return false;
6370                }
6371                if (is_opera() && o.type == 'audio' && Number(video.readyState) == 2) {
6372                    clearInterval(inter_videoReadyState);
6373                    init_readyVideo();
6374                }
6375
6376
6377                // --- WORKAROUND __ for some reason android default browser would not go over video ready state 2
6378                if(o.type=='normal' && is_ios() && Number(video.readyState) >= 1){
6379                    clearInterval(inter_videoReadyState);
6380                    init_readyVideo();
6381                }
6382
6383
6384                // --- WORKAROUND __ for some reason ios default browser would not go over video ready state 1
6385                if(o.type=='normal' && is_android() && Number(video.readyState) >= 2){
6386                    clearInterval(inter_videoReadyState)
6387                    init_readyVideo({
6388                        'call_from' : 'check_videoReadyState'
6389                    });
6390                }
6391                // --- WORKAROUND __ for some reason ios default browser would not go over video ready state 1
6392
6393                if(o.type=='dash'){
6394                    //console.warn(video.readyState)
6395                    clearInterval(inter_videoReadyState)
6396                    init_readyVideo({
6397                        'call_from' : 'check_videoReadyState'
6398                    });
6399                }
6400//                console.log(video.readyState);
6401            }
6402
6403            function yt_onPlayerReady(e){
6404
6405
6406
6407
6408                //console.info('yt_onPlayerReady',e);
6409
6410
6411
6412                //yt_qualCurr = video.getPlaybackQuality();
6413                //
6414                //console.log(yt_qualCurr);
6415
6416
6417                if(video && video.getPlaybackQuality){
6418                    // console.info('getPlaybackQuality - ', video.getPlaybackQuality(), ' | state - ','player ready', ' | quality levels - ',video.getAvailableQualityLevels() );
6419                }
6420
6421
6422
6423                return false;
6424                //console.info(video.getOptions('cc'));
6425                video.unloadModule('cc'); // For AS3.
6426                video.unloadModule('captions'); // For HTML5.
6427                video.unloadModule("captions");  //Works for AS3 ignored by html5
6428                video.setOption("captions", "track", {"languageCode": "en"});
6429
6430                var yt_playerReady = true;
6431
6432                init_readyall();
6433            }
6434            function yt_onPlayerStateChange(e){
6435
6436
6437                // console.info('yt_onPlayerStateChange', cthis, e.data, e);
6438
6439                if(e.data==1){
6440                    // -play
6441                    //console.log(paused);
6442                    //if(paused){ playMovie(); }
6443
6444                    console.info(has_ad_to_play);
6445
6446
6447                    if(ad_status=='waiting_for_play'){
6448                        setup_skipad();
6449                    }
6450
6451                    check_if_ad_must_be_played();
6452                    check_if_hd_available();
6453
6454                    playMovie_visual();
6455                    paused = false;
6456
6457                    initial_played=true;
6458
6459
6460                    if(is_mobile()){
6461                        cthis.find('.controls').eq(0).css('pointer-events', 'auto');
6462
6463                    }
6464
6465                }
6466                if(e.data==2){
6467                    // pause
6468
6469                    if(suspend_state_2_for_loop==false){
6470
6471                        pauseMovie({
6472                            'call_from':'state_2_for_youtube'
6473                        });
6474                    }
6475                    paused = true;
6476                }
6477
6478                if(video && video.getPlaybackQuality){
6479                    // console.info('getPlaybackQuality - ', video.getPlaybackQuality(), ' | state - ',e.data, ' | quality levels - ',video.getAvailableQualityLevels() );
6480                }
6481
6482
6483                if(e.data==3){
6484
6485
6486                }
6487                if(e.data==0){
6488
6489                    // -- handlevideo end
6490                    handleVideoEnd();
6491                }
6492            }
6493
6494            function init_readyVideo(pargs) {
6495                //console.log(video.getAvailableQualityLevels());
6496
6497
6498                var margs = {
6499
6500                    'call_from' : 'default'
6501                };
6502
6503                if(pargs){
6504                    margs = $.extend(margs, pargs);
6505                }
6506
6507
6508                // if(video && video.getPlaybackQuality){
6509                //     console.info('getPlaybackQuality - ', video.getPlaybackQuality(), ' | state - ','init_readyVideo', ' | quality levels - ',video.getAvailableQualityLevels() );
6510                // }
6511
6512
6513                //console.log('init_readyVideo() - ', cthis, margs);
6514
6515
6516
6517                if (o.settings_makeFunctional == true) {
6518                    var allowed = false;
6519
6520                    var url = document.URL;
6521                    var urlStart = url.indexOf("://") + 3;
6522                    var urlEnd = url.indexOf("/", urlStart);
6523                    var domain = url.substring(urlStart, urlEnd);
6524                    //console.log(domain);
6525                    if (domain.indexOf('a') > -1 && domain.indexOf('c') > -1 && domain.indexOf('o') > -1 && domain.indexOf('l') > -1) {
6526                        allowed = true;
6527                    }
6528                    if (domain.indexOf('o') > -1 && domain.indexOf('z') > -1 && domain.indexOf('e') > -1 && domain.indexOf('h') > -1 && domain.indexOf('t') > -1) {
6529                        allowed = true;
6530                    }
6531                    if (domain.indexOf('e') > -1 && domain.indexOf('v') > -1 && domain.indexOf('n') > -1 && domain.indexOf('a') > -1 && domain.indexOf('t') > -1) {
6532                        allowed = true;
6533                    }
6534                    if (allowed == false) {
6535                        return;
6536                    }
6537
6538                }
6539                if (localStorage != null) {
6540                    if (localStorage.getItem('volumeIndex') === null)
6541                        defaultVolume = 1;
6542                    else
6543                        defaultVolume = localStorage.getItem('volumeIndex');
6544                }
6545                if (videoWidth == 0) {
6546                    //videoWidth = jQuery(video).width();
6547                    //videoHeight = jQuery(video).height();
6548                    videoWidth = cthis.width();
6549                    videoHeight = cthis.height();
6550                }
6551
6552                cthis.addClass('dszvp-loaded');
6553                if (o.gallery_object != null) {
6554                    if(typeof(o.gallery_object.get(0))!='undefined'){
6555                        o.gallery_object.get(0).api_video_ready();
6556                    }
6557                }
6558
6559                if (o.type == 'youtube') {
6560                    yt_qualCurr = video.getPlaybackQuality();
6561
6562                }
6563
6564
6565
6566                videoWidth = cthis.outerWidth();
6567                videoHeight = cthis.outerHeight();
6568
6569
6570//                console.log(cthis.width(), videoWidth, videoHeight);
6571                resizePlayer(videoWidth, videoHeight)
6572
6573                if(is_touch_device()==false){
6574
6575                    setupVolume(defaultVolume);
6576                }
6577
6578
6579                // console.log(cthis, o.settings_disableControls);
6580                // console.info(' is ad ', o.is_ad, o.type, is_ios() && video && o.is_ad == 'on');
6581
6582                var checkInter = setInterval(tick, 100);
6583                //console.info(o.type,autoplay);
6584                if (autoplay == 'on') {
6585
6586                    if(o.type!='vimeo'){
6587
6588                        playMovie({
6589                            'call_from':'autoplay - on'
6590                        });
6591                    }
6592                }
6593
6594                if(o.playfrom!='default'){
6595
6596//                    console.info(the_player_id, o.playfrom);
6597
6598                    if(o.playfrom=='last' && the_player_id!=''){
6599                        if(typeof Storage!='undefined'){
6600
6601                            if(typeof localStorage['dzsvp_'+the_player_id+'_lastpos']!='undefined'){
6602//                                console.info(localStorage['dzsvp_'+the_player_id+'_lastpos'], o.type, Number(localStorage['dzsvp_'+the_player_id+'_lastpos']));
6603                                if (o.type == 'normal' || o.type == 'audio') {
6604                                    video.currentTime = Number(localStorage['dzsvp_'+the_player_id+'_lastpos']);
6605                                }
6606                                if (o.type == 'youtube') {
6607                                    video.seekTo(Number(localStorage['dzsvp_'+the_player_id+'_lastpos']));
6608                                    if(wasPlaying==false){
6609                                        pauseMovie({
6610                                            'call_from':'_init_readyVideo()'
6611                                        });
6612                                    }
6613                                }
6614                            }
6615                        }
6616                    }
6617
6618                    if(isNaN(Number(o.playfrom))==false){
6619                        if (o.type == 'normal' || o.type == 'audio') {
6620                            video.currentTime = o.playfrom;
6621                        }
6622                        if (o.type == 'youtube') {
6623                            //video.seekTo(o.playfrom, true);
6624                            //
6625                            //
6626                            //
6627                            ////console.info(wasPlaying);
6628                            //if(wasPlaying==false){
6629                            //
6630                            //
6631                            //
6632                            //    setTimeout(function(){
6633                            //        if (video && video.pauseVideo) {
6634                            //
6635                            //            try {
6636                            //                video.pauseVideo();
6637                            //            }catch (err) {
6638                            //                if (window.console) {
6639                            //                    console.log(err);
6640                            //                }
6641                            //            }
6642                            //        }
6643                            //    },300);
6644                            //
6645                            //
6646                            //    setTimeout(function(){
6647                            //
6648                            //        pauseMovie();
6649                            //    },1100);
6650                            //}
6651                        }
6652                    }
6653
6654
6655                }
6656
6657
6658
6659
6660
6661
6662                tick({
6663                    skin_play_check : true
6664                });
6665
6666
6667                //console.info('o.settings_disableControls - ',o.settings_disableControls);
6668                if (o.settings_disableControls != 'on') {
6669
6670                    if(cthis.hasClass('debug-target')){ console.info(cthis, playcontrols); }
6671                    cthis.on('mouseleave',handleMouseout);
6672                    cthis.on('mouseover', handleMouseover);
6673                    cthis.find('.controls').eq(0).bind('mouseover', handle_mouse);
6674                    cthis.find('.controls').eq(0).bind('mouseout', handle_mouse);
6675                    cthis.bind('mousemove', handle_mousemove);
6676                    $(window).on('keypress',handleKeyPress);
6677
6678                    fScreenControls.off('click',onFullScreen);
6679                    fScreenControls.on('mousedown touchstart',onFullScreen)
6680                    scrubbar.bind('click', handleScrub);
6681                    scrubbar.bind('mousedown', handle_mouse);
6682                    scrubbar.bind('mousemove', handleScrubMouse);
6683                    scrubbar.bind('mouseout', handleScrubMouse);
6684                    cthis.bind('mouseleave', handleScrubMouse);
6685                    // playcontrols.click(onPlayPause);
6686
6687                    //console.info('cthis in addEventListener - ',cthis);
6688                    cthis.on('click','> .controls .playcontrols, > .vp-inner > .controls .playcontrols',onPlayPause);
6689                    cthis.find('.touch-play-btn').on('click touchstart', onPlayPause);
6690                    cthis.find('.mutecontrols-con').bind('click', click_mutecontrols);
6691
6692                    // console.info("HMM");
6693                    // cthis.bind('keypress',handle_key);
6694
6695                    if(o.type=='normal'){
6696
6697                        video.addEventListener('fullscreenchange', checkFullscreen, false);
6698                        video.addEventListener('mozfullscreenchange', checkFullscreen, false);
6699                        video.addEventListener('webkitfullscreenchange', checkFullscreen, false);
6700                    }else{
6701                    }
6702
6703                    document.addEventListener('fullscreenchange', checkFullscreen, false);
6704                    document.addEventListener('mozfullscreenchange', checkFullscreen, false);
6705                    document.addEventListener('webkitfullscreenchange', checkFullscreen, false);
6706
6707
6708
6709                    //console.info('ios - ',is_ios(),'android - ',is_android());
6710                    if(is_mobile()){
6711                        if(o.type=='youtube'){
6712                            if(o.settings_video_overlay=='on'){
6713
6714                                cthis.find('.controls').eq(0).css('pointer-events', 'none');
6715                                cthis.find('.controls .playcontrols').eq(0).css('pointer-events', 'auto');
6716                            }
6717                        }
6718                        //$(video).bind('ended', event_video);
6719                    }
6720
6721                } else {
6722                    // -- disable controls except volume / probably because its a advertisment
6723                    playcontrols.css({'opacity': 0.5});
6724                    fScreenControls.css({'opacity': 0.5});
6725                    scrubbar.css({'opacity': 0.5});
6726                    _timetext.css({'opacity': 0.5});
6727
6728
6729                    if(o.is_ad=='on' && autoplay=='off'){
6730
6731                    }
6732
6733                    if(is_ios() || is_android()){
6734
6735                        playcontrols.css({'opacity': 1});
6736                        playcontrols.click(onPlayPause);
6737                    }
6738
6739                    //volumecontrols.css({'opacity' : 0.5});
6740//                     if (o.ad_link != '') {
6741//                         //console.log(cthis, cthis.children().eq(0), o.ad_link
6742//                         var _c = cthis.children().eq(0);
6743//                         _c.css({'cursor': 'pointer'})
6744// //                        console.info(_c, cthis, o.ad_link, _c.parent(), _c.parent().find('.video-overlay'));
6745//                         _c.unbind('click');
6746//                         _c.bind('click', function() {
6747//                             //console.info(played, 'ceva', cthis.find('.controls').eq(0).css('pointer-events'));
6748//                             if(played) {
6749//                                 window.open(o.ad_link);
6750//                             }
6751//                         })
6752//                     }
6753                }
6754
6755                $(video).bind('play', event_video);
6756
6757
6758                // console.info(o.settings_disableControls, o.settings_video_overlay, cthis);
6759                if(o.settings_video_overlay=='on'){
6760
6761                    // console.info("HMM", cthis.find('.the-video').eq(0));
6762                    cthis.find('.the-video').eq(0).after('<div class="video-overlay"></div>');
6763                    cthis.on('click','.video-overlay', click_videoOverlay);
6764                    cthis.on('dblclick','.video-overlay', onFullScreen);
6765                }
6766
6767                if(o.settings_big_play_btn=='on'){
6768                    var auxbpb = '<div class="big-play-btn">';
6769                    auxbpb+=svg_aurora_play_btn;
6770                    auxbpb+='</div>';
6771                    cthis.find('.controls').before(auxbpb);
6772                    cthis.on('click','.big-play-btn', click_videoOverlay);
6773                }
6774
6775                if(o.video_description_style=='gradient'){
6776
6777                    var aux3 = '<div class="video-description video-description-style-'+o.video_description_style+'"><div>';
6778
6779                    aux3+=dataVideoDesc;
6780                    aux3+='</div></div>';
6781
6782                    if(cthis.find('.big-play-btn').length){
6783
6784                        cthis.find('.big-play-btn').eq(0).before(aux3);
6785                    }else{
6786
6787                        if(cthis.find('.video-overlay').length){
6788
6789                            cthis.find('.video-overlay').eq(0).after(aux3);
6790                        }else{
6791
6792                            cthis.find('.controls').before(aux3);
6793                        }
6794                    }
6795                }
6796
6797                //console.info('dataVideoDesc - ',dataVideoDesc);
6798
6799
6800                //_volumeControls.click(handleVolume);
6801
6802                window.dzsvg_handle_mouse = handle_mouse;
6803
6804
6805                _volumeControls_real.bind('mousedown', handle_mouse);
6806                $(document).undelegate(window, 'mouseup', window.dzsvg_handle_mouse);
6807                $(document).delegate(window, 'mouseup', window.dzsvg_handle_mouse);
6808                _volumeControls_real.bind('click', handleVolume);
6809
6810
6811
6812                if (o.settings_hideControls == 'on') {
6813                    controlsDiv.hide();
6814                }
6815
6816
6817                if (o.type == 'normal' || o.type == 'audio') {
6818
6819                    video.addEventListener('ended', handleVideoEnd, false);
6820
6821                    if(is_ios() && video && o.is_ad == 'on'){
6822
6823                        console.info("ADDED END FULLSCREEN EVENT");
6824                        video.addEventListener('webkitendfullscreen', function(){
6825                            if(video.currentTime>video.duration*0.75){
6826                                handleVideoEnd();
6827                            }
6828                        }, false);
6829                    }
6830                }
6831
6832
6833                if(cthis.children('.subtitles-con-input').length || o.settings_subtitle_file){
6834                    setup_subtitle();
6835                }
6836
6837
6838
6839                setTimeout(handleResize, 500);
6840
6841
6842
6843                //--if video were inside a gallery, the gallery would handle resize
6844                if(o.gallery_object==null){
6845                }
6846
6847
6848
6849
6850
6851
6852                cthis.get(0).api_destroy_listeners = destroy_listeners;
6853
6854
6855
6856
6857            }
6858
6859            function destroy_listeners(){
6860                cthis.unbind('mouseout',handleMouseout);
6861                cthis.unbind('mouseover',handleMouseover);
6862                cthis.find('.controls').eq(0).unbind('mouseover', handle_mouse);
6863                cthis.find('.controls').eq(0).unbind('mouseout', handle_mouse);
6864                cthis.unbind('mousemove', handle_mousemove);
6865                cthis.unbind('keydown',handleKeyPress);
6866                fScreenControls.off('click',onFullScreen)
6867                scrubbar.unbind('click', handleScrub);
6868                scrubbar.unbind('mousedown', handle_mouse);
6869                scrubbar.unbind('mousemove', handleScrubMouse);
6870                scrubbar.unbind('mouseout', handleScrubMouse);
6871                cthis.unbind('mouseleave', handleScrubMouse);
6872                cthis.off('click');
6873                cthis.find('.mutecontrols-con').unbind('click', click_mutecontrols);
6874                document.removeEventListener('fullscreenchange', checkFullscreen, false);
6875                document.removeEventListener('mozfullscreenchange', checkFullscreen, false);
6876                document.removeEventListener('webkitfullscreenchange', checkFullscreen, false);
6877
6878
6879                if(o.gallery_object==null) {
6880                    $(window).off('resize', handleResize);
6881                }
6882
6883                if (o.type == 'normal' || o.type == 'audio') {
6884
6885                    video.removeEventListener('ended', handleVideoEnd, false);
6886                }
6887            }
6888
6889            function check_if_hd_available(){
6890
6891
6892                if(yt_qualArray.length>0){
6893                    return false;
6894                }
6895
6896
6897
6898                yt_qualCurr = video.getPlaybackQuality();
6899
6900                yt_qualArray = video.getAvailableQualityLevels();
6901
6902                //console.info(yt_qualCurr, yt_qualArray);
6903
6904                if ($.inArray('hd720', yt_qualArray) > -1) {
6905                    hasHD = true;
6906                }
6907                if (hasHD == true) {
6908
6909                    if(controlsDiv.children('.hdbutton-con').length==0){
6910
6911
6912
6913
6914                        if(o.settings_suggestedQuality!='default'){
6915                            if(yt_qualCurr!=o.settings_suggestedQuality){
6916                                video.setPlaybackQuality(o.settings_suggestedQuality);
6917                                //console.info(yt_qualCurr, o.settings_suggestedQuality)
6918                            }
6919                        }
6920
6921
6922                        controlsDiv.append('<div class="hdbutton-con"><div class="hdbutton-normal">HD</div></div>');
6923
6924
6925                        if(o.design_skin!='skin_pro' && o.design_skin!='skin_reborn'){
6926                            o.design_scrubbarWidth -= 23;
6927                            original_scrubwidth -= 23;
6928
6929                        }
6930
6931                        //console.log(o.design_skin);
6932                        if(o.design_skin=='skin_pro'){
6933                            //console.log(controlsDiv.find('.hdbutton-normal'))
6934                            //controlsDiv.find('.hdbutton-normal').eq(0).append("HD");
6935                            //controlsDiv.find('.hdbutton-hover').eq(0).append("HD");
6936                        }
6937
6938                        _btnhd = controlsDiv.children('.hdbutton-con');
6939                        if (yt_qualCurr == 'hd720' || yt_qualCurr == 'hd1080') {
6940                            _btnhd.addClass('active');
6941                        }
6942                        _btnhd.bind('click', click_hd);
6943
6944
6945
6946                        resizePlayer(videoWidth, videoHeight);
6947                    }
6948
6949                }
6950            }
6951
6952            function handle_mouse(e){
6953//                console.info(e.pageX, e.pageY);
6954                var _t = $(this);
6955
6956
6957
6958                if(e.type=='mouseover'){
6959
6960                    if(_t.hasClass('controls')){
6961
6962                        controls_are_hovered = true;
6963                    }
6964                }
6965                if(e.type=='mouseout'){
6966
6967                    if(_t.hasClass('controls')){
6968
6969                        controls_are_hovered = false;
6970                    }
6971                }
6972
6973                if(e.type=='mousedown'){
6974
6975                    if(_t.hasClass('volumecontrols')){
6976
6977                        volume_mouse_down = true;
6978                    }
6979                    if(_t.hasClass('scrubbar')){
6980
6981
6982
6983                        clearTimeout(inter_mousedownscrubbing);
6984                        inter_mousedownscrubbing = setTimeout(enable_mousedown_scrubbing,100);
6985
6986                    }
6987                }
6988                if(e.type=='click'){
6989
6990                }
6991                if(e.type=='mouseup'){
6992
6993                    clearTimeout(inter_mousedownscrubbing);
6994
6995                    //console.info('window mouseup');
6996                    volume_mouse_down = false;
6997                    scrub_mouse_down = false;
6998                }
6999            }
7000            function enable_mousedown_scrubbing(){
7001
7002                scrub_mouse_down = true;
7003            }
7004
7005            function handle_mousemove(e){
7006                //console.info(e.pageX, e.pageY);
7007                // console.info('mousemove', is_fullscreen, o.settings_disable_mouse_out, o.settings_disable_mouse_out_for_fullscreen, o.settings_mouse_out_delay_for_fullscreen);
7008                cthis.removeClass('mouse-is-out');
7009                mouseover = true;
7010
7011                if(volume_mouse_down){
7012                    handleVolume(e);
7013                }
7014                if(scrub_mouse_down){
7015
7016
7017                    var argperc = (e.pageX - (scrubbar.offset().left)) / (scrubbar.children().eq(0).width());
7018                    seek_to_perc(argperc);
7019                }
7020
7021                if(is_fullscreen){
7022
7023
7024                    if(o.settings_disable_mouse_out!='on' && o.settings_disable_mouse_out_for_fullscreen!='on') {
7025                        clearTimeout(inter_removeFsControls);
7026                        inter_removeFsControls = setTimeout(controls_mouse_is_out, o.settings_mouse_out_delay_for_fullscreen);
7027                    }
7028
7029                    if(e.pageX>ww-10 ){
7030                        controls_are_hovered = false;
7031                    }
7032                }
7033            }
7034
7035            function controls_mouse_is_out(){
7036
7037                // console.info('controls_mouse_is_out', controls_are_hovered, cthis);
7038                if(paused==false && (controls_are_hovered==false|| is_android() )){
7039
7040                    cthis.removeClass('mouse-is-over');
7041                    cthis.addClass('mouse-is-out');
7042                }
7043                mouseover = false;
7044            }
7045
7046            function event_video(e){
7047
7048                // console.info('event_video', e, e.type);
7049
7050                if(e.type=='play'){
7051
7052                    played = true;
7053
7054                    if(is_ios() || is_android()){
7055                        cthis.find('.controls').eq(0).css('pointer-events', 'auto');
7056                    }
7057                    setup_skipad();
7058                }
7059            }
7060
7061            function click_mutecontrols(e){
7062                var _t = $(this);
7063                _t.toggleClass('active');
7064
7065                if(_t.hasClass('active')){
7066                    lastVolume = getVolume();
7067                    setupVolume(0);
7068                }else{
7069
7070                    setupVolume(lastVolume);
7071                }
7072            }
7073
7074            function handle_key(e){
7075                console.info(e);
7076
7077
7078            }
7079
7080            function setup_subtitle(){
7081                var subtitle_input = '';
7082                if(cthis.children('.subtitles-con-input').length>0){
7083                    subtitle_input = cthis.children('.subtitles-con-input').eq(0).html();
7084//                    console.info(subtitle_input);
7085                    parse_subtitle(subtitle_input);
7086                }else{
7087                    if(o.settings_subtitle_file!=''){
7088                        $.ajax({
7089                            url: o.settings_subtitle_file
7090                            , success: function(response){
7091//                                console.info(response);
7092                                subtitle_input = response;
7093                                parse_subtitle(subtitle_input);
7094                            }
7095                        });
7096                    }
7097                }
7098
7099
7100
7101
7102
7103            }
7104            function parse_subtitle(arg){
7105                var regex_subtitle = /([0-9]+(?:\.[0-9]*)?)[\s\S]*?((.*)--[>|\&gt;](.*))[\n|\r]([\s\S]*?)[\n|\r]/g;
7106                var arr_subtitle = [];
7107                cthis.append('<div class="subtitles-con"></div>')
7108                while(arr_subtitle=regex_subtitle.exec(arg)){
7109//                    console.info(arr_subtitle);
7110
7111                    var starttime = '';
7112                    if(arr_subtitle[3]){
7113                        starttime = format_to_seconds(arr_subtitle[3]);
7114                    }
7115                    var endtime = '';
7116                    if(arr_subtitle[4]){
7117                        arr_subtitle[4] = String(arr_subtitle[4]).replace('gt;', '');
7118                        endtime = format_to_seconds(arr_subtitle[4]);
7119                    }
7120
7121                    var cnt = '';
7122                    if(arr_subtitle[5]){
7123                        cnt = arr_subtitle[5];
7124                    }
7125
7126                    cthis.children('.subtitles-con').append('<div class="dzstag subtitle-tag" data-starttime="'+starttime+'" data-endtime="'+endtime+'">'+cnt+'</div>');
7127                }
7128                arrTags = cthis.find('.dzstag');
7129
7130            }
7131
7132            function format_to_seconds(arg){
7133//                console.info(arg);
7134                var argsplit = String(arg).split(':');
7135                argsplit.reverse();
7136                var secs = 0;
7137//                console.info(argsplit);
7138                if(argsplit[0]){
7139                    argsplit[0] = String(argsplit[0]).replace(',','.');
7140                    secs+=Number(argsplit[0]);
7141                }
7142                if(argsplit[1]){
7143                    secs+=Number(argsplit[1]) * 60;
7144                }
7145                if(argsplit[2]){
7146                    secs+=Number(argsplit[2]) * 60;
7147                }
7148//                console.info(secs);
7149
7150                return secs;
7151            }
7152
7153
7154            function click_coverImage(e){
7155                //console.log(cthis.find('.cover-image'));
7156
7157
7158                if(o.type!='image'){
7159
7160                    playMovie({
7161                        'call_from':'click coverImage'
7162                    });
7163                }
7164            }
7165            function click_videoOverlay(e){
7166
7167                // console.info('click_videoOverlay');
7168
7169                if(o.is_ad=='on'){
7170                    if(o.ad_link){
7171                        window.open(o.ad_link);
7172                        return false;
7173                    }
7174                }else{
7175
7176                    if(wasPlaying===false){
7177                        playMovie({
7178                            'call_from':'_click_videoOverlay()'
7179                        });
7180                    }else{
7181                        pauseMovie({
7182                            'call_from':'_click_videoOverlay()'
7183                        });
7184                    }
7185
7186                }
7187
7188
7189
7190            }
7191
7192            function click_hd() {
7193                var _t = $(this);
7194                //console.log(_t);
7195                if (_t.hasClass('active')) {
7196                    _t.removeClass('active');
7197                    if ($.inArray('large', yt_qualArray) > -1) {
7198                        video.setPlaybackQuality('large');
7199                    } else {
7200                        if ($.inArray('medium', yt_qualArray) > -1) {
7201                            video.setPlaybackQuality('medium');
7202                        } else {
7203                            if ($.inArray('small', yt_qualArray) > -1) {
7204                                video.setPlaybackQuality('small');
7205                            }
7206                        }
7207                    }
7208
7209                } else {
7210                    _t.addClass('active');
7211                    if ($.inArray('hd1080', yt_qualArray) > -1) {
7212                        video.setPlaybackQuality('hd1080');
7213                    }else{
7214
7215                        if ($.inArray('hd720', yt_qualArray) > -1) {
7216                            video.setPlaybackQuality('hd720');
7217                        }
7218                    }
7219                }
7220            }
7221
7222            function checkFullscreen(e) {
7223                console.log('checkFullscreen', e.keyCode=='27',is_fullscreen, document.fullscreen, document.mozFullScreen);
7224                var identifiers_fs = [document.fullscreen, document.mozFullScreen, document.webkitIsFullScreen];
7225                for (var i = 0; i < identifiers_fs.length; i++) {
7226                    if (identifiers_fs[i] != undefined) {
7227                        //console.log(identifiers_fs[i]);
7228                        if (identifiers_fs[i] == true) {
7229                            is_fullscreen = 1;
7230                            cthis.addClass('is_fullscreen');
7231                        }
7232                        if (identifiers_fs[i] === false && is_fullscreen == 1) {
7233                            onFullScreen();
7234                            //is_fullscreen=0;
7235                            //console.log(identifiers_fs[i], is_fullscreen);
7236
7237                        }
7238                    }
7239                }
7240
7241                if(o.touch_play_inline=='on'){
7242
7243                    if(is_ios()){
7244                        pauseMovie({
7245                            'call_from':'_touch_play_inline_ios()'
7246                        });
7247                    }
7248                }
7249            }
7250
7251            function mouse_is_over(){
7252
7253                clearTimeout(inter_removeFsControls);
7254                cthis.removeClass('mouse-is-out');
7255                cthis.addClass('mouse-is-over');
7256            }
7257            function handleMouseover(e) {
7258
7259                // console.info('mouseover', e.currentTarget);
7260
7261                if($(e.currentTarget).hasClass('vplayer')){
7262
7263                    if(o.settings_disable_mouse_out!='on'){
7264
7265                        if(fullscreen_just_pressed==false){
7266                            mouse_is_over();
7267                        }
7268
7269                    }
7270                }
7271                if($(e.currentTarget).hasClass('fullscreen-button')){
7272                    draw_fs_canvas(o.controls_fscanvas_hover_bg);
7273                }
7274
7275
7276            }
7277            function handleMouseout(e) {
7278
7279                // console.info('mouseout');
7280
7281                if(o.type=='youtube' && is_fullscreen){
7282                    fullscreen_just_pressed = true;
7283
7284                    setTimeout(function(){
7285                        fullscreen_just_pressed = false;
7286                    }, 500)
7287                }
7288                if($(e.currentTarget).hasClass('vplayer')){
7289
7290
7291                    if(o.settings_disable_mouse_out!='on'){
7292
7293
7294
7295                        clearTimeout(inter_removeFsControls);
7296
7297                        // console.info('delay - ' ,o.settings_mouse_out_delay_for_fullscreen);
7298                        inter_removeFsControls = setTimeout(control
7298s_mouse_is_out, o.settings_mouse_out_delay);
7299                    }
7300                }
7301                if($(e.currentTarget).hasClass('fullscreen-button')){
7302                    draw_fs_canvas(o.controls_fscanvas_bg);
7303                }
7304
7305            }
7306            function handleScrubMouse(e) {
7307                //console.log(e.type, e);
7308                var _t = scrubbar;
7309
7310                if (e.type == 'mousemove') {
7311                    //console.log(e, e.pageX, jQuery(this).offset().left)
7312                    var mouseX = (e.pageX - $(this).offset().left) / currScale;
7313                    //console.log(_t,_t.children('.scrubBox'));
7314                    var aux = (mouseX / scrubbg_width) * totalDuration;
7315                    _t.children('.scrubBox').html(formatTime(aux));
7316                    _t.children('.scrubBox').css({'visibility': 'visible', 'left': (mouseX - 16)});
7317
7318
7319                }
7320                if (e.type == 'mouseout') {
7321                    _t.children('.scrubBox').css({'visibility': 'hidden'});
7322
7323                }
7324                if (e.type == 'mouseleave') {
7325                    _t.children('.scrubBox').css({'visibility': 'hidden'});
7326                }
7327                //console.log(mouseX);
7328            }
7329
7330
7331            function handleScrub(e) {
7332                /*
7333                 if (wasPlaying == false){
7334                 pauseMovie();
7335                 }else{
7336                 //console.log(o.type);
7337                 playMovie();
7338                 }
7339                 */
7340                //console.log(o.type);
7341                //return;
7342
7343                var argperc = (e.pageX - (scrubbar.offset().left)) / (scrubbar.children().eq(0).width());
7344                seek_to_perc(argperc);
7345            }
7346
7347            function seek_to_perc(argperc){
7348                //console.info('seek_to_perc()',argperc)
7349
7350                // console.info(argperc);
7351                if(ad_array.length){
7352                    for(var i2 = 0; i2<ad_array.length; i2++){
7353                        if(ad_array[i2].time < argperc){
7354                            argperc = Number(ad_array[i2].time);
7355                        }
7356                    }
7357                }
7358
7359                // console.info(argperc);
7360
7361                if (o.type == 'normal' || o.type == 'audio' || o.type == 'dash') {
7362                    totalDuration = video.duration;
7363
7364
7365
7366
7367                    if(isNaN(totalDuration)){
7368                        return false;
7369                    }
7370                    // console.info(totalDuration, argperc)
7371                    video.currentTime = (argperc) * totalDuration;
7372                }
7373                if (o.type == 'youtube') {
7374                    //console.log(video.getDuration());
7375
7376
7377                    if(video && video.getDuration){
7378
7379                        totalDuration = video.getDuration();
7380                    }else{
7381                        console.info('vplayer warning, youtube type - youtube api not ready .. ? ');
7382                        totalDuration = 0;
7383                    }
7384                    //console.info(time_curr, totalDuration);
7385
7386                    // -- no need for seek to perct if video has not started.
7387                    if(isNaN(totalDuration) || (time_curr==0 && argperc==0) ){
7388                        return false;
7389                    }
7390
7391                    video.seekTo(argperc * totalDuration);
7392                    if(wasPlaying==false){
7393                        pauseMovie({
7394                            'call_from':'_seek_to_perc()'
7395                        });
7396                    }
7397                }
7398
7399
7400
7401                if (o.type == 'vimeo') {
7402                    //if (/Opera/.test(navigator.userAgent)) {
7403                    //    return;
7404                    //}
7405
7406                    //console.info(initial_played);
7407                    if(argperc==0 && initial_played){
7408
7409                        vimeo_data = {
7410                            "method": "seekTo"
7411                            ,"value": "0"
7412                        };
7413
7414                        if(vimeo_url) {
7415                            try {
7416                                video.contentWindow.postMessage(JSON.stringify(vimeo_data), vimeo_url);
7417
7418                                wasPlaying = false;
7419                                paused=true;
7420                            } catch (err) {
7421                                if (window.console) {
7422                                    console.log(err);
7423                                }
7424                            }
7425                        }
7426                    }
7427                }
7428
7429            }
7430
7431            function tick(pargs){
7432                // -- enterFrame function
7433
7434                var margs = {
7435                    skin_play_check : false
7436                }
7437
7438                if(pargs){
7439                    margs = $.extend(margs,pargs);
7440                }
7441
7442                if (o.type == 'normal' || o.type == 'audio' || o.type == 'dash') {
7443                    totalDuration = video.duration;
7444                    time_curr = video.currentTime;
7445
7446                    //console.log(cthis, video.buffered.end(0), bufferedWidthOffset);
7447
7448                    if(video && video.buffered && video.readyState>1){
7449                        bufferedLength=0;
7450                        try{
7451
7452                            bufferedLength = (video.buffered.end(0) / video.duration) * (scrubbar.children().eq(0).width() + bufferedWidthOffset);
7453                        }catch(err){
7454                            console.log(err);
7455                        }
7456                    }
7457
7458
7459                }
7460                if (o.type == 'youtube') {
7461//                    console.log(video.getVideoLoadedFraction())
7462                    if (video.getVideoLoadedFraction == undefined || video.getVideoLoadedFraction==0) {
7463                        return false;
7464                    }
7465                    if (video.getDuration != undefined) {
7466                        totalDuration = video.getDuration();
7467                        time_curr = video.getCurrentTime();
7468                    }
7469                    bufferedLength = (video.getVideoLoadedFraction()) * (_scrubBg.width() + bufferedWidthOffset);
7470
7471//                    console.info(video.getVideoLoadedFraction(), scrubbar, _scrubBg,  (_scrubBg.width() + bufferedWidthOffset), bufferedLength);
7472                    aux = 0;
7473                    scrubbar.children('.scrub-buffer').css('left', aux);
7474
7475
7476                }
7477                aux = ((time_curr / totalDuration) * (scrubbg_width));
7478
7479                // console.info(time_curr, totalDuration, scrubbg_width);
7480                if(aux>scrubbg_width){
7481                    aux = scrubbg_width;
7482                }
7483                aux = parseInt(aux,10);
7484                // scrubbar.children('.scrub').width(aux);
7485                scrubbar.children('.scrub').animate({
7486                    'width' : aux
7487                },{
7488                    queue:false
7489                    ,duration: 100
7490                    ,easing: "linear"
7491
7492                });
7493
7494
7495                if (bufferedLength > -1) {
7496
7497                    //console.info(bufferedLength, scrubbar.children('.scrub-bg').width(), _scrubBg.width(), bufferedWidthOffset);
7498
7499                    if(bufferedLength > scrubbg_width+bufferedWidthOffset){
7500                        bufferedLength = scrubbg_width+bufferedWidthOffset;
7501                    }
7502                    scrubbar.children('.scrub-buffer').width(bufferedLength)
7503                }
7504                if (_timetext.css('display') != 'none' && (wasPlaying==true || margs.skin_play_check==true)) {
7505
7506                    var aux35 = formatTime(totalDuration);
7507
7508
7509                    if(o.design_skin!='skin_reborn'){
7510
7511                        aux35 = ' / '+aux35;
7512                    }
7513
7514                    //console.info(o.design_skin);
7515
7516
7517
7518                    _timetext.children(".curr-timetext").html(formatTime(time_curr));
7519                    _timetext.children(".total-timetext").html(aux35);
7520                }
7521                if (o.design_enableProgScrubBox == 'on') {
7522                    scrubbar.children('.scrubBox-prog').html(formatTime(time_curr));
7523                    // scrubbar.children('.scrubBox-prog').css('left', aux - 16);
7524
7525                    scrubbar.children('.scrubBox-prog').animate({
7526                        'left' : aux - 16
7527                    },{
7528                        queue:false
7529                        ,duration: 100
7530                        ,easing: "linear"
7531
7532                    })
7533                }
7534
7535
7536                if(o.playfrom=='last'){
7537                    if(typeof Storage!='undefined'){
7538                        localStorage['dzsvp_'+the_player_id+'_lastpos'] = time_curr;
7539                    }
7540                }
7541
7542            }
7543
7544
7545
7546            function handleVolume(e) {
7547                _volumeControls = cthis.find('.volumecontrols').children();
7548                if ((e.pageX - (_volumeControls.eq(1).offset().left)) >= 0) {
7549                    aux = (e.pageX - (_volumeControls.eq(1).offset().left)) / currScale;
7550
7551                    //_volumeControls.eq(2).height(24)
7552                    _volumeControls.eq(2).css('visibility', 'visible')
7553                    _volumeControls.eq(3).css('visibility', 'hidden')
7554
7555                    setupVolume(aux / _volumeControls.eq(1).width());
7556                } else {
7557                    if (_volumeControls.eq(3).css('visibility') == 'hidden') {
7558                        lastVolume = video.volume;
7559                        if (o.type == 'normal' || o.type == 'audio') {
7560                            video.volume = 0;
7561                        }
7562                        if (o.type == 'youtube') {
7563                            video.setVolume(0);
7564                        }
7565                        _volumeControls.eq(3).css('visibility', 'visible')
7566                        _volumeControls.eq(2).css('visibility', 'hidden')
7567                    } else {
7568                        //console.log(lastVolume);
7569
7570                        // console.info('o.type');
7571                        if (o.type == 'normal' || o.type == 'audio') {
7572                            video.volume = lastVolume;
7573                        }
7574                        if (o.type == 'youtube') {
7575                            video.setVolume(lastVolume);
7576                        }
7577                        _volumeControls.eq(3).css('visibility', 'hidden')
7578                        _volumeControls.eq(2).css('visibility', 'visible')
7579                    }
7580                }
7581
7582            }
7583
7584            function getVolume(){
7585
7586
7587                if (o.type == 'normal') {
7588                    return video.volume;
7589                }
7590                if (o.type == 'youtube') {
7591                    return (Number(video.getVolume()) / 100);
7592                }
7593
7594                return 0;
7595            }
7596
7597            function setupVolume(arg) {
7598
7599                // -- @arg is ratio 0 - 1
7600
7601                // console.info('setupVolume()', arg)
7602                var volumeControl = cthis.find('.volumecontrols').children();
7603
7604                if(arg>1){
7605                    arg = 1;
7606                }
7607
7608                var aux = 0;
7609
7610                if (arg >= 0) {
7611
7612                    // console.info(o.type);
7613                    if (o.type == 'normal' || o.type == 'audio'){
7614                        video.volume = arg;
7615                    }
7616                    if (o.type == 'youtube') {
7617                        aux = arg * 100;
7618                        video.setVolume(aux);
7619
7620                    }
7621
7622                }
7623
7624
7625                if(o.design_skin=='skin_reborn'){
7626                    arg*=10;
7627                    arg = Math.round(arg);
7628                    arg/=10;
7629                }
7630
7631                if(arg>1){
7632                    arg = 1;
7633                }
7634
7635                // console.info(volumeControl, arg, volumeControl.eq(1).width(), volumeWidthOffset)
7636
7637
7638                aux = arg * (volumeControl.eq(1).width() + volumeWidthOffset) ;
7639
7640                // console.warn(aux);
7641
7642                if(o.design_skin=='skin_reborn'){
7643
7644                    //console.info(arg, aux);
7645                    var aux2 = arg*=10;
7646                    _volumeControls_real.children('.volume_static').children().removeClass('active');
7647                    //console.info(aux2, _volumeControls_real, _volumeControls_real.children('.volume_static').children())
7648                    for(var i=0;i<aux2;i++){
7649                        //console.info(_volumeControls_real, _volumeControls_real.children('.volume_static').children())
7650                        _volumeControls_real.children('.volume_static').children().eq(i).addClass('active');
7651                    }
7652
7653
7654                    _volumeControls_real.children('.volume-tooltip').css({
7655                        'right': (100- ( aux2*10))+'%'
7656                    })
7657                    _volumeControls_real.children('.volume-tooltip').html('VOLUME: '+( aux2*10));
7658
7659                }else{
7660
7661                    volumeControl.eq(2).width(aux);
7662                }
7663
7664
7665                if (localStorage != null){
7666                    localStorage.setItem('volumeIndex', arg);
7667                }
7668            }
7669
7670            function formatTime(arg) {
7671                //formats the time
7672                var s = Math.round(arg);
7673                var m = 0;
7674                if (s > 0) {
7675                    while (s > 59) {
7676                        m++;
7677                        s -= 60;
7678                    }
7679                    return String((m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s);
7680                } else {
7681                    return "00:00";
7682                }
7683            }
7684            function handleVideoEnd() {
7685                //console.info('handleVideoEnd() - ' ,cthis, is_fullscreen, o.type, window.fullscreen);
7686
7687                // -- function on video end
7688
7689                if(o.type=='vimeo'){
7690
7691                    if(document.exitFullscreen) {
7692                        document.exitFullscreen();
7693                    } else if(document.mozCancelFullScreen) {
7694                        document.mozCancelFullScreen();
7695                    } else if(document.webkitExitFullscreen) {
7696                        document.webkitExitFullscreen();
7697                    }
7698                }
7699
7700
7701                if (is_fullscreen == 1 ) {
7702                    onFullScreen(); // we exit fullscreen if video has ended on fullscreen
7703                    setTimeout(function(){
7704                        handleResize();
7705                    },100);
7706                }
7707
7708
7709                console.info('o.type - ',o.type);
7710                if (o.type == 'video' || o.type == 'normal' || o.type == 'audio'|| o.type == 'dash') {
7711
7712                    console.info("loop - ", loop, video);
7713                    if(loop=='on'){
7714
7715                        console.info("YES");
7716                        seek_to_perc(0);
7717                        playMovie({
7718                            'call_from':'play_from_loop'
7719                        });
7720                        return false;
7721                    }
7722                    if (video) {
7723
7724
7725                        if(o.settings_video_end_reset_time=='on'){
7726
7727                            video.currentTime = 0;
7728
7729                            if(loop!='on'){
7730
7731                                pauseMovie({
7732                                    'call_from':'end_video()'
7733                                });
7734                                cthis.find('.cover-image').fadeIn('slow');
7735                            }else{
7736                                return false;
7737                            }
7738
7739
7740                        }
7741                    }
7742                }
7743                if (o.type == 'youtube') {
7744                    if(loop=='on'){
7745
7746                        // console.info("YES");
7747                        seek_to_perc(0);
7748                        setTimeout(function(){
7749
7750                            playMovie({
7751                                'call_from':'play_from_loop'
7752                            });
7753                        },1000);
7754
7755                        suspend_state_2_for_loop = true;
7756                        setTimeout(function(){
7757                            suspend_state_2_for_loop = false;
7758                        },1500);
7759                        return false;
7760                    }
7761                    //console.log(video.getDuration())
7762                    if (video) {
7763                        if (video && video.pauseVideo) {
7764                            wasPlaying = false;
7765                            if(o.settings_video_end_reset_time=='on'){
7766
7767                                // -- youtube already shows cover photo and replay button - maybe no need
7768
7769                                //seek_to_perc(0);
7770                                //
7771                                //video.pauseVideo();
7772                            }
7773                        }
7774                    }
7775                }
7776
7777
7778                console.log("PASS EVENT TO GALLERY", cthis, o.gallery_object);
7779                if (o.gallery_object ) {
7780                    if(typeof(o.gallery_object.get(0))!='undefined'){
7781                        o.gallery_object.get(0).videoEnd();
7782                    }
7783
7784                }
7785                if (o.parent_player) {
7786                    if(o.parent_player.get(0)){
7787
7788                        console.info(o.parent_player.get(0));
7789                        o.parent_player.get(0).api_ad_end();
7790                    }
7791
7792                }
7793
7794            }
7795            function handleResize(e, pargs) {
7796                // console.log('vplayer triggered resize',e,pargs);
7797                //return;
7798
7799
7800
7801                var margs = {
7802                    'force_resize_gallery' : false
7803                    ,'call_from' : 'default'
7804                };
7805
7806                if(pargs){
7807                    margs = $.extend(margs,pargs);
7808                }
7809
7810
7811
7812
7813
7814                videoWidth = cthis.width();
7815                videoHeight = cthis.height();
7816
7817
7818
7819
7820                if(margs.call_from=='recheck_sizes'){
7821
7822                    // console.info('recheck_sizes player', Math.abs(last_videoHeight-videoHeight), Math.abs(last_videoWidth-videoWidth));
7823                    if(Math.abs(last_videoHeight-videoHeight)<4 && Math.abs(last_videoWidth-videoWidth)<4){
7824
7825
7826                        return false;
7827                    }
7828
7829                }
7830
7831                last_videoWidth = videoWidth;
7832                last_videoHeight = videoHeight;
7833
7834
7835                //console.info(cthis, o.responsive_ratio, isNaN(o.responsive_ratio), videoWidth, videoHeight);
7836
7837                //console.info(cthis, o.is_ad);
7838                // console.info('responsive_ratio', o.responsive_ratio, auxh);
7839                if(isNaN(o.responsive_ratio)===false && o.responsive_ratio>0){
7840                    var auxh = o.responsive_ratio * videoWidth;
7841
7842
7843                    // console.warn(o.gallery_object, (cthis.hasClass('currItem') && o.is_ad!='on'), margs.force_resize_gallery)
7844                    if(o.gallery_object && ( (cthis.hasClass('currItem') && o.is_ad!='on') || margs.force_resize_gallery)  ){
7845                        //console.warn("RESIZE IT!",cthis, auxh , o.responsive_ratio, videoWidth, videoHeight);
7846                        if(o.gallery_object.get(0) && o.gallery_object.get(0).api_responsive_ratio_resize_h){
7847                            o.gallery_object.addClass('responsive-ratio-smooth');
7848                            o.gallery_object.get(0).api_responsive_ratio_resize_h(auxh, {
7849                                caller: cthis
7850                            });
7851                        }
7852                    }else{
7853                        //console.info('single player', o.responsive_ratio);
7854
7855                        //console.warn(o);
7856
7857                        if(o.is_ad!='on'){
7858
7859                            cthis.height(o.responsive_ratio * cthis.width());
7860                        }
7861                    }
7862                }
7863                if (is_ios()) {
7864                    //ios has a nasty bug wbhen the parent is scaled - iframes scale too
7865                    if (undefined != _vgparent) {
7866                        var aux = (_vgparent.get(0).var_scale);
7867                        //console.log(cthis);
7868                        //cthis.children('iframe').width((1/aux) * videoWidth); cthis.children('iframe').height((1/aux) * videoHeight);
7869
7870                    }
7871                }
7872
7873
7874
7875
7876                if(videoWidth<600){
7877                    cthis.addClass('under-600');
7878
7879                    if(o.design_skin=='skin_aurora'){
7880                        o.design_scrubbarWidth = original_scrubwidth - 10;
7881                    }
7882
7883
7884
7885                    if(videoWidth<421){
7886                        cthis.addClass('under-420');
7887
7888                        if(o.design_skin=='skin_aurora'){
7889                            o.design_scrubbarWidth = original_scrubwidth - 10;
7890                        }
7891                    }else{
7892                        cthis.removeClass('under-420');
7893                        if(o.design_skin=='skin_aurora'){
7894                            o.design_scrubbarWidth = original_scrubwidth ;
7895                        }
7896                    }
7897                }else{
7898                    cthis.removeClass('under-600');
7899                    if(o.design_skin=='skin_aurora'){
7900                        o.design_scrubbarWidth = original_scrubwidth ;
7901                    }
7902                }
7903
7904
7905
7906                if (is_fullscreen === 1) {
7907                    ww = $(window).width();
7908                    wh = window.innerHeight;
7909                    resizePlayer(ww, wh);
7910
7911
7912                    cthis.css('transform', '');
7913                    currScale = 1;
7914                } else {
7915
7916                    //console.info(cthis, videoWidth,videoHeight);
7917                    resizePlayer(videoWidth, videoHeight);
7918                }
7919
7920            }
7921            function handleKeyPress(e) {
7922                //-check if space is pressed for pause
7923
7924                console.info(e, e.which, e.charCode);
7925
7926                if (mouseover ){
7927                    if(e.charCode==27){
7928                        setTimeout(function(){
7929                            console.info("ESC KEY");
7930                            calculateDims();
7931                        },100);
7932                    }
7933                    if(e.charCode == 32) {
7934                        onPlayPause();
7935
7936                        e.stopPropagation();
7937                        e.preventDefault();
7938                    }
7939                }
7940            }
7941
7942            function vimeo_windowMessage(e) {
7943                //--- we receive iframe messages from vimeo here
7944                var data, method;
7945                //console.log(e);
7946
7947                if (e.origin != 'https://player.vimeo.com' && e.origin != 'http://player.vimeo.com') {
7948                    return;
7949                }
7950                vimeo_url = '';
7951                vimeo_url = $(video).attr('src').split('?')[0];
7952
7953                if(String(vimeo_url).indexOf('http')!=0){
7954                    vimeo_url = 'https:'+vimeo_url;
7955                }
7956
7957                //console.info('vimeo_url',vimeo_url);
7958                try {
7959                    data = JSON.parse(e.data);
7960                    method = data.event || data.method;
7961                }
7962                catch (e) {
7963                    //fail silently... like a ninja!
7964                }
7965
7966
7967                //if(cthis.attr)
7968                if (data.player_id && dataSrc != data.player_id.substr(11)) {
7969                    return;
7970                }
7971
7972                if (data != undefined) {
7973                    if (data.event == 'ready') {
7974                        //console.log(cthis);
7975                        if (autoplay == 'on') {
7976                            // -- we don't force play Movie because we already set autoplay to 1 on the iframe
7977                            //playMovie();
7978                        }
7979                        vimeo_data = {
7980                            "method": "addEventListener",
7981                            "value": "finish"
7982                        };
7983
7984                        //console.info(vimeo_url);
7985                        if(video && video.contentWindow&&vimeo_url){
7986
7987                            video.contentWindow.postMessage(JSON.stringify(vimeo_data), vimeo_url);
7988                        }
7989                        vimeo_data = {
7990                            "method": "addEventListener",
7991                            "value": "playProgress"
7992                        };
7993
7994                        //console.info(vimeo_url);
7995                        if(video && video.contentWindow&&vimeo_url){
7996
7997                            video.contentWindow.postMessage(JSON.stringify(vimeo_data), vimeo_url);
7998                        }
7999
8000                        //if(video){
8001                        //
8002                        //    video.addEvent('pause', function(){
8003                        //        console.info('paUSE!!!');
8004                        //    });
8005                        //}
8006
8007
8008                        cthis.addClass('dzsvp-loaded');
8009                        if (o.gallery_object != null) {
8010                            if (typeof(o.gallery_object.get(0)) != 'undefined') {
8011                                o.gallery_object.get(0).api_video_ready();
8012                            }
8013                        }
8014
8015
8016                    }
8017                    if (data.event == 'playProgress') {
8018                        initial_played = true;
8019
8020
8021                    }
8022                    if (data.event == 'finish') {
8023                        handleVideoEnd();
8024                    }
8025                }
8026            }
8027            function onPlayPause() {
8028
8029                //console.log(busy_playpause_mistake, 'onPlayPause', paused);
8030                if(busy_playpause_mistake){
8031                    return false;
8032                }
8033
8034
8035                busy_playpause_mistake=true;
8036
8037                if(inter_clear_playpause_mistake){
8038                    clearTimeout(inter_clear_playpause_mistake);
8039                }
8040                inter_clear_playpause_mistake = setTimeout(function(){
8041                    busy_playpause_mistake = false;
8042                }, 300);
8043                //return;
8044
8045                if (o.type == 'youtube' && video.getPlayerState && (video.getPlayerState() == 2||video.getPlayerState() == -1)) {
8046                    paused = true;
8047                }
8048
8049//                    console.info('playpause', paused);
8050                if (paused) {
8051                    playMovie({
8052                        'call_from':'onPlayPause'
8053                    });
8054                } else {
8055                    pauseMovie({
8056                        'call_from':'onPlayPause'
8057                    });
8058                }
8059
8060
8061            }
8062
8063
8064
8065            function onFullScreen(e) {
8066                // -- is_fullscreenscreen trigger event
8067                // console.info('click fullscreen');
8068
8069
8070                var aux = cthis.get(0);
8071                var _t = $(this);
8072                //totalWidth= $(window).width()
8073                //totalHeight= $(window).height()
8074
8075                videoWidth = cthis.outerWidth();
8076                videoHeight = cthis.outerHeight();
8077
8078                // console.info(e, is_fullscreen);
8079                //console.log(_t, _t.parent().parent().parent().parent().parent())
8080
8081                // console.info(is_fullscreen, document.fullscreenEnabled, document.msFullscreenEnabled);
8082                // if (document.fullscreenEnabled) {
8083                //     is_fullscreen = 1;
8084                // } else if (document.mozFullscreenEnabled) {
8085                //     is_fullscreen = 1;
8086                // } else if (document.webkitFullscreenEnabled) {
8087                //     is_fullscreen = 1;
8088                // }else if (document.msFullscreenEnabled) {
8089                //     is_fullscreen = 1;
8090                // }
8091
8092                // console.info(is_fullscreen);
8093
8094                if(is_ios() && o.touch_play_inline=='off'){
8095                    playMovie({
8096                        'call_from':'onfullscreen ios'
8097                    });
8098                    return false;
8099                }
8100
8101                if (is_fullscreen == 0) {
8102
8103                    is_fullscreen = 1;
8104
8105                    cthis.addClass('is_fullscreen');
8106                    cthis.addClass('is-fullscreen');
8107
8108                    if(is_ios() && video.webkitEnterFullscreen){
8109
8110                        video.webkitEnterFullscreen();
8111                        return false;
8112                    }
8113
8114                    var elem = aux;
8115                    // console.info(elem, elem.requestFullScreen, elem.msRequestFullscreen);
8116                    if (elem.requestFullScreen) {
8117                        elem.requestFullScreen();
8118                    } else if (elem.mozRequestFullScreen) {
8119                        elem.mozRequestFullScreen();
8120                    } else if (elem.webkitRequestFullScreen) {
8121                        elem.webkitRequestFullScreen();
8122                    }else if (elem.msRequestFullscreen) {
8123                        elem.msRequestFullscreen();
8124                    } else {
8125                        if(o.gallery_object){
8126                            o.gallery_object.find('.the-logo').hide();
8127                            o.gallery_object.find('.gallery-buttons').hide();
8128                        }
8129
8130                    }
8131
8132                    //jQuery('body').css('overflow', 'hidden');
8133                    totalWidth= window.screen.width;
8134                    totalHeight= window.screen.height;
8135                    //console.log(totalWidth, totalHeight);
8136
8137                    resizePlayer(totalWidth,totalHeight);
8138                    /*
8139                     cthis.css({
8140                     'position' : 'fixed',
8141                     'z-index' : 9999,
8142                     'left' : '0px',
8143                     'top' : '0px'
8144                     //,'width': totalWidth
8145                     //,'height': totalHeight
8146                     })
8147                     if(cthis.find('.audioImg').length>0){
8148                     cthis.find('.audioImg').css({
8149                     'width' : totalWidth
8150                     ,'height' : totalHeight
8151                     })
8152                     }
8153                     */
8154
8155                    if(is_ie()){
8156                        setTimeout(handleResize, 300);
8157                    }
8158
8159
8160
8161                    if(o.design_skin=='skin_reborn') {
8162                        cthis.find('.full-tooltip').eq(0).html('EXIT FULLSCREEN');
8163                    }
8164
8165
8166
8167
8168                    fullscreen_just_pressed = true;
8169
8170                    setTimeout(function(){
8171                        fullscreen_just_pressed = false
8172                    },700)
8173
8174                    // console.info(o.settings_disable_mouse_out, o.settings_disable_mouse_out_for_fullscreen, o.settings_mouse_out_delay_for_fullscreen)
8175                    if(o.settings_disable_mouse_out!='on' && o.settings_disable_mouse_out_for_fullscreen!='on') {
8176
8177                        clearTimeout(inter_removeFsControls);
8178                        inter_removeFsControls = setTimeout(control
8178s_mouse_is_out, o.settings_mouse_out_delay_for_fullscreen);
8179                    }
8180
8181                    if (o.gallery_object) {
8182                        //dispatchEvent('goFullscreen');
8183                        //_t.parent().parent().parent().parent().parent().turnFullscreen();
8184
8185                        if (o.gallery_object != null) {
8186                            //o.videoGalleryCon.turnFullscreen();
8187                        }
8188                    }
8189
8190                } else {
8191
8192                    //console.info('ceva');
8193                    is_fullscreen = 0;
8194                    cthis.addClass('remove_fullscreen');
8195                    cthis.removeClass('is_fullscreen');
8196                    cthis.removeClass('is-fullscreen');
8197                    var elem = document;
8198                    if (elem.cancelFullScreen) {
8199                        elem.cancelFullScreen();
8200                    } else if (elem.exitFullscreen) {
8201                        elem.exitFullscreen();
8202                    }else if (elem.mozCancelFullScreen) {
8203                        elem.mozCancelFullScreen();
8204                    } else if (elem.webkitCancelFullScreen) {
8205                        elem.webkitCancelFullScreen();
8206                    } else if (elem.msExitFullscreen) {
8207                        elem.msExitFullscreen();
8208                    }
8209
8210                    if(o.design_skin=='skin_reborn') {
8211                        cthis.find('.full-tooltip').eq(0).html('FULLSCREEN');
8212                    }
8213
8214
8215
8216                    //console.info(cthis, videoWidth,videoHeight);
8217                    resizePlayer(videoWidth, videoHeight);
8218
8219
8220                    if(is_ie() || is_firefox()){
8221                        setTimeout(handleResize, 300);
8222                    }
8223                    if(is_ie() ){
8224                        setTimeout(handleResize, 1000);
8225                    }
8226
8227
8228                }
8229            }
8230
8231            function resizePlayer(warg, harg) {
8232                //console.log(cthis);
8233
8234
8235                calculateDims(warg, harg);
8236
8237                //console.log(warg);
8238
8239//                console.log(_scrubBg, warg, o.design_scrubbarWidth, (warg + o.design_scrubbarWidth));
8240
8241                if(the_player_id=='debug-video'){
8242
8243                    //console.info(cthis, the_player_id, warg, o.design_scrubbarWidth);
8244                }
8245
8246                //console.info(cthis, warg, o.design_scrubbarWidth);
8247                _scrubBg.css({
8248                    'width' : (warg + o.design_scrubbarWidth)
8249                });
8250
8251                if(o.design_skin=='skin_aurora'){
8252                    _scrubBg.css({
8253                        'width' : '100%'
8254                    });
8255                }
8256
8257                scrubbg_width = _scrubBg.width();
8258
8259
8260                infoPosX = parseInt(controlsDiv.find('.infoText').css('left'));
8261                infoPosY = parseInt(controlsDiv.find('.infoText').css('top'));
8262            }
8263
8264
8265            function calculateDims(warg, harg){
8266
8267                // console.info('vplayer calculateDims()', warg, harg, o.design_skin);
8268                if(o.design_skin!='skin_bigplay'){
8269                    /*
8270                     controlsDiv.find('.background').css({
8271                     'width': warg + parseInt(o.design_background_offsetw)
8272                     })
8273                     */
8274                }
8275
8276                if(o.design_skin=='skin_white'){
8277                    cthis.find('.controls .background').css({
8278                        'width' : (warg - 95)
8279                    })
8280                }
8281
8282                /*
8283                 controlsDiv.css({
8284                 'width': warg
8285                 });
8286                 */
8287            }
8288
8289            function check_if_ad_must_be_played(){
8290
8291                console.info('check_if_ad_must_be_played()', o.gallery_object, cthis.attr('data-adsource'), cthis.data('adplayed'));
8292                if(cthis.attr('data-adsource') && cthis.data('adplayed')!='on'){
8293
8294
8295
8296                    if(is_ios()){
8297                        setTimeout(function(){
8298                            console.info("PAUSE VIDEO FOR AD")
8299                            pauseMovie({
8300                                'call_from':'check_if_ad_must_be_played'
8301                            });
8302
8303                            if(o.type=='youtube'){
8304                                video.stopVideo();
8305                            }
8306
8307                            seek_to_perc(0);
8308                            // if(video && video.webkitExitFullScreen){
8309                            //
8310                            //     video.webkitExitFullScreen();
8311                            //     document.webkitExitFullscreen();
8312                            // }
8313                        },1000);
8314                    }
8315
8316
8317                    if(o.gallery_object && o.gallery_object.get(0) && o.gallery_object.get(0).api_setup_ad){
8318
8319                        o.gallery_object.get(0).api_setup_ad(cthis);
8320
8321                        cthis.data('adplayed','on');
8322
8323                        has_ad_to_play = false;
8324
8325                        return false;
8326                    }
8327
8328                }
8329
8330            }
8331
8332            function playMovie(pargs) {
8333                //console.info('playMovie() - ',pargs, cthis);
8334                //console.info(o.type);
8335
8336
8337                var margs = {
8338                    'call_from': 'default'
8339                };
8340
8341                if(pargs){
8342                    margs = $.extend(margs,pargs);
8343                }
8344
8345                play_commited = true;
8346                if(cthis.hasClass('dszvp-loaded')==false){
8347                    setTimeout(function(){
8348                        // -- check if play still commited
8349
8350                        console.info('check if play still commited - ',play_commited, cthis);
8351                        if(play_commited){
8352
8353                            playMovie(margs);
8354                        }
8355                    },500);
8356                    return false;
8357                }
8358
8359                if(margs.call_from=='play_only_on_desktop'){
8360                    if(is_mobile()){
8361                        return false;
8362                    }
8363                }
8364
8365
8366
8367                cthis.find('.cover-image').fadeOut('fast');
8368
8369
8370
8371                // console.warn('playMovie()', cthis, o.type,paused, initial_played, margs);
8372
8373                if(o.settings_disableVideoArray!='on'){
8374                    for(var i=0;i< dzsvp_players_arr.length;i++){
8375//                        console.info(dzsvp_players_arr);
8376                        if(dzsvp_players_arr[i].get(0).externalPauseMovie!=undefined){
8377                            dzsvp_players_arr[i].get(0).externalPauseMovie({
8378                                'call_from':'external_pauseMovie()'
8379                            });
8380                        }
8381                    }
8382                }
8383
8384                // check_if_ad_must_be_played();
8385
8386
8387
8388
8389                if (o.type == 'vimeo') {
8390                    vimeo_data = {
8391                        "method": "play"
8392                    };
8393                    //console.info('ceva',vimeo_url);
8394
8395                    if(video&&video.contentWindow&&vimeo_url){
8396
8397                        video.contentWindow.postMessage(JSON.stringify(vimeo_data), vimeo_url);
8398                    }
8399
8400
8401                }
8402                //return;
8403
8404
8405
8406                if(o.try_to_pause_zoomsounds_players=='on'){
8407                    //console.info(dzsap_list);
8408                    for (i = 0; i < dzsap_list.length; i++) {
8409
8410                        //                    console.info(!is_ie8(), dzsap_list[i].get(0), typeof dzsap_list[i].get(0)!="undefined", typeof dzsap_list[i].get(0).api_pause_media!="undefined")
8411                        if (!is_ie8() && typeof dzsap_list[i].get(0) != "undefined" && typeof dzsap_list[i].get(0).api_pause_media != "undefined" && dzsap_list[i].get(0) != cthis.get(0)) {
8412
8413                            //console.info('try to pause', dzsap_list[i].get(0),dzsap_list[i].data('type_audio_stop_buffer_on_unfocus'))
8414                            if (dzsap_list[i].data('type_audio_stop_buffer_on_unfocus') && dzsap_list[i].data('type_audio_stop_buffer_on_unfocus') == 'on') {
8415                                dzsap_list[i].get(0).api_destroy_for_rebuffer();
8416                            } else {
8417
8418                                dzsap_list[i].get(0).api_pause_media({
8419                                    'audioapi_setlasttime': false
8420                                });
8421                            }
8422                            window.dzsap_player_interrupted_by_dzsvg = dzsap_list[i].get(0);
8423                        }
8424                    }
8425                }
8426
8427                playMovie_visual();
8428//                console.info(cthis, 'playmovie', video, o.type);;
8429
8430                if (o.type == 'normal' || o.type == 'audio'|| o.type == 'dash'){
8431                    video.play();
8432                }
8433                if (o.type == 'youtube'){
8434
8435
8436
8437                    //yt_qualCurr = video.getPlaybackQuality();
8438                    //
8439                    //console.info(yt_qualCurr);
8440
8441
8442                    if(paused==false){
8443                        return false;
8444                    }
8445
8446                    if(video.playVideo!=undefined && video.getPlayerState && video.getPlayerState!=1){
8447                        video.playVideo();
8448                    }
8449                }
8450
8451
8452
8453                wasPlaying = true;
8454                paused=false;
8455                initial_played=true;
8456                //console.log(wasPlaying);
8457
8458                cthis.trigger('videoPlay');
8459
8460
8461                check_one_sec();
8462
8463
8464                //console.info(o.action_video_view);
8465                if(o.action_video_view){
8466                    if(view_sent == false){
8467                        o.action_video_view(cthis,video_title);
8468                        view_sent = true;
8469                    }
8470                }
8471
8472
8473
8474            }
8475
8476            function playMovie_visual(){
8477
8478                //console.warn("playMovie_visual()");
8479
8480
8481                // playcontrols.children().eq(0).fadeOut('fast');
8482                // playcontrols.children().eq(2).fadeIn('fast');
8483                //
8484                // if(cthis.hasClass('skin_aurora')==false && cthis.hasClass('skin_bigplay')==false && cthis.hasClass('skin_pro')==false){
8485                //
8486                //     playcontrols.children().eq(1).fadeOut('fast');
8487                //     playcontrols.children().eq(3).fadeIn('fast');
8488                // }
8489
8490
8491                cthis.addClass('first-played');
8492
8493
8494
8495                if (o.settings_disableControls != 'on') {
8496                }
8497
8498                if(o.google_analytics_send_play_event=='on' && window._gaq && google_analytics_sent_play_event==false){
8499                    //if(window.console){ console.info( 'sent event'); }
8500                    window._gaq.push(['_trackEvent', 'Video Gallery Play', 'Play', 'video gallery play - '+cthis.attr('data-source')]);
8501                    google_analytics_sent_play_event = true;
8502                }
8503
8504
8505                if(o.settings_disable_mouse_out!='on'){
8506
8507
8508
8509                    if(is_android()){
8510                        clearTimeout(inter_removeFsControls);
8511                        inter_removeFsControls = setTimeout(controls_mouse_is_out, o.settings_mouse_out_delay_for_fullscreen);
8512                    }
8513
8514                }
8515
8516
8517                cthis.addClass('is-playing');
8518                if(o.gallery_object && o.gallery_object.get(0) && o.gallery_object.get(0).api_played_video){
8519                    o.gallery_object.get(0).api_played_video();
8520                }
8521
8522            }
8523
8524            function pauseMovie_visual(){
8525
8526                //
8527                // if(cthis.hasClass('skin_aurora')==false && cthis.hasClass('skin_bigplay')==false && cthis.hasClass('skin_pro')==false){
8528                //
8529                //     playcontrols.children().eq(1).fadeIn('fast');
8530                //     playcontrols.children().eq(3).fadeOut('fast');
8531                // }
8532                //
8533                // playcontrols.children().eq(2).fadeOut('fast');
8534                // playcontrols.children().eq(0).fadeIn('fast');
8535
8536
8537
8538
8539
8540
8541            }
8542
8543            function pauseMovie(pargs) {
8544
8545                //console.info(o.type, paused);
8546                //if(o.type!='vimeo' && paused==true){
8547                //    return;
8548                //}
8549
8550                //console.info('initial_played', initial_played);
8551
8552                var margs = {
8553                    'call_from': 'default'
8554                };
8555
8556                if(pargs){
8557                    margs = $.extend(margs,pargs);
8558                }
8559
8560
8561
8562
8563                play_commited = false;
8564                if(o.try_to_pause_zoomsounds_players=='on'){
8565                    if(window.dzsap_player_interrupted_by_dzsvg){
8566
8567                        window.dzsap_player_interrupted_by_dzsvg.api_play_media({
8568                            'audioapi_setlasttime': false
8569                        });
8570                        window.dzsap_player_interrupted_by_dzsvg = null;
8571                    }
8572                }
8573
8574                 //console.warn('pauseMovie() - ', cthis, o.type,paused, initial_played, margs);
8575
8576                if(initial_played==false){
8577                    return false;
8578                }
8579                suspend_state_2_for_loop = true;
8580                setTimeout(function(){
8581                    suspend_state_2_for_loop = false;
8582                },1500);
8583
8584                //console.info(initial_played);
8585
8586                pauseMovie_visual();
8587
8588                if (o.type == 'normal' || o.type == 'audio' || o.type=='dash') {
8589                    if(video!=undefined){
8590                        video.pause();
8591                    }else{
8592                        if(window.console != undefined){ console.info('warning: video undefined') };
8593                    }
8594                }
8595                if (o.type == 'youtube') {
8596                    //return false;
8597
8598                    //console.info('pause YOUTUBE',video ,video.pauseVideo);
8599
8600                    if (video && video.pauseVideo) {
8601
8602                        try {
8603                            video.pauseVideo();
8604                        } catch (err) {
8605                            if (window.console) {
8606                                console.log(err);
8607                            }
8608                        }
8609//                        console.info('pauseMovie',video, video.pauseVideo, paused);
8610                    }
8611                }
8612
8613                if (o.type == 'vimeo') {
8614                    //if (/Opera/.test(navigator.userAgent)) {
8615                    //    return;
8616                    //}
8617                    vimeo_data = {
8618                        "method": "pause"
8619                    };
8620
8621                    if(vimeo_url) {
8622                        try {
8623                            video.contentWindow.postMessage(JSON.stringify(vimeo_data), vimeo_url);
8624
8625                            //console.info(vimeo_data, vimeo_url);
8626                            wasPlaying = false;
8627                            paused=true;
8628                        } catch (err) {
8629                            if (window.console) {
8630                                console.log(err);
8631                            }
8632                        }
8633                    }
8634                    return;
8635                }
8636
8637
8638                wasPlaying = false;
8639                paused=true;
8640
8641                mouse_is_over();
8642
8643                cthis.removeClass('is-playing');
8644            }
8645
8646            function reinit_cover_image(){
8647
8648                cthis.find('.cover-image').fadeIn('fast');
8649            }
8650
8651            //console.log(cthis);
8652            try {
8653                cthis.get(0).checkYoutubeState = function() {
8654                    if (o.type == 'youtube' && video.getPlayerState != undefined) {
8655                        //console.log("ceva", cthis, video.getPlayerState());
8656                        if (video.getPlayerState && video.getPlayerState() == 0) {
8657                            handleVideoEnd();
8658                        }
8659                    }
8660                }
8661
8662            } catch (err) {
8663                if (window.console)
8664                    console.log(err);
8665            }
8666            /*
8667             window.checkYoutubeState=function(){
8668             // - we check if video youtube has ended so we can go to the next one
8669
8670             }
8671             */
8672
8673        }); // end each
8674
8675    }
8676
8677
8678    window.dzsvp_init = function(selector, settings) {
8679        //console.info($(selector), settings);
8680
8681
8682        if(typeof(settings)!="undefined" && typeof(settings.init_each)!="undefined" && settings.init_each==true ){
8683            var element_count = 0;
8684            for (var e in settings) { element_count++; }
8685            if(element_count==1){
8686                settings = undefined;
8687            }
8688
8689            $(selector).each(function(){
8690                var _t = $(this);
8691                _t.vPlayer(settings)
8692            });
8693        }else{
8694            $(selector).vPlayer(settings);
8695        }
8696
8697
8698    };
8699
8700
8701})(jQuery);
8702
8703
8704
8705
8706if(typeof window.onYouTubePlayerReady=='function'){
8707    window.backup_onYouTubePlayerReady = window.onYouTubePlayerReady;
8708}
8709window.onYouTubePlayerReady = function onYouTubePlayerReady(playerId) {
8710    //alert('ytready')
8711    //alert(playerId)
8712
8713
8714
8715
8716//    console.info('ytready', playerId);
8717
8718    var aux_objectid = playerId;
8719    var aux_videoid = playerId.substr(8);
8720
8721//        console.info(youtubeid_array);
8722
8723//        console.info(auxerid, document.getElementById(aux_objectid), aux_videoid);
8724    for(var i=0;i<youtubeid_array.length;i++){
8725        if(youtubeid_array[i].id == aux_videoid){
8726            if(youtubeid_array[i].nrtimes>0){
8727                aux_objectid+='_clone'+youtubeid_array[i].nrtimes;
8728            }
8729        }
8730    }
8731
8732//        console.info(aux_objectid, document.getElementById(aux_objectid))
8733
8734
8735    ytplayer = document.getElementById(aux_objectid);
8736
8737
8738    var _t = jQuery(ytplayer);
8739    if(_t.hasClass('treated')){
8740        return;
8741    }
8742    _t.addClass('treated');
8743
8744    //console.log(ytplayer);
8745    ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
8746    var aux2 = _t.attr('data-suggestedquality');
8747    //console.log(aux2);
8748    ytplayer.loadVideoById(aux_videoid, 0, aux2);
8749    ytplayer.pauseVideo();
8750
8751
8752
8753
8754};
8755
8756
8757window.requestAnimFrame = (function(){
8758    return  window.requestAnimationFrame       ||
8759        window.webkitRequestAnimationFrame ||
8760        window.mozRequestAnimationFrame    ||
8761        function( callback ){
8762            window.setTimeout(callback, 1000 / 60);
8763        };
8764})();
8765
8766
8767jQuery(document).ready(function($){
8768//    --- mega conflict with mediaelement.js, well workaround by treating untreated flash items
8769
8770    var inter_check_treat = 0;
8771
8772    clearTimeout(inter_check_treat);
8773    inter_check_treat = setTimeout(workaround_treatuntretreadItems, 2000);
8774
8775    function workaround_treatuntretreadItems(){
8776
8777
8778        jQuery('.js-api-player:not(.treated)').each(function(){
8779            var _t = jQuery(this);
8780            var __t = _t.get(0);
8781//            console.info(_t, __t);
8782
8783            var playerId = _t.attr('id');
8784
8785            var aux = playerId.substr(8);
8786            var aux2 = _t.attr('data-suggestedquality');
8787            //console.log(aux2);
8788
8789            if(typeof __t.loadVideoById !='undefined'){
8790                __t.loadVideoById(aux, 0, aux2);
8791                __t.pauseVideo();
8792            }else{
8793
8794                inter_check_treat = setTimeout(workaround_treatuntretreadItems, 2000);
8795            }
8796
8797
8798        })
8799
8800    }
8801
8802    if(typeof window.onYouTubePlayerReady=='function' && typeof backup_onYouTubePlayerReady == 'undefined'){
8803        window.backup_onYouTubePlayerReady = window.onYouTubePlayerReady;
8804    }
8805
8806    window.onYouTubePlayerReady = function onYouTubePlayerReady(playerId) {
8807        //alert('ytready')
8808        //alert(playerId)
8809
8810
8811        //console.info('ytready', playerId);
8812
8813        var aux_objectid = playerId;
8814        var aux_videoid = playerId.substr(8);
8815
8816//        console.info(youtubeid_array);
8817
8818//        console.info(auxerid, document.getElementById(aux_objectid), aux_videoid);
8819        for(var i=0;i<youtubeid_array.length;i++){
8820            if(youtubeid_array[i].id == aux_videoid){
8821                if(youtubeid_array[i].nrtimes>0){
8822                    aux_objectid+='_clone'+youtubeid_array[i].nrtimes;
8823                }
8824            }
8825        }
8826
8827//        console.info(aux_objectid, document.getElementById(aux_objectid))
8828
8829
8830        ytplayer = document.getElementById(aux_objectid);
8831
8832
8833        var _t = jQuery(ytplayer);
8834
8835        if(_t.hasClass('treated')){
8836            return;
8837        }
8838        _t.addClass('treated');
8839
8840        //console.log(ytplayer);
8841        ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
8842        var aux2 = _t.attr('data-suggestedquality');
8843//        console.log(aux2, ytplayer);
8844        ytplayer.loadVideoById(aux_videoid, 0, aux2);
8845        ytplayer.pauseVideo();
8846
8847        if(typeof backup_onYouTubePlayerReady=='function'){
8848            backup_onYouTubePlayerReady(playerId);
8849        }
8850
8851    };
8852
8853
8854    $('.videogallery--navigation-outer').each(function(){
8855        var _t = $(this);
8856        var _tar = $(_t.attr('data-vgtarget')).eq(0);
8857        var _clip =_t.find('.videogallery--navigation-outer--clip').eq(0);
8858        var _clipmover =_t.find('.videogallery--navigation-outer--clipmover').eq(0);
8859
8860        var currPage = 0;
8861        var _block_active = _t.find('.videogallery--navigation-outer--bigblock.active').eq(0);
8862//        console.info(_tar);
8863
8864        var _navOuterBullets = _t.find('.navigation-outer--bullet');
8865        var _navOuterBlocks = _t.find('.videogallery--navigation-outer--block');
8866
8867        setTimeout(function(){
8868            _t.addClass('active');
8869            _block_active = _t.find('.videogallery--navigation-outer--bigblock.active').eq(0);
8870            _clip.height(_block_active.height());
8871        },500)
8872
8873        _navOuterBlocks.bind('click', function(){
8874            var _t2 = $(this);
8875            var ind = _navOuterBlocks.index(_t2);
8876
8877
8878//            console.info(ind);
8879
8880            if(_tar.get(0) && _tar.get(0).api_gotoItem){
8881                if(_tar.get(0).api_gotoItem(ind)){
8882                }
8883            }
8884        });
8885
8886        _navOuterBullets.bind('click',function(){
8887            var _t2 = $(this);
8888            var ind = _navOuterBullets.index(_t2);
8889
8890            gotoPage(ind);
8891
8892        })
8893
8894        function gotoPage(arg){
8895            var auxl = -(Number(arg)*100) + '%';
8896
8897            _navOuterBullets.removeClass('active');
8898            _navOuterBullets.eq(arg).addClass('active');
8899
8900            _t.find('.videogallery--navigation-outer--bigblock.active').removeClass('active');
8901            _t.find('.videogallery--navigation-outer--bigblock').eq(arg).addClass('active');
8902
8903
8904            _clip.height(_t.find('.videogallery--navigation-outer--bigblock').eq(arg).height());
8905
8906            _clipmover.css('left',auxl);
8907
8908        }
8909
8910
8911    })
8912});
8913
8914
8915
8916
8917jQuery(document).ready(function($){
8918    //console.info($('.zoomvideogallery.auto-init'));
8919    dzsvp_init('.vplayer-tobe.auto-init', {init_each: true});
8920    dzsvg_init('.videogallery.auto-init', {init_each: true});
8921
8922    //if (typeof window.onYouTubeIframeAPIReady!='undefined' && typeof backup_yt_iframe_ready=='undefined'){
8923    //    backup_yt_iframe_ready = window.onYouTubeIframeAPIReady;
8924    //}
8925    //
8926    //window.onYouTubeIframeAPIReady = function() {
8927    //
8928    //    dzszvp_yt_iframe_ready();
8929    //    if(backup_yt_iframe_ready){
8930    //        backup_yt_iframe_ready();
8931    //    }
8932    //}
8933
8934
8935    $(document).undelegate('.dzsas-second-con .read-more-label', 'click');
8936    $(document).delegate('.dzsas-second-con .read-more-label', 'click',function(e){
8937        // console.log(e);
8938
8939        var _t = $(this);
8940        var _con = _t.parent();
8941
8942        var _content = _con.children('.read-more-content').eq(0);
8943
8944        if(_con.hasClass('active')){
8945
8946            _content.animate({
8947                'height' : 0
8948            },{
8949                queue:false
8950                ,duration:300
8951                ,complete: function(e){
8952                    //console.info(this);
8953
8954                }
8955            })
8956
8957            _con.removeClass('active');
8958        }else{
8959            _content.css('height', 'auto');
8960
8961            var auxh = (_content.outerHeight());
8962
8963            _content.css('height', 0);
8964            _content.animate({
8965                'height' : auxh
8966            },{
8967                queue:false
8968                ,duration:300
8969                ,complete: function(e){
8970                    //console.info(this);
8971
8972                    $(this).css('height', 'auto');
8973                }
8974            })
8975
8976            _con.addClass('active');
8977
8978        }
8979
8980
8981        return false;
8982    })
8983});
8984
8985
8986function onytplayerStateChange(newState) {
8987//    console.log(jQuery(ytplayer).parent().get(0), "Player's new state: " + newState, ytplayer.getAvailableQualityLevels());
8988    if(typeof(jQuery(ytplayer).parent().get(0))!='undefined'){
8989        try {
8990            jQuery(ytplayer).parent().get(0).checkYoutubeState();
8991        } catch (err) {
8992            if (window.console){
8993                console.log(err);
8994            }
8995        }
8996    }
8997
8998    //console.log(newState);
8999    //window.checkYoutubeState();
9000    //- we send the on end event to the gallery if it has one
9001    newState = parseInt(newState, 10);
9002    if (newState == 0) {
9003        //console.log(jQuery(ytplayer))
9004        //jQuery(ytplayer).parent().get(0).handleVideoEnd();
9005    }
9006
9007    window.onYouTubeIframeAPIReady = function() {
9008        dzsvp_yt_iframe_ready();
9009    }
9010}
9011
9012function dzsvp_yt_iframe_ready(){
9013
9014    _global_youtubeIframeAPIReady = true;
9015}
9016
9017window.onYouTubeIframeAPIReady = function() {
9018    dzsvp_yt_iframe_ready();
9019}
9020
9021function onYouTubeIframeAPIReady() {
9022}
9023
9024
9025function can_translate() {
9026    if (is_chrome() || is_safari()) {
9027        return true;
9028    }
9029    if (is_firefox() && version_firefox() > 10) {
9030        return true;
9031    }
9032    return false;
9033}
9034
9035function can_history_api() {
9036    return !!(window.history && history.pushState);
9037}
9038function is_ios() {
9039    //return true;
9040    return ((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) || (navigator.platform.indexOf("iPad") != -1)
9041    );
9042}
9043
9044function is_android() {
9045    //return true;
9046
9047
9048    var ua = navigator.userAgent.toLowerCase();
9049    // console.info(ua);
9050    return (ua.indexOf("android") > -1);
9051}
9052
9053function is_ie() {
9054    if (navigator.appVersion.indexOf("MSIE") != -1) {
9055        return true;    }; return false;
9056}
9057;
9058function is_firefox() {
9059    if (navigator.userAgent.indexOf("Firefox") != -1) {        return true;    };
9060    return false;
9061}
9062;
9063function is_opera() {
9064    if (navigator.userAgent.indexOf("Opera") != -1) {        return true;    };
9065    return false;
9066}
9067;
9068function is_chrome() {
9069    return navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
9070}
9071;
9072function is_safari() {
9073    return navigator.userAgent.toLowerCase().indexOf('safari') > -1;
9074}
9075;
9076function version_ie() {
9077    return parseFloat(navigator.appVersion.split("MSIE")[1]);
9078}
9079;
9080function version_firefox() {
9081    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
9082        var aversion = new Number(RegExp.$1); return(aversion);
9083    }
9084    ;
9085}
9086;
9087function version_opera() {
9088    if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
9089        var aversion = new Number(RegExp.$1); return(aversion);
9090    }
9091    ;
9092}
9093;
9094function is_ie8() {
9095    if (is_ie() && version_ie() < 9) {  return true;  };
9096    return false;
9097}
9098function is_ie9() {
9099    if (is_ie() && version_ie() == 9) {
9100        return true;
9101    }
9102    return false;
9103}
9104
9105function get_query_arg(purl, key){
9106    if(purl.indexOf(key+'=')>-1){
9107        //faconsole.log('testtt');
9108        var regexS = "[?&]"+key + "=.+";
9109        var regex = new RegExp(regexS);
9110        var regtest = regex.exec(purl);
9111        //console.info(regtest);
9112
9113        if(regtest != null){
9114            var splitterS = regtest[0];
9115            if(splitterS.indexOf('&')>-1){
9116                var aux = splitterS.split('&');
9117                splitterS = aux[1];
9118            }
9119            //console.log(splitterS);
9120            var splitter = splitterS.split('=');
9121            //console.log(splitter[1]);
9122            //var tempNr = ;
9123
9124            return splitter[1];
9125
9126        }
9127        //$('.zoombox').eq
9128    }
9129}
9130
9131function add_query_arg(purl, key,value){
9132    key = encodeURIComponent(key); value = encodeURIComponent(value);
9133
9134    var s = purl;
9135    var pair = key+"="+value;
9136
9137    var r = new RegExp("(&|\\?)"+key+"=[^\&]*");
9138
9139    s = s.replace(r,"$1"+pair);
9140    //console.log(s, pair);
9141    if(s.indexOf(key + '=')>-1){
9142
9143
9144    }else{
9145        if(s.indexOf('?')>-1){
9146            s+='&'+pair;
9147        }else{
9148            s+='?'+pair;
9149        }
9150    }
9151    //if(!RegExp.$1) {s += (s.length>0 ? '&' : '?') + kvp;};
9152
9153
9154    //if value NaN we remove this field from the url
9155    if(value=='NaN'){
9156        var regex_attr = new RegExp('[\?|\&]'+key+'='+value);
9157        s=s.replace(regex_attr, '');
9158    }
9159
9160    return s;
9161}
9162
9163function can_play_mp3(){
9164    var a = document.createElement('audio');
9165    return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
9166}
9167function can_play_mp4(){
9168    var a = document.createElement('video');
9169    return !!(a.canPlayType && a.canPlayType('video/mp4;').replace(/no/, ''));
9170}
9171
9172
9173//time, begin, change( f-b ), duration
9174function global_ease_in(t, b, c, d) {
9175
9176    return -c *(t/=d)*(t-2) + b;
9177
9178};
9179function is_mobile() {
9180    //return true;
9181    return is_ios() || is_android();
9182}
9183
9184function is_touch_device() {
9185    //return true;
9186    return !!('ontouchstart' in window);
9187}
9188
9189
9190jQuery.fn.urlParam = function (arg, name) {
9191    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(arg);
9192    return (results !== null) ? results[1] : 0;
9193}
9194
9195
9196window.dzsvg_wp_send_view = function(argcthis, argtitle){
9197    //console.info(argcthis, argtitle);
9198
9199
9200
9201    var data = {
9202        video_title: argtitle
9203        ,dzsvg_curr_user: window.dzsvg_curr_user
9204    };
9205
9206    var theajaxurl = 'index.php?action=ajax_dzsvg_submit_view';
9207
9208    if(window.dzsvg_site_url){
9209
9210        theajaxurl = dzsvg_settings.dzsvg_site_url + theajaxurl;
9211    }
9212
9213
9214    jQuery.ajax({
9215        type: "POST",
9216        url: theajaxurl,
9217        data: data,
9218        success: function(response) {
9219            if(typeof window.console != "undefined" ){ console.log('Ajax - submit view - ' + response); }
9220
9221
9222
9223        },
9224        error:function(arg){
9225            if(typeof window.console != "undefined" ){ console.warn('Got this from the server: ' + arg); };
9226        }
9227    });
9228
9229
9230}
9231window.dzsvg_wp_send_contor_10_secs = function(argcthis, argtitle){
9232
9233    var data = {
9234        video_title: argtitle
9235        ,dzsvg_curr_user: window.dzsvg_curr_user
9236    };
9237    var theajaxurl = 'index.php?action=ajax_dzsvg_submit_contor_10_secs';
9238
9239    if(window.dzsvg_site_url){
9240
9241        theajaxurl = dzsvg_settings.dzsvg_site_url + theajaxurl;
9242    }
9243
9244
9245
9246    jQuery.ajax({
9247        type: "POST",
9248        url: theajaxurl,
9249        data: data,
9250        success: function(response) {
9251            if(typeof window.console != "undefined" ){ console.log('Ajax - submit view - ' + response); }
9252
9253
9254
9255        },
9256        error:function(arg){
9257            if(typeof window.console != "undefined" ){ console.warn('Got this from the server: ' + arg); };
9258        }
9259    });
9260}
9261
9262
9263window.dzsvg_open_social_link = function(arg){
9264    var leftPosition, topPosition;
9265    var w = 500, h= 500;
9266
9267    arg = arg.replace("{{replacewithcurrurl}}",encodeURIComponent(window.location.href));
9268    //Allow for borders.
9269    leftPosition = (window.screen.width / 2) - ((w / 2) + 10);
9270    //Allow for title and status bars.
9271    topPosition = (window.screen.height / 2) - ((h / 2) + 50);
9272    var windowFeatures = "status=no,height=" + h + ",width=" + w + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
9273    window.open(arg,"sharer", windowFeatures);
9274}
9275
9276
9277function get_base_url_arr(){
9278
9279
9280
9281    var scripts = document.getElementsByTagName("script");
9282
9283
9284    for(var i23 in scripts){
9285        if(scripts[i23] && scripts[i23].src && String(scripts[i23].src).indexOf('vplayer.js')>-1){
9286
9287            break;
9288        }
9289    }
9290    var baseUrl_arr = String(scripts[i23].src).split('/');
9291
9292    return baseUrl_arr;
9293}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.