Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(t) {
- function e(t, e) {
- var n, o, i = "";
- return (n = t.indexOf("#")) < 0 || (i = t.substr(n), t = t.substr(0, n)), (n = t.indexOf("?")) < 0 || (o = t.substr(n), t = t.substr(0, n)), e = o ? o + "&" + e : "?" + e, t + e + i
- }
- function n() {
- return q || (q = $("<div></div>").css({
- visibility: "hidden",
- position: "absolute",
- left: -2e4,
- top: -2e4,
- width: "100%",
- height: "100%"
- }).appendTo("body")), q
- }
- function o(t, e) {
- F = t, G = e, P || (P = $("<iframe id=loginiframe></iframe>").css(z)), P.appendTo(n()).attr("src", K + "&t=" + x()).lightbox($.extend({
- canclose: r
- }, J))
- }
- function i(t, e) {
- F = t, G = e, P || (P = $("<iframe id=loginiframe></iframe>").css(z)), P.appendTo(n()).attr("src", logouturl + "&t=" + x())
- }
- function a() {
- f(), P && P.attr("src", ""), $.lightbox_handler && $.lightbox_handler.close(), v(Q + "?command=whoami", l)
- }
- function r() {
- return !1
- }
- function l(t) {
- var e = F;
- V = t, t ? ($("#loginkey").text(t), $("#playlogin").text("Play as " + t)) : ($("#loginkey").text(""), $("#playlogin").text("Play (login)")), F = null, e && e()
- }
- function s() {
- f(), W ? d() : w(d)
- }
- function d() {
- V ? i(d) : o(b, p)
- }
- function _() {
- f(), w()
- }
- function c(t, e) {
- h(), u(e), t && l(t)
- }
- function u(t) {
- j = t;
- var e, n, o, i, a = [{
- id: "play",
- text: "Play",
- svg: "M 0% 0% L 100% 50% L 0% 100% z",
- func: s
- }],
- r = $("#embed_buttons");
- if (!r.length) return _();
- for (r.children(".embed_button").remove(), e = 0, n = a.length; n > e; ++e) {
- if (o = a[e], i = $("<a class=embed_button></a>").attr("id", o.id).text(o.text).appendTo(r), o.svg) {
- var l = m(o.svg, 50);
- i.empty().append(l), i.attr("title", o.text)
- }
- o.func ? i.click(o.func) : o.link && i.attr({
- href: o.link,
- target: "_blank"
- })
- }
- }
- function f() {
- $("#embed_buttons_container").fadeOut()
- }
- function p() {
- $("#embed_buttons_container").fadeIn()
- }
- function h() {
- var t, n, o, i, a = [{
- id: "popout",
- text: "Popout",
- svg: "M 0 0 L 40% 0 L 40% 10% L 10% 10% L 10% 40% L 0 40% z M 100% 100% L 60% 100% L 60% 90% L 90% 90% L 90% 60% L 100% 60% z M 100% 0 L 100% 40% L 90% 40% L 90% 10% L 60% 10% L 60% 0 z M 0 100% L 0 60% L 10% 60% L 10% 90% L 40% 90% L 40% 100% z",
- link: e("" + window.location, "popout=1")
- }],
- r = $("#embed_footer");
- if (r.length)
- for (t = 0, n = a.length; n > t; ++t) {
- if (o = a[t], i = $("<a class=embed_button></a>").attr("id", o.id).text(o.text).appendTo(r), o.svg) {
- var l = m(o.svg, 16);
- i.empty().append(l), i.attr("title", o.text)
- }
- o.func ? i.click(o.func) : o.link && i.attr({
- href: o.link,
- target: "_blank"
- })
- }
- }
- function m(t, e) {
- var n = "http://www.w3.org/2000/svg",
- o = document.createElementNS(n, "svg");
- o.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"), $(o).css({
- width: e,
- height: e,
- display: "inline-block"
- });
- var i = document.createElementNS(n, "path");
- return i.setAttribute("d", g(t, e)), i.setAttribute("fill", "currentColor"), o.appendChild(i), o
- }
- function g(t, e) {
- var n, o;
- for (t = t.split(/[\s,\n\r]+/), n = 0, o = t.length; o > n; ++n) t[n].match(/^(-?[\d\.]+)(e[+\-]?\d+)?\%$/i) && (t[n] = (parseFloat(RegExp.$1) * e / 100).toFixed(2).replace(/\.0+$/, "").replace(/(\..*)0+$/, "$1"));
- return t.join(" ")
- }
- function v(t, e) {
- var n = ajaxObject();
- n && (n.onreadystatechange = function() {
- if (n && 4 == n.readyState) {
- var t = null;
- 200 == n.status && (t = n.responseText.replace(/\r/g, "").replace(/^\n+/, "").replace(/\n$/, "")), e(t, n.status)
- }
- }, n.open("GET", t, !0), n.send(""))
- }
- function b() {
- W ? (Z = null, $("#gameframe").attr("src", W)) : w()
- }
- function w(t) {
- W = null, v(j + "/query", function(e) {
- var n;
- if (null == e) return void A("The game is currently not available to play.");
- try {
- n = JSON.parse(e)
- } catch (o) {
- console.log(o)
- }
- return n.fail ? void A($("<div></div>").text(n.fail).html()) : (n.url || (n.url = "/play"), n.url.match(/^https?:\/+/) || (n.url = j + n.url), W = n.url, void(t ? t() : b()))
- })
- }
- function y(t, e) {
- v(t + "/query", function(n) {
- var o;
- if (null != n) {
- try {
- o = JSON.parse(n)
- } catch (i) {
- console.log(i)
- }
- o.fail || (o.url || (o.url = "/play"), o.url.match(/^https?:\/+/) || (o.url = t + o.url), O(), W = o.url, e ? e() : b())
- }
- })
- }
- function T(t) {
- var e = t.data;
- "closelogin" == e && a()
- }
- function x() {
- return (new Date).getTime()
- }
- function E(t) {
- var e = new XMLHttpRequest,
- n = "command=keyreq&url=" + encodeURIComponent(Z);
- t && (n += "&key=" + encodeURIComponent(t)), e.onreadystatechange = function() {
- if (this && 4 == this.readyState) {
- var t = this.responseText.trim();
- t.length < 25 ? C(t) : (M(), I(te, 200 == this.status ? "key:" + t : "key_failed", Z))
- }
- }, e.open("POST", "/", !0), e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), e.send(n)
- }
- function L(e) {
- var n, o, i, a, r = e.source,
- l = e.data;
- if ("string" == typeof l) {
- for (; r && r != t;) r = r.parent;
- if (r == t) {
- if (e.origin && e.origin.match(/^https?:\/+\w+\.byond\.com(\/|$)/)) return void T(e);
- if (Z) {
- if (Z != e.origin) return
- } else Z = e.origin, te = e.source;
- if ("key" == l) E();
- else if (l.match(/^progress:(\d+)\/(\d+)$/i)) D(RegExp.$1, RegExp.$2);
- else if (l.match(/^scripts:(.*)$/i)) "begin" == RegExp.$1 ? D(0, 0, "Connected to world, downloading client") : D();
- else if (l.match(/^command:/i)) {
- if (l = l.substr(8), i = "", l.match(/^\w*:/) && (n = l.indexOf(":"), o = l.substr(0, n), l = l.substr(n + 1)), l.match(/^\w*:/) && (n = l.indexOf(":"), i = l.substr(n + 1), l = l.substr(0, n)), a = t.webclientCommand, a && a[l]) {
- var s = a[l](i, e.source);
- o && e.source.postMessage("command_callback:" + JSON.stringify({
- name: o,
- command: l,
- arg: i,
- result: s
- }), "*")
- }
- } else l.match(/^ready/i) && N()
- }
- }
- }
- function I(t, e, n) {
- n = n || "*";
- try {
- t.postMessage(e, n)
- } catch (o) {}
- }
- function O() {
- $("#backdrop").show(), $("#altContent2").length || $("#notprogress").append('<div id="altContent2" class="embed_div"></div>'), $("#progresstext").text(""), $("#progress").css("width", 0)
- }
- function D(t, e, n) {
- try {
- t || (t = 0), e || (e = 0), t -= 0, e -= 0, n ? ($("#progresstext").text(n), show = 1) : (t > e && (t = e), $("#progressbar").css("width", t / (e || 1) * 100 + "%"), e && e > t && $("#progresstext").text("Loading resources (" + k(t) + " of " + k(e) + ")"))
- } catch (o) {}
- }
- function k(t) {
- for (var e = ["B", "KB", "MB", "GB"], n = 0; t >= 1e3 && n + 1 < e.length;) t /= 1024, ++n;
- return t = n && 100 > t ? t.toFixed(1) : Math.floor(t + .5), t + " " + e[n]
- }
- function A(t) {
- $("#faildiv").show();
- var e = $("#fail");
- e.length || (X = null, $("<table cellspacing=0 cellpadding=0><tr><td id=failtext></td></tr></table>").css({
- border: "none",
- maxWidth: "60%",
- height: "100%",
- margin: "0 auto"
- }).appendTo("#faildiv")), $("#failtext").html(t)
- }
- function C(t) {
- X || (X = t, pe ? U(!0) : R(!0))
- }
- function M() {
- ce && clearTimeout(ce), $(ae).remove(), $("#gameframe,.gameitem").css("visibility", "visible")
- }
- function N() {
- $("#backdrop").hide()
- }
- function B() {
- $("#faildiv").hide(), M(), E(X)
- }
- function S() {
- var t = X;
- ee = null, A("Flash is unavailable. Please wait a few seconds for game to load."), X = t, setTimeout(B, 15e3)
- }
- function R(t) {
- t ? ee = pe ? U : S : ee && ee != R || (ee = H);
- try {
- $(ae).append($("<video id=vid1></video>").css({
- width: "100%",
- height: "100%",
- zIndex: "0"
- }));
- var e = videojs("vid1", {
- controls: !1,
- autoplay: !1,
- width: $(re).width(),
- height: $(re).height()
- });
- e.ads(), e.vast({
- url: "http://ads.intergi.com/adrawdata/3.0/5205/3327855/0/4796/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__",
- skip: 10
- }), e.on("adsready", function() {
- var t = this;
- t.vast.preroll(), e.paused() && (e.one("play", function() {
- e.controls(!1)
- }), e.controls(!0))
- }), e.on("adend", function() {
- $("#vid").remove(), B()
- }), e.on("adtimeout", function() {
- $("#vid").remove(), ee ? (ue = 0, setTimeout(ee, 100)) : H("html5")
- }), e.trigger("contentupdate")
- } catch (n) {
- ++ue < 3 ? setTimeout(R, 100) : ee && (ue = 0, setTimeout(ee, 100))
- }
- }
- function U(t) {
- if (t ? ee = R : ee && ee != U || (ee = H), !pe) return S();
- try {
- if (he) {
- var e, n = $("body")[0];
- e = document.createElement("script");
- var o = {
- "data-vast-src": "http://ads.intergi.com/adrawdata/3.0/5205/2594435/0/2898/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__",
- "data-container": ie,
- "data-post-ad-container": ie,
- "data-autoplay": "true",
- "data-autoload": "false",
- "data-width": $(re).width(),
- "data-height": $(re).height(),
- "data-foreground-color": "0xffffff",
- "data-background-color": "0x000000"
- };
- if (e.setAttribute)
- for (var i in o) o.hasOwnProperty(i) && e.setAttribute(i, o[i]);
- else
- for (var i in o) o.hasOwnProperty(i) && (e[i] = o[i]);
- e.src = "http://cdn.playwire.com/bolt/js/embed.min.js", n.appendChild(e), boltTries = 0, window.boltDone = function() {
- Bolt.removeVideo(ie, !0), B()
- }, window.boltFailed = function() {
- Bolt.removeVideo(ie, !0), ee ? (ue = 0, setTimeout(ee, 100)) : H()
- }, window.startBolt = function() {
- return "undefined" != typeof Bolt && Bolt.renderVideo ? (Bolt.addEventListener ? Bolt.addEventListener(ie, "boltAdComplete", boltDone) : $(ae).bind("boltAdComplete", boltDone), Bolt.addEventListener && Bolt.addEventListener(ie, "boltAdError", boltFailed), void Bolt.renderVideo(ie, new AttributesParser(e).data)) : void(++boltTries > 20 ? H() : setTimeout(startBolt, 100))
- }, startBolt()
- } else {
- var e = document.createElement("script"),
- n = $("body")[0];
- e.src = "http://cdn.playwire.com/wrapper.min.js", n.appendChild(e);
- var a = function() {
- var t = iwWrapper;
- return typeof t === oe ? setTimeout(a, 100) : (t.url = "http://ads.intergi.com/adrawdata/3.0/5205/3245144/0/2898/ADTECH;cors=yes;width=__WIDTH__;height=__HEIGHT__;referring_url=__WEB_URL__;content_url=__CONTENT_URL__;media_id=__MEDIA_ID__;title=__TITLE__;device=__DEVICE__;model=__MODEL__;os=__OS__;osversion=__OSVERSION__;ua=__UA__;ip=__IP__;uniqueid:__UNIQUEID__;tags=__TAGS__;number=__RANDOM__;time=__TIME__", t.to_wrap = ie, t.width = $(re).width(), t.height = $(re).height(), t.callback = B, void t.init())
- };
- setTimeout(a, 100)
- }
- } catch (r) {
- ++ue < 3 ? setTimeout(U, 100) : ee && (ue = 0, setTimeout(ee, 100))
- }
- }
- function H(t) {
- ee = null, X = null, ce && clearTimeout(ce), ce = 0;
- var e;
- e = "flash" == t ? 'To view ads you need <a href="http//get.adobe.com/flashplayer">Flash</a> enabled.' : 'This could be due to an ad blocker or a technical issue.<br/><br/>If you are not blocking ads, please contact <a href="' + se + '">BYOND support</a>. Otherwise, please turn off your ad blocking software for byond.com.', A(de + e + _e)
- }
- var P, V, j, W, F, G, q, z = {
- minWidth: "25vw",
- minHeight: "25vh",
- maxWidth: "90vw",
- maxHeight: "90vh"
- },
- J = {
- foregroundColor: "transparent"
- },
- Q = window.location.origin,
- Y = Q.replace(/^http:/, "https:").replace(/^https:\/+www\./, "https://secure."),
- K = Y + "/login.cgi?frame=1&login=1&url=" + Q;
- logouturl = Y + "/?command=logout_ajax", byondplay = Q + "/play/";
- var X, Z, te, ee, ne = swfobject,
- oe = "undefined",
- ie = "altContent2",
- ae = "#" + ie,
- re = "#gamecontainer",
- le = "http://www.byond.com/membership",
- se = "http://www.byond.com/support",
- de = "An advertisement could not be displayed. ",
- _e = ' <a href="' + le + '">BYOND Members</a> also have the option to disable ads.',
- ce = 0,
- ue = 0,
- fe = typeof ne !== oe ? ne.getFlashPlayerVersion() : {},
- pe = !!fe.major,
- he = !(typeof ne === oe || !ne.hasFlashPlayerVersion("11.4"));
- t.addEventListener("message", L), $.extend(t, {
- login: o,
- logout: i,
- logged_in: l,
- ajaxGet: v,
- pinggame: w,
- pinglink: y,
- progress: D,
- setup: c
- })
- }(window);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement