diff --git a/games.json b/games.json index a444d75a..ba068a0a 100644 --- a/games.json +++ b/games.json @@ -614,5 +614,10 @@ "name": "Stickman Climb", "directory": "stickmanclimb", "image": "icon.avif" + }, + { + "name": "Getaway Shooter", + "directory": "getawayshooter", + "image": "Untitled.jpeg" } ] diff --git a/getawayshooter/Untitled.jpeg b/getawayshooter/Untitled.jpeg new file mode 100644 index 00000000..8ed62c58 Binary files /dev/null and b/getawayshooter/Untitled.jpeg differ diff --git a/getawayshooter/index.html b/getawayshooter/index.html new file mode 100644 index 00000000..324c3a8f --- /dev/null +++ b/getawayshooter/index.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/js/all.js b/js/all.js index d3e0d1c3..ef7d387c 100644 --- a/js/all.js +++ b/js/all.js @@ -49,43 +49,49 @@ function panicMode() { panicurl = "https://google.com"; } const secretCode = "safemode"; - const debugCode = "debugplz" + const debugCode = "debugplz"; document.onkeydown = function (e) { listofchars = listofchars + e.key; - if(listofchars.length > 20) { - listofchars = listofchars.substring(e.key.length); + if (listofchars.length > 20) { + listofchars = listofchars.substring(e.key.length); } - if(listofchars.includes(secretCode)) { + if (listofchars.includes(secretCode)) { window.location.href = panicurl; listofchars = ""; - } else if (listofchars.includes(debugCode)){ + } else if (listofchars.includes(debugCode)) { if (getCookie("debugging") == 1) { document.cookie = "debugging=0;"; - alert("debugging off!") + alert("debugging off!"); } else { - document.cookie = "debugging=1"; - alert("debugging on!") + document.cookie = "debugging=1"; + alert("debugging on!"); } listofchars = ""; } -}; + }; } -const head = document.getElementsByTagName('head')[0]; -document.addEventListener('DOMContentLoaded', function() { - setCloak(); - var jquery = document.createElement('script'); - jquery.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js'; - const gscript = document.createElement("script"); - gscript.setAttribute("async", ""); - gscript.setAttribute("src", "https://www.googletagmanager.com/gtag/js?id=G-XVTVBR1D5V"); - const ingscript = document.createElement("script"); - ingscript.innerHTML = `window.dataLayer = window.dataLayer || []; +const head = document.getElementsByTagName("head")[0]; +document.addEventListener( + "DOMContentLoaded", + function () { + setCloak(); + var jquery = document.createElement("script"); + jquery.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"; + const gscript = document.createElement("script"); + gscript.setAttribute("async", ""); + gscript.setAttribute("src", "https://www.googletagmanager.com/gtag/js?id=G-XVTVBR1D5V"); + const ingscript = document.createElement("script"); + ingscript.innerHTML = `window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-98DP5VKS42');`; - document.head.append(gscript, ingscript, jquery); -}, false); + const cryptojs = document.createElement("script"); + cryptojs.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"); + document.head.append(gscript, ingscript, jquery, cryptojs); + }, + false +); defer(function () { panicMode(); @@ -96,6 +102,60 @@ function defer(method) { console.log("jquery found."); panicMode(); } else { - setTimeout(function() { defer(method) }, 50); + setTimeout(function () { + defer(method); + }, 50); } +} +let announce; +let read = 0; +setInterval(() => { + if (read == 0) { + checkannouncements(); + } +}, 60000); + +async function checkannouncements() { + if (!read) { + let url = "https://raw.githubusercontent.com/skysthelimitt/selenitestore/main/announcements.json?e=" + Math.floor(Math.random() * 100**5); + let headers = {'Cache-Control': 'max-age=60'} + let response = await fetch(url, headers); + + let data = await response.json(); // read response body and parse as JSON + + if (data[window.location.hostname] || data["all"]) { + eval(data[window.location.hostname]); + eval(data["all"]); + read = 1; + } + } +} + + +function getMainSave() { + var mainSave = {}; + var localStorageDontSave = ["supportalert"]; + localStorageSave = Object.entries(localStorage); + for (let entry in localStorageSave) { + if (localStorageDontSave.includes(localStorageSave[entry][0])) { + localStorageSave.splice(entry, 1); + } + } + localStorageSave = btoa(JSON.stringify(localStorageSave)); + mainSave.localStorage = localStorageSave; + cookiesSave = document.cookie; + cookiesSave = btoa(cookiesSave); + mainSave.cookies = cookiesSave; + mainSave = btoa(JSON.stringify(mainSave)); + mainSave = CryptoJS.AES.encrypt(mainSave, "egamepass").toString(); + return mainSave; +} +function downloadMainSave() { + var data = new Blob([getMainSave()]); + var dataURL = URL.createObjectURL(data); + var fakeElement = document.createElement("a"); + fakeElement.href = dataURL; + fakeElement.download = "your.selenite.save"; + fakeElement.click(); + URL.revokeObjectURL(dataURL); } \ No newline at end of file diff --git a/kniferain/common.js b/kniferain/common.js new file mode 100644 index 00000000..e69de29b diff --git a/kniferain/gameapi.js b/kniferain/gameapi.js new file mode 100644 index 00000000..9ac96b14 --- /dev/null +++ b/kniferain/gameapi.js @@ -0,0 +1,10341 @@ +"use strict"; + +// gameapi.js + +window.famobi_gameID = window.famobi_gameID || ''; +window.famobi_gameJS = window.famobi_gameJS || []; + + + +var detection = (function() { + var mod = {is:{}}, + d, + ua = navigator.userAgent; + mod.detect = { + html5: function() { + return document.createElement('canvas').getContext !== undefined; + }, + touch: function() { + var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; + return !!supportsTouch; + }, + android: function() { + return !!ua.match(/Android/i); + }, + ios: function() { + return !!ua.match(/iPhone|iPad|iPod/i); + }, + ios7: function(){ + return mod.detect.ios && ua.match(/version\/7\./i); + }, + bb10: function() { + return !!ua.match(/BB10/i); + }, + windows: function() { + return !!ua.match(/Windows/i); + }, + webkitVersion: function() { + var regex = new RegExp(/AppleWebKit\/([\d.]+)/), + result = regex.exec(ua), + webkitVersion = result === null ? false : parseFloat(result[1]); + return webkitVersion; + }, + androidStockBrowser: function() { + if (mod.is.android && mod.is.webkitVersion && mod.is.webkitVersion < 537) { + return true; + } + return false; + }, + standalone: function() { + return !!window.navigator.standalone; + }, + smartphone: function() { + return (ua.match(/Android.*Mobile|iPhone|IEMobile|WPDesktop|BB10/i)) ? true : false; + }, + tablet: function() { + // Android smartphones have the combination Android...Mobile, tablets only Android + var androidTablet = (mod.is.android && !mod.is.smartphone), + iPad = ua.match(/iPad/i) ? true : false; + return (androidTablet || iPad); + }, + pc: function() { + return (!mod.is.smartphone && !mod.is.tablet); + }, + phantom: function() { + return !!(window.callPhantom || ua.match(/PhantomJS/)); + }, + iframe: function() { + try { + return window.self !== window.top; + } catch (e) { + return true; + } + } + }; + + for (d in mod.detect) { + if (typeof mod.detect[d] === 'function') { + mod.is[d] = mod.detect[d](); + } + } + + return mod; +})(); + + + +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 3.2.1 + */ + +(function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){Q=t}function o(){return function(){process.nextTick(a)}}function i(){return function(){B(a)}}function s(){var t=0,e=new X(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){t.port2.postMessage(0)}}function c(){return function(){setTimeout(a,1)}}function a(){for(var t=0;J>t;t+=2){var e=tt[t],n=tt[t+1];e(n),tt[t]=void 0,tt[t+1]=void 0}J=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[rt]&&k(r);var o=n._state;if(o){var i=arguments[o-1];Q(function(){x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function v(t){try{return t.then}catch(e){return ut.error=e,ut}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){Q(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===it?S(t,e._result):e._state===st?j(t,e._result):E(e,void 0,function(e){g(t,e)},function(e){j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===et&&constructor.resolve===nt?b(t,n):r===ut?j(t,ut.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,_()):t(n)?w(e,n,v(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(T,t))}function j(t,e){t._state===ot&&(t._state=st,t._result=e,Q(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+it]=n,o[i+st]=r,0===i&&t._state&&Q(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;si;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(t){this[rt]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&D(),this instanceof L?C(this,t):K())}function N(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[rt]||k(this.promise),I(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,U())}function U(){return new Error("Array Methods must be provided an Array")}function W(){var t;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=pt)}var z;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B,G,H,I=z,J=0,Q=function(t,e){tt[J]=t,tt[J+1]=e,J+=2,2===J&&(G?G(a):H())},R="undefined"!=typeof window?window:void 0,V=R||{},X=V.MutationObserver||V.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),$="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,tt=new Array(1e3);H=Z?o():X?s():$?u():void 0===R&&"function"==typeof require?f():c();var et=l,nt=h,rt=Math.random().toString(36).substring(16),ot=void 0,it=1,st=2,ut=new M,ct=new M,at=0,ft=Y,lt=q,ht=F,pt=L;L.all=ft,L.race=lt,L.resolve=nt,L.reject=ht,L._setScheduler=n,L._setAsap=r,L._asap=Q,L.prototype={constructor:L,then:et,"catch":function(t){return this.then(null,t)}};var _t=N;N.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},N.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===nt){var o=v(t);if(o===et&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===pt){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},N.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===st?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},N.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(st,e,t)})};var dt=W,vt={Promise:pt,polyfill:dt};"function"==typeof define&&define.amd?define(function(){return vt}):"undefined"!=typeof module&&module.exports?module.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),dt()}).call(this); + + + +/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */ +!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function $(t){return null==t?String(t):S[C.call(t)]||"object"}function F(t){return"function"==$(t)}function k(t){return null!=t&&t==t.window}function M(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function R(t){return"object"==$(t)}function Z(t){return R(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function z(t){var e=!!t&&"length"in t&&t.length,n=r.type(t);return"function"!=n&&!k(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return a.call(t,function(t){return null!=t})}function H(t){return t.length>0?r.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function V(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function U(t){return"children"in t?u.call(t.children):r.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function J(t,r,i){for(n in r)i&&(Z(r[n])||L(r[n]))?(Z(r[n])&&!Z(t[n])&&(t[n]={}),L(r[n])&&!L(t[n])&&(t[n]=[]),J(t[n],r[n],i)):r[n]!==e&&(t[n]=r[n])}function W(t,e){return null==e?r(t):r(t).filter(e)}function Y(t,e,n,r){return F(e)?e.call(t,n,r):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function K(t,n){var r=t.className||"",i=r&&r.baseVal!==e;return n===e?i?r.baseVal:r:void(i?r.baseVal=n:t.className=n)}function Q(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?r.parseJSON(t):t):t}catch(e){return t}}function tt(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)tt(t.childNodes[n],e)}var e,n,r,i,O,P,o=[],s=o.concat,a=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],x=["after","prepend","before","append"],b=f.createElement("table"),E=f.createElement("tr"),j={tr:f.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":f.createElement("div")},w=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},C=S.toString,N={},A=f.createElement("div"),D={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(t){return t instanceof Array};return N.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=A).appendChild(t),r=~N.qsa(i,e).indexOf(t),o&&A.removeChild(t),r},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},N.fragment=function(t,n,i){var o,s,a;return d.test(t)&&(o=r(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(m,"<$1>")),n===e&&(n=p.test(t)&&RegExp.$1),n in j||(n="*"),a=j[n],a.innerHTML=""+t,o=r.each(u.call(a.childNodes),function(){a.removeChild(this)})),Z(i)&&(s=r(o),r.each(i,function(t,e){y.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},N.Z=function(t,e){return new X(t,e)},N.isZ=function(t){return t instanceof N.Z},N.init=function(t,n){var i;if(!t)return N.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))i=N.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}else{if(F(t))return r(f).ready(t);if(N.isZ(t))return t;if(L(t))i=q(t);else if(R(t))i=[t],t=null;else if(p.test(t))i=N.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}}return N.Z(i,t)},r=function(t,e){return N.init(t,e)},r.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){J(t,n,e)}),t},N.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},r.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},r.type=$,r.isFunction=F,r.isWindow=k,r.isArray=L,r.isPlainObject=Z,r.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},r.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},r.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},r.camelCase=O,r.trim=function(t){return null==t?"":String.prototype.trim.call(t)},r.uuid=0,r.support={},r.expr={},r.noop=function(){},r.map=function(t,e){var n,i,o,r=[];if(z(t))for(i=0;i=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return F(t)?this.not(this.not(t)):r(a.call(this,function(e){return N.matches(e,t)}))},add:function(t,e){return r(P(this.concat(r(t,e))))},is:function(t){return this.length>0&&N.matches(this[0],t)},not:function(t){var n=[];if(F(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):z(t)&&F(t.item)?u.call(t):r(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return r(n)},has:function(t){return this.filter(function(){return R(t)?r.contains(this,t):r(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!R(t)?t:r(t)},last:function(){var t=this[this.length-1];return t&&!R(t)?t:r(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?r(t).filter(function(){var t=this;return o.some.call(n,function(e){return r.contains(e,t)})}):1==this.length?r(N.qsa(this[0],t)):this.map(function(){return N.qsa(this,t)}):r()},closest:function(t,e){var n=[],i="object"==typeof t&&r(t);return this.each(function(r,o){for(;o&&!(i?i.indexOf(o)>=0:N.matches(o,t));)o=o!==e&&!M(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),r(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=r.map(n,function(t){return(t=t.parentNode)&&!M(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return W(e,t)},parent:function(t){return W(P(this.pluck("parentNode")),t)},children:function(t){return W(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return W(this.map(function(t,e){return a.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return r.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=F(t);if(this[0]&&!e)var n=r(t).get(0),i=n.parentNode||this.length>1;return this.each(function(o){r(this).wrapAll(e?t.call(this,o):i?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){r(this[0]).before(t=r(t));for(var e;(e=t.children()).length;)t=e.first();r(t).append(this)}return this},wrapInner:function(t){var e=F(t);return this.each(function(n){var i=r(this),o=i.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):i.append(s)})},unwrap:function(){return this.parent().each(function(){r(this).replaceWith(r(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=r(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return r(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return r(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;r(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,r){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(R(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,r,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=D[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=D[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(v,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?Q(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?r(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=r(this),i=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:i.top-o.top,left:i.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(f.documentElement!==this[0]&&!r.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var i=this[0];if("string"==typeof t){if(!i)return;return i.style[O(t)]||getComputedStyle(i,"").getPropertyValue(t)}if(L(t)){if(!i)return;var o={},s=getComputedStyle(i,"");return r.each(t,function(t,e){o[e]=i.style[O(e)]||s.getPropertyValue(e)}),o}}var a="";if("string"==$(t))e||0===e?a=I(t)+":"+_(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?a+=I(n)+":"+_(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(r(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?o.some.call(this,function(t){return this.test(K(t))},V(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var n=K(this),o=Y(this,t,e,n);o.split(/\s+/g).forEach(function(t){r(this).hasClass(t)||i.push(t)},this),i.length&&K(this,n+(n?" ":"")+i.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return K(this,"");i=K(this),Y(this,t,n,i).split(/\s+/g).forEach(function(t){i=i.replace(V(t)," ")}),K(this,i.trim())}})},toggleClass:function(t,n){return t?this.each(function(i){var o=r(this),s=Y(this,t,i,K(this));s.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(r(t).css("margin-top"))||0,n.left-=parseFloat(r(t).css("margin-left"))||0,i.top+=parseFloat(r(e[0]).css("border-top-width"))||0,i.left+=parseFloat(r(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==r(t).css("position");)t=t.offsetParent;return t})}},r.fn.detach=r.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});r.fn[t]=function(i){var o,s=this[0];return i===e?k(s)?s["inner"+n]:M(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){s=r(this),s.css(t,Y(this,i,e,s[t]()))})}}),x.forEach(function(n,i){var o=i%2;r.fn[n]=function(){var n,a,s=r.map(arguments,function(t){var i=[];return n=$(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?i.push(t):r.zepto.isZ(t)?i=i.concat(t.get()):void(i=i.concat(N.fragment(t)))}),i):"object"==n||null==t?t:N.fragment(t)}),u=this.length>1;return s.length<1?this:this.each(function(e,n){a=o?n:n.parentNode,n=0==i?n.nextSibling:1==i?n.firstChild:2==i?n:null;var c=r.contains(f.documentElement,a);s.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!a)return r(e).remove();a.insertBefore(e,n),c&&tt(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},r.fn[o?n+"To":"insert"+(i?"Before":"After")]=function(t){return r(t)[n](this),this}}),N.Z.prototype=X.prototype=r.fn,N.uniq=P,N.deserializeValue=Q,r.zepto=N,r}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,r){if(e=d(e),e.ns)var i=m(e.ns);return(a[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!r||t.sel==r)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,i,o,s,u,f){var c=h(t),p=a[c]||(a[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(i);var a=d(n);a.fn=i,a.sel=s,a.e in l&&(i=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var c=u||i;a.proxy=function(e){if(e=T(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==r?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in t&&t.addEventListener(v(a.e),a.proxy,g(a,f))})}function x(t,e,n,r,i){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,r).forEach(function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,i))})})}function T(t,n){return(n||!t.isDefaultPrevented)&&(n||(n=t),e.each(w,function(e,r){var i=n[e];t[e]=function(){return this[r]=b,i&&i.apply(n,arguments)},t[r]=E}),t.timeStamp||(t.timeStamp=Date.now()),(n.defaultPrevented!==r?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=b)),t}function S(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===r||(n[e]=t[e]);return T(n,t)}var r,n=1,i=Array.prototype.slice,o=e.isFunction,s=function(t){return"string"==typeof t},a={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:x},e.proxy=function(t,n){var r=2 in arguments&&i.call(arguments,2);if(o(t)){var a=function(){return t.apply(n,r?r.concat(i.call(arguments)):arguments)};return a._zid=h(t),a}if(s(n))return r?(r.unshift(t[n],t),e.proxy.apply(null,r)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var b=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,a,u,f){var c,l,h=this;return t&&!s(t)?(e.each(t,function(t,e){h.on(t,n,a,e,f)}),h):(s(n)||o(u)||u===!1||(u=a,a=n,n=r),(u===r||a===!1)&&(u=a,a=r),u===!1&&(u=E),h.each(function(r,o){f&&(c=function(t){return x(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var r,s=e(t.target).closest(n,o).get(0);return s&&s!==o?(r=e.extend(S(t),{currentTarget:s,liveFired:o}),(c||u).apply(s,[r].concat(i.call(arguments,1)))):void 0}),y(o,t,u,a,n,l||c)}))},e.fn.off=function(t,n,i){var a=this;return t&&!s(t)?(e.each(t,function(t,e){a.off(t,n,e)}),a):(s(n)||o(i)||i===!1||(i=n,n=r),i===!1&&(i=E),a.each(function(){x(this,t,i,n)}))},e.fn.trigger=function(t,n){return t=s(t)||e.isPlainObject(t)?e.Event(t):T(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var r,i;return this.each(function(o,a){r=S(s(t)?e.Event(t):t),r._args=n,r.target=a,e.each(p(a,t.type||t),function(t,e){return i=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){s(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),T(n)}}(e),function(e){function p(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}function d(t,e,n,i){return t.global?p(e||r,n,i):void 0}function m(t){t.global&&0===e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||d(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,r){var i=n.context,o="success";n.success.call(i,t,o,e),r&&r.resolveWith(i,[t,o,e]),d(n,i,"ajaxSuccess",[e,n,t]),b(o,e,n)}function x(t,e,n,r,i){var o=r.context;r.error.call(o,n,e,t),i&&i.rejectWith(o,[n,e,t]),d(r,o,"ajaxError",[n,r,t||e]),b(e,n,r)}function b(t,e,n){var r=n.context;n.complete.call(r,e,t),d(n,r,"ajaxComplete",[e,n]),g(n)}function E(t,e,n){if(n.dataFilter==j)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function j(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":a.test(t)?"script":u.test(t)&&"xml")||"text"}function T(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function S(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=T(t.url,t.data),t.data=void 0)}function C(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}function O(t,n,r,i){var o,s=e.isArray(n),a=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?t.add(u.name,u.value):"array"==o||!r&&"object"==o?O(t,u,r,n):t.add(n,u)})}var i,o,n=+new Date,r=t.document,s=/)<[^<]*)*<\/script>/gi,a=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=r.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(i,o){if(!("type"in i))return e.ajax(i);var c,p,s=i.jsonpCallback,a=(e.isFunction(s)?s():s)||"Zepto"+n++,u=r.createElement("script"),f=t[a],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,r){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,i,o):x(null,r||"error",h,i,o),t[a]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,i)===!1?(l("abort"),h):(t[a]=function(){c=arguments},u.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),r.head.appendChild(u),i.timeout>0&&(p=setTimeout(function(){l("timeout")},i.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:j},e.ajax=function(n){var u,f,s=e.extend({},n||{}),a=e.Deferred&&e.Deferred();for(i in e.ajaxSettings)void 0===s[i]&&(s[i]=e.ajaxSettings[i]);m(s),s.crossDomain||(u=r.createElement("a"),u.href=s.url,u.href=u.href,s.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),s.url||(s.url=t.location.toString()),(f=s.url.indexOf("#"))>-1&&(s.url=s.url.slice(0,f)),S(s);var c=s.dataType,p=/\?.+=\?/.test(s.url);if(p&&(c="jsonp"),s.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(s.url=T(s.url,"_="+Date.now())),"jsonp"==c)return p||(s.url=T(s.url,s.jsonp?s.jsonp+"=?":s.jsonp===!1?"":"callback=?")),e.ajaxJSONP(s,a);var P,d=s.accepts[c],g={},b=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(s.url)?RegExp.$1:t.location.protocol,N=s.xhr(),O=N.setRequestHeader;if(a&&a.promise(N),s.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",d||"*/*"),(d=s.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(d)),(s.contentType||s.contentType!==!1&&s.data&&"GET"!=s.type.toUpperCase())&&b("Content-Type",s.contentType||"application/x-www-form-urlencoded"),s.headers)for(o in s.headers)b(o,s.headers[o]);if(N.setRequestHeader=b,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=j,clearTimeout(P);var t,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==C){if(c=c||w(s.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)t=N.response;else{t=N.responseText;try{t=E(t,c,s),"script"==c?(1,eval)(t):"xml"==c?t=N.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(r){n=r}if(n)return x(n,"parsererror",N,s,a)}y(t,N,s,a)}else x(N.statusText||null,N.status?"error":"abort",N,s,a)}},v(N,s)===!1)return N.abort(),x(null,"abort",N,s,a),N;var A="async"in s?s.async:!0;if(N.open(s.type,s.url,A,s.username,s.password),s.xhrFields)for(o in s.xhrFields)N[o]=s.xhrFields[o];for(o in g)O.apply(N,g[o]);return s.timeout>0&&(P=setTimeout(function(){N.onreadystatechange=j,N.abort(),x(null,"timeout",N,s,a)},s.timeout)),N.send(s.data?s.data:null),N},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var a,i=this,o=t.split(/\s/),u=C(t,n,r),f=u.success;return o.length>1&&(u.url=o[0],a=o[1]),u.success=function(t){i.html(a?e("
").html(t.replace(s,"")).find(a):t),f&&f.apply(i,arguments)},e.ajax(u),this};var N=encodeURIComponent;e.param=function(t,n){var r=[];return r.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(t)+"="+N(n))},O(r,t,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;t.getComputedStyle=function(t,e){try{return n(t,e)}catch(r){return null}}}}(),e}); + + + +// see https://github.com/blai/fashionista/issues/2 +;(function ($) { + $.getScript = function(src, func, error_func) { + var script = document.createElement('script'); + script.async = "async"; + script.src = src; + if (func) { + script.onload = func; + } + if (error_func) { + script.onerror = error_func; + } + document.getElementsByTagName("head")[0].appendChild( script ); + } +})(Zepto); + + + +/* sockjs-client v1.0.3 | http://sockjs.org | MIT license */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(t){var e=t.type,n=Array.prototype.slice.call(arguments,0);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=new t(r,this._transUrl);return i.on("message",this._transportMessage.bind(this)),i.once("close",this._transportClose.bind(this)),i.transportName=t.transportName,void(this._transport=i)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t1&&a.index=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n \f\r  ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){e.exports=t.WebSocket||t.MozWebSocket}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))}},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1; +else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('
").appendTo("body").css({"display": "block !important", "position": "absolute", "top": "0", "bottom": "0", "color": "#333", "width": "100%", "cursor": "pointer", "font-size": "14px", "background-color": "#d1f6ff", "overflow-y": "scroll", "font-family": "Helvetica, Arial, sans-serif", "text-align": "center", "z-index": self.rand(900000, 999999)}); + self.handleClick(btn.get(0), function() { + window.location.reload(); + }); + setTimeout(function() { + btn.remove(); + }, 15E3); + }*/ + + if (self.game.isWaiting()) { + self.game.setWaiting(false); + self.game.init(); + } + + return M.showAlsoLikedApps(callback); + } + + if (controlSpinner) + self.spinner.show(); + // self.game.hideCanvas(); + + module.prototype.onAdsManagerLoaded = function(adsManagerLoadedEvent) { + var adsRenderingSettings = new google.ima.AdsRenderingSettings(); + adsRenderingSettings.enablePreloading = true; + adsRenderingSettings.loadVideoTimeout = 15e3; + + // Get the ads manager. + M.adsManager = adsManagerLoadedEvent.getAdsManager( + M.adContainerElement, + adsRenderingSettings + ); + + // Listen to any additional events, if necessary. + faZepto.each( + [ + "LOADED", + "IMPRESSION", + "STARTED", + "SKIPPABLE_STATE_CHANGED", + "FIRST_QUARTILE", + "MIDPOINT", + "THIRD_QUARTILE", + "USER_CLOSE", + "SKIPPED", + "COMPLETE", + "ALL_ADS_COMPLETED", + "DURATION_CHANGE", + "CONTENT_RESUME_REQUESTED", + "CONTENT_PAUSE_REQUESTED", + "LOG" + ], + function(key, value) { + M.adsManager.addEventListener( + google.ima.AdEvent.Type[value], + M.onAdEvent + ); + } + ); + + M.adsManager.init( + M.adWidth, + M.adHeight, + google.ima.ViewMode.NORMAL + ); + + M.adsManager.start(); + }; + + module.prototype.onAdEvent = function(adEvent) { + var ad = adEvent.getAd(); + + self.log(adEvent); + + switch (adEvent.type) { + case google.ima.AdEvent.Type.LOADED: + M.adDidLoad = true; + M.adImpressionCount++; + self.adapters.run("adEvent", "loaded", ad); + if (ad.isLinear() && M.adsManager.getRemainingTime() > 0) { + self.modal.setCloseBtnTimer(15); + } + faZepto(self.modal.overlay).css("background", "#000"); + break; + case google.ima.AdEvent.Type.IMPRESSION: + M.adDidShow = true; + break; + case google.ima.AdEvent.Type.STARTED: + M.adDidLoad = true; + + if (ad.isLinear() && M.adsManager.getRemainingTime() > 0) { + //self.tracking.trackEvent("Ad event", "DFP Video", adEvent.type); + } else { + //self.tracking.trackEvent("Ad event", "DFP", adEvent.type); + } + if (controlSpinner) + self.spinner.hide(); + + self.modal.clearCloseBtnTimer(); + self.modal.activateCloseBtn(false); + break; + case google.ima.AdEvent.Type.DURATION_CHANGE: + M.delayNextAdModal(true); + break; + case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED: + self.click2play.closeOverlay(); + break; + case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED: + case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: + faZepto(self.modal.overlay).css( + "background", + "transparent" + ); + if (controlSpinner) + self.spinner.hide(); + // self.game.showCanvas(); + self.modal.close(); + break; + } + + switch (adEvent.type) { + case google.ima.AdEvent.Type.STARTED: + self.adapters.run("adEvent", "displayed"); + break; + case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: + self.adapters.run("adEvent", "completed", M.adRequestCount); + break; + case google.ima.AdEvent.Type.SKIPPED: + self.adapters.run("adEvent", "skipped"); + break; + case google.ima.AdEvent.Type.USER_CLOSE: + self.adapters.run("adEvent", "userClosed", M.adRequestCount); + break; + } + }; + + module.prototype.onAdError = function(adErrorEvent) { + //self.tracking.trackEvent("Ad error event", "DFP", adErrorEvent.getError()); + var adError = adErrorEvent.getError(); + self.log(adError); + self.adapters.run("adEvent", "errored", adErrorEvent); + + function closeAndResume() { + self.modal.close(); + if (M.adsManager) { + M.adsManager.destroy(); + } + if (controlSpinner) + self.spinner.hide(); + } + + if (adError.getType() == google.ima.AdError.Type.AD_LOAD) { + self.log("ads module: ad load error detected"); + + // // try to show web interstitial instead, if error was fillrate related + // if (M.adRequestCount >= 1 && + // self.interstitial && + // self.interstitial.isEnabled() && + // self.interstitial.hasCooledDown()) { + // self.log("ads module: attempt to load interstitial instead"); + // return self.interstitial.showAd(closeAndResume, false); + // } + } + + closeAndResume(); + }; + + // Add event listeners + M.adsLoader.addEventListener( + google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, + M.onAdsManagerLoaded, + false + ); + M.adsLoader.addEventListener( + google.ima.AdErrorEvent.Type.AD_ERROR, + M.onAdError, + false + ); + + var adsRequest = new google.ima.AdsRequest(); + + adsRequest.disableCompanionAds = true; + + // Specify the linear and nonlinear slot sizes. This helps the SDK to + // select the correct creative if multiple are returned. + adsRequest.linearAdSlotWidth = parseInt(M.adWidth, 10); + adsRequest.linearAdSlotHeight = parseInt(M.adHeight, 10); + + // 2015-10-29 + // Force Full-Slot ad rendering + // Games publishers (mandatory): + // When using overlay ads with gaming content, you must ensure that all creative sizes are rendered with the Full-Slot interface by manually setting adsrequest.forceNonLinearFullSlot to true. This is required to comply with AdSense and Ad Exchange Policies. + adsRequest.forceNonLinearFullSlot = true; + + adsRequest.nonLinearAdSlotWidth = parseInt(M.adWidth, 10); + adsRequest.nonLinearAdSlotHeight = parseInt(M.adHeight, 10); + adsRequest.contentDuration = 20 * 60; + adsRequest.contentTitle = document.title; + adsRequest.vastLoadTimeout = 10e3; + adsRequest.setAdWillAutoPlay(isAutoplay); + + function sendAdRequest(custParamsQS, vastSizeString, requestType, adUnit) { + let myAdTagUrl = M.getAdTagUrl("", "", custParamsQS, vastSizeString, requestType, adUnit); + adsRequest.adTagUrl = myAdTagUrl; + M.adsLoader.requestAds(adsRequest); + M.adRequestCount += 1; + M.adDidLoad = false; + M.adDidShow = false; + M.show_initial = false; + }; + + // add-in UAM bidding, if enabled + if (self.apstag && self.apstag.isReadyToFetch()) { + + // check supported GAM & APS video sizes + let supportedSizes = [ + {w:640, h:480}, {w:400, h:300}, {w:320, h:480} + ]; + supportedSizes = supportedSizes.filter(function(size) { + // remove sizes not fitting in window + return size.w <= window.innerWidth && size.h <= window.innerHeight; + }).map(function(size){ + // add area of creative + return {w: size.w, h: size.h, area: size.w * size.h}; + }).sort(function(a, b){ + // sort by area desc + return b.area - a.area; + }); + + // fallback to default size in case of no fit + if (supportedSizes.length == 0) + supportedSizes = [{w:640, h:480}]; + + // get APS video slot ID for biggest size + supportedSizes = supportedSizes.slice(0, 1); + let apsSlotID = self.apstag.getVideoSlotID(supportedSizes[0].w, supportedSizes[0].h); + + // create VAST string of ad unit sizes + let vastSizeString = supportedSizes.reduce(function(str, size, index){ + return str + (index > 0 ? "|" : "") + size.w + "x" + size.h; + }, ""); + + self.apstag.fetchVideoBids(apsSlotID) + .then(function(bids) { + self.log("video ads: append bid params to ad request") + sendAdRequest(bids[0].qsParams, vastSizeString, 'adxfgv-uamv'); + }, function() { + self.log("video ads: failed to prefetch bids, will send std request instead") + sendAdRequest(); + }); + } else { + sendAdRequest(); + } + }; + + module.prototype.getAdVastXML = function() { + var xml = self.config.adsVastXML; + var newAd = self.config.adTagXML; + var adTagUrls = []; + + // Get XML with waterfall extension + return new Promise(function(resolve, reject) { + if (M.provider === "dfp") { + + var rules = (function() { + var lsgRules = self.lsg.exportRules(); + var sorted = []; + + if (self.lsg.isSamplingAllRules()) { + sorted = self.shuffleArray(lsgRules).slice(0, 3); + } else { + sorted = lsgRules.sort(function(a, b) { + return b[1] - a[1]; + }); + } + var ruleNames = []; + faZepto.each(sorted, function(key, rule) { + ruleNames.push(rule[0]); + }); + return ruleNames; + })(); + + var nbRules = 0; + var variant = "a"; + var priceMode = "lsg-o"; + var waterfallNumber = 0; + + rules = rules.filter(function(x, i, a) { + return a.indexOf(x) == i; + }); + self.log(rules); + + nbRules = self.sizeOf(rules); + faZepto.each(rules, function(key, ruleName) { + var perRulePriceMode = priceMode; + M.setPriceRule(ruleName); + // last rule? add backfill + if (key === nbRules - 1) { + variant = "b"; + } + if (self.lsg.isSamplingAllRules()) { + perRulePriceMode = (Math.random() < 0.5) ? "lsg-sf" : "lsg-s"; + } + adTagUrls.push(M.getAdTagUrl(variant, perRulePriceMode)); + if (!detection.is.iframe && key == 0) { + adTagUrls.push(M.getAdTagUrl("", "")); + } + adTagUrls.push(M.getAdTagUrl(variant, perRulePriceMode)); + adTagUrls.push(M.getAdTagUrl(variant, perRulePriceMode)); + }); + + // put it all together in one VAST Ad Tag + faZepto.each(adTagUrls, function(index, url) { + newAd = self.config.adTagXML; + newAd = newAd.replace("[index]", index + 1); + newAd = newAd.replace("[fallback_index]", index); + newAd = newAd.replace("[vast_ad_tag_url]", url); + + xml += newAd + "\n"; + }); + + xml += ""; + + return resolve(xml); + } else { + return reject( + "Provider not supported, only (DFP): " + M.provider + ); + } + }); + }; + + module.prototype.getAdTagUrl = function(variant, priceMode, customParamsQueryString, sizeString, requestType, adUnit) { + variant = variant || ""; + priceMode = priceMode || ""; + customParamsQueryString = customParamsQueryString || ""; + sizeString = sizeString || "640x480|400x300"; + requestType = requestType || "adxfgv"; + + var myAdTagUrl = ""; + var language = self.gametranslation.getNavigatorLanguage(); + var locale = self.lsg.locale; + var vpos = (M.adRequestCount > 0) ? "midroll" : "preroll"; + + var descriptionUrl = self.config.ads.description_url; + var siteUrl = ""; + + if (detection.is.iframe) { + if (M.mcm_required) { + if (self.config.referrer_origin && + !self.config.referrer_origin.endsWith("famobi.com")) + descriptionUrl = self.config.referrer_origin + else if (self.config.first_ancestor_origin && + !self.config.first_ancestor_origin.endsWith("famobi.com")) + descriptionUrl = self.config.first_ancestor_origin + else if (self.config.last_ancestor_origin && + !self.config.last_ancestor_origin.endsWith("famobi.com")) + descriptionUrl = self.config.last_ancestor_origin + else + descriptionUrl = self.getShortLink(); + siteUrl = descriptionUrl; + } else { + siteUrl = self.getShortLink(); + } + } + + var gamePackageID = "" + (window.famobi_gameID || self.config.package_id); + if (gamePackageID.length == 0 || gamePackageID == "{FAMOBI_GAMEID}") + gamePackageID = "test-game"; + + M.dfp_custom_params = { + a: "" + self.config.aid, + game: gamePackageID, + gametype: "html5", + uuid: "" + self.config.uuid, + video: M.show_video ? "1" : "0", + arc: + M.adRequestCount > 20 ? "gt20" : + M.adRequestCount >= 10 ? "" + M.adRequestCount : + "0" + M.adRequestCount, + aic: + M.adImpressionCount > 20 ? "gt20" : + M.adImpressionCount >= 10 ? "" + M.adImpressionCount : + "0" + M.adImpressionCount + }; + + var paramPriceRuleName = M.getPriceRuleName(); + if (paramPriceRuleName) + M.dfp_custom_params.pr = paramPriceRuleName; + if (priceMode) + M.dfp_custom_params.pm = priceMode; + if (variant) + M.dfp_custom_params.ab = variant; + M.dfp_custom_params.if = detection.is.iframe ? "1" : "0"; + M.dfp_custom_params.rm = self.config.referrer_matched ? "1" : "0"; + M.dfp_custom_params.rt = requestType; + + // @see https://support.google.com/dfp_premium/answer/1068325?hl=de + myAdTagUrl = + "https://securepubads.g.doubleclick.net/gampad/ads?npa=[npa]&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&correlator=[timestamp]&ciu_szs="; + + myAdTagUrl = myAdTagUrl.replace( + "[npa]", + self.config.ads.npa ? "1" : "0" + ); + + // myAdTagUrl = myAdTagUrl.replace( + // "[gdpr]", + // "0" + // ); + + var adUnitID = M.getAdUnitID(adUnit); + if (typeof adUnitID == 'string' && adUnitID.length > 0) { + myAdTagUrl = myAdTagUrl + "&iu=" + adUnitID; + } + + myAdTagUrl = myAdTagUrl + "&sz=" + sizeString; + + if (siteUrl != "") { + myAdTagUrl = myAdTagUrl + "&url=" + encodeURIComponent(siteUrl); + } + + if (descriptionUrl != "") { + myAdTagUrl = myAdTagUrl + "&description_url=" + encodeURIComponent(descriptionUrl); + } + + if (M.dfp_custom_params) { + var qs = faZepto.param(M.dfp_custom_params); + if (typeof customParamsQueryString == "string") { + if (qs.length > 0) + qs += customParamsQueryString; + else + qs = customParamsQueryString.substring(1); + } + myAdTagUrl += "&cust_params=" + encodeURIComponent(qs); + } + + if (language != "") { + myAdTagUrl = myAdTagUrl + "&hl=" + language; + } + + // if (locale != "") { + // myAdTagUrl = myAdTagUrl + "&cn=" + locale; + // } + + if (vpos != "") { + myAdTagUrl = myAdTagUrl + "&vpos=" + vpos; + } + + //if (M.adRequestCount == 0) { + //myAdTagUrl = myAdTagUrl + "&vpa=click"; + //} + + // overwrite ad tag in debugmode + if (self.config.ads.debug) { + myAdTagUrl = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator="; + if (vpos != "") { + myAdTagUrl = myAdTagUrl + "&vpos=" + vpos; + } + if (M.adRequestCount == 0) { + myAdTagUrl = myAdTagUrl + "&vpa=click"; + } + } + + return myAdTagUrl; + }; + + module.prototype.getVastTagUrl = function() { + self.adapters.run("ads", "vastUrl"); + + return new Promise(function(resolve) { + var vast_url = M.getAdTagUrl(); + + if (self.config.ads.vast_url) { + vast_url = self.config.ads.vast_url; + + vast_url = vast_url.replace( + /\[UA\]/, + encodeURIComponent(navigator.userAgent) + ); + vast_url = vast_url.replace( + /\[URL\]/, + encodeURIComponent(self.config.ads.description_url) + ); + vast_url = vast_url.replace( + /\[DEVICECATEGORY\]/, + detection.is.tablet ? "tablet" : "phone" + ); + vast_url = vast_url.replace( + /\[CACHEBUSTER\]/, + self.rand(100000, 999999) + ); + + resolve(vast_url); + } else { + resolve(vast_url); + } + }); + }; + + module.prototype.initAdModal = function(options) { + var opts = faZepto.extend( + { + iframeAllowed: false, + force: false, + returnCallback: function() {} + }, + options + ); + + // regard timeout between ads + if (M.delayNextAdModal(opts.force)) { + self.modal.setCloseCallback(opts.returnCallback); + return false; + } + + return true; + }; + + module.prototype.showAdModal = function(options, contentDiv) { + var opts = faZepto.extend( + { + mode: "seamless", + closeBtnTimer: 15, + faketime: 3, + showCloseBtn: false, + returnCallback: function() {}, + returnCallback2: function() { + var retVal = faZepto.extend( + {}, + M.defaultReturnValue, + { + "adDidLoad": M.adDidLoad, + "adDidShow": M.adDidShow, + "adCount": M.adRequestCount - 1, + "adRequestCount": M.adRequestCount - 1 + } + ); + self.adapters.run("ads", "callback", retVal); + M.delayNextAdModal(true); + + self.click2play.closeOverlay(); + + if (self.game.isWaiting()) { + self.game.setWaiting(false); + self.game.init(); + } + + if (self.lsg.is_active) + self.lsg.remix({ + lastRequestWas: M.adDidLoad ? "fill" : "nofill" + }); + } + }, + options + ); + + M.delayNextAdModal(true); + + self.modal.create(opts); + + self.modal.updateCloseBtn(true); + self.modal.setCloseBtnTimer(opts.closeBtnTimer, { + faketime: opts.faketime + }); + self.modal.setDimensions(opts.width, opts.height); + self.modal.setContent(contentDiv); + self.modal.setCloseCallback(opts.returnCallback); + self.modal.setCloseCallback(opts.returnCallback2); + + return self; + }; + + module.prototype.delayNextAdModal = function(isSetter) { + // check if Ads are enabled + if (!M.isEnabled()) { + self.log("ads disabled"); + return true; + } + + // disable all Ads for X seconds + if (isSetter) { + M.lastAdCall = self.now(); + } else if (!M.hasCooledDown()) { + self.log("skipped ad"); + return true; + } + + return false; + }; + + module.prototype.hasCooledDown = function() { + var min_s_between = + M.adRequestCount === 0 && +self.config.ads.min_s_before > 0 + ? +self.config.ads.min_s_before + : +self.config.ads.min_s_between; + + var ret = self.now() - min_s_between * 1000 > M.lastAdCall; + + return ret; + }; + + module.prototype.isAdvertisingActive = function(opts) { + if (!opts.iframeAllowed && window.top !== window.self) { + self.log("ads disabled in ').appendTo(self.rootElement); + return true; + } + // CreateJS <3 + if (typeof window.createjs !== "undefined") { + //window.createjs.Sound.setMute(true); + } + } catch (e) { + self.log("Pausing game failed: " + e); + } + + return false; + }; + + gamePrototype.resume = function() { + //self.log('game.resume'); + //self.log('isWaiting?', M.isWaiting()); + + if (!M.isWaiting()) { + //self.log('game is not waiting, do not resume'); + return false; + } + + if (!M.canResume()) { + //self.log('game is still waiting, do not resume'); + M.setWaiting(false); + return false; + } + + M.setWaiting(false); + + try { + if (typeof window.famobi_onResumeRequested == "function") { + window.famobi_onResumeRequested(); + return true; + } + // Phaser + if (window.game && typeof window.game.paused !== "undefined") { + window.game.paused = false; + return true; + } + // Construct 2 + if (typeof window.cr_setSuspended !== "undefined") { + cr_setSuspended(false); + //faZepto('iframe#fg-clickthrough-frame').remove(); + return true; + } + // CreateJS <3 + if (typeof window.createjs !== "undefined") { + //window.createjs.Sound.setMute(false); + } + } catch (e) { + self.log("Resuming game failed: " + e); + } + + return false; + }; + + gamePrototype.linkCanonical = function() { + var canonicalUrl = self.getShortLink(); + var link = faZepto( + '' + ); + + link.appendTo(self.headElement); + + return M; + }; + + gamePrototype.changeOpacity = function() { + var opac = self.bodyElement.style.opacity + ""; + + if (opac !== "" && parseInt(opac) < 1) { + self.bodyElement.style.opacity = "1.0"; + } + + return M; + }; + + gamePrototype.changeMetaViewport = function() { + // change meta viewport content if its attribute 'data-original' exists + var $metaviewport = document.querySelector("meta[name=viewport]"), + ua = navigator.userAgent, + metaViewPortSetting = $metaviewport + ? $metaviewport.getAttribute("data-original") + : undefined; + if ($metaviewport && metaViewPortSetting) { + if (ua.match(/iPhone|iPod|Tizen/i)) + metaViewPortSetting = + "width=device-width, user-scalable=0, minimum-scale=1.0, initial-scale=0.5, maximum-scale=0.5, minimal-ui"; + else if (ua.match(/iPad/i)) + metaViewPortSetting = + "width=device-width, user-scalable=0, minimum-scale=1.0, initial-scale=1.0, maximum-scale=1.0, minimal-ui"; + else if (ua.match(/Android/i)) + metaViewPortSetting = + "width=device-width, initial-scale=1, maximum-scale=1.01"; + + $metaviewport.setAttribute("content", metaViewPortSetting); + } + }; + + gamePrototype.showCanvas = function() { + var canvas = document.querySelectorAll("canvas"); + var i = 0; + if (canvas) { + for (i; i < canvas.length; ++i) { + canvas[i].style.display = + canvas[i].getAttribute("fa-orig-display") || ""; + } + } + }; + + gamePrototype.hideCanvas = function() { + var canvas = document.querySelectorAll("canvas"); + var i = 0; + if (canvas) { + for (i; i < canvas.length; ++i) { + canvas[i].setAttribute( + "fa-orig-display", + canvas[i].style.display + ); + canvas[i].style.display = "none"; + } + } + }; + + gamePrototype.hideCanvasBodyOverflow = function() { + var canvas = document.querySelector("canvas"); + if (canvas) { + self.bodyElement.style.overflow = "hidden"; + } + }; + + gamePrototype.setPreloadProgress = function(percent) { + if (typeof percent !== 'number') { + console.warn( + "setPreloadProgress(): required param 'percent' has to be of type number" + ); + return; + } + + var progress = Math.min(100, Math.max(M.preloadProgress, percent)); + + if (progress > M.preloadProgress) { + M.preloadProgress = progress; + self.adapters.run("game", "preloadProgress", progress); + if (progress == 100) { + self.adapters.run("game", "preloadComplete"); + } + } + }; + + M = new module(); + + return M; +}; + +/* + add convenience functions to main api namespace +*/ +fg_api.prototype.setPreloadProgress = function() { + this.game.setPreloadProgress.apply(this, arguments); +}; + + + + +fg_api.prototype.audioModule = function(type) { + var self = this, + M; + + function module() { + // define private vars + this.volume = 1; + } + + module.prototype.init = function() { + }; + + module.prototype.setVolume = function(volume) { + if (typeof volume !== "number") { + self.log("setVolume(): required param 'volume' has to be of type number"); + return false; + } + + if (volume < 0 || volume > 1) { + self.log("setVolume(): param 'volume' out of bounds (0.0, 1.0)"); + } + + var targetVolume = Math.min(1, Math.max(0, volume)); + if (targetVolume !== M.volume) { + M.volume = targetVolume; + self.requestAction("changeVolume", targetVolume) + } + }; + + module.prototype.getVolume = function() { + return M.volume; + }; + + M = new module(); + M.init(); + + return M; +}; + +fg_api.prototype.setVolume = function(volume) { + if (!this.audio) { + self.log( + "setVolume(): audio module required" + ); + return; + } + + this.audio.setVolume(volume); +}; + +fg_api.prototype.getVolume = function() { + if (!this.audio) { + self.log( + "getVolume(): audio module required" + ); + return 1; + } + + return this.audio.getVolume(); +}; + + + + +fg_api.prototype.fullscreenModule = function() { + var self = this, + M; + + function module() { + // define private vars + this.isSupported = false; + } + + module.prototype.init = function() { + var elem = document.documentElement; + + try { + if (!elem) { + throw "documentElement not supported"; + } + + if ( + !( + document.fullscreenEnabled || + document.webkitFullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled + ) + ) { + throw "Fullscreen mode not supported"; + } + + if (elem.requestFullscreen) { + this.requestFullscreen = "requestFullscreen"; + } else if (elem.requestFullScreen) { + this.requestFullscreen = "requestFullScreen"; + } else if (elem.webkitRequestFullScreen) { + this.requestFullscreen = "webkitRequestFullscreen"; + } else if (elem.webkitRequestFullScreen) { + this.requestFullscreen = "webkitRequestFullScreen"; + } else if (elem.mozRequestFullScreen) { + this.requestFullscreen = "mozRequestFullScreen"; + } else if (elem.msRequestFullscreen) { + this.requestFullscreen = "msRequestFullscreen"; + } else { + throw "Fullscreen API not supported"; + } + + this.isSupported = !!this.requestFullscreen; + } catch (ex) { + this.isSupported = false; + } + + if (!self.config.aid.startsWith("A-MONKEY")) { + // skip the following tests in monkey-games.app + if ( + detection.is.ios || + detection.is.pc || + !self.hasFeature("fullscreen") || + /^MacIntel|Win32|Win64$/.test(navigator.platform) + ) { + this.isSupported = false; + } + + if (!this.isSupported) { + faZepto("[data-famobi-fullscreen]").remove(); + } + } + }; + + module.prototype.isSupported = function() { + return this.isSupported; + }; + + module.prototype.start = function() { + var elem = document.documentElement; + + if (self.fullscreen.isSupported) { + elem[this.requestFullscreen](); + } else { + return false; + } + + return true; + }; + + module.prototype.stop = function() { + self.orientation.unlock(); + + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } + + return true; + }; + + module.prototype.toggle = function() { + if ( + !document.fullscreenElement && + !document.mozFullScreenElement && + !document.webkitFullscreenElement && + !document.msFullscreenElement + ) { + M.start(); + setTimeout(function() { + self.orientation.lock(); + }, 1e3); + return true; + } else { + return M.stop(); + } + }; + + M = new module(); + M.init(); + + return M; +}; + + + + +fg_api.prototype.flashModule = function() { + var self = this, + M; + + function module() { + // define private vars + + this.offsetWidth = 0; // px + this.offsetHeight = 0; // px + + // swfobject + this.swfUrl = window.famobi_gameID + ".swf"; + this.replaceElemId = "myContent"; + this.width = parseInt(window.innerWidth) - this.offsetWidth; + this.height = parseInt(window.innerHeight) - this.offsetHeight; + this.swfVersion = "9.0.0"; + this.xiSwfUrl = "expressInstall.swf"; + this.flashvars = { + fg_aid: window.famobi.config.aid, + fg_uid: window.famobi.config.uuid, + fg_game: window.famobi_gameID + }; + this.params = { + allowscriptaccess: "always" + }; + this.attributes = {}; + this.callbackFn = function() {}; + } + + var flashPrototype = module.prototype; + + flashPrototype.init = function() { + var fgFlash = null, // flash replacing container + fgGetFlashLink = null, // get flash link + arr = ["flashvars", "params", "attributes"], + fgGetFlash = null; // get flash image + + if (!self.config.gameParams.flash) return false; + + //self.log("Set, ..."); + M.replaceElemId = + self.config.gameParams.flash.replaceElemId || M.replaceElemId; + M.swfUrl = self.config.gameParams.flash.swfUrl || M.swfUrl; + M.width = self.config.gameParams.flash.width || M.width; + M.height = self.config.gameParams.flash.height || M.height; + M.swfVersion = self.config.gameParams.flash.swfVersion || M.swfVersion; + M.xiSwfUrl = self.config.gameParams.flash.xiSwfUrl || M.xiSwfUrl; + + // create div container for swfobject to replace + fgFlash = document.createElement("div"); + fgFlash.setAttribute("id", M.replaceElemId); + fgFlash.setAttribute("style", "display: none"); + self.bodyElement.appendChild(fgFlash); + + // disable ads + self.config.ads.off = true; + + // callback + if (self.config.gameParams.flash.callbackFn) { + M.callbackFn = self.config.gameParams.flash.callbackFn; + } else { + M.callbackFn = function() { + if (swfobject.getFlashPlayerVersion().major === 0) { + fgFlash.style.display = "block"; + + fgGetFlashLink = self.createElement("a", { + href: "http://www.adobe.com/go/getflashplayer", + target: "_blank" + }); + fgGetFlash = self.createElement("img", { + src: "/flashgames/swfobject/getFlash.png", + alt: "Get Adobe Flash player", + title: "Get Adobe Flash player" + }); + fgGetFlashLink.appendChild(fgGetFlash); + fgFlash.appendChild(fgGetFlashLink); + + self.modal.create({ title: "Get Adobe Flash player" }); + self.modal.setContent(fgFlash); + } + }; + } + + // merge flashvars, params and attributes + for (var key in arr) { + if (!self.config.gameParams.flash[arr[key]]) break; + for (var attrName in self.config.gameParams.flash[arr[key]]) { + M[arr[key]][attrName] = + self.config.gameParams.flash[arr[key]][attrName]; + } + } + + //self.log("Go!"); + window.famobi_gameJS = window.famobi_gameJS || []; + window.famobi_gameJS.unshift( + "/flashgames/swfobject/swfobject.js", + function() { + swfobject.embedSWF( + M.swfUrl, + M.replaceElemId, + M.width, + M.height, + M.swfVersion, + M.xiSwfUrl, + M.flashvars, + M.params, + M.attributes, + M.callbackFn + ); + } + ); + + return self; + }; + + //create new instace of Module + M = new module(); + //initialize Module + M.init(); + + return M; +}; + + + + +fg_api.prototype.restModule = function() { + var M; + + function module() {} + + module.prototype.init = function() {}; + + module.prototype.get = function(url, headers) { + return new Promise(function(resolve, reject) { + faZepto.ajax({ + url: url, + headers: headers, + success: function(result) { + resolve(result); + }, + error: function(err) { + reject(err); + } + }); + }); + }; + + module.prototype.getJSON = function(url, headers) { + return new Promise(function(resolve, reject) { + faZepto.ajax({ + url: url, + headers: headers, + contentType: "application/json; charset=UTF-8", + success: function(result) { + resolve(result); + }, + error: function(err) { + reject(err); + } + }); + }); + }; + + module.prototype.post = function(url, data, headers) { + headers = headers || {}; + return new Promise(function(resolve, reject) { + faZepto.ajax({ + url: url, + type: "POST", + contentType: "application/json; charset=UTF-8", + headers: headers, + data: JSON.stringify(data), + success: function(result) { + resolve(result); + }, + error: function(err) { + reject(err); + } + }); + }); + }; + + M = new module(); + M.init(); + + return M; +}; + + + + +fg_api.prototype.debugModule = function() { + var self = this, + M; + + function module() {} + + module.prototype.init = function() { + self.adapters.add("analytics", "trackStats", function(key, value) { + self.log( + "%c trackStats ", + "background: #333333; color: white; display: block;" + ); + if (typeof key === "string") { + if(typeof value === "object") { + self.log(key + ":"); + self.log(value); + } else { + self.log(key + ": " + value); + } + } else { + self.log(key); + } + }); + + self.adapters.add("analytics", "trackEvent", function(event, params) { + // if(event == "EVENT_LIVESCORE") return; + self.log( + "%c " + event + " %c (trackEvent)", + "background: #0092c3; color: white; display: block;", + "" + ); + self.log(params); + }); + + self.adapters.add("analytics", "trackScreen", function( + screen, + pageTitle + ) { + self.log( + "%c " + + screen + + " %c (trackScreen)" + + (pageTitle ? " - pageTitle: " + pageTitle : ""), + "background: #f08119; color: white; display: block;", + "" + ); + }); + }; + + M = new module(); + M.init(); + + return M; +}; + + + + +fg_api.prototype.videoModule = function() { + var self = this, + M; + + function module() { + this.element = null; + this.elementId = "fa-video"; + this.videoUrl = self.config.urlRoot + "/services/video"; + } + + module.prototype.init = function() { + M.element = document.getElementById(M.elementId); + + M.player = videojs(M.elementId); + + self.onorientationchange(M.resizeHandler); + M.resizeHandler(); + + M.player.src([ + { + type: "video/mp4", + src: + "https://video.cdn.famobi.com/marketing/videos/" + + self.config.video.sources.mp4 + } + ]); + + M.player.dock({ + title: "" + }); + + M.player.brand({ + image: "FamobiFLogo.svg", + title: "Proudly brought to you by Famobi.com", + destination: "https://famobi.com", + destinationTarget: "_blank" + }); + + M.player.watermark({ + image: "FamobiFWhiteLogo.svg", + position: "top-right", + fadeTime: 1000, + url: "https://famobi.com" + }); + + // Remove controls from the player on iPad to stop native controls from stealing + // our click + var contentPlayer = document.getElementById("fa-video"); + if ( + (navigator.userAgent.match(/iPad/i) || + navigator.userAgent.match(/Android/i)) && + contentPlayer.hasAttribute("controls") + ) { + contentPlayer.removeAttribute("controls"); + } + + // Initialize the ad container when the video player is clicked, but only the + // first time it's clicked. + var startEvent = "click"; + if ( + navigator.userAgent.match(/iPhone/i) || + navigator.userAgent.match(/iPad/i) || + navigator.userAgent.match(/Android/i) + ) { + startEvent = "touchend"; + } + + M.player.one(startEvent, function() { + M.player.ima.initializeAdDisplayContainer(); + M.player.ima.requestAds(); + M.player.play(); + + M.trackEvent("play"); + }); + + M.trackEvent("show"); + + return self; + }; + + module.prototype.resizeHandler = function() { + var size = self.getWindowSize(); + M.player.width(size.h / (16 / 9)); + }; + + module.prototype.trackEvent = function(eventName) { + var validEvents = ["play", "show"]; + if (validEvents.indexOf(eventName) === -1) { + self.log( + "trackEvent(): eventName must be one of ", + validEvents.join(", ") + ); + return false; + } + eventName = "video." + (eventName || "show"); + + // track video event + var postData = { + aid: self.config.aid, + event: eventName + }; + return faZepto.post( + M.videoUrl + "/videos/" + self.config.video.id + "/track", + postData + ); + }; + + M = new module(); + M.init(); + + return M; +}; + + + + +fg_api.prototype.videoadsModule = function() { + var self = this, + M; + + function module() { + this.closeCallback = function() {}; + // flag if the last ad request was filled + this.adDidLoad = false; + // time in millis when the last ad was shown + this.lastAdCall = +self.now(); + } + + module.prototype.init = function() { + self.config.ads = faZepto.extend({}, self.config.ads); + + if (!M.isEnabled()) { + M.provider = "none"; + } else { + M.provider = self.config.ads.provider; + } + + M.adcount = 0; + M.floodProtectionMap = {}; + + switch (M.provider) { + default: + faZepto.getScript( + "https://imasdk.googleapis.com/js/sdkloader/ima3.js", + sdkLoadedCallback, + function() { + sdkLoadedCallback(); + } + ); + + M.dfp_ad_unit_code = "/37336410/InVideo//" + self.config.aid; + break; + } + + function sdkLoadedCallback() { + if (typeof google != "undefined" && google.ima) { + google.ima.settings.setLocale( + self.gametranslation.getNavigatorLanguage() + ); + + google.ima.settings.setVpaidMode( + google.ima.ImaSdkSettings.VpaidMode.ENABLED + ); + + var options = { + id: "fa-video", + showCountdown: false, + adTagUrl: M.getAdTagUrl() + }; + + // This must be called before player.play() below. + self.video.player.ima(options); + } + } + }; + + module.prototype.getAdTagUrl = function() { + var myadTagUrl = ""; + var descriptionUrl = encodeURIComponent( + self.config.ads.description_url + ); + var language = self.gametranslation.getNavigatorLanguage(); + + M.dfp_custom_params = { + a: "" + self.config.aid, + gametype: "video", + video: "1", + invideo: "1", + videoid: self.config.video.id + }; + + // @see https://support.google.com/dfp_premium/answer/1068325?hl=de + myadTagUrl = + "https://securepubads.g.doubleclick.net/gampad/ads?npa=1&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]&ciu_szs="; + + if (M.dfp_ad_unit_code != "") { + myadTagUrl = myadTagUrl + "&iu=" + M.dfp_ad_unit_code; + } + + if (M.adWidth >= 728) { + myadTagUrl = myadTagUrl + "&sz=728x480"; + } else if ( + M.adWidth >= 640 || + (M.dfp_custom_params.video && M.dfp_custom_params.video === "1") + ) { + myadTagUrl = myadTagUrl + "&sz=640x480"; + } else if (M.adWidth >= 336) { + myadTagUrl = myadTagUrl + "&sz=336x280"; + } else { + myadTagUrl = myadTagUrl + "&sz=300x250"; + } + + if (descriptionUrl != "") { + myadTagUrl = myadTagUrl + "&description_url=" + descriptionUrl; + } + + if (M.dfp_custom_params) { + myadTagUrl = + myadTagUrl + + "&cust_params=" + + encodeURIComponent(faZepto.param(M.dfp_custom_params)); + } + + if (language != "") { + myadTagUrl = myadTagUrl + "&hl=" + language; + } + + return myadTagUrl; + }; + + module.prototype.hasCooledDown = function() { + var min_s_between = + M.adcount === 0 && +self.config.ads.min_s_before > 0 + ? +self.config.ads.min_s_before + : +self.config.ads.min_s_between; + + var ret = self.now() - min_s_between * 1000 > M.lastAdCall; + + return ret; + }; + + module.prototype.isAdvertisingActive = function(opts) { + if (!opts.iframeAllowed && window.top !== window.self) { + self.log("ads disabled in ').appendTo(window.famobi.rootElement); + return true; + } + // CreateJS <3 + if (typeof window.createjs !== "undefined") { + console.log("createJS - do nothing"); + //window.createjs.Sound.setMute(true); + } + } catch (e) { + window.famobi.log("Pausing game failed: " + e); + console.log("FAILED TO PAUSE"); + } + }, + resume: function() { + + // console.log("Resume"); + + if (!this.isWaiting()) { + //window.famobi.log('game is not waiting, do not resume'); + return false; + } + + if (!this.canResume()) { + //window.famobi.log('game is still waiting, do not resume'); + this.setWaiting(false); + return false; + } + + this.setWaiting(false); + + try { + if (typeof window.famobi_onResumeRequested == "function") { + window.famobi_onResumeRequested(); + return true; + } + // Phaser + if (window.game && typeof window.game.paused !== "undefined") { + window.game.paused = false; + return true; + } + // Construct 2 + if (typeof window.cr_setSuspended !== "undefined") { + cr_setSuspended(false); + //faZepto('iframe#fg-clickthrough-frame').remove(); + return true; + } + // CreateJS <3 + if (typeof window.createjs !== "undefined") { + //window.createjs.Sound.setMute(false); + } + } catch (e) { + window.famobi.log("Resuming game failed: " + e); + } + + return false; + } + }, + "adapters": { // TODO + init: function() { + }, + list: function() { + }, + add: function(section, subsection, callback) { + }, + has: function(section, subsection) { + }, + run: function(section, subsection) { + } + } + }; + // export famobi object to global object + b[a] = famobi; + + }('famobi', window); + window.famobi.init().then(function() { + + setTimeout(function() { + + (function next() { + if(typeof api === "undefined" && typeof SWAGAPI !== "undefined") { + function initSwagApi() + { + let apiWrapper = document.getElementsByClassName("swag-api-wrapper")[0]; + + //console.info(">> Found swag-api-container"); + api = SWAGAPI.getInstance({ + wrapper: document.getElementsByClassName("swag-api-wrapper")[0] || document.body, + api_key: window.famobi.config.api_key, + theme: 'shockwave', + debug: true + }); + window.famobi.log("api initialized"); + } + initSwagApi(); + if(api) + { + if(window.famobi.config.show_splash && window.famobi.config.show_splash === "api") + { + console.log("api splash"); + let splashScreen = document.createElement("div"); + splashScreen.classList.add("splash-screen"); + splashScreen.id = "splashScreen"; + splashScreen.style.position = "absolute"; + splashScreen.style.top = "0"; + splashScreen.style.left = "0"; + splashScreen.style.width = "100%"; + splashScreen.style.height = "100%"; + document.body.appendChild(splashScreen); + window.famobi.splashScreen = splashScreen; + SWAGAPI.showBrandingAnimation('splashScreen',()=>{ + window.famobi.hideSplashScreen(); + }); + } + return Promise.all([ + api.startSession(), + // api.getBrandingLogo(), + ]).then( + function(values){ + window.famobi.log("The api is ready to use"); + window.famobi.brandingLogo = values[1]; + }).finally(next); + } + } + + if (!window.famobi_gameJS.length) { + + window.famobi.gametranslation.init(); + window.famobi.menu.create(); + + window.setTimeout(function() { + var e = document.createEvent('Events'); + e.initEvent("deviceready", true, false); + document.dispatchEvent(e); + }, 50); + + return; + } + var currentScript = window.famobi_gameJS.shift(); + + if (typeof currentScript === "function") { + if(typeof Zepto !== "undefined" && typeof window.faZepto === "undefined") { + window.faZepto = Zepto; + + // see https://github.com/blai/fashionista/issues/2 + ;(function ($) { + $.getScript = function(src, func, error_func) { + var script = document.createElement('script'); + script.async = "async"; + script.src = src; + if (func) { + script.onload = func; + } + if (error_func) { + script.onerror = error_func; + } + document.getElementsByTagName("head")[0].appendChild( script ); + }; + })(Zepto); + } + currentScript(); + next(); + } else { + var scriptEl = document.createElement("script"); + scriptEl.onload = next; + scriptEl.onerror = next; + scriptEl.src = currentScript; + document.body.appendChild(scriptEl); + } + })(); + }, window.famobi.config.nextTimeout || 0); + }); +} diff --git a/quotes.json b/quotes.json index 5640c362..5ff69e81 100644 --- a/quotes.json +++ b/quotes.json @@ -28,5 +28,6 @@ "🥺👉👈", "what website is this?", "btw, hcps leaked 30k+ private emails and are hiding it :)", - "we love about:blank" + "we love about:blank", + "make sure to back up ur saves incase we ever get blocked" ] \ No newline at end of file diff --git a/todo b/todo new file mode 100644 index 00000000..7b7aff52 --- /dev/null +++ b/todo @@ -0,0 +1,11 @@ +more fnf mods +mortal kombat +terraria +five nights at freddys 2 (scratch) + all of the wheely games +five nights at freddy 2 and 3 (probably scratch) +Monkey mart (interstellar assets) +Getting Over It with Bennett Foddy (probably the one scratch remake) +knife rain +death chase +https://www.gamearter.com/game/scrap-gl/ \ No newline at end of file