1console.log( 2 "not acast", 3 document 4 .querySelector(".controls iframe") 5 .getAttribute("src") 6 .indexOf("embed.acast.com") < 0 7); 8if ( 9 document.querySelector(".controls iframe") && 10 document 11 .querySelector(".controls iframe") 12 .getAttribute("src") 13 .indexOf("embed.acast.com") < 0 14) { 15 var player; 16 17 function loadPlayer(targ) { 18 player = new playerjs.Player(targ); 19 20 player.on("ready", function () { 21 console.log("ready", $(".controls").attr("data-play-id")); 22 var track = window.episodesSorted.find( 23 (x) => 24 x.id.replace(/\W/, "") === 25 $(".controls").attr("data-play-id").replace(/\W/, "") 26 ); 27 console.log({ track }); 28 $(".controls .duration").html(track.duration); 29 $(".episode-title").html("<em>" + track.num + ":</em> " + track.title); 30 }); 31 // when the player is played 32 player.on("play", function () { 33 document.body.classList.add("playing"); 34 }); 35 // when the player is paused 36 player.on("pause", function () { 37 document.body.classList.remove("playing"); 38 }); 39 // when the player is playing, receive progress events 40 player.on("timeupdate", function (data) { 41 // console.log("timeupdate (seconds: " + data.seconds + " duration: " + data.duration +")"); 42 document.body.classList.remove("audio-loading"); 43 $(".controls .meter").width((data.seconds / data.duration) * 100 + "%"); 44 var m = Math.floor(data.seconds / 60), 45 s = Math.floor(data.seconds % 60); 46 $(".controls .current-time").html( 47 (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s 48 ); 49 var m = Math.floor(data.duration / 60), 50 s = Math.floor(data.duration % 60); 51 $(".controls .duration").html( 52 (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s 53 ); 54 }); 55 // when the player is paused 56 player.on("ended", function () { 57 $(".controls .meter").width(0 * 100 + "%"); 58 $(".controls .current-time").html("00:00"); 59 document.body.classList.remove("playing"); 60 }); 61 } 62 63 function checkForData(targ) { 64 var checkExist = setInterval(function () { 65 if (window.episodesSorted) { 66 console.log("Data loaded"); 67 loadPlayer(targ); 68 clearInterval(checkExist); 69 } 70 }, 100); 71 } 72 73 // playerjs can only be initialized after the iframe has loaded 74 // initialize playerjs using jquery's document ready state 75 $(function () { 76 $(".controls iframe").on("load", function () { 77 checkForData(this); 78 }); 79 80 // play button 81 $("body").on("click", ".play-icon", function () { 82 $("body").addClass("open-player"); 83 $(this).removeClass("block-play"); 84 console.log( 85 this.getAttribute("data-play-id"), 86 document.querySelector(".controls").getAttribute("data-play-id") 87 ); 88 var target = this.getAttribute("data-play-id"), 89 current = document 90 .querySelector(".controls") 91 .getAttribute("data-play-id"); 92 if (target == current) { 93 // same track, so play 94 $(".controls .play > *:visible").trigger("click"); 95 } else { 96 $(".controls .icn-pause").trigger("click"); 97 $(".controls iframe") 98 .one("load", function () { 99 $(".controls").attr("data-play-id", target); 100 $(`[data-play-id=${target}]`).trigger("click"); 101 }) 102 .attr( 103 "src", 104 window.episodesSorted.find((x) => x.id.replace(/\W/, "") === target) 105 .url 106 ); 107 } 108 }); 109 110 $("body").on("click", ".icn-play", function () { 111 document.body.classList.add("audio-loading"); 112 var awaitPlayer = setInterval(function () { 113 if (player.play) { 114 console.log("Player loaded"); 115 player.play(); 116 clearInterval(awaitPlayer); 117 } 118 }, 100); 119 }); 120 121 // track forward/back 122 $("body").on("click", ".play-next", function () { 123 player.getCurrentTime((time) => player.setCurrentTime(time + 10)); 124 }); 125 $("body").on("click", ".play-previous", function () { 126 player.getCurrentTime((time) => player.setCurrentTime(time - 10)); 127 }); 128 129 // mute button 130 $("body").on("click", ".t-mute", function () { 131 this.parentNode.classList.add("muted"); 132 player.mute(); 133 }); 134 $("body").on("click", ".t-unmute", function () { 135 this.parentNode.classList.remove("muted"); 136 player.unmute(); 137 }); 138 // pause button 139 $("body").on("click", ".icn-pause", function () { 140 player.pause(); 141 }); 142 143 $("body").on("click", ".progress-wrapper", function (e) { 144 var percent = e.offsetX / $(".controls .progress").width(); 145 player.getDuration(function (duration) { 146 player.setCurrentTime(percent * duration); 147 }, this); 148 }); 149 }); 150 151 // var iframeMouseOver = false 152 // $('.controls').on('mouseover', function() { 153 // console.log('hover') 154 // iframeMouseOver = true 155 // }) 156 // $('.controls').on('mouseout', function() { 157 // console.log('hoverout') 158 // iframeMouseOver = false 159 // }) 160 // $('.controls iframe').on('load', function() { 161 // $(window).on('blur', function(){ 162 // // console.log('WINDOW BLUR', iframeMouseOver) 163 // // if (iframeMouseOver) { 164 // // console.log('IFRAME CLICK'); 165 // $('.controls iframe').addClass('iframe-activated') 166 // $('.controls .icn-play').click() 167 // // } 168 // }) 169 // }) 170}
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.