1/** 2 * Front-end javascript for Rainmaker LMS embedded media. 3 * 4 * @require jQuery 5 * @require Magnific Popup 6 * 7 * @since 2.3 8 */ 9 10;jQuery( function(){ 11 12 // jQuery( '.lms-media-download-type:contains("pdf")' ).parent('li').addClass('show-on-mobile'); 13 // jQuery( '.lms-media-download-type:contains("JPG")' ).parent('li').addClass('show-on-mobile'); 14 // jQuery( '.lms-media-download-type:contains("gif")' ).parent('li').addClass('show-on-mobile'); 15 // jQuery( '.lms-media-download-type:contains("png")' ).parent('li').addClass('show-on-mobile'); 16 17 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 18 19 jQuery( '.lms-media-download:not(".show-on-mobile")').hide(); 20 21 } 22 23 jQuery( '.lms-media-embed-media' ).on( 'click', 'a.iframe', function( event ){ 24 _this = jQuery( this ), 25 url = _this.attr( 'href' ); 26 27 event.preventDefault(); 28 29 jQuery.magnificPopup.open({ 30 type: 'iframe', 31 items: { 32 src: url 33 }, 34 callbacks: { 35 open: lms_embed_media_modal_open 36 } 37 }); 38 }); 39 40 jQuery( '.lms-media-content' ).on( 'click', 'a.lms-modal', function( event ){ 41 event.preventDefault(); 42 43 jQuery( '#media-modal-content' ).addClass( 'mfp-hide' ).removeClass( 'lms-mfp-slide' ); 44 45 jQuery.magnificPopup.open({ 46 items: { 47 type: 'inline', 48 src: '#media-modal-content' 49 }, 50 callbacks: { 51 open: lms_embed_media_modal_open 52 } 53 }); 54 }); 55 56 /** 57 * Callback for Magnific popup 'open' event. 58 * 59 * @since 2.3 60 * 61 * @return {void} 62 */ 63 function lms_embed_media_modal_open(){ 64 var modal_window = jQuery( '.mfp-content' ); 65 66 if( ! modal_window.hasClass( 'lms' ) ){ 67 modal_window.addClass( 'lms' ); 68 } 69 70 var window_height = jQuery( window ).height(); 71 var height = modal_window.height(); 72 var iframe = modal_window.find( 'iframe' ); 73 var video = modal_window.find( '.wp-video-shortcode' ); 74 75 //* if modal height is larger than the viewport, resize 76 if( height + 20 > window_height ){ 77 modal_window.css( 'height', ( window_height - 40 ) + 'px' ); 78 } 79 80 //* get the new height 81 height = modal_window.height(); 82 height = height - 80; 83 84 //* resize the iframe 85 iframe.css( 'height', height + 'px' ); 86 video.css( 'height', height + 'px' ); 87 } 88 89});
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.