1jQuery(document).ready(function ($) { 2 console.log('image-video.js ready'); 3 4 // UABB mounts video modals above the page but does not lock the document 5 // underneath. Keep the page in place while a video is open, then restore 6 // the exact scroll position when the modal closes. 7 var videoModalScrollState = null; 8 9 function lockVideoModalPage() { 10 if (videoModalScrollState !== null) { 11 return; 12 } 13 14 var body = document.body; 15 var html = document.documentElement; 16 17 videoModalScrollState = { 18 scrollY: window.pageYOffset || window.scrollY || 0, 19 bodyPosition: body.style.position, 20 bodyTop: body.style.top, 21 bodyWidth: body.style.width, 22 bodyOverflow: body.style.overflow, 23 htmlOverflow: html.style.overflow 24 }; 25 26 body.classList.add('image-video-modal-open'); 27 body.style.position = 'fixed'; 28 body.style.top = '-' + videoModalScrollState.scrollY + 'px'; 29 body.style.width = '100%'; 30 body.style.overflow = 'hidden'; 31 html.style.overflow = 'hidden'; 32 } 33 34 function unlockVideoModalPage() { 35 if (videoModalScrollState === null) { 36 return; 37 } 38 39 var body = document.body; 40 var html = document.documentElement; 41 var savedState = videoModalScrollState; 42 43 body.classList.remove('image-video-modal-open'); 44 body.style.position = savedState.bodyPosition; 45 body.style.top = savedState.bodyTop; 46 body.style.width = savedState.bodyWidth; 47 body.style.overflow = savedState.bodyOverflow; 48 html.style.overflow = savedState.htmlOverflow; 49 videoModalScrollState = null; 50 51 window.scrollTo(0, savedState.scrollY); 52 } 53 54 // These hooks fire for every Ultimate Addons modal. Restrict the page lock 55 // to video modals so non-video popups keep their existing behaviour. 56 if (typeof UABBTrigger !== 'undefined') { 57 UABBTrigger.addHook('uabb-modal-click', function (event, selector) { 58 var popup = $(selector).closest('.uabb-modal-parent-wrapper'); 59 60 if (popup.find('.uabb-modal-youtube, .uabb-modal-vimeo, .uabb-video-player').length) { 61 lockVideoModalPage(); 62 } 63 }); 64 65 UABBTrigger.addHook('uabb-modal-after-close', function (event, popup) { 66 if ($(popup).find('.uabb-modal-youtube, .uabb-modal-vimeo, .uabb-video-player').length) { 67 unlockVideoModalPage(); 68 } 69 }); 70 } 71 72 // Close a video popup when its dimmed backdrop is clicked. This is kept 73 // separate from UABB's optional overlay-click setting so the behaviour is 74 // consistent for every video modal using this component. 75 $(document).on('click', '.uabb-modal-parent-wrapper .uabb-overlay', function () { 76 var popup = $(this).closest('.uabb-modal-parent-wrapper'); 77 var isOpenVideoModal = popup.find('.uabb-modal.uabb-show').length && 78 popup.find('.uabb-modal-youtube, .uabb-modal-vimeo, .uabb-video-player').length; 79 80 if (isOpenVideoModal) { 81 popup.find('.uabb-modal-close').first().trigger('click'); 82 } 83 }); 84 85 // Background video modal // 86 function bg_video_modal(){ 87 $(".column_videobg").each(function(){ 88 89 if ($(this).find(".video_window_wrapper_inner").length) { 90 wrapper_h = $(this).find(".video_window_wrapper").height() 91 wrapper_w = $(this).find(".video_window_wrapper").width() 92 93 if (!$(this).find(".fl-module-modal-popup").length) 94 $(this).find(".video_window_wrapper").css({ 95 "min-height" : wrapper_h-90 96 }) 97 98 $(this).find(".video_window_wrapper_inner").height(wrapper_h) 99 100 new_w = wrapper_w+wrapper_h*3 101 $(this).find(".video_window_wrapper_inner").width(new_w) 102 103 $(this).find(".video_window_wrapper_inner").css("left",-(new_w/2 - wrapper_h/1.2)) 104 //$(this).find(".video_window_wrapper_inner").css("top",-wrapper_h/8) 105 } 106 }) 107 108 109 } 110 //bg_video_modal(); 111 112 113 // WINDOW RESIZE // 114 $(window).on( "resize", function() { 115 //bg_video_modal(); 116 }); 117 // WINDOW SCROLL // 118 $(window).on( "scroll", function() { 119 120 }); 121})
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.