1document.addEventListener("DOMContentLoaded", function () { 2 jQuery("body").delegate("#h5ap_shortcode_button", "click", function () { 3 var tnc_file_uploader = wp 4 .media({ 5 title: "Upload File", 6 button: { 7 text: "Insert", 8 }, 9 library: { type: "audio" }, 10 multiple: false, 11 }) 12 .on("select", function () { 13 var attachment = tnc_file_uploader.state().get("selection").first().toJSON(); 14 wp.media.editor.insert('[h5ap_inline_player src="' + attachment?.url + '"]'); 15 }) 16 .open(); 17 }); 18 19 const inlinePlayers = document.querySelectorAll(".h5ap_inline_player"); 20 if (inlinePlayers) { 21 Object.values(inlinePlayers).map((playerWrapper) => { 22 const player = playerWrapper.querySelector("audio"); 23 const playBtn = playerWrapper.querySelector(".dashicons-controls-play"); 24 const pauseBtn = playerWrapper.querySelector(".dashicons-controls-pause"); 25 playBtn.onclick = function () { 26 player.play(); 27 }; 28 pauseBtn.onclick = function () { 29 player.pause(); 30 }; 31 32 player.addEventListener("play", function () { 33 playBtn.style.display = "none"; 34 pauseBtn.style.display = "inline-block"; 35 // playerWrapper.classList.remove("paused"); 36 // playerWrapper.classList.add("playing"); 37 }); 38 player.addEventListener("pause", function () { 39 // playerWrapper.classList.add("paused"); 40 // playerWrapper.classList.remove("playing"); 41 pauseBtn.style.display = "none"; 42 playBtn.style.display = "inline-block"; 43 }); 44 }); 45 } 46});
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.