1/** 2 * @package EmbedPress 3 * @author EmbedPress <[email protected]> 4 * @copyright Copyright (C) 2018 EmbedPress. All rights reserved. 5 * @license GPLv2 or later 6 * @since 1.7.0 7 */ 8(function ($) { 9 'use strict'; 10 $( document ).ready(function() { 11 var selector = $('.embedpress-embed-document-pdf'); 12 let option = { 13 forceObject: true, 14 }; 15 if(selector.length){ 16 selector.each(function(index, value) { 17 var $this = $(this), 18 id = $this.data('emid'), 19 src = $this.data('emsrc'); 20 PDFObject.embed(src, "."+id, option); 21 }); 22 } 23 }); 24 25 /** 26 * 27 * Make embeds responsive so they don't overflow their container. 28 */ 29 30 /** 31 * Add max-width & max-height to <iframe> elements, depending on their width & height props. 32 * 33 * 34 * @return {void} 35 */ 36 function embedPressResponsiveEmbeds() { 37 var proportion, parentWidth; 38 39 // Loop iframe elements. 40 document.querySelectorAll( 'iframe' ).forEach( function( iframe ) { 41 // Only continue if the iframe has a width & height defined. 42 if ( iframe.width && iframe.height ) { 43 // Calculate the proportion/ratio based on the width & height. 44 proportion = parseFloat( iframe.width ) / parseFloat( iframe.height ); 45 // Get the parent element's width. 46 parentWidth = parseFloat( window.getComputedStyle( iframe.parentElement, null ).width.replace( 'px', '' ) ); 47 // Set the max-width & height. 48 iframe.style.maxWidth = '100%'; 49 iframe.style.maxHeight = Math.round( parentWidth / proportion ).toString() + 'px'; 50 } 51 } ); 52 } 53 54 // Run on initial load. 55 embedPressResponsiveEmbeds(); 56 57 // Run on resize. 58 window.onresize = embedPressResponsiveEmbeds; 59 60})(jQuery);
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.