JSFiddle - React, Tailwind, and code Playground
by Jim_Toth
JavaScript
(function () {
function j(a, c) {
return new Promise(function (d, i) {
function j(a) {
if (!(a.origin != m || a.source != p.contentWindow) && "ready" == a.data) window.clearTimeout(l), window.removeEventListener("message", j), window.addEventListener("message", f), d(p)
}
var p = document.createElement("iframe");
p.setAttribute("src", a);
p.setAttribute("style", "display:none");
p.height = 1;
p.width = 1;
var l = window.setTimeout(function () {
window.removeEventListener("message", j);
document.body.removeChild(p);
i(Error("timeout waiting for iframe to load"))
},
c);
window.addEventListener("message", j);
document.body.appendChild(p)
})
}
function f(a) {
for (var d, f = c.length; f-- && c[f].msgId !== a.data.msgId;);
if (!(d = 0 > f)) d = a.data, d = !(a.origin === m && d && d.hasOwnProperty("success") && d.hasOwnProperty("result") && d.hasOwnProperty("msgId"));
d || (d = c[f].handler, c.splice(f, 1), d(a))
}
var l = navigator.userAgent.match(/Chrome\/([0-9]*)/);
if (l && 37 <= parseInt(l[1])) {
var m = "https://secure.netflix.com",
i = m + "/us/ffe/player/webCryptoIframe/nfcrypto-iframe-inner-2202394.html",
a = 0,
c = [],
d = (new Promise(function (a) {
function c() {
document.removeEventListener("DOMContentLoaded",
c);
a()
}
"loading" === document.readyState ? document.addEventListener("DOMContentLoaded", c) : a()
})).then(function () {
return j(i, 2E3)
}).
catch (function () {
return j(i, 8E3)
}),
p = {
subtle: {}
...