1/* 2Plugin Name: VidoRev Extensions 3Author: BeeTeam368 4Author URI: http://themeforest.net/user/beeteam368 5Version: 2.9.9.9.7.9 6License: Themeforest Licence 7License URI: http://themeforest.net/licenses 8*/ 9 10var vidorev_builder_control = null; 11 12var imdb = {}; 13imdb.rating = {}; 14imdb.rating.run = function(values){ 15 if(typeof(values)==='object' && typeof(values.resource)==='object' && typeof(vidorev_builder_control)!=="undefined" && vidorev_builder_control!==null){ 16 vidorev_builder_control.imdb_rating_html(values.resource); 17 } 18} 19 20;(function(factory) { 21 if(typeof define === 'function' && define.amd){ 22 define(['jquery'], factory); 23 }else if (typeof exports !== 'undefined'){ 24 module.exports = factory(require('jquery')); 25 }else{ 26 factory(jQuery); 27 } 28}(function($){ 29 'use strict'; 30 31 var prefix = 'vidorev_plugin'; 32 var vidorev_plugin = window.vidorev_plugin || {}; 33 34 vidorev_plugin = (function(){ 35 function vidorev_plugin(el, options){ 36 var _ = this; 37 38 _.defaults = { 39 40 } 41 42 if(typeof(options)==='object'){ 43 _.options = $.extend({}, _.defaults, options); 44 }else{ 45 _.options = _.defaults; 46 } 47 48 _.global_youtube_API_ready = false; 49 _.global_live_yt_ready = 1; 50 51 _.$el = $(el); 52 53 _.global_scroll_bar_lib = 'malihu'; 54 if(typeof(vidorev_jav_js_object)!=='undefined' && typeof(vidorev_jav_js_object.scrollbar_library)!=='undefined' && vidorev_jav_js_object.scrollbar_library == 'overlay'){ 55 _.global_scroll_bar_lib = 'overlay'; 56 } 57 58 _.init(); 59 } 60 61 return vidorev_plugin; 62 }()); 63 64 /*init function [Core]*/ 65 vidorev_plugin.prototype.init = function(){ 66 var _ = this; 67 68 _.like_action(); 69 _.shortcode_slider_calc_width(); 70 _.shortcode_slider(); 71 _.filter_tab_responsive(); 72 _.filter_action(); 73 _.next_paged_action(); 74 _.imdb_rating_jsonp(); 75 _.videoPreview(); 76 _.youtubePreviewBroadcasts(); 77 _.youtubeBroadcastsPrevNextRefresh(); 78 _.youtubeBroadcastsTriggerFirstLoad(); 79 _.vidorev_video_report(); 80 _.vidorev_channel_subscribe(); 81 _.vidorev_cf7_select2(); 82 _.show_more_videos(); 83 _.get_playlist_by_user_login(); 84 _.front_end_edit_post(); 85 _.front_end_delete_post(); 86 _.series_dropdown_menu(); 87 _.document_control(); 88 _.advance_search(); 89 _.ads_settings(); 90 _.tmdb_block_render(); 91 _.youtube_live_video(); 92 93 _.window_resize(); 94 _.window_load(); 95 96 /*init*/ 97 _.$el.trigger(prefix+'init', [_]);/*init*/ 98 }/*init function [Core]*/ 99 100 vidorev_plugin.prototype.like_action = function(){ 101 var _ = this; 102 103 _.$el.off('.vpLikeAction').on('click.vpLikeAction', '.like-action-control', function(){ 104 var $t = $(this), 105 id = $.trim($t.attr('data-id')), 106 task_action = $.trim($t.attr('data-action')), 107 $likeaction = _.$el.find('.like-action-control'); 108 109 if($t.find('.login-req').length>0){ 110 return false; 111 } 112 113 var data = { 114 'action': 'like_action_query', 115 'post_id': id, 116 'task_action': task_action, 117 'security': vidorev_jav_js_object.security, 118 } 119 120 $likeaction.addClass('loading-ajax'); 121 $t.addClass('add-load-icon'); 122 123 $.ajax({ 124 type: 'POST', 125 url: vidorev_jav_js_object.admin_ajax, 126 cache: false, 127 data: data, 128 dataType: 'json', 129 success: function(data, textStatus, jqXHR){ 130 if(typeof(data) === 'object'){ 131 if(data.error == 0){ 132 $likeaction.removeClass('active-item-sub'); 133 if(data.has_voted==1){ 134 $('.like-action-control[data-id="'+(id)+'"][data-action="like"]').addClass('active-item-sub'); 135 }else if(data.has_voted==-1){ 136 $('.like-action-control[data-id="'+(id)+'"][data-action="dislike"]').addClass('active-item-sub'); 137 } 138 139 $('.like-count[data-id="'+(id)+'"]').text(data.like_count); 140 $('.dislike-count[data-id="'+(id)+'"]').text(data.dislike_count); 141 $('.like-count-full[data-id="'+(id)+'"]').text(data.like_count_full.toLocaleString()); 142 $('.dislike-count-full[data-id="'+(id)+'"]').text(data.dislike_count_full.toLocaleStr
142ing()); 143 144 var likebar_percent = 0; 145 if(parseFloat(data.like_count_full) + parseFloat(data.dislike_count_full) == 0 || parseFloat(data.like_count_full) + parseFloat(data.dislike_count_full) < 0){ 146 likebar_percent = 0; 147 }else{ 148 likebar_percent = parseFloat(data.like_count_full) / (parseFloat(data.like_count_full) + parseFloat(data.dislike_count_full)) * 100; 149 } 150 $('.like-dislike-bar-percent-control').css({'width':(likebar_percent)+'%'}); 151 }else{ 152 $('body').trigger('vidorev_like_dislike_error', [$t, task_action, $likeaction, data]); 153 } 154 155 $likeaction.removeClass('loading-ajax'); 156 $t.removeClass('add-load-icon'); 157 } 158 }, 159 error: function( jqXHR, textStatus, errorThrown ){ 160 } 161 }); 162 }); 163 } 164 165 vidorev_plugin.prototype.window_load = function(){ 166 var _ = this; 167 $(window).on('load', function(){ 168 169 /*action*/ 170 /*action*/ 171 172 }); 173 } 174 175 vidorev_plugin.prototype.document_control = function(){ 176 var _ = this; 177 $(document).on('click', function(e){ 178 var $target = $(e.target); 179 if(!$target.closest('.series-dropdown-control').length && $('.series-dropdown-control').is(":visible")) { 180 $('.series-dropdown-control').removeClass('active-item'); 181 } 182 }); 183 } 184 185 vidorev_plugin.prototype.window_resize = function(){ 186 var _ = this, 187 default_width = window.innerWidth; 188 189 $(window).on('resize', function(){ 190 if(default_width === window.innerWidth){ 191 return; 192 } 193 194 /*action*/ 195 _.shortcode_slider_calc_width(); 196 /*action*/ 197 198 default_width = window.innerWidth; 199 }); 200 } 201 202 vidorev_plugin.prototype.shortcode_slider_calc_width = function(){ 203 var _ = this; 204 205 var $fs = $('body.main-layout-boxed .page-slider-header.full-width-slider'), 206 wW = window.innerWidth, 207 w = $(window).width(); 208 209 if(wW >= 576 && wW < 768){ 210 $fs.css({'margin-left':((540-w)/2)+'px', 'margin-right':((540-w)/2)+'px', 'max-width':(w)+'px'}); 211 }else if(wW >= 768 && wW < 992){ 212 $fs.css({'margin-left':((720-w)/2)+'px', 'margin-right':((720-w)/2)+'px', 'max-width':(w)+'px'}); 213 }else if(wW >= 992 && wW < 1200){ 214 $fs.css({'margin-left':((930-w)/2)+'px', 'margin-right':((930-w)/2)+'px', 'max-width':(w)+'px'}); 215 }else if(wW>=1200){ 216 $fs.css({'margin-left':((1140-w)/2)+'px', 'margin-right':((1140-w)/2)+'px', 'max-width':(w)+'px'}); 217 }else{ 218 $fs.css({'margin-left':'0', 'margin-right':'0', 'max-width':'none'}); 219 } 220 } 221 222 vidorev_plugin.prototype.shortcode_slider = function(){ 223 var _ = this; 224 225 _.$el.find('.is-shortcode-slider:not(.ready-setup)').each(function(index, element){ 226 var $t = $(this), 227 p = $.parseJSON($t.attr('data-params')), 228 $sync = $('.'+(p['rnd_class'])).find('.sync-slider-small-control'); 229 230 $t.addClass('ready-setup'); 231 232 var options = { 233 arrows:false, 234 dots: false, 235 infinite: true, 236 speed: 500, 237 slidesToShow: 1, 238 adaptiveHeight: true, 239 focusOnSelect: false, 240 prevArrow: '<button class="slick-prev slick-arrow" aria-label="Previous" type="button"><i class="fa fa-angle-left" aria-hidden="true"></i></button>', 241 nextArrow: '<button class="slick-next slick-arrow" aria-label="Next" type="button"><i class="fa fa-angle-right" aria-hidden="true"></i></button>', 242 }; 243 244 if(p['fade']=='yes'){ 245 options['fade'] = true; 246 } 247 248 if(p['arrows']){ 249 options['arrows'] = true; 250 } 251 252 if(p['dots']){ 253 options['dots'] = true; 254 } 255 256 if(p['autoplay']!=0 && parseFloat(p['autoplay'])>0){ 257 options['autoplay'] = true; 258 options['autoplaySpeed'] = p['autoplay']; 259 } 260 261 switch(p['layout']){ 262 case 'slider-1': 263 if($t.find('.slide-item').length<2){ 264 return; 265 } 266 break; 267 268 case 'slider-2': 269 if($t.find('.slide-item').length<2){ 270 return; 271 } 272 break; 273 274 case 'slider-3': 275 break; 276 277 case 'slider-4': 278 options['asNavFor'] = $sync; 279 break; 280 281 case 'slider-5': 282 options['slidesToShow'] = 3; 283 options['centerMode'] = true; 284 options['centerPadding'] = '15%'; 285 options['responsive'] = [ 286 { 287 breakpoint: 2181, 288 settings: { 289 slidesToShow: 2, 290 centerPadding: '18%', 291 } 292 }, 293 { 294 breakpoint: 1601, 295 settings: { 296 slidesToShow: 2, 297 centerPadding: '15%', 298 } 299 }, 300 { 301 breakpoint: 1025, 302 settings: { 303 slidesToShow: 2, 304 centerPadding: '80px', 305 } 306 }, 307 { 308 breakpoint: 992, 309 settings: { 310 slidesToShow: 2, 311 centerPadding: '60px', 312 } 313 }, 314 { 315 breakpoint: 768, 316 settings: { 317 slidesToShow: 1, 318 centerPadding: '40px', 319 } 320 }, 321 { 322 breakpoint: 481, 323 settings: { 324 slidesToShow: 1, 325 centerPadding: '15px', 326 } 327 }, 328 ]; 329 break; 330 331 case 'slider-6': 332 options['slidesToShow'] = 4; 333 options['slidesToScroll'] = 4; 334 options['responsive'] = [ 335 { 336 breakpoint: 1200, 337 settings: { 338 slidesToShow: 3, 339 slidesToScroll: 3, 340 } 341 }, 342 { 343 breakpoint: 992, 344 settings: { 345 slidesToShow: 2, 346 slidesToScroll: 2, 347 } 348 }, 349 { 350 breakpoint: 576, 351 settings: { 352 slidesToShow: 1, 353 slidesToScroll: 1, 354 } 355 }, 356 ]; 357 358 if(_.$el.hasClass('fullwidth-mode-enable')){ 359 options['slidesToShow'] = 6; 360 options['slidesToScroll'] = 6; 361 options['responsive'] = [ 362 { 363 breakpoint: 2000, 364 settings: { 365 slidesToShow: 5, 366 slidesToScroll: 5, 367 } 368 }, 369 { 370 breakpoint: 1580, 371 settings: { 372 slidesToShow: 4, 373 slidesToScroll: 4, 374 } 375 }, 376 { 377 breakpoint: 1200, 378 settings: { 379 slidesToShow: 3, 380 slidesToScroll: 3, 381 } 382 }, 383 { 384 breakpoint: 992, 385 settings: { 386 slidesToShow: 2, 387 slidesToScroll: 2, 388 } 389 }, 390 { 391 breakpoint: 576, 392 settings: { 393 slidesToShow: 1, 394 slidesToScroll: 1, 395 } 396 }, 397 ]; 398 } 399 break; 400 401 case 'slider-7': 402 break; 403 404 case 'slider-8': 405 options['slidesToShow'] = 3; 406 options['responsive'] = [ 407 { 408 breakpoint: 1200, 409 settings: { 410 slidesToShow: 2, 411 } 412 }, 413 { 414 breakpoint: 768, 415 settings: { 416 slidesToShow: 1, 417 slidesToScroll: 1, 418 } 419 }, 420 ]; 421 422 if(_.$el.hasClass('fullwidth-mode-enable')){ 423 options['slidesToShow'] = 5; 424 options['responsive'] = [ 425 { 426 breakpoint: 2000, 427 settings: { 428 slidesToShow: 4, 429 } 430 }, 431 { 432 breakpoint: 1580, 433 settings: { 434 slidesToShow: 3, 435 } 436 }, 437 { 438 breakpoint: 1200, 439 settings: { 440 slidesToShow: 2, 441 } 442 }, 443 { 444 breakpoint: 768, 445 settings: { 446 slidesToShow: 1, 447 slidesToScroll: 1, 448 } 449 }, 450 ]; 451 } 452 break; 453 case 'slider-9': 454 if(_.global_scroll_bar_lib === 'malihu'){ 455 $t.mCustomScrollbar({ 456 axis: 'x', 457 alwaysShowScrollbar:0, 458 scrollInertia: 120, 459 });
460 }else{ 461 var instance = $t.overlayScrollbars({ 462 overflowBehavior:{ 463 x:'scroll', 464 y:'hidden', 465 }, 466 }).overlayScrollbars(); 467 468 var scrollValue = instance.scroll().position.x; 469 var scrollDirection; 470 var scrollSmoothness = 10; 471 var scrollAmount = 100; 472 var animationLoop = function() { 473 var currScroll = instance.scroll().position.x; 474 var delta = scrollValue - currScroll; 475 var easedValue = parseInt(currScroll + (delta / Math.max(1, scrollSmoothness))); 476 if(easedValue === currScroll){ 477 easedValue += delta > 0 ? 1 : -1; 478 } 479 if(delta !== 0) { 480 instance.scroll({ x:easedValue }); 481 requestAnimationFrame(animationLoop); 482 } 483 }; 484 $(instance.getElements().viewport).mousewheel(function(event, delta) { 485 if(event.originalEvent.deltaX === 0) { 486 var factor = delta < 0 ? -1 : 1; 487 var directionChanged = scrollDirection != factor; 488 var amount = scrollAmount * factor; 489 var root = directionChanged ? instance.scroll().position.x : scrollValue; 490 scrollValue = Math.max(0, Math.min(instance.scroll().max.x, root - amount)) 491 scrollDirection = factor; 492 animationLoop(); 493 event.preventDefault(); 494 } 495 }); 496 } 497 return; 498 break; 499 500 case 'slider-10': 501 if($t.find('.slide-item').length<2){ 502 return; 503 } 504 break; 505 } 506 507 $t.on('init', function(event, slick){ 508 if(p['layout']==='slider-4'){ 509 _.$el.on('vidorev_themeside_menu_action', function(e){ 510 $t.slick('reinit'); 511 _.$el.off('vidorev_themeside_menu_action'); 512 console.log('Resize Slider'); 513 }); 514 } 515 }); 516 517 $t.find('img.ul-normal-effect').addClass('img-effect-setup img-loaded'); 518 $t.slick(options); 519 520 if($sync.length > 0){ 521 522 $sync.find('img.ul-normal-effect').addClass('img-effect-setup img-loaded'); 523 524 var opt_small_sync_slider = { 525 slidesToShow: 4, 526 slidesToScroll: 1, 527 asNavFor: $t, 528 arrows:false, 529 dots: false, 530 focusOnSelect: true, 531 responsive:[ 532 { 533 breakpoint: 1200, 534 settings: { 535 slidesToShow: 3, 536 slidesToScroll: 1, 537 } 538 }, 539 { 540 breakpoint: 992, 541 settings: { 542 slidesToShow: 2, 543 slidesToScroll: 1, 544 } 545 }, 546 { 547 breakpoint: 576, 548 settings: { 549 slidesToShow: 1, 550 slidesToScroll: 1, 551 centerMode: true, 552 } 553 }, 554 ] 555 } 556 557 if(_.$el.hasClass('fullwidth-mode-enable')){ 558 opt_small_sync_slider.slidesToShow = 6; 559 opt_small_sync_slider.responsive = [ 560 { 561 breakpoint: 2000, 562 settings: { 563 slidesToShow: 5, 564 slidesToScroll: 1, 565 } 566 }, 567 { 568 breakpoint: 1580, 569 settings: { 570 slidesToShow: 4, 571 slidesToScroll: 1, 572 } 573 }, 574 { 575 breakpoint: 1200, 576 settings: { 577 slidesToShow: 3, 578 slidesToScroll: 1, 579 } 580 }, 581 { 582 breakpoint: 992, 583 settings: { 584 slidesToShow: 2, 585 slidesToScroll: 1, 586 } 587 }, 588 { 589 breakpoint: 576, 590 settings: { 591 slidesToShow: 1, 592 slidesToScroll: 1, 593 centerMode: true, 594 } 595 }, 596 ]; 597 } 598 599 $sync.slick(opt_small_sync_slider); 600 601 } 602 }); 603 604 } 605 606 vidorev_plugin.prototype.filter_tab_responsive = function(){ 607 var _ = this; 608 609 $('.filter-container-control:not(.ready-setup)').each(function(index, element) { 610 var $t = $(this), 611 elm_index = 'priority-wrapper-index-'+index+'rnd'+(Math.floor((Math.random() * 999) + 1)), 612 title_width = 0; 613 614 $t.addClass('ready-setup').attr('id', elm_index); 615 616 var $elm_index = $('#'+(elm_index)), 617 css = ''; 618 619 $('<style id="css-'+elm_index+'" type="text/css"></style>').appendTo('head'); 620 621 title_width = $elm_index.find('.block-title-control').outerWidth(true) + 60; 622 css = '#'+elm_index+' .filter-items-control{min-width:calc(100% - '+title_width+'px); min-width:-webkit-calc(100% - '+title_width+'px); min-width:-ms-calc(100% - '+title_width+'px); min-width:-moz-calc(100% - '+title_width+'px);}}'; 623 $('#css-'+elm_index).html(css); 624 625 var nav = priorityNav.init({ 626 mainNavWrapper : '#'+(elm_index)+' .filter-items-control', 627 mainNav : '.filter-items-wrapper-control', 628 navDropdownLabel : '<span class="responsive-button"></span><span class="responsive-line"></span>', 629 navDropdownBreakpointLabel : '<span class="responsive-button"></span><span class="responsive-line"></span>', 630 navDropdownClassName : 'nav__dropdown', 631 navDropdownToggleClassName : 'nav__dropdown-toggle', 632 breakPoint : 0, 633 }); 634 635 }); 636 } 637 638 vidorev_plugin.prototype.filter_action = function(){ 639 var _ = this; 640 641 _.$el.off('.filterActionControl').on('click.filterActionControl', '.filter-action-control', function(e){
642 var $t = $(this), 643 $parent = $t.parents('.sc-blocks-container-control'), 644 idParams = $.trim($parent.attr('data-id')), 645 $nextAction = $parent.find('.next-prev-action[data-action="next"]'), 646 $prevAction = $parent.find('.next-prev-action[data-action="prev"]'), 647 $pnControl = $parent.find('.bl-page-prev-next-control'); 648 649 if(idParams!='' && typeof(vidorev_layouts_query_params)!=='undefined' && typeof(vidorev_layouts_query_params[idParams]!=='undefined')){ 650 var params = vidorev_layouts_query_params[idParams]; 651 652 params['data_ajax'] = 'yes'; 653 params['filter'] = $.trim($t.attr('data-id')); 654 params['tax'] = $.trim($t.attr('data-taxonomy')); 655 params['paged'] = 1; 656 657 if(params['filter']=='' || params['tax']==''){ 658 return false; 659 } 660 661 $parent.addClass('container-loading').find('.filter-action-control').removeClass('active-item'); 662 $t.addClass('active-item'); 663 664 if($('.nav__dropdown.show', $parent).length>0 || $('.nav__dropdown-toggle.is-open', $parent).length>0){ 665 $('.nav__dropdown.show', $parent).removeClass('show'); 666 $('.nav__dropdown-toggle.is-open', $parent).removeClass('is-open'); 667 } 668 669 if($('.blog-wrapper-control[data-item="'+(params['filter'])+'"]', $parent).length>0){ 670 setTimeout(function(){ 671 672 $parent.find('.blog-wrapper-control').removeClass('active-item'); 673 674 $('.blog-wrapper-control[data-item="'+(params['filter'])+'"].current-paged', $parent).addClass('active-item'); 675 676 if($('.blog-wrapper-control[data-item="'+(params['filter'])+'"][data-end="yes"]', $parent).length>0 && $('.blog-wrapper-control[data-item="'+(params['filter'])+'"]', $parent).length==1){ 677 678 $pnControl.hide(); 679 680 }else{ 681 682 var $block_active_check = $('.blog-wrapper-control[data-item="'+(params['filter'])+'"].active-item.current-paged', $parent); 683 684 if($block_active_check.attr('data-end') == 'yes'){ 685 686 $nextAction.addClass('disabled-query'); 687 688 }else{ 689 690 $nextAction.removeClass('disabled-query'); 691 692 } 693 694 if($block_active_check.attr('data-paged') == '1'){ 695 696 $prevAction.addClass('disabled-query'); 697 698 }else{ 699 700 $prevAction.removeClass('disabled-query'); 701 702 } 703 704 $pnControl.show(); 705 } 706 707 $parent.removeClass('container-loading'); 708 709 }, 500); 710 711 return false; 712 } 713 714 var paramsRequest = { 715 'params': params, 716 'action': 'blockajaxaction', 717 'security': vidorev_jav_js_object.security, 718 }; 719 720 $.ajax({
721 url: vidorev_jav_js_object.admin_ajax, 722 type: 'POST', 723 data: paramsRequest, 724 dataType: 'html', 725 cache: false, 726 success: function(data){ 727 728 $parent.find('.blog-wrapper-control').removeClass('active-item'); 729 $parent.find('.block-filter-control').append(data); 730 731 var dataEnd = $parent.find('.blog-wrapper-control[data-item="'+(params['filter'])+'"].current-paged').attr('data-end'); 732 733 if(typeof(vidorev_builder_control)!=="undefined" && vidorev_builder_control!==null){ 734 vidorev_builder_control.imdb_rating_jsonp(); 735 } 736 737 if(typeof(window.vidorev_visible_image_opacity) !== 'undefined'){ 738 window.vidorev_visible_image_opacity(); 739 } 740 741 if(dataEnd=='yes' || data==''){ 742 743 $pnControl.hide(); 744 745 }else{ 746 747 $pnControl.show(); 748 749 } 750 751 $parent.find('.next-prev-action[data-action="prev"]').addClass('disabled-query'); 752 $parent.find('.next-prev-action[data-action="next"]').removeClass('disabled-query'); 753 754 $parent.removeClass('container-loading'); 755 756 }, 757 error: function(){ 758 759 $parent.removeClass('container-loading'); 760 761 }, 762 }); 763 } 764 }); 765 } 766 767 vidorev_plugin.prototype.next_paged_action = function(){ 768 var _ = this; 769 770 _.$el.off('.nextPagedAction').on('click.nextPagedAction', '.next-prev-action', function(e){ 771 var $t = $(this), 772 $parent = $t.parents('.sc-blocks-container-control'), 773 idParams = $.trim($parent.attr('data-id')), 774 $nextAction = $parent.find('.next-prev-action[data-action="next"]'), 775 $prevAction = $parent.find('.next-prev-action[data-action="prev"]'); 776 777 if(idParams!='' && typeof(vidorev_layouts_query_params)!=='undefined' && typeof(vidorev_layouts_query_params[idParams]!=='undefined')){ 778 var params = vidorev_layouts_query_params[idParams]; 779 780 params['data_ajax'] = 'yes'; 781 params['filter'] = $.trim($parent.find('.filter-action-control.active-item').attr('data-id')); 782 params['tax'] = $.trim($parent.find('.filter-action-control.active-item').attr('data-taxonomy')); 783 784 if(params['filter']=='' || params['tax']==''){ 785 params['filter'] = '0'; 786 params['tax'] = 'all'; 787 } 788 789 $parent.addClass('container-loading'); 790 791 if($('.nav__dropdown.show', $parent).length>0 || $('.nav__dropdown-toggle.is-open', $parent).length>0){ 792 $('.nav__dropdown.show', $parent).removeClass('show'); 793 $('.nav__dropdown-toggle.is-open', $parent).removeClass('is-open'); 794 } 795 796 var current_paged = 1; 797 var $current_paged = $parent.find('.blog-wrapper-control[data-item="'+(params['filter'])+'"].current-paged'); 798 799 if($current_paged.length>0){ 800 current_paged = parseFloat($current_paged.attr('data-paged')); 801 } 802 803 var f_paged = 1; 804 805 if($.trim($t.attr('data-action'))=='next'){ 806 f_paged = current_paged + 1; 807 }else{ 808 f_paged = current_paged - 1; 809 } 810 811 var $f_paged = $('.blog-wrapper-control[data-item="'+(params['filter'])+'"][data-paged="'+(f_paged)+'"]', $parent); 812 var $paged_in_filter = $('.blog-wrapper-control[data-item="'+(params['filter'])+'"]', $parent); 813 814 if($f_paged.length>0){ 815 816 setTimeout(function(){ 817 $paged_in_filter.removeClass('current-paged'); 818 $f_paged.addClass('active-item current-paged'); 819 820 if(f_paged==1){ 821 $prevAction.addClass('disabled-query'); 822 }else{ 823 $prevAction.removeClass('disabled-query'); 824 } 825 826 if($f_paged.attr('data-end')=='yes'){ 827 $nextAction.addClass('disabled-query'); 828 }else{ 829 $nextAction.removeClass('disabled-query'); 830 } 831 832 $parent.removeClass('container-loading'); 833 834 }, 500); 835 836 return false; 837 } 838 839 params['paged'] = f_paged; 840 841 var paramsRequest = { 842 'params': params, 843 'action': 'blockajaxaction', 844 'security': vidorev_jav_js_object.security, 845 }; 846 847 $.ajax({
848 url: vidorev_jav_js_object.admin_ajax, 849 type: 'POST', 850 data: paramsRequest, 851 dataType: 'html', 852 cache: false, 853 success: function(data){ 854 855 $paged_in_filter.removeClass('current-paged'); 856 $parent.find('.block-filter-control').append(data); 857 var dataEnd = $parent.find('.blog-wrapper-control[data-item="'+(params['filter'])+'"].active-item.current-paged').attr('data-end'); 858 859 if(typeof(vidorev_builder_control)!=="undefined" && vidorev_builder_control!==null){ 860 vidorev_builder_control.imdb_rating_jsonp(); 861 } 862 863 if(typeof(window.vidorev_visible_image_opacity) !== 'undefined'){ 864 window.vidorev_visible_image_opacity(); 865 } 866 867 if(dataEnd=='yes'){ 868 $nextAction.addClass('disabled-query'); 869 } 870 871 $prevAction.removeClass('disabled-query'); 872 873 $parent.removeClass('container-loading'); 874 875 }, 876 error: function(){ 877 878 $parent.removeClass('container-loading'); 879 880 }, 881 }); 882 } 883 }); 884 } 885 886 vidorev_plugin.prototype.imdb_rating_jsonp = function(){ 887 var _ = this; 888 $('.imdbRatingPlugin-control:not(.imdbRatingPlugin-ready)').each(function(index, element) { 889 890 var $t = $(this); 891 892 var dataTitle = $.trim($t.attr('data-title')); 893 var dataUser = $.trim($t.attr('data-user')); 894 var imdbdata = $.trim($t.attr('data-imdbdata')); 895 896 var fill_immdb_data = function(dataTitle, dataUser){ 897 $.ajax({
898 url: '//p.media-imdb.com/static-content/documents/v1/title/' + dataTitle + '/ratings%3Fjsonp=imdb.rating.run:imdb.api.title.ratings/data.json?u=' + dataUser, 899 type: 'POST', 900 dataType: 'jsonp', 901 cache: false 902 }); 903 } 904 905 if(typeof(dataTitle)!=='undefined' && typeof(dataUser)!=='undefined' && dataTitle!='' && dataUser!=''){ 906 907 $('.imdbRatingPlugin-control[data-title="'+(dataTitle)+'"]').addClass('imdbRatingPlugin-ready'); 908 909 if(typeof(imdbdata) !== 'undefined' && imdbdata!=''){ 910 911 try{ 912 imdbdata = JSON.parse(imdbdata); 913 }catch(error){ 914 fill_immdb_data(dataTitle, dataUser); 915 } 916 917 if(typeof(imdbdata.id)!=='undefined' && imdbdata.id!=''){ 918 _.imdb_rating_html(imdbdata); 919 }else{ 920 fill_immdb_data(dataTitle, dataUser); 921 } 922 }else{ 923 fill_immdb_data(dataTitle, dataUser); 924 } 925 926 } 927 928 }); 929 } 930 931 vidorev_plugin.prototype.imdb_rating_html = function(resource){ 932 var _ = this, 933 rating = typeof(resource.rating)==='number'?resource.rating:'NA', 934 imdb_logo_url = vidorev_jav_plugin_js_object.imdb_logo_url; 935 936 var imdb_logo = '<img class="imdb-logo" src="'+(imdb_logo_url)+'.png" sizes="(max-width: 38px) 100vw, 38px" srcset="'+(imdb_logo_url)+'.png 38w, '+(imdb_logo_url)+'_retina_2x.png 54w, '+(imdb_logo_url)+'_retina_3x.png 101w">' 937 938 var html = '<a href="//www.imdb.com'+(resource.id)+'" target="_blank">' 939 +(imdb_logo)+ 940 '<span class="rating">'+ 941 '<span class="rating-wrap">'+ 942 '<span class="rt-point h5">'+(rating)+'</span>'+ 943 '<span class="ofTen font-size-12"> / 10</span>'+ 944 '</span>'+ 945 '</span>'+ 946 '<i class="fa fa-star star" aria-hidden="true"></i>'+ 947 '</a>'; 948 949 $('.imdbRatingPlugin-control[data-title="'+(resource.id.split('/')[2])+'"]').html(html).addClass('imdbRatingStyle2'); 950 } 951 952 vidorev_plugin.prototype.setYoutubeAPIReady = function(vid_id){ 953 954 var _ = this, 955 prefix_vid_id = ''; 956 957 if(typeof(vid_id)!=='undefined'){ 958 prefix_vid_id = vid_id; 959 } 960 961 setTimeout(function(){ 962 if($('script[src*="youtube.com/iframe_api"]').length>0 || $('script[src*="www-widgetapi.js"]').length>0){ 963 964 var triggerInterval = setInterval(function(){ 965 if(typeof(YT)!=='undefined' && typeof(YT.Player)!=='undefined'){ 966 _.global_youtube_API_ready = true; 967 $(document).trigger(prefix+'youtubeAPIReadyPreview'+(prefix_vid_id), []); 968 clearInterval(triggerInterval); 969 } 970 },368); 971 972 }else{ 973 974 var you_API_YTdeferred = $.Deferred(); 975 976 window.onYouTubeIframeAPIReady = function(){ 977 you_API_YTdeferred.resolve(window.YT); 978 } 979 980 var tag = document.createElement('script'); 981 tag.src = "https://www.youtube.com/iframe_api"; 982 var firstScriptTag = document.getElementsByTagName('script')[0]; 983 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 984 985 you_API_YTdeferred.done(function(YT){ 986 _.global_youtube_API_ready = true; 987 $(document).trigger(prefix+'youtubeAPIReadyPreview'+(prefix_vid_id), []); 988 }); 989 } 990 },368); 991 } 992 993 vidorev_plugin.prototype.youtubeBroadcastsPrevNextRefresh = function(){ 994 var _ = this; 995 996 _.$el.off('.broadcastsPageToken').on('click.broadcastsPageToken', '.next-prev-action', function(e){ 997 var $t = $(this), 998 $broadcasts = $t.parents('.youtube-broadcast-control'), 999 broadcastsID= $broadcasts.attr('id'), 1000 action = $t.attr('data-action'), 1001 prevToken = $.trim($broadcasts.find('input.prev-page-token-control[type="hidden"]').val()), 1002 nextToken = $.trim($broadcasts.find('input.next-page-token-control[type="hidden"]').val()), 1003 pageToken = '', 1004 $wrap_data = $broadcasts.find('.blog-wrapper-control'); 1005 1006 if(action == 'prev'){ 1007 if(prevToken == ''){ 1008 return false; 1009 } 1010 1011 pageToken = prevToken; 1012 1013 }else if(action == 'next'){ 1014 if(nextToken == ''){ 1015 return false; 1016 } 1017 1018 pageToken = nextToken; 1019 } 1020 1021 if(pageToken == ''){ 1022 return false; 1023 } 1024 1025 if(typeof(vidorev_jav_plugin_js_object)==='undefined'){ 1026 return false; 1027 } 1028 1029 if(typeof(vidorev_jav_plugin_js_object.youtube_broadcasts_params)==='undefined'){ 1030 return false; 1031 } 1032 1033 if(typeof(vidorev_jav_plugin_js_object.youtube_broadcasts_params[broadcastsID])==='undefined'){ 1034 return false; 1035 } 1036 1037 var params = vidorev_jav_plugin_js_object.youtube_broadcasts_params[broadcastsID]; 1038 1039 if(typeof(params)!=='object'){ 1040 return false; 1041 } 1042 1043 $broadcasts.addClass('container-loading'); 1044 1045 params['pageToken'] = pageToken; 1046 params['ajax'] = true; 1047 1048 var newParamsRequest = { 1049 'action': 'vidorev_request_pagetoken_youtube_broadcasts', 1050 'params': params, 1051 'security': vidorev_jav_js_object.security, 1052 } 1053 1054 $.ajax({
1055 url: vidorev_jav_js_object.admin_ajax, 1056 type: 'POST', 1057 cache: false, 1058 dataType: 'html', 1059 data: newParamsRequest, 1060 success: function(data){ 1061 1062 if($.trim(data)==''){ 1063 $broadcasts.find('.next-prev-action[data-action="prev"]').removeClass('disabled-query'); 1064 $broadcasts.find('.next-prev-action[data-action="next"]').addClass('disabled-query'); 1065 1066 $broadcasts.removeClass('container-loading cache-load-fist'); 1067 return false; 1068 } 1069 1070 $wrap_data.html(data); 1071 1072 prevToken = $.trim($broadcasts.find('input.prev-page-token-control[type="hidden"]').val()); 1073 nextToken = $.trim($broadcasts.find('input.next-page-token-control[type="hidden"]').val()); 1074 1075 if(typeof(prevToken)!=='undefined' && prevToken!=''){ 1076 $broadcasts.find('.next-prev-action[data-action="prev"]').removeClass('disabled-query'); 1077 }else{ 1078 $broadcasts.find('.next-prev-action[data-action="prev"]').addClass('disabled-query'); 1079 } 1080 1081 if(typeof(nextToken)!=='undefined' && nextToken!=''){ 1082 $broadcasts.find('.next-prev-action[data-action="next"]').removeClass('disabled-query'); 1083 }else{ 1084 $broadcasts.find('.next-prev-action[data-action="next"]').addClass('disabled-query'); 1085 } 1086 1087 var currentVideoPlayer = $broadcasts.find('.player-video-control').attr('data-current-player-id'); 1088 if(typeof(currentVideoPlayer)!=='undefined' && currentVideoPlayer!=''){ 1089 $broadcasts.find('.youtube-item-control[data-current-player-id="'+(currentVideoPlayer)+'"]').addClass('is-player-active'); 1090 } 1091 1092 $broadcasts.removeClass('container-loading cache-load-fist'); 1093 1094 }, 1095 error: function(err){ 1096 $broadcasts.removeClass('container-loading cache-load-fist'); 1097 } 1098 }); 1099 }); 1100 1101 _.$el.off('.broadcastsRefresh').on('click.broadcastsRefresh', '.refresh-broadcasts-control', function(e){ 1102 var $t = $(this), 1103 $broadcasts = $t.parents('.youtube-broadcast-control'), 1104 broadcastsID= $broadcasts.attr('id'), 1105 $wrap_data = $broadcasts.find('.blog-wrapper-control'); 1106 1107 if(typeof(vidorev_jav_plugin_js_object)==='undefined'){ 1108 return false; 1109 } 1110 1111 if(typeof(vidorev_jav_plugin_js_object.youtube_broadcasts_params)==='undefined'){ 1112 return false; 1113 } 1114 1115 if(typeof(vidorev_jav_plugin_js_object.youtube_broadcasts_params[broadcastsID])==='undefined'){ 1116 return false; 1117 } 1118 1119 var params = vidorev_jav_plugin_js_object.youtube_broadcasts_params[broadcastsID]; 1120 1121 if(typeof(params)!=='object'){ 1122 return false; 1123 } 1124 1125 $t.find('i.fa-refresh').addClass('fa-spin'); 1126 $broadcasts.addClass('container-loading'); 1127 1128 if(typeof(params['pageToken'])!=='undefined' && params['pageToken']!=''){ 1129 delete params['pageToken']; 1130 } 1131 params['ajax'] = true; 1132 1133 var newParamsRequest = { 1134 'action': 'vidorev_request_pagetoken_youtube_broadcasts', 1135 'params': params, 1136 'security': vidorev_jav_js_object.security, 1137 } 1138 1139 $.ajax({ 1140 url: vidorev_jav_js_object.admin_ajax, 1141 type: 'POST', 1142 cache: false, 1143 dataType: 'html', 1144 data: newParamsRequest, 1145 success: function(data){ 1146 1147 $wrap_data.html(data); 1148 1149 var prevToken = $.trim($broadcasts.find('input.prev-page-token-control[type="hidden"]').val()); 1150 var nextToken = $.trim($broadcasts.find('input.next-page-token-control[type="hidden"]').val()); 1151 1152 if(typeof(prevToken)!=='undefined' && prevToken!=''){ 1153 $broadcasts.find('.next-prev-action[data-action="prev"]').removeClass('disabled-query'); 1154 }else{ 1155 $broadcasts.find('.next-prev-action[data-action="prev"]').addClass('disabled-query'); 1156 } 1157 1158 if(typeof(nextToken)!=='undefined' && nextToken!=''){ 1159 $broadcasts.find('.next-prev-action[data-action="next"]').removeClass('disabled-query'); 1160 }else{ 1161 $broadcasts.find('.next-prev-action[data-action="next"]').addClass('disabled-query'); 1162 } 1163 1164 var currentVideoPlayer = $broadcasts.find('.player-video-control').attr('data-current-player
1164-id'); 1165 if(typeof(currentVideoPlayer)!=='undefined' && currentVideoPlayer!=''){ 1166 $broadcasts.find('.youtube-item-control[data-current-player-id="'+(currentVideoPlayer)+'"]').addClass('is-player-active'); 1167 } 1168 1169 $broadcasts.removeClass('container-loading cache-load-fist'); 1170 $t.find('i.fa-refresh').removeClass('fa-spin'); 1171 1172 }, 1173 error: function(err){ 1174 $broadcasts.removeClass('container-loading cache-load-fist'); 1175 $t.find('i.fa-refresh').removeClass('fa-spin'); 1176 } 1177 }); 1178 1179 }); 1180 } 1181 1182 vidorev_plugin.prototype.youtubeBroadcastsTriggerFirstLoad = function(broadCastID){ 1183 var _ = this; 1184 1185 if(typeof(broadCastID)!=='undefined'){ 1186 1187 $('#'+(broadCastID)+' .refresh-broadcasts-control').trigger('click'); 1188 1189 }else{ 1190 1191 $('.cache-load-fist-control .refresh-broadcasts-control').trigger('click'); 1192 1193 } 1194 } 1195 1196 vidorev_plugin.prototype.check_contains = function(x, y, obj) { 1197 return (x >= obj.left && x <= obj.right && y >= obj.top && y <= obj.bottom); 1198 } 1199 1200 vidorev_plugin.prototype.videoPreview = function(){ 1201 var _ = this; 1202 1203 _.$el.off('.actionVideoPreview').on('mouseenter.actionVideoPreview', '.wrap_preview_control', function(e){ 1204 1205 var $t = $(this), 1206 $preview_container = $t.find('.preview-video-control'); 1207 1208 /* 1209 if($t.hasClass('is-mouseenter')){ 1210 return false; 1211 } 1212 */ 1213 $t.find('a').attr('title', ''); 1214 1215 if($preview_container.length == 0){ 1216 $t.addClass('fn-loaded'); 1217 return false; 1218 } 1219 1220 var imgpreview = $preview_container.attr('data-imgpreview'); 1221 var iframepreview = $preview_container.attr('data-iframepreview'); 1222 1223 if(typeof(imgpreview) === 'undefined' && typeof(iframepreview) === 'undefined'){ 1224 $t.addClass('fn-loaded'); 1225 return false; 1226 } 1227 1228 $t.addClass('is-mouseenter').find('.video-popup-control').append('<div class="notice-preview font-size-12 meta-font">'+(vidorev_jav_js_object.translate_loading_preview)+'</div>'); 1229 1230 var preview_img_interval = null; 1231 if(typeof(imgpreview) !== 'undefined' && imgpreview!='' && typeof(vidorev_jav_js_preview) && typeof(vidorev_jav_js_preview[imgpreview]) && Array.isArray(vidorev_jav_js_preview[imgpreview]) && $preview_container.find('div').length == 0){ 1232 var preview_container_id = 'preview_'+(imgpreview); 1233 $preview_container.html('').attr('id', preview_container_id); 1234 1235 $.each(vidorev_jav_js_preview[imgpreview], function(key, value){ 1236 $preview_container.append('<div>'+(value)+'</div>'); 1237 }); 1238 1239 var $all_preview_image = $preview_container.find('img'); 1240 var totalImages = $all_preview_image.length; 1241 var imagesLoaded = 0; 1242 1243 $all_preview_image.on('load', function(event) { 1244 imagesLoaded++; 1245 if (imagesLoaded == totalImages) { 1246 if(preview_img_interval!=null){ 1247 clearInterval(preview_img_interval); 1248 } 1249 $('#'+(preview_container_id)+' > div:gt(0)').hide(); 1250 preview_img_interval = setInterval(function() { 1251 $('#'+(preview_container_id)+' > div:first').slideUp(568).next().fadeIn(568).end().appendTo('#'+(preview_container_id)); 1252 }, 1368); 1253 $t.addClass('prevew-image-loaded fn-loaded').find('.notice-preview').remove(); 1254 } 1255 }); 1256 } 1257 1258 if(typeof(iframepreview) !== 'undefined' && iframepreview!='' && $t.hasClass('is-mouseenter') && $preview_container.find('iframe').length == 0){ 1259 var iframe = document.createElement('iframe'); 1260 iframe.onload = function() { 1261 $t.addClass('prevew-video-loaded').find('.notice-preview').remove(); 1262 } 1263 iframe.src = iframepreview; 1264 1265 $preview_container.append('<div class="overlay-video-none"></div>'); 1266 $preview_container.prepend(iframe); 1267 1268 1269 var $curr_iframe = $preview_container.find('iframe'); 1270 1271 var vidRescale = function(){ 1272 1273 var w = $preview_container.width()+3, 1274 h = $preview_container.height()+3; 1275 1276 if (w/h > 16/9){ 1277 $curr_iframe.css({'width': (w)+'px', 'height': (w/16*9)+'px'}); 1278 $curr_iframe.css({'left': '0px'}); 1279 } else { 1280 $curr_iframe.css({'width': (h/9*16)+'px', 'height': (h)+'px'}); 1281 $curr_iframe.css({'left': -($curr_iframe.outerWidth()-w)/2}); 1282 } 1283 } 1284 1285 vidRescale(); 1286 } 1287 1288 $t.off('.actionVideoPreviewLeave').on('mouseleave.actionVideoPreviewLeave', function(e){
1289 1290 /*if(_.check_contains(e.pageX, e.pageY, $t.get(0).getBoundingClientRect())){ 1291 console.log('faild'); 1292 return false; 1293 }*/ 1294 1295 $t.removeClass('is-mouseenter prevew-video-loaded prevew-image-loaded').find('.notice-preview').remove(); 1296 $preview_container.html(''); 1297 if(preview_img_interval!=null){ 1298 clearInterval(preview_img_interval); 1299 } 1300 1301 }); 1302 1303 }); 1304 } 1305 1306 vidorev_plugin.prototype.youtubePreviewBroadcasts = function(){ 1307 var _ = this; 1308 1309 _.$el.off('.broadcastsVideoAction').on('click.broadcastsVideoAction', '.open-live-video-control', function(e){ 1310 var $t = $(this), 1311 $wrap = $t.parents('.youtube-item-control'), 1312 youtube_video_id = $t.attr('data-video-id'), 1313 $broadcasts = $t.parents('.youtube-broadcast-control'), 1314 elem_id = ($broadcasts.attr('id'))+'br-player-'+(youtube_video_id), 1315 $playerControl = $broadcasts.find('.player-video-control'); 1316 1317 $broadcasts.find('.youtube-item-control').removeClass('is-player-active'); 1318 1319 $wrap.addClass('is-player-active').removeClass('is-mouseenter').find('.preview-video-control').removeClass('active-item').find('#'+(elem_id)).remove(); 1320 1321 $('html, body').stop().animate({scrollTop:($broadcasts.offset().top-$('#wpadminbar').height()-50)}, {duration:500}, function(){}); 1322 1323 $broadcasts.addClass('is-show-player'); 1324 1325 $playerControl.attr('data-current-player-id', youtube_video_id).find('iframe').remove(); 1326 $playerControl.attr('data-current-player-id', youtube_video_id).find('div[id]').remove(); 1327 1328 if($playerControl.attr('data-current-player-id') != youtube_video_id){ 1329 return false; 1330 } 1331 1332 $playerControl.append('<div id="'+(elem_id)+'"><div>'); 1333 1334 var $player = null, 1335 options = { 1336 enablejsapi: 1, 1337 html5: 1, 1338 wmode: 'transparent', 1339 modestbranding: 0, 1340 iv_load_policy: 3, 1341 autoplay: 1, 1342 playsinline: 1, 1343 rel: 0, 1344 showinfo: 0, 1345 controls: 1, 1346 mute: 0, 1347 } 1348 1349 var create_player = function(){ 1350 if($playerControl.attr('data-current-player-id') != youtube_video_id){ 1351 return false; 1352 } 1353 1354 $player = new YT.Player( 1355 elem_id, 1356 { 1357 videoId: youtube_video_id, 1358 playerVars: options, 1359 events: { 1360 'onReady': function(e){ 1361 e.target.unMute(); 1362 1363 if($playerControl.attr('data-current-player-id') != youtube_video_id){ 1364 return false; 1365 } 1366 _.$el.on('vidorev_themeopenLightBoxVideoEventTrigger', function(){ 1367 try{ 1368 $player.pauseVideo(); 1369 }catch(error){ 1370 /*no player*/ 1371 } 1372 });
1373 } 1374 } 1375 } 1376 ); 1377 } 1378 1379 if(!_.global_youtube_API_ready){ 1380 $(document).on(prefix+'youtubeAPIReadyPreview'+(elem_id), function(){ 1381 create_player(); 1382 }); 1383 _.setYoutubeAPIReady(elem_id); 1384 }else{ 1385 create_player(); 1386 } 1387 1388 $broadcasts.off('.broadcastsVideoMin').on('click.broadcastsVideoMin', '.broadcasts-min-control', function(e){ 1389 $broadcasts.find('.youtube-item-control[data-current-player-id="'+(youtube_video_id)+'"]').removeClass('is-player-active'); 1390 $broadcasts.removeClass('is-show-player'); 1391 $playerControl.attr('data-current-player-id', '').find('iframe').remove(); 1392 }); 1393 }); 1394 1395 _.$el.off('.broadcastsVideoPreview').on('mouseenter.broadcastsVideoPreview', '.youtube-preview-control', function(e){ 1396 var $t = $(this), 1397 $wrap = $t.parents('.youtube-item-control'), 1398 youtube_video_id = $t.attr('data-video-id'), 1399 $broadcasts = $t.parents('.youtube-broadcast-control'), 1400 elem_id = ($broadcasts.attr('id'))+'preview-'+(youtube_video_id), 1401 $player = null, 1402 $previewVideoControl = $t.find('.preview-video-control'); 1403 1404 $t.addClass('is-mouseenter'); 1405 1406 if(typeof(youtube_video_id)!=='undefined' && youtube_video_id!=''){ 1407 1408 var $player = null, 1409 options = { 1410 enablejsapi: 1, 1411 html5: 1, 1412 wmode: 'transparent', 1413 modestbranding: 0, 1414 iv_load_policy: 3, 1415 autoplay: 0, 1416 playsinline: 1, 1417 rel: 0, 1418 showinfo: 0, 1419 controls: 0, 1420 mute: 1, 1421 } 1422 1423 $previewVideoControl.prepend('<div id="'+(elem_id)+'"><div>'); 1424 1425 var create_player = function(){ 1426 $player = new YT.Player( 1427 elem_id, 1428 { 1429 videoId: youtube_video_id, 1430 playerVars: options, 1431 events: { 1432 'onReady': function(e){ 1433 e.target.mute(); 1434 setTimeout(function(){ 1435 if($t.hasClass('is-mouseenter') && !$wrap.hasClass('is-player-active')){ 1436 e.target.playVideo(); 1437 $previewVideoControl.addClass('active-item'); 1438 }else{ 1439 $t.removeClass('is-mouseenter'); 1440 1441 e.target.destroy(); 1442 $player = null; 1443 1444 $('#'+(elem_id)).remove(); 1445 $previewVideoControl.removeClass('active-item'); 1446 } 1447 }, 368); 1448 1449 } 1450 } 1451 } 1452 ); 1453 } 1454 1455 if(!_.global_youtube_API_ready){ 1456 $(document).on(prefix+'youtubeAPIReadyPreview'+(elem_id), function(){ 1457 create_player(); 1458 }); 1459 _.setYoutubeAPIReady(elem_id); 1460 }else{ 1461 create_player(); 1462 } 1463 1464 }else{ 1465 return false; 1466 } 1467 1468 $t.off('.broadcastsVideoPreviewLeave').on('mouseleave.broadcastsVideoPreviewLeave', function(e){ 1469 1470 $t.removeClass('is-mouseenter'); 1471 1472 if($player!=null){ 1473 $player.destroy(); 1474 $player = null; 1475 } 1476 1477 $('#'+(elem_id)).remove(); 1478 $previewVideoControl.removeClass('active-item'); 1479 }); 1480 }); 1481 1482 /*_.$el.find('.vidorev-youtube-broadcast .youtube-item-control:first-child .open-live-video-control').trigger('click');*/ 1483 } 1484 1485 vidorev_plugin.prototype.vidorev_video_report = function(){ 1486 var _ = this; 1487 1488 _.$el.off('.openReportBox').on('click.openReportBox', '.report-video-btn', function(){ 1489 var $t = $(this), 1490 $wrap = $t.parents('.report-block-control'); 1491 1492 $wrap.toggleClass('active-report'); 1493 1494 if($wrap.hasClass('active-report')){ 1495 $('html, body').stop().animate({scrollTop:($t.offset().top+$t.height()-window.innerHeight/2+100)}, {duration:500}, function(){}); 1496 } 1497 1498 setTimeout(function(){ 1499 if($t.hasClass('complete-action') || $wrap.find('.report-form-control').hasClass('not-login-yet')){ 1500 return false; 1501 } 1502 $wrap.find('.report-textarea-control').focus(); 1503 }, 200); 1504 1505 return false; 1506 }); 1507 1508 _.$el.off('.submitReportReasons').on('click.submitReportReasons', '.report-submit-control', function(){ 1509 var $t = $(this), 1510 $wrap = $t.parents('.report-block-control'); 1511 1512 $wrap.find('.report-info-control').removeClass('active-item'); 1513 1514 var val = $wrap.find('.report-textarea-control').val(), 1515 post_id = $wrap.find('.report-textarea-control').attr('data-id'); 1516 1517 if(typeof(val) === 'undefined' || typeof(post_id) === 'undefined' || $.trim(post_id) =='' || $.trim(val) == ''){ 1518 $wrap.find('.report-no-data-control').addClass('active-item'); 1519 return false; 1520 } 1521 1522 val = $.trim(val); 1523 1524 $wrap.addClass('disable-report'); 1525 $t.blur(); 1526 1527 var newParamsRequest = { 1528 'action': 'vidorev_submit_video_report', 1529 'post_id': post_id, 1530 'reasons': val, 1531 'security': vidorev_jav_js_object.security, 1532 } 1533 1534 $.ajax({
1535 url: vidorev_jav_js_object.admin_ajax, 1536 type: 'POST', 1537 cache: false, 1538 dataType: 'json', 1539 data: newParamsRequest, 1540 success: function(data){ 1541 1542 if(typeof(data)!=='object'){ 1543 $wrap.find('.report-error-control').addClass('active-item'); 1544 $wrap.removeClass('disable-report'); 1545 }else{ 1546 if(typeof(data.error)!=='undefined' && data.error == 'yes'){ 1547 $wrap.find('.report-error-control').addClass('active-item'); 1548 $wrap.removeClass('disable-report'); 1549 }else if(typeof(data.success)!=='undefined' && data.success == 'yes'){ 1550 $wrap.find('.report-success-control').addClass('active-item'); 1551 $wrap.find('.report-video-control').addClass('complete-action'); 1552 $wrap.find('.reported-control').text(vidorev_jav_js_object.translate_reported); 1553 1554 }else{ 1555 $wrap.find('.report-error-control').addClass('active-item'); 1556 $wrap.removeClass('disable-report'); 1557 } 1558 } 1559 1560 }, 1561 error: function(err){ 1562 $wrap.find('.report-error-control').addClass('active-item'); 1563 $wrap.removeClass('disable-report'); 1564 } 1565 }); 1566 }); 1567 } 1568 1569 vidorev_plugin.prototype.isNumber = function(n){ 1570 var _ = this; 1571 return !isNaN(parseFloat(n)) && isFinite(n); 1572 } 1573 1574 vidorev_plugin.prototype.vidorev_channel_subscribe = function(){ 1575 var _ = this; 1576 1577 _.$el.off('.channelSubscribe').on('click.channelSubscribe', '.subscribe-control', function(){ 1578 var $t = $(this), 1579 channel_id = $t.attr('data-channel-id'), 1580 data_login = $t.attr('data-login'); 1581 1582 if(typeof(data_login)==='undefined' || data_login === 'none'){ 1583 document.location.href= vidorev_jav_js_object.login_url; 1584 return false; 1585 } 1586 1587 if(typeof(channel_id)==='undefined' || !_.isNumber(channel_id)){ 1588 return false; 1589 } 1590 1591 var $btn_channel_id = $('.subscribe-control[data-channel-id="'+(channel_id)+'"]'); 1592 1593 $btn_channel_id.addClass('subscribe-loading'); 1594 1595 var newParamsRequest = { 1596 'action': 'vidorev_submit_channel_subscribe', 1597 'channel_id': channel_id, 1598 'security': vidorev_jav_js_object.security, 1599 } 1600 1601 $.ajax({ 1602 url: vidorev_jav_js_object.admin_ajax, 1603 type: 'POST', 1604 cache: false, 1605 dataType: 'json', 1606 data: newParamsRequest, 1607 success: function(data){ 1608 1609 if(typeof(data)!=='object'){ 1610 1611 }else{ 1612 if(typeof(data.success)!=='undefined' && data.success === 'yes'){ 1613 if(data.status_update == 0){ 1614 $btn_channel_id.removeClass('channel-subscribed'); 1615 setTimeout(function(){ 1616 if($t.parents('.subscriptions-archive-control').length > 0){ 1617 $t.parents('.post-item.vid_channel').hide('slow', function(){ $(this).remove(); }); 1618 } 1619 }, 300); 1620 } 1621 if(data.status_update == 1){ 1622 $btn_channel_id.addClass('channel-subscribed'); 1623 } 1624 1625 $btn_channel_id.find('.subscribed-count-control').text(''); 1626 1627 if(data.subscribed_count != 0){ 1628 $btn_channel_id.find('.subscribed-count-control').text(data.subscribed_count) 1629 } 1630 } 1631 } 1632 1633 $btn_channel_id.removeClass('subscribe-loading').blur(); 1634 1635 }, 1636 error: function(err){ 1637 1638 } 1639 }); 1640 }); 1641 } 1642 1643 vidorev_plugin.prototype.vidorev_cf7_select2 = function(){ 1644 var _ = this; 1645 var dir = 'ltr'; 1646 1647 if(_.$el.css('direction')=='rtl'){ 1648 dir = 'rtl'; 1649 } 1650 1651 if(typeof($.fn.select2)==='undefined'){ 1652 return; 1653 } 1654 1655 $('.select-multiple-control').select2({ 1656 dir:dir, 1657 }); 1658 1659 $('.select-single-ss-control').select2({ 1660 dir:dir, 1661 allowClear:true, 1662 }); 1663 1664 $('.ajax-select-playlist-control').select2({ 1665 ajax: { 1666 url: vidorev_jav_js_object.admin_ajax, 1667 data: function (params) { 1668 var queryParameters = { 1669 'action': 'ajaxGetAllPlaylists', 1670 'keyword': params.term, 1671 'security': vidorev_jav_js_object.security, 1672 } 1673 return queryParameters; 1674 }, 1675 delay: 250, 1676 dataType: 'json', 1677 type: 'POST', 1678 cache: true, 1679 }, 1680 minimumInputLength: 3, 1681 allowClear:true, 1682 dir:dir, 1683 }); 1684 1685 $('.ajax-select-channel-control').select2({ 1686 ajax: {
1687 url: vidorev_jav_js_object.admin_ajax, 1688 data: function (params) { 1689 var queryParameters = { 1690 'action': 'ajaxGetAllChannels', 1691 'keyword': params.term, 1692 'security': vidorev_jav_js_object.security, 1693 } 1694 return queryParameters; 1695 }, 1696 delay: 250, 1697 dataType: 'json', 1698 type: 'POST', 1699 cache: true, 1700 }, 1701 minimumInputLength: 3, 1702 allowClear:true, 1703 dir:dir, 1704 }); 1705 1706 _.$el.off('.cf7Submit').on('click.cf7Submit', '.wpcf7-submit', function(){ 1707 $(this).parents('.wpcf7').addClass('form-data-loading'); 1708 }); 1709 1710 if($( '.wpcf7' ).length > 0){ 1711 $( '.wpcf7' ).each(function(index, element) { 1712 var wpcf7Elm = document.querySelector( '#'+($(this).attr('id')) ); 1713 'wpcf7invalid wpcf7spam wpcf7mailfailed wpcf7mailsent'.split(' ').forEach(function(e){ 1714 wpcf7Elm.addEventListener(e, function(event){ 1715 $('#'+(event.detail.unitTag)+'.wpcf7').removeClass('form-data-loading');/*.find('form').trigger('reset');*/ 1716 if(e == 'wpcf7mailsent'){ 1717 $('#'+(event.detail.unitTag)+'.wpcf7').find('.select-multiple-control').val(null).trigger("change"); 1718 $('#'+(event.detail.unitTag)+'.wpcf7').find('.ajax-select-playlist-control').val(null).trigger("change"); 1719 $('#'+(event.detail.unitTag)+'.wpcf7').find('.ajax-select-channel-control').val(null).trigger("change"); 1720 } 1721 }, false); 1722 }); 1723 }); 1724 } 1725 } 1726 1727 vidorev_plugin.prototype.show_more_videos = function(){ 1728 var _ = this; 1729 1730 var $singleScrollBar = _.$el.find('.show-more-videos-control .blog-wrapper-control'); 1731 if($singleScrollBar.length > 0){ 1732 1733 if(_.global_scroll_bar_lib === 'malihu'){ 1734 1735 $singleScrollBar.mCustomScrollbar({ 1736 axis: 'x', 1737 alwaysShowScrollbar:0, 1738 scrollInertia: 120, 1739 }); 1740 1741 }else{ 1742 var instance = $singleScrollBar.overlayScrollbars({ 1743 overflowBehavior : { 1744 x:'scroll', 1745 y:'hidden', 1746 } 1747 }).overlayScrollbars(); 1748 1749 var scrollValue = instance.scroll().position.x; 1750 var scrollDirection; 1751 var scrollSmoothness = 10; 1752 var scrollAmount = 100; 1753 var animationLoop = function() { 1754 var currScroll = instance.scroll().position.x; 1755 var delta = scrollValue - currScroll; 1756 var easedValue = parseInt(currScroll + (delta / Math.max(1, scrollSmoothness))); 1757 if(easedValue === currScroll){ 1758 easedValue += delta > 0 ? 1 : -1; 1759 } 1760 if(delta !== 0) { 1761 instance.scroll({ x:easedValue }); 1762 requestAnimationFrame(animationLoop); 1763 } 1764 }; 1765 $(instance.getElements().viewport).mousewheel(function(event, delta) { 1766 if(event.originalEvent.deltaX === 0) { 1767 var factor = delta < 0 ? -1 : 1; 1768 var directionChanged = scrollDirection != factor; 1769 var amount = scrollAmount * factor; 1770 var root = directionChanged ? instance.scroll().position.x : scrollValue; 1771 scrollValue = Math.max(0, Math.min(instance.scroll().max.x, root - amount)) 1772 scrollDirection = factor; 1773 animationLoop(); 1774 event.preventDefault(); 1775 } 1776 }); 1777 } 1778 1779 _.$el.off('.moreVideoControl').on('click.moreVideoControl', '.more-videos-control', function(){ 1780 var $t = $(this); 1781 $t.toggleClass('active-item'); 1782 _.$el.find('.show-more-videos-control').toggleClass('active-block'); 1783 }); 1784 } 1785 1786 var $singleSeriesScrollBar = _.$el.find('.grid-style-series-control .blog-wrapper-control'); 1787 if($singleSeriesScrollBar.length > 0){ 1788 1789 $singleSeriesScrollBar.each(function(index, element){ 1790 var $t = $(this), 1791 sPos = ''; 1792 if($t.find('#current-playing-series').length>0){ 1793 sPos = '#current-playing-series'; 1794 } 1795 1796 if(_.global_scroll_bar_lib === 'malihu'){ 1797 1798 $t.mCustomScrollbar({ 1799 axis: 'x', 1800 alwaysShowScrollbar:0, 1801 scrollInertia: 120, 1802 callbacks:{ 1803 onInit: function(){ 1804 if(sPos!=''){ 1805 setTimeout(function(){ 1806 $t.mCustomScrollbar('scrollTo', sPos); 1807 },368); 1808 } 1809 } 1810 } 1811 });
1812 }else{ 1813 var instance = $t.overlayScrollbars({ 1814 overflowBehavior : { 1815 x:'scroll', 1816 y:'hidden' 1817 }, 1818 }).overlayScrollbars(); 1819 1820 var scrollValue = instance.scroll().position.x; 1821 var scrollDirection; 1822 var scrollSmoothness = 10; 1823 var scrollAmount = 100; 1824 var animationLoop = function() { 1825 var currScroll = instance.scroll().position.x; 1826 var delta = scrollValue - currScroll; 1827 var easedValue = parseInt(currScroll + (delta / Math.max(1, scrollSmoothness))); 1828 if(easedValue === currScroll){ 1829 easedValue += delta > 0 ? 1 : -1; 1830 } 1831 if(delta !== 0) { 1832 instance.scroll({ x:easedValue }); 1833 requestAnimationFrame(animationLoop); 1834 } 1835 }; 1836 $(instance.getElements().viewport).mousewheel(function(event, delta) { 1837 if(event.originalEvent.deltaX === 0) { 1838 var factor = delta < 0 ? -1 : 1; 1839 var directionChanged = scrollDirection != factor; 1840 var amount = scrollAmount * factor; 1841 var root = directionChanged ? instance.scroll().position.x : scrollValue; 1842 scrollValue = Math.max(0, Math.min(instance.scroll().max.x, root - amount)) 1843 scrollDirection = factor; 1844 animationLoop(); 1845 event.preventDefault(); 1846 } 1847 }); 1848 1849 if(sPos!=''){ 1850 instance.scroll({ el: $(sPos), scroll : { y : 'never' } }, 500); 1851 } 1852 1853 } 1854 1855 }); 1856 } 1857 } 1858 1859 vidorev_plugin.prototype.get_playlist_by_user_login = function(){ 1860 var _ = this; 1861 1862 _.$el.off('.addVideoToPlaylistControl').on('click.addVideoToPlaylistControl', '.add-video-to-playlist-control', function(){ 1863 1864 var $t = $(this); 1865 1866 var post_id = $t.attr('data-post-id'); 1867 1868 if(typeof(post_id) === 'undefined'){ 1869 return false; 1870 } 1871 1872 _.$el.toggleClass('active-playlist-lightbox'); 1873 1874 if($t.hasClass('fn-request')){ 1875 return false; 1876 } 1877 1878 $t.addClass('fn-request'); 1879 1880 var newParamsRequest = { 1881 'action': 'get_playlist_by_user_login', 1882 'post_id': post_id, 1883 'security': vidorev_jav_js_object.security, 1884 } 1885 1886 $.ajax({ 1887 type: 'POST', 1888 url: vidorev_jav_js_object.admin_ajax, 1889 cache: false, 1890 data: newParamsRequest, 1891 dataType: 'html', 1892 success: function(data, textStatus, jqXHR){ 1893 if(data != ''){ 1894 1895 if(_.global_scroll_bar_lib === 'malihu'){ 1896 1897 $('.ajax-playlist-list-control').html(data).mCustomScrollbar({ 1898 alwaysShowScrollbar:1, 1899 scrollInertia: 200, 1900 }); 1901 1902 }else{ 1903 $('.ajax-playlist-list-control').html(data).overlayScrollbars({ 1904 scrollbars:{ 1905 //autoHide:'move', 1906 } 1907 }); 1908 } 1909 1910 } else { 1911 1912 } 1913 1914 }, 1915 error: function( jqXHR, textStatus, errorThrown ){ 1916 } 1917 }); 1918 }); 1919 1920 _.$el.off('.addVideoToPlaylistPopup').on('click.addVideoToPlaylistPopup', '.playlist-item-add-control', function(){ 1921 1922 var $t = $(this); 1923 1924 var post_id = $t.attr('data-post-id'); 1925 var playlist_id = $t.attr('data-playlist-id'); 1926 1927 if(typeof(post_id) === 'undefined' || typeof(playlist_id) === 'undefined'){ 1928 return false; 1929 } 1930 1931 $t.addClass('loaded-in'); 1932 1933 var newParamsRequest = { 1934 'action': 'add_post_to_playlist_by_user_login', 1935 'post_id': post_id, 1936 'playlist_id': playlist_id, 1937 'security': vidorev_jav_js_object.security, 1938 } 1939 1940 $.ajax({ 1941 type: 'POST', 1942 url: vidorev_jav_js_object.admin_ajax, 1943 cache: false, 1944 data: newParamsRequest, 1945 dataType: 'json', 1946 success: function(data, textStatus, jqXHR){ 1947 if(typeof(data) === 'object' && typeof(data['success']) !== 'undefined'){ 1948 1949 if(data['success']=='in'){ 1950 $t.addClass('ready-in'); 1951 }else{ 1952 $t.removeClass('ready-in'); 1953 } 1954 1955 $t.removeClass('loaded-in'); 1956 1957 } else { 1958 $t.removeClass('loaded-in'); 1959 } 1960 1961 }, 1962 error: function( jqXHR, textStatus, errorThrown ){ 1963 $t.removeClass('loaded-in'); 1964 } 1965 }); 1966 }); 1967 1968 _.$el.off('.closeVideoToPlaylistLightbox').on('click.closeVideoToPlaylistLightbox', '.playlist-items-control', function(e){
1969 var $t = $(this); 1970 _.$el.toggleClass('active-playlist-lightbox'); 1971 return false; 1972 }); 1973 } 1974 1975 vidorev_plugin.prototype.front_end_edit_post = function(){ 1976 var _ = this; 1977 1978 _.$el.off('.frontEndEditControl').on('click.frontEndEditControl', '.fe_edit-post-control', function(){ 1979 1980 var $t = $(this); 1981 1982 var post_id = $t.attr('data-id'); 1983 1984 var newParamsRequest = { 1985 'action': 'front_end_edit_post_control', 1986 'post_id': post_id, 1987 'security': vidorev_jav_js_object.security, 1988 } 1989 1990 _.$el.append('<div class="lightbox-edit-post lightbox-edit-post-control"><span class="video-load-icon"></span></div>'); 1991 1992 $.ajax({ 1993 type: 'POST', 1994 url: vidorev_jav_js_object.admin_ajax, 1995 cache: false, 1996 data: newParamsRequest, 1997 dataType: 'json', 1998 success: function(data, textStatus, jqXHR){ 1999 if(typeof(data) === 'object' && typeof(data['form']) !== 'undefined'){ 2000 var html_form = ''; 2001 html_form+='<div class="lightbox-edit-post-content"><div role="form" class="wpcf7" id="vidorev-edit-'+(post_id)+'"><div class="lightbox-edit-close lightbox-edit-close-control"><i class="fa fa-times" aria-hidden="true"></i></div><form method="post" class="wpcf7-form front-end-edit-form-control" enctype="multipart/form-data">'; 2002 2003 $.each(data, function(i, values){ 2004 if(typeof(values)==='object'){ 2005 2006 $.each(values, function (z, value) { 2007 2008 var check_type = typeof(value[0])!=='undefined' && $.trim(value[0])!=''; 2009 2010 if(check_type){ 2011 html_form+='<div class="vidorev-submit-post">'; 2012 html_form+='<h3 class="h5 extra-bold">'+(value[0])+'</h3>'; 2013 } 2014 if(typeof(value[1])!=='undefined' && check_type){ 2015 html_form+='<p><span class="wpcf7-form-control-wrap">'+(value[1])+'</span></p>'; 2016 }else if(typeof(value[1])!=='undefined' && !check_type){ 2017 html_form+=value[1]; 2018 } 2019 if(typeof(value[2])!=='undefined'){ 2020 html_form+='<br><span class="desc-param">'+(value[2])+'</span>'; 2021 } 2022 2023 if(check_type){ 2024 html_form+='</div>'; 2025 } 2026 }); 2027 2028 } 2029 }); 2030 2031 2032 html_form+='<div class="vidorev-submit-post"><input type="button" value="SUBMIT" class="vidorev-submit-video-control" id="vidorev-submit-video"><span class="ajax-loader"></span></div class="ajx"><div class="response-err response-err-control"></div></form></div></div>'; 2033 2034 $('.lightbox-edit-post-control').html(html_form); 2035 2036 var dir = 'ltr'; 2037 if($('body').css('direction')=='rtl'){ 2038 dir = 'rtl'; 2039 } 2040 2041 if($('.ajax-edit-find-playlist-control').length>0){ 2042 $('.ajax-edit-find-playlist-control').select2({ 2043 ajax: { 2044 url: vidorev_jav_js_object.admin_ajax, 2045 data: function (params) { 2046 var queryParameters = { 2047 'action': 'ajaxEditGetAllPlaylists', 2048 'keyword': params.term, 2049 'security': vidorev_jav_js_object.security, 2050 } 2051 return queryParameters; 2052 }, 2053 delay: 250, 2054 dataType: 'json', 2055 type: 'POST', 2056 cache: true, 2057 }, 2058 minimumInputLength: 2, 2059 allowClear:false, 2060 dir:dir, 2061 width: 'resolve' 2062 }); 2063 } 2064 if($('.ajax-edit-find-channel-control').length>0){ 2065 $('.ajax-edit-find-channel-control').select2({ 2066 ajax: { 2067 url: vidorev_jav_js_object.admin_ajax, 2068 data: function (params) { 2069 var queryParameters = { 2070 'action': 'ajaxEditGetAllChannels', 2071 'keyword': params.term, 2072 'security': vidorev_jav_js_object.security, 2073 } 2074 return queryParameters; 2075 }, 2076 delay: 250, 2077 dataType: 'json', 2078 type: 'POST', 2079 cache: true, 2080 }, 2081 minimumInputLength: 2, 2082 allowClear:false, 2083 dir:dir, 2084 width: 'resolve' 2085 }); 2086 } 2087 }else{ 2088 $('.lightbox-edit-post-control').remove(); 2089 } 2090 }, 2091 error: function( jqXHR, textStatus, errorThrown ){ 2092 $('.lightbox-edit-post-control').remove(); 2093 } 2094 }); 2095 }); 2096 2097 _.$el.off('.lightboxEditCloseControl').on('click.lightboxEditCloseControl', '.lightbox-edit-close-control', function(){ 2098 $('.lightbox-edit-post-control').remove(); 2099 }); 2100 2101 _.$el.off('.lightboxEditButtonControl').on('click.lightboxEditButtonControl', '.vidorev-submit-video-control', function(){ 2102 2103 if ( typeof window.FormData !== 'function' ) { 2104 return; 2105 } 2106 2107 var $t = $(this), 2108 $form = $t.parents('.front-end-edit-form-control'), 2109 $parents = $t.parents('.lightbox-edit-post-control'); 2110 2111 $parents.addClass('save-data').find('.wpcf7-response-output, .wpcf7-not-valid-tip').remove(); 2112 2113 var formData = new FormData( $form.get(0) ); 2114 2115 formData.append('action', 'front_end_edit_post_data'); 2116 formData.append('security', vidorev_jav_js_object.security); 2117 2118 $.ajax({
2119 type: 'POST', 2120 url: vidorev_jav_js_object.admin_ajax, 2121 cache: false, 2122 data: formData, 2123 dataType: 'json', 2124 processData: false, 2125 contentType: false, 2126 success: function(data, textStatus, jqXHR){ 2127 if(typeof(data) === 'object' && typeof(data['success'])!=='undefined'){ 2128 location.reload(); 2129 }else{ 2130 $parents.removeClass('save-data'); 2131 if(typeof(data['error'])!=='undefined' && typeof(data['error_content'])==='object'){ 2132 var err_obj = data['error_content']; 2133 $parents.find('.response-err-control').html('<div class="wpcf7-response-output wpcf7-validation-errors" role="alert">'+(err_obj.err_title)+'</div>'); 2134 $.each(err_obj.err_class, function (zc, val) { 2135 $parents.find('[name="'+(val)+'"]').after(function() { 2136 return '<span class="wpcf7-not-valid-tip">'+(err_obj.err_desc)+'</span>'; 2137 }); 2138 }); 2139 } 2140 } 2141 }, 2142 error: function( jqXHR, textStatus, errorThrown ){ 2143 $parents.removeClass('save-data'); 2144 } 2145 }); 2146 }); 2147 } 2148 2149 vidorev_plugin.prototype.front_end_delete_post = function(){ 2150 var _ = this; 2151 2152 _.$el.off('.frontEndDeleteControl').on('click.frontEndDeleteControl', '.fe_delete-post-control', function(){ 2153 if (!confirm(vidorev_jav_js_object.translate_confirm_delete)) { 2154 return false; 2155 } 2156 2157 var $t = $(this); 2158 2159 var post_id = $t.attr('data-id'); 2160 2161 var newParamsRequest = { 2162 'action': 'front_end_delete_post_data', 2163 'post_id': post_id, 2164 'security': vidorev_jav_js_object.security, 2165 } 2166 2167 _.$el.append('<div class="lightbox-edit-post lightbox-edit-post-control"><span class="video-load-icon"></span></div>'); 2168 2169 $.ajax({ 2170 type: 'POST', 2171 url: vidorev_jav_js_object.admin_ajax, 2172 cache: false, 2173 data: newParamsRequest, 2174 dataType: 'json', 2175 success: function(data, textStatus, jqXHR){ 2176 if(typeof(data) === 'object' && typeof(data['success']) !== 'undefined' && typeof(data['red_url']) !== 'undefined'){ 2177 alert(vidorev_jav_js_object.translate_delete_success); 2178 document.location.href = data['red_url']; 2179 }else{ 2180 $('.lightbox-edit-post-control').remove(); 2181 } 2182 }, 2183 error: function( jqXHR, textStatus, errorThrown ){ 2184 $('.lightbox-edit-post-control').remove(); 2185 } 2186 }); 2187 }) 2188 } 2189 2190 vidorev_plugin.prototype.series_dropdown_menu = function(){ 2191 var _ = this; 2192 2193 _.$el.off('.seriesDropdownControl').on('click.seriesDropdownControl', '.series-df-item-control', function(){ 2194 var $t = $(this), 2195 $parents = $t.parents('.series-dropdown-control'); 2196 2197 if($parents.hasClass('active-item')){ 2198 $('.series-dropdown-control').removeClass('active-item'); 2199 }else{ 2200 $('.series-dropdown-control').removeClass('active-item'); 2201 $parents.addClass('active-item'); 2202 } 2203 2204 }) 2205 } 2206 2207 vidorev_plugin.prototype.updateQueryStringParameter = function(uri, key, value) { 2208 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 2209 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 2210 if (uri.match(re)) { 2211 return uri.replace(re, '$1' + key + "=" + value + '$2'); 2212 }else { 2213 return uri + separator + key + "=" + value; 2214 } 2215 } 2216 2217 vidorev_plugin.prototype.advance_search = function(){ 2218 var _ = this; 2219 2220 _.$el.off('.advanceSearchControl').on('click.advanceSearchControl', '.filter-group-title-control', function(){ 2221 var $t = $(this), 2222 $parents = $t.parents('.ft-group-control'), 2223 $item_block = $parents.find('.ft-group-items-control'); 2224 2225 if($item_block.css('display') == 'none'){ 2226 $parents.removeClass('hide-group-filter').addClass('show-group-filter'); 2227 }else{ 2228 $parents.removeClass('show-group-filter').addClass('hide-group-filter'); 2229 } 2230 }); 2231 2232 _.$el.off('.advanceSearchTopPress').on('keyup.advanceSearchTopPress', '.ft-keyword-control-top', function(e){ 2233 var $t = $(this); 2234 $('.ft-keyword-control-bottom').val($t.val()); 2235 if (e.keyCode == 13) { 2236 $('.apply-ft-control').trigger('click'); 2237 } 2238 }); 2239 2240 _.$el.off('.advanceSearchBottomPress').on('keyup.advanceSearchBottomPress', '.ft-keyword-control-bottom', function(){ 2241 var $t = $(this); 2242 $('.ft-keyword-control-top').val($t.val()); 2243 if (e.keyCode == 13) { 2244 $('.apply-ft-control').trigger('click'); 2245 } 2246 }); 2247 2248 _.$el.off('.advanceSearchSubmit').on('click.advanceSearchSubmit', '.apply-ft-control', function(){ 2249 var $t = $(this), 2250 $parents = $t.parents('.ft-search-box-control'); 2251 2252 if($parents.hasClass('ft-search-box-top')){ 2253 $('.ft-keyword-control-bottom').val($('.ft-keyword-control-top').val()); 2254 }else{ 2255 $('.ft-keyword-control-top').val($('.ft-keyword-control-bottom').val()); 2256 } 2257 2258 var default_url = $t.attr('data-url'); 2259 var new_url = ''; 2260 2261 var keyword = $('.ft-keyword-control-top').val(); 2262 2263 new_url = _.updateQueryStringParameter(default_url, 'keyword', encodeURIComponent(keyword)); 2264 2265 var tags = $('input[name="tag_item_ft[]"]:checked').map(function(_, el) { 2266 return $(el).val(); 2267 }).get(); 2268 2269 new_url = _.updateQueryStringParameter(new_url, 'tags', encodeURIComponent(tags.join())); 2270 2271 document.location.href = new_url; 2272 }); 2273 } 2274 2275 vidorev_plugin.prototype.ads_settings = function(){ 2276 var _ = this; 2277 $('input[name="ads_types"]').on('change', function() { 2278 var value = $(this).val(); 2279 switch(value){ 2280 case 'google_ima': 2281 if($('.user-ads-google-ima').length > 0){ 2282 $('html, body').stop().animate({scrollTop:$('.user-ads-google-ima').offset().top-90}, {duration:500}, function(){}); 2283 } 2284 break; 2285 2286 case 'image': 2287 if($('.user-ads-image').length > 0){ 2288 $('html, body').stop().animate({scrollTop:$('.user-ads-image').offset().top-90}, {duration:500}, function(){}); 2289 } 2290 break; 2291 2292 case 'html5_video':
2293 if($('.user-ads-html5-video').length > 0){ 2294 $('html, body').stop().animate({scrollTop:$('.user-ads-html5-video').offset().top-90}, {duration:500}, function(){}); 2295 } 2296 break; 2297 2298 case 'google_adsense': 2299 if($('.user-ads-google-adsense').length > 0){ 2300 $('html, body').stop().animate({scrollTop:$('.user-ads-google-adsense').offset().top-90}, {duration:500}, function(){}); 2301 } 2302 break; 2303 2304 case 'vast': 2305 if($('.user-ads-vast').length > 0){ 2306 $('html, body').stop().animate({scrollTop:$('.user-ads-vast').offset().top-90}, {duration:500}, function(){}); 2307 } 2308 break; 2309 } 2310 }); 2311 2312 _.$el.off('.userUpdateAds').on('click.userUpdateAds', '#ads_settings_update', function(){ 2313 2314 var $t = $(this); 2315 2316 var ads_types = $('input[name="ads_types"]:checked').val(); 2317 2318 var ima_source_desktop = $.trim($('input[name="ima_source_desktop"]').val()); 2319 var ima_source_tablet = $.trim($('input[name="ima_source_tablet"]').val()); 2320 var ima_source_mobile = $.trim($('input[name="ima_source_mobile"]').val()); 2321 2322 var image_source = $.trim($('input[name="image_source"]').val()); 2323 var image_link_target = $.trim($('input[name="image_link_target"]').val()); 2324 var image_time_show_ad = $.trim($('input[name="image_time_show_ad"]').val()); 2325 var image_time_skip_ad = $.trim($('input[name="image_time_skip_ad"]').val()); 2326 var image_time_hide_ad = $.trim($('input[name="image_time_hide_ad"]').val()); 2327 2328 var video_source = $.trim($('input[name="video_source"]').val()); 2329 var video_link_target = $.trim($('input[name="video_link_target"]').val()); 2330 var video_time_show_ad = $.trim($('input[name="video_time_show_ad"]').val()); 2331 var video_time_skip_ad = $.trim($('input[name="video_time_skip_ad"]').val()); 2332 2333 var adsense_client_id = $.trim($('input[name="adsense_client_id"]').val()); 2334 var adsense_slot_id = $.trim($('input[name="adsense_slot_id"]').val()); 2335 var adsense_time_show_ad = $.trim($('input[name="adsense_time_show_ad"]').val()); 2336 var adsense_time_skip_ad = $.trim($('input[name="adsense_time_skip_ad"]').val()); 2337 var adsense_time_hide_ad = $.trim($('input[name="adsense_time_hide_ad"]').val()); 2338 2339 var vast_preroll = $.trim($('input[name="vast_preroll"]').val()); 2340 var vast_postroll = $.trim($('input[name="vast_postroll"]').val()); 2341 var vast_pauseroll = $.trim($('input[name="vast_pauseroll"]').val()); 2342 var vast_midroll = $.trim($('input[name="vast_midroll"]').val()); 2343 2344 var user_ads_object = { 2345 "vid_ads_m_video_ads": "no", 2346 "vid_ads_m_video_ads_type": "", 2347 "vid_ads_m_group_google_ima": [ 2348 {"vid_ads_m_ima_source": [""], "vid_ads_m_ima_source_tablet": [""], "vid_ads_m_ima_source_mobile": [""]} 2349 ], 2350 "vid_ads_m_group_image": [ 2351 {"vid_ads_m_image_source": "", "vid_ads_m_image_link": "", "image_time_show_ad": "", "image_time_skip_ad": "", "image_time_hide_ad": ""} 2352 ], 2353 "vid_ads_m_group_html5_video": [ 2354 {"vid_ads_m_video_source": {0: ""}, "vid_ads_m_video_link": "", "video_time_show_ad": "", "video_time_skip_ad": ""} 2355 ], 2356 "vid_ads_m_group_html": [ 2357 {"vid_ads_m_html_source": [""], "adsense_client_id": "", "adsense_slot_id": "", "adsense_time_show_ad": "", "adsense_time_skip_ad": "", "adsense_time_hide_ad":""} 2358 ], 2359 "vid_ads_m_vast_preroll": [ 2360 {"vid_ads_m_vast_tag_pre": ""} 2361 ], 2362 "vid_ads_m_vast_postroll": [ 2363 {"vid_ads_m_vast_tag_post": ""} 2364 ], 2365 "vid_ads_m_vast_pauseroll": [ 2366 {"vid_ads_m_vast_tag_pause": ""} 2367 ], 2368 "vid_ads_m_vast_midroll": [ 2369 {"vid_ads_m_vast_tag_mid": "", "vid_ads_m_vast_timer_seconds": "10"} 2370 ], 2371 "vid_ads_m_time_to_show_ads": 0, 2372 "vid_ads_m_time_skip_ads": 5, 2373 "vid_ads_m_time_to_hide_ads": 10, 2374 } 2375 2376 if(ads_types == 'google_ima' || ads_types == 'image' || ads_types == 'html5_video' || ads_types == 'google_adsense' || ads_types == 'vast'){ 2377 user_ads_object.vid_ads_m_video_ads = 'yes'; 2378 user_ads_object.vid_ads_m_video_ads_type = ads_types; 2379 2380 switch(ads_types){ 2381 case 'google_ima': 2382 break; 2383 2384 case 'image': 2385 if(image_time_show_ad!=''){ 2386 user_ads_object.vid_ads_m_time_to_show_ads = image_time_show_ad;
2387 } 2388 if(image_time_skip_ad!=''){ 2389 user_ads_object.vid_ads_m_time_skip_ads = image_time_skip_ad; 2390 } 2391 if(image_time_hide_ad!=''){ 2392 user_ads_object.vid_ads_m_time_to_hide_ads = image_time_hide_ad; 2393 } 2394 break; 2395 2396 case 'html5_video': 2397 if(video_time_show_ad!=''){ 2398 user_ads_object.vid_ads_m_time_to_show_ads = video_time_show_ad; 2399 } 2400 if(video_time_skip_ad!=''){ 2401 user_ads_object.vid_ads_m_time_skip_ads = video_time_skip_ad; 2402 } 2403 break; 2404 2405 case 'google_adsense': 2406 user_ads_object.vid_ads_m_video_ads_type = 'html'; 2407 if(adsense_time_show_ad!=''){ 2408 user_ads_object.vid_ads_m_time_to_show_ads = adsense_time_show_ad; 2409 } 2410 if(adsense_time_skip_ad!=''){ 2411 user_ads_object.vid_ads_m_time_skip_ads = adsense_time_skip_ad; 2412 } 2413 if(adsense_time_hide_ad!=''){ 2414 user_ads_object.vid_ads_m_time_to_hide_ads = adsense_time_hide_ad; 2415 } 2416 break; 2417 2418 case 'vast': 2419 break; 2420 } 2421 } 2422 2423 if(ima_source_desktop!=''){ 2424 user_ads_object.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source[0] = ima_source_desktop; 2425 } 2426 if(ima_source_tablet!=''){ 2427 user_ads_object.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_tablet[0] = ima_source_tablet; 2428 } 2429 if(ima_source_mobile!=''){ 2430 user_ads_object.vid_ads_m_group_google_ima[0].vid_ads_m_ima_source_mobile[0] = ima_source_mobile; 2431 } 2432 2433 if(image_source!=''){ 2434 user_ads_object.vid_ads_m_group_image[0].vid_ads_m_image_source = image_source; 2435 } 2436 if(image_link_target!=''){ 2437 user_ads_object.vid_ads_m_group_image[0].vid_ads_m_image_link = image_link_target; 2438 } 2439 if(image_time_show_ad!=''){ 2440 user_ads_object.vid_ads_m_group_image[0].image_time_show_ad = image_time_show_ad; 2441 } 2442 if(image_time_skip_ad!=''){ 2443 user_ads_object.vid_ads_m_group_image[0].image_time_skip_ad = image_time_skip_ad; 2444 } 2445 if(image_time_hide_ad!=''){ 2446 user_ads_object.vid_ads_m_group_image[0].image_time_hide_ad = image_time_hide_ad; 2447 } 2448 2449 if(video_source!=''){ 2450 user_ads_object.vid_ads_m_group_html5_video[0].vid_ads_m_video_source = {"0": video_source}; 2451 } 2452 if(video_link_target!=''){ 2453 user_ads_object.vid_ads_m_group_html5_video[0].vid_ads_m_video_link = video_link_target; 2454 } 2455 if(video_time_show_ad!=''){ 2456 user_ads_object.vid_ads_m_group_html5_video[0].video_time_show_ad = video_time_show_ad; 2457 } 2458 if(video_time_skip_ad!=''){ 2459 user_ads_object.vid_ads_m_group_html5_video[0].video_time_skip_ad = video_time_skip_ad; 2460 } 2461 2462 if(adsense_client_id!='' && adsense_slot_id!=''){ 2463 user_ads_object.vid_ads_m_group_html[0].vid_ads_m_html_source[0] = "<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\""+(adsense_client_id)+"\" data-ad-slot=\""+(adsense_slot_id)+"\" data-ad-format=\"auto\"><\/ins><script>(adsbygoogle=window.adsbygoogle||[]).push({});<\/script>"; 2464 } 2465 2466 if(adsense_client_id!=''){ 2467 user_ads_object.vid_ads_m_group_html[0].adsense_client_id = adsense_client_id; 2468 } 2469 if(adsense_slot_id!=''){ 2470 user_ads_object.vid_ads_m_group_html[0].adsense_slot_id = adsense_slot_id; 2471 } 2472 if(adsense_time_show_ad!=''){ 2473 user_ads_object.vid_ads_m_group_html[0].adsense_time_show_ad = adsense_time_show_ad; 2474 } 2475 if(adsense_time_skip_ad!=''){ 2476 user_ads_object.vid_ads_m_group_html[0].adsense_time_skip_ad = adsense_time_skip_ad; 2477 } 2478 if(adsense_time_hide_ad!=''){ 2479 user_ads_object.vid_ads_m_group_html[0].adsense_time_hide_ad = adsense_time_hide_ad; 2480 } 2481 2482 if(vast_preroll!=''){ 2483 user_ads_object.vid_ads_m_vast_preroll[0].vid_ads_m_vast_tag_pre = vast_preroll; 2484 } 2485 2486 if(vast_postroll!=''){ 2487 user_ads_object.vid_ads_m_vast_postroll[0].vid_ads_m_vast_tag_post = vast_postroll; 2488 } 2489 2490 if(vast_pauseroll!=''){ 2491 user_ads_object.vid_ads_m_vast_pauseroll[0].vid_ads_m_vast_tag_pause = vast_pauseroll; 2492 } 2493 2494 if(vast_midroll!=''){ 2495 user_ads_object.vid_ads_m_vast_midroll[0].vid_ads_m_vast_tag_mid = vast_midroll; 2496 user_ads_object.vid_ads_m_vast_midroll[0].vid_ads_m_vast_timer_seconds = "10"; 2497 } 2498 2499 var newParamsRequest = { 2500 'action': 'vidorev_update_user_ads_settings', 2501 'ads': user_ads_object, 2502 'security': vidorev_jav_js_object.security, 2503 } 2504 $t.addClass('loading-submit'); 2505 $('.ads-notice-submit-control').text('').removeClass('error-text'); 2506 2507 $.ajax({
2508 url: vidorev_jav_js_object.admin_ajax, 2509 type: 'POST', 2510 cache: false, 2511 dataType: 'json', 2512 data: newParamsRequest, 2513 success: function(data){ 2514 2515 if(typeof(data['results'])!=='undefined'){ 2516 $('.ads-notice-submit-control').text(data['results'][1]); 2517 if(data['results'][0]==='error'){ 2518 $('.ads-notice-submit-control').addClass('error-text'); 2519 } 2520 } 2521 2522 $t.removeClass('loading-submit'); 2523 }, 2524 error: function(err){ 2525 $t.removeClass('loading-submit'); 2526 $('.ads-notice-submit-control').text('An error occurred, please try again!'); 2527 } 2528 }); 2529 2530 }); 2531 } 2532 2533 vidorev_plugin.prototype.tmdb_block_render = function(){ 2534 var _ = this; 2535 2536 _.$el.off('.tmdbShowmore').on('click.tmdbShowmore', '.tmdb_showmore_button_control', function(){ 2537 var $t = $(this), 2538 $parent = $t.parents('.tmdb-section-control'); 2539 2540 $parent.toggleClass('show-more-content'); 2541 2542 if(!$parent.hasClass('show-more-content')){ 2543 $('html, body').animate({scrollTop:$parent.offset().top-150}, {duration:500, complete: function(){}}); 2544 } 2545 }); 2546 } 2547 2548 vidorev_plugin.prototype.nFormatter = function(num, digits){ 2549 2550 if(isNaN(num)){ 2551 return '0'; 2552 } 2553 2554 var si = [ 2555 { value: 1E18, symbol: "E" }, 2556 { value: 1E15, symbol: "P" }, 2557 { value: 1E12, symbol: "T" }, 2558 { value: 1E9, symbol: "G" }, 2559 { value: 1E6, symbol: "M" }, 2560 { value: 1E3, symbol: "k" } 2561 ], 2562 rx = /\.0+$|(\.[0-9]*[1-9])0+$/, 2563 i; 2564 for (var i=0; i<si.length;i++) { 2565 if(num>=si[i].value) { 2566 return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol; 2567 } 2568 } 2569 return num.toFixed(digits).replace(rx, "$1"); 2570 }/*big number format*/ 2571 2572 vidorev_plugin.prototype.secondsToTime = function (e){ 2573 var h = Math.floor(e / 3600).toString().padStart(2,'0'), 2574 m = Math.floor(e % 3600 / 60).toString().padStart(2,'0'), 2575 s = Math.floor(e % 60).toString().padStart(2,'0'); 2576 2577 if(h=='00'){ 2578 return m + ':' + s; 2579 }else{ 2580 return h + ':' + m + ':' + s; 2581 } 2582 } 2583 2584 vidorev_plugin.prototype.youtube_live_video_pros = function(crr_yvt, crr_obj, action){ 2585 var _ = this; 2586 2587 var live_url = crr_obj.live_url, 2588 upcoming_url = crr_obj.upcoming_url, 2589 completed_url = crr_obj.completed_url, 2590 recent_url = crr_obj.recent_url, 2591 channel_name = crr_obj.channel_name, 2592 live_video_title = crr_obj.live_video_title, 2593 auto_refresh = crr_obj.auto_refresh, 2594 fallback_options = crr_obj.fallback_options, 2595 public_api_key = crr_obj.public_api_key, 2596 lang = crr_obj.lang, 2597 timezone = crr_obj.timezone, 2598 display_info = crr_obj.display_info, 2599 player = crr_obj.player, 2600 autoplay = crr_obj.autoplay; 2601 2602 var $live_bar_control = crr_yvt.find('.live-bar-control'), 2603 $live_player_control = crr_yvt.find('.live-player-control'), 2604 $reload_time_control = crr_yvt.find('.reload-time-control'); 2605 2606 var reloadTimeInterval = null; 2607 2608 2609 var append_html_player = function(video_id, status){ 2610 2611 var def_obj = { 2612 'membership' : '', 2613 'player_library' : 'vp', 2614 'plyr_player' : 'on', 2615 'poster_background' : '', 2616 'prime_video' : '', 2617 'single_video_network' : 'youtube', 2618 'single_video_source' : video_id, 2619 'single_video_streaming' : '', 2620 'single_video_suggested' : '', 2621 'single_video_url' : '', 2622 'single_video_youtube_playlist_id' : '', 2623 'vidorev_jav_plugin_video_ads_object_post' : {'vid_ads_m_video_ads':'no'}, 2624 'vm_video_ratio' : '16:9', 2625 'vm_video_ratio_mobile' : '16:9', 2626 'woo_membership' : '', 2627 2628 } 2629 2630 if(player=='youtube'){ 2631 def_obj.plyr_player = 'off'; 2632 } 2633 2634 var url_details = '://www.googleapis.com/youtube/v3/videos?id='+(video_id)+'&part=snippet,statistics&key='+(public_api_key); 2635 2636 switch(status){ 2637 case 'live': 2638 url_details = '://www.googleapis.com/youtube/v3/videos?id='+(video_id)+'&part=snippet,statistics,liveStreamingDetails&key='+(public_api_key); 2639 break; 2640 case 'scheduled': 2641 url_details = '://www.googleapis.com/youtube/v3/videos?id='+(video_id)+'&part=snippet,statistics,liveStreamingDetails&key='+(public_api_key); 2642 break; 2643 } 2644 2645 var rnd_url_pl_id = 'cache_'+(Math.random().toString(36).substring(2, 11) + Math.random().toString(36).substring(2, 15)); 2646 2647 $.ajax({
2648 url: _.updateQueryStringParameter('https'+(url_details), 'vid_callback', encodeURIComponent(rnd_url_pl_id)), 2649 type: 'GET', 2650 cache: true, 2651 dataType: 'jsonp', 2652 success: function(data){ 2653 2654 if(typeof(data.items)!=='undefined' || typeof(data.items[0])!=='undefined'){ 2655 2656 var rnd_id = 'live-p-'+(Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)); 2657 2658 var val_details = data.items[0], 2659 vid_title = typeof(val_details.snippet.title)!=='undefined'?val_details.snippet.title:'', 2660 vid_channel = typeof(val_details.snippet.channelId)!=='undefined'?val_details.snippet.channelId:'', 2661 vid_channel_title = typeof(val_details.snippet.channelTitle)!=='undefined'?val_details.snippet.channelTitle:'', 2662 likes_counter = (typeof(val_details.statistics)!=='undefined' && typeof(val_details.statistics.likeCount)!=='undefined')?_.nFormatter(parseFloat(val_details.statistics.likeCount), 1):0, 2663 views_counter = 0; 2664 2665 var post_meta = '', 2666 vid_scheduled = '', 2667 iframe_chat = ''; 2668 2669 switch(status){ 2670 case 'live': 2671 views_counter = (typeof(val_details.liveStreamingDetails)!=='undefined' && typeof(val_details.liveStreamingDetails.concurrentViewers)!=='undefined')?_.nFormatter(parseFloat(val_details.liveStreamingDetails.concurrentViewers), 1):0; 2672 2673 post_meta = '<div class="entry-meta post-meta meta-font"><div class="post-meta-wrap"><div class="channel-url"><i class="fa fa-video-camera" aria-hidden="true"></i><a href="https://www.youtube.com/channel/'+(vid_channel)+'" target="_blank">'+(vid_channel_title)+'</a></div><div class="watching-count"><i class="fa fa-circle" aria-hidden="true"></i><span>'+(views_counter)+' Watching</span></div><div class="like-count"><i class="fa fa-thumbs-up" aria-hidden="true"></i><span class="like-count">'+(likes_counter)+'</span></div></div></div>'; 2674 2675 iframe_chat = ''; 2676 2677 break; 2678 2679 case 'scheduled': 2680 2681 var scheduledStartTime = (typeof(val_details.liveStreamingDetails)!=='undefined' && typeof(val_details.liveStreamingDetails.scheduledStartTime)!=='undefined')?val_details.liveStreamingDetails.scheduledStartTime:0; 2682 2683 var scheduled_options = { 2684 year: '2-digit', month: '2-digit', day: '2-digit', 2685 hour: '2-digit', minute: '2-digit', second: '2-digit', 2686 timeZone: timezone, 2687 timeZoneName: 'short' 2688 } 2689 var formater = new Intl.DateTimeFormat(lang, scheduled_options); 2690 2691 var startingDate = new Date(scheduledStartTime); 2692 var currentLocalTime = new Date(); 2693 2694 var hoursCD = Math.abs(startingDate - currentLocalTime) / 36e5; 2695 2696 var time_iterv = startingDate.getTime()/1000 - currentLocalTime.getTime()/1000; 2697 2698 var dateInNewTimezone = formater.format(startingDate); 2699 var currentdateInNewTimezone = formater.format(currentLocalTime); 2700 2701 post_meta = '<div class="entry-meta post-meta meta-font"><div class="post-meta-wrap"><div class="channel-url"><i class="fa fa-video-camera" aria-hidden="true"></i><a href="https://www.youtube.com/channel/'+(vid_channel)+'" target="_blank">'+(vid_channel_title)+'</a></div><div class="watching-count"><i class="fa fa-circle" aria-hidden="true"></i><span>Scheduled for '+(dateInNewTimezone)+'</span></div><div class="like-count"><i class="fa fa-thumbs-up" aria-hidden="true"></i><span class="like-count">'+(likes_counter)+'</span></div></div></div>'; 2702 2703 vid_scheduled = '<div class="absolute-content checking-scheduled dark-background"><span><i class="fa fa-clock-o" aria-hidden="true"></i> <span class="reload-atl-control-'+(rnd_id)+'">'+(_.secondsToTime(time_iterv))+'</span></span><br><span class="scheduled-time-control"><i class="fa fa-podcast" aria-hidden="true"></i> '+(dateInNewTimezone)+'</span></div>'; 2704 2705 break; 2706 2707 default: 2708 views_counter = (typeof(val_details.statistics)!=='undefined' && typeof(val_details.statistics.viewCount)!=='undefined')?_.nFormatter(parseFloat(val_details.statistics.viewCount), 1):0; 2709 2710 post_meta = '<div class="entry-meta post-meta meta-font"><div class="post-meta-wrap"><div class="channel-url"><i class="fa fa-video-camera" aria-hidden="true"></i><a href="https://www.youtube.com/channel/'+(vid_channel)+'" target="_blank">'+(vid_channel_title)+'</a></div><div class="watching-count"><i class="fa fa-circle" aria-hidden="true"></i><span>'+(views_counter)+'</span></div><div class="like-count"><i class="fa fa-thumbs-up" aria-hidden="true"></i><span class="like-count">'+(likes_counter)+'</span></div></div></div>'; 2711 2712 } 2713 2714 var post_content = ''; 2715 if(display_info=='on'){ 2716 post_content = '<div class="vid-content dark-background">\ 2717 <h3 class="h5-mobile post-title">
2717'+(vid_title)+'</h3>\ 2718 '+(post_meta)+'\ 2719 </div>'; 2720 } 2721 2722 var html_player = '<div class="live-player-item live-player-item-control">\ 2723 <div class="video-player-wrap">\ 2724 <div class="video-player-ratio"></div>\ 2725 <div class="video-player-content video-player-control">\ 2726 <div class="player-3rdparty player-3rdparty-control" id="'+(rnd_id)+'-init">\ 2727 <div id="'+(rnd_id)+'" class="player-api">\ 2728 </div>\ 2729 <div class="player-muted player-muted-control"><i class="fa fa-volume-off" aria-hidden="true"></i></div>\ 2730 </div>\ 2731 <div class="video-loading video-loading-control"><span class="video-load-icon"></span></div>\ 2732 </div>\ 2733 '+(vid_scheduled)+'\ 2734 </div>\ 2735 '+(post_content)+'\ 2736 '+(iframe_chat)+'\ 2737 </div>'; 2738 2739 $live_player_control.append(html_player); 2740 2741 if(typeof(time_iterv)!=='undefined' && time_iterv>0){ 2742 var time_iterv_action = null, 2743 crr_sch_time = time_iterv; 2744 2745 time_iterv_action = setInterval(function(){ 2746 crr_sch_time--; 2747 2748 if($('.reload-atl-control-'+(rnd_id)).length === 0){ 2749 clearInterval(time_iterv_action); 2750 return false; 2751 } 2752 2753 if(crr_sch_time<=0){ 2754 clearInterval(time_iterv_action); 2755 $('.reload-atl-control-'+(rnd_id)).text('00:00'); 2756 api_load_live_video(); 2757 return false; 2758 } 2759 $('.reload-atl-control-'+(rnd_id)).text(_.secondsToTime(crr_sch_time)); 2760 }, 1000); 2761 }else{ 2762 if(time_iterv<=0){ 2763 $('.reload-atl-control-'+(rnd_id)).text(vidorev_jav_js_object.translate_live_or_ended); 2764 } 2765 } 2766 2767 if(autoplay==='on' && (status==='live' || status==='recent' || status==='completed') && _.global_live_yt_ready === 1){ 2768 def_obj.sc_autoplay_valid = 'on'; 2769 _.global_live_yt_ready++; 2770 } 2771 2772 if(typeof(window.get_vidorev_build_fnc)!=='undefined' && window.get_vidorev_build_fnc!==null){ 2773 window.get_vidorev_build_fnc.create_single_video_player(rnd_id, def_obj); 2774 }else{ 2775 _.$el.on('get_vidorev_build_fnc', function(e){ 2776 window.get_vidorev_build_fnc.create_single_video_player(rnd_id, def_obj); 2777 }); 2778 } 2779 2780 switch(status){ 2781 case 'live': 2782 if(!crr_yvt.is('.status-live')){ 2783 crr_yvt.addClass('status-live').removeClass('status-check status-offline recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl[data-action="live"]').addClass('active-item'); 2784 } 2785 break; 2786 case 'scheduled': 2787 if(!crr_yvt.is('.status-offline.scheduled-active')){ 2788 crr_yvt.addClass('status-offline scheduled-active').removeClass('status-check status-live recent-active completed-active').find('.live-bar-btn-ctrl[data-action="scheduled"]').addClass('active-item'); 2789 } 2790 break; 2791 2792 case 'recent': 2793 if(!crr_yvt.is('.status-offline.recent-active')){ 2794 crr_yvt.addClass('status-offline recent-active').removeClass('status-check status-live scheduled-active completed-active').find('.live-bar-btn-ctrl[data-action="recent"]').addClass('active-item'); 2795 } 2796 break; 2797 2798 case 'completed': 2799 if(!crr_yvt.is('.status-offline.completed-active')){ 2800 crr_yvt.addClass('status-offline completed-active').removeClass('status-check status-live scheduled-active recent-active').find('.live-bar-btn-ctrl[data-action="completed"]').addClass('active-item'); 2801 } 2802 break; 2803 2804 } 2805 } 2806 2807 }, 2808 error: function(err){ 2809 return; 2810 } 2811 }); 2812 } 2813 2814 var reload_action = function(){ 2815 2816 _.global_live_yt_ready = 1; 2817 2818 if(auto_refresh!='on'){ 2819 return; 2820 } 2821 2822 if(reloadTimeInterval!==null){ 2823 clearInterval(reloadTimeInterval); 2824 } 2825 2826 var currentReloadTime = 300; 2827 reloadTimeInterval = setInterval(function(){ 2828 currentReloadTime--; 2829 if(currentReloadTime<=0){ 2830 clearInterval(reloadTimeInterval); 2831 api_load_live_video(); 2832 } 2833 $reload_time_control.text(_.secondsToTime(currentReloadTime)); 2834 }, 1000); 2835 } 2836 2837 var api_load_live_video = function(){ 2838 2839 reload_action(); 2840 2841 if(!crr_yvt.is('.sub-check-online.status-live') && !crr_yvt.is('.status-offline.sc
2841heduled-active') && !crr_yvt.is('.status-offline.recent-active') && !crr_yvt.is('.status-offline.completed-active') && !crr_yvt.is('.firstly-done')){ 2842 crr_yvt.addClass('status-check').removeClass('status-offline status-live recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl').removeClass('active-item'); 2843 } 2844 2845 if(crr_yvt.find('.live-bar-btn-ctrl.user-click-item[data-action="live"]').length > 0){ 2846 crr_yvt.addClass('status-check').removeClass('status-offline status-live recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl').removeClass('active-item'); 2847 } 2848 2849 var rnd_url_live_id = 'cache_'+(Math.random().toString(36).substring(2, 11) + Math.random().toString(36).substring(2, 15)); 2850 2851 $.ajax({ 2852 url: _.updateQueryStringParameter(live_url, 'vid_callback', encodeURIComponent(rnd_url_live_id)), 2853 type: 'GET', 2854 cache: false, 2855 dataType: 'jsonp', 2856 success: function(data){ 2857 2858 if(typeof(data.items)==='undefined' || typeof(data.items[0])==='undefined'){ 2859 2860 crr_yvt.find('.live-bar-btn-ctrl.user-click-item[data-action="live"]').removeClass('user-click-item'); 2861 2862 switch(fallback_options){ 2863 case 'scheduled_live_video': 2864 api_load_scheduled_live_video(); 2865 break; 2866 2867 case 'recent_video': 2868 api_load_recent_video(); 2869 break; 2870 2871 case 'completed_live_video': 2872 api_load_completed_live_video(); 2873 break; 2874 } 2875 2876 crr_yvt.removeClass('sub-check-online'); 2877 2878 return; 2879 } 2880 2881 if( crr_yvt.is('.sub-check-online.status-live') || (crr_yvt.find('.live-bar-btn-ctrl.user-click-item:not([data-action="live"])').length > 0 && crr_yvt.is('.sub-check-online')) ){ 2882 return; 2883 } 2884 2885 crr_yvt.find('.live-bar-btn-ctrl').removeClass('active-item'); 2886 crr_yvt.find('.live-bar-btn-ctrl.user-click-item[data-action="live"]').removeClass('user-click-item'); 2887 2888 if(!crr_yvt.is('.status-live')){ 2889 crr_yvt.find('.live-player-item-control').remove(); 2890 } 2891 2892 $.each(data.items, function( index, value ){ 2893 2894 if(typeof(value.id)!=='undefined' && typeof(value.id.videoId)!=='undefined'){ 2895 append_html_player(value.id.videoId, 'live'); 2896 } 2897 2898 }); 2899 2900 crr_yvt.addClass('sub-check-online firstly-done'); 2901 2902 }, 2903 error: function(err){ 2904 crr_yvt.addClass('status-offline').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 2905 crr_yvt.removeClass('sub-check-online'); 2906 console.log(err); 2907 return; 2908 } 2909 }); 2910 } 2911 2912 var api_load_scheduled_live_video = function(){ 2913 2914 reload_action(); 2915 2916 if(crr_yvt.is('.status-offline.scheduled-active') || crr_yvt.find('.live-bar-btn-ctrl.user-click-item:not([data-action="scheduled"])').length > 0){ 2917 return; 2918 } 2919 2920 crr_yvt.addClass('status-check').removeClass('status-offline status-live recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl').removeClass('active-item'); 2921 2922 var rnd_url_scheduled_id = 'cache_'+(Math.random().toString(36).substring(2, 11) + Math.random().toString(36).substring(2, 15)); 2923 2924 $.ajax({ 2925 url: _.updateQueryStringParameter(upcoming_url, 'vid_callback', encodeURIComponent(rnd_url_scheduled_id)), 2926 type: 'GET', 2927 cache: false, 2928 dataType: 'jsonp', 2929 success: function(data){ 2930 2931 if(typeof(data.items)==='undefined' || typeof(data.items[0])==='undefined'){ 2932 2933 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 2934 crr_yvt.find('.live-bar-btn-ctrl[data-action="scheduled"]').addClass('active-item'); 2935 2936 return; 2937 } 2938 2939 if(!crr_yvt.is('.status-offline.scheduled-active')){
2940 crr_yvt.find('.live-player-item-control').remove(); 2941 } 2942 2943 $.each(data.items, function( index, value ){ 2944 2945 if(typeof(value.id)!=='undefined' && typeof(value.id.videoId)!=='undefined'){ 2946 append_html_player(value.id.videoId, 'scheduled'); 2947 } 2948 2949 }); 2950 2951 crr_yvt.addClass('firstly-done'); 2952 2953 }, 2954 error: function(err){ 2955 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 2956 console.log(err); 2957 return; 2958 } 2959 }); 2960 2961 } 2962 2963 var api_load_recent_video = function(){ 2964 2965 reload_action(); 2966 2967 if(crr_yvt.is('.status-offline.recent-active') || crr_yvt.find('.live-bar-btn-ctrl.user-click-item:not([data-action="recent"])').length > 0){ 2968 return; 2969 } 2970 2971 crr_yvt.addClass('status-check').removeClass('status-offline status-live recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl').removeClass('active-item'); 2972 2973 var rnd_url_recent_id = 'cache_'+(Math.random().toString(36).substring(2, 11) + Math.random().toString(36).substring(2, 15)); 2974 2975 $.ajax({ 2976 url: _.updateQueryStringParameter(recent_url, 'vid_callback', encodeURIComponent(rnd_url_recent_id)), 2977 type: 'GET', 2978 cache: false, 2979 dataType: 'jsonp', 2980 success: function(data){ 2981 2982 if(typeof(data.items)==='undefined' || typeof(data.items[0])==='undefined'){ 2983 2984 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 2985 crr_yvt.find('.live-bar-btn-ctrl[data-action="recent"]').addClass('active-item'); 2986 2987 return; 2988 } 2989 2990 if(!crr_yvt.is('.status-offline.recent-active')){ 2991 crr_yvt.find('.live-player-item-control').remove(); 2992 } 2993 2994 $.each(data.items, function( index, value ){ 2995 2996 if(typeof(value.id)!=='undefined' && typeof(value.id.videoId)!=='undefined'){ 2997 append_html_player(value.id.videoId, 'recent'); 2998 } 2999 3000 }); 3001 3002 crr_yvt.addClass('firstly-done'); 3003 3004 }, 3005 error: function(err){ 3006 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 3007 console.log(err); 3008 return; 3009 } 3010 }); 3011 3012 } 3013 3014 var api_load_completed_live_video = function(){ 3015 3016 reload_action(); 3017 3018 if(crr_yvt.is('.status-offline.completed-active') || crr_yvt.find('.live-bar-btn-ctrl.user-click-item:not([data-action="completed"])').length > 0){ 3019 return; 3020 } 3021 3022 crr_yvt.addClass('status-check').removeClass('status-offline status-live recent-active scheduled-active completed-active').find('.live-bar-btn-ctrl').removeClass('active-item'); 3023 3024 var rnd_url_completed_id = 'cache_'+(Math.random().toString(36).substring(2, 11) + Math.random().toString(36).substring(2, 15)); 3025 3026 $.ajax({ 3027 url: _.updateQueryStringParameter(completed_url, 'vid_callback', encodeURIComponent(rnd_url_completed_id)), 3028 type: 'GET', 3029 cache: false, 3030 dataType: 'jsonp', 3031 success: function(data){ 3032 3033 if(typeof(data.items)==='undefined' || typeof(data.items[0])==='undefined'){ 3034 3035 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 3036 crr_yvt.find('.live-bar-btn-ctrl[data-action="completed"]').addClass('active-item'); 3037 3038 return; 3039 } 3040 3041 if(!crr_yvt.is('.status-offline.completed-active')){ 3042 crr_yvt.find('.live-player-item-control').remove(); 3043 } 3044 3045 $.each(data.items, function( index, value ){ 3046 3047 if(typeof(value.id)!=='undefined' && typeof(value.id.videoId)!=='undefined'){ 3048 append_html_player(value.id.videoId, 'completed'); 3049 } 3050 3051 });
3052 3053 crr_yvt.addClass('firstly-done'); 3054 3055 }, 3056 error: function(err){ 3057 crr_yvt.addClass('status-offline firstly-done').removeClass('status-check status-live recent-active scheduled-active completed-active').find('.live-player-item-control').remove(); 3058 console.log(err); 3059 return; 3060 } 3061 }); 3062 3063 } 3064 3065 switch(action){ 3066 case 'live': 3067 api_load_live_video(); 3068 break; 3069 3070 case 'scheduled': 3071 api_load_scheduled_live_video(); 3072 break; 3073 3074 case 'recent': 3075 api_load_recent_video(); 3076 break; 3077 3078 case 'completed': 3079 api_load_completed_live_video(); 3080 break; 3081 } 3082 3083 crr_yvt.find('.live-bar-btn-ctrl').on('click', function(){ 3084 var $t = $(this), 3085 d_action = $t.attr('data-action'); 3086 3087 crr_yvt.find('.live-bar-btn-ctrl').removeClass('user-click-item'); 3088 3089 $t.addClass('user-click-item'); 3090 3091 if(typeof(d_action)!=='undefined' && d_action!=''){ 3092 switch(d_action){ 3093 case 'live': 3094 api_load_live_video(); 3095 break; 3096 3097 case 'scheduled': 3098 api_load_scheduled_live_video(); 3099 break; 3100 3101 case 'recent': 3102 api_load_recent_video(); 3103 break; 3104 3105 case 'completed': 3106 api_load_completed_live_video(); 3107 break; 3108 } 3109 } 3110 3111 return false; 3112 }); 3113 } 3114 3115 vidorev_plugin.prototype.youtube_live_video = function(id){ 3116 var _ = this, 3117 $yvl_wrapper = _.$el.find('.yvl-wrapper-control'); 3118 3119 if(typeof(id)!=='undefined' && id!=''){ 3120 $yvl_wrapper = _.$el.find('.yvl-wrapper-control[id="'+(id)+'"]'); 3121 console.log($yvl_wrapper); 3122 } 3123 3124 if($yvl_wrapper.length>0){ 3125 $yvl_wrapper.each(function(index, element){ 3126 var crr_yvt = $(this), 3127 crr_id = crr_yvt.attr('id'); 3128 3129 if(typeof(crr_id)!=='undefined' && crr_id!='' && typeof(beeteam368_vid_live_json[crr_id])==='object'){ 3130 3131 var crr_obj = beeteam368_vid_live_json[crr_id]; 3132 _.youtube_live_video_pros(crr_yvt, crr_obj, 'live'); 3133 3134 } 3135 }); 3136 } 3137 } 3138 3139 /*destroy [Core]*/ 3140 vidorev_plugin.prototype.destroy = function(){ 3141 var _ = this; 3142 }/*destroy [Core]*/ 3143 3144 /*jquery [Core]*/ 3145 $.fn.J_vidorev_plugin = function(){ 3146 var _ = this, 3147 opt = arguments[0], 3148 args = Array.prototype.slice.call(arguments, 1), 3149 l = _.length, 3150 i, 3151 ret; 3152 for(i = 0; i < l; i++) { 3153 if(typeof opt == 'object' || typeof opt == 'undefined'){ 3154 _[i].J_vidorev_plugin = new vidorev_plugin(_[i], opt); 3155 }else{ 3156 ret = _[i].J_vidorev_plugin[opt].apply(_[i].J_vidorev_plugin, args); 3157 } 3158 if (typeof ret != 'undefined'){ 3159 return ret; 3160 } 3161 } 3162 return _; 3163 }/*jquery [Core]*/ 3164 3165 /*ready [Core]*/ 3166 $(document).ready(function(){ 3167 var $b = $( 'body' ), 3168 options = { }; 3169 3170 $b.on(prefix+'init', function(e, fnc){ 3171 console.log('VidoRev-plugin: library is installed, version 2.9.9.9.7.9'); 3172 vidorev_builder_control = fnc; 3173 }); 3174 3175 $b.J_vidorev_plugin( options ); 3176 });/*ready [Core]*/ 3177 3178}));
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.