1jQuery(function ($) { 2 $(document).ready(function () { 3 // $('.pdfp_insert_pdf_btn').click(open_media_window); 4 setTimeout(() => { 5 document.querySelectorAll('.pdfp_insert_pdf_btn').forEach(btn => { 6 btn.addEventListener('click', open_media_window); 7 }) // end fo 8 }, 1000); 9 10 }); 11 12 13 function open_media_window() { 14 if (this.window === undefined) { 15 this.window = wp.media({ 16 title: 'Choose PDF File', 17 library: { type: 'application/pdf' }, 18 multiple: false, 19 button: { text: 'Embed This File' } 20 }); 21 22 var self = this; // Needed to retrieve our variable in the anonymous function below 23 this.window.on('select', function () { 24 var first = self.window.state().get('selection').first().toJSON(); 25 wp.media.editor.insert('[pdf_embed url="' + first.url + '"]'); 26 }); 27 } 28 29 this.window.open(); 30 return false; 31 } 32 33 34});
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.