1 2function documentReady(callback) { 3 new Promise((resolutionFunc, rejectionFunc) => { 4 if (document.readyState === 'interactive' || document.readyState === 'complete') { 5 resolutionFunc('interactive') 6 } 7 document.addEventListener('DOMContentLoaded', () => { 8 resolutionFunc('DOMContentLoaded') 9 }, false); 10 setTimeout(() => { 11 resolutionFunc('timeout') 12 }, 35000); 13 }).then(resolution => { 14 callback(resolution); 15 }).catch(err => { 16 callback(err) 17 }); 18} 19 20documentReady(() => { 21 22 23 const wrapElementInHtml = () => { 24 25 } 26 27 28 const $wpBlocks = document.querySelectorAll('.wp-block-audio:not(.dzsap-treated)'); 29 30 $wpBlocks.forEach(($node) => { 31 32 const src = $node.querySelector('audio').getAttribute('src'); 33 const preloadMethod = $node.querySelector('audio').getAttribute('preload'); 34 const isAutoplay = $node.querySelector('audio').autoplay; 35 const isLoop = $node.querySelector('audio').loop; 36 $node.classList.add('dzsap-treated'); 37 38 let playerOptions = { 39 loop: isLoop ? 'on': 'off', 40 autoplay: isAutoplay ? 'on': 'off', 41 preload_method: preloadMethod, 42 }; 43 44 45 46 let $feed_dzsapConfigs = null; 47 const $feed_dzsapConfigsAll = document.querySelectorAll('.dzsap-feed--dzsap-configs'); 48 if ($feed_dzsapConfigsAll.length) { 49 $feed_dzsapConfigs = $feed_dzsapConfigsAll[$feed_dzsapConfigsAll.length-1]; 50 } 51 if ($feed_dzsapConfigs) { 52 window.dzsap_apconfigs = JSON.parse($feed_dzsapConfigs.innerHTML); 53 } 54 55 56 57 58 59 60 let $feed_dzsapMainSettings = null; 61 const $feed_dzsapMainSettingsAll = document.querySelectorAll('.dzsap-main-settings'); 62 if ($feed_dzsapMainSettingsAll.length) { 63 $feed_dzsapMainSettings = $feed_dzsapMainSettingsAll[$feed_dzsapMainSettingsAll.length-1]; 64 } 65 if ($feed_dzsapMainSettings) { 66 window.dzsap_settings = JSON.parse($feed_dzsapMainSettings.innerHTML); 67 } 68 69 70 71 72 const view_replace_audio_shortcode = String(window.dzsap_settings.view_replace_audio_shortcode); 73 74 const sanitizedKey = view_replace_audio_shortcode.replace(/[^a-zA-Z0-9\-]+/g, ''); 75 76 77 if(sanitizedKey && window.dzsap_apconfigs[sanitizedKey]){ 78 79 playerOptions = Object.assign(window.dzsap_apconfigs[sanitizedKey], playerOptions); 80 } 81 82 83 84 85 86 let newHtml = `<div class="audioplayer-tobe apconfig-${sanitizedKey} ${playerOptions.skin_ap} auto-init`; 87 88 89 if(playerOptions.button_aspect){ 90 newHtml+=` ${playerOptions.button_aspect}`; 91 } 92 93 newHtml+=`" data-options='${JSON.stringify(playerOptions)}' data-type="audio" 94 data-source="${src}" > 95 </div>`; 96 97 $node.innerHTML = newHtml; 98 99 100 setTimeout(()=>{ 101 102 if (window.jQuery && window.dzsap_init_allGalleries) { 103 window.dzsap_init_allGalleries(window.jQuery) 104 } 105 if (window.jQuery && window.dzsap_init_allPlayers) { 106 window.dzsap_init_allPlayers(window.jQuery) 107 } 108 },10); 109 110 }) 111})
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.