12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449 |
- /*! game-api - v0.21.2 - 2015-07-31 */
- (function(e) {
- "use strict";
- function t() {}
- function n(e) {
- if (e = e || {},
- this.IS_MASTER = e.isMaster || !1, !this.IS_MASTER) throw Error("The DataStore can only be instantiated by the Master");
- this.dataStore = {}
- }
- function i(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.IS_STANDALONE = e.isStandalone,
- this.messenger = e.messenger,
- this.moduleReady = t || !1,
- this.appTimer = null,
- this.appDelayMin = 1e4,
- this.appDelayMax = 24e4,
- this.appError = !1,
- this.appTimerDelay = this.appDelayMax,
- this.appToken = null
- }
- function a(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.IS_STANDALONE = e.isStandalone,
- this.messenger = e.messenger,
- this.eventTracking = e.eventTracking,
- this.appToken = e.appToken,
- this.moduleReady = t || !1,
- this.isGamestate = !1,
- this.endpoint = null,
- this.spilStorageId = null,
- this.flushTimer = null,
- this.flushDelayMin = 500,
- this.flushDelayMax = 3e4,
- this.flushTimerDelay = this.flushDelayMin,
- this.gameState = {
- started: !1,
- userId: null,
- appId: null,
- dirtyKeys: []
- }
- }
- function s(e, t) {
- if (this.IS_MASTER = e && e.isMaster ? e.isMaster: !1, this.IS_SLAVE = !this.IS_MASTER, this.messenger = null, this.subscribers = {},
- this.moduleReady = t ? t: !1, this.data = e.data || null, this.gameState = "resume", !e || !e.messenger) throw Error("No messenger passed to the Game module instance");
- this.messenger = e.messenger,
- window.addEventListener ? window.addEventListener("message", this._performAction.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._performAction.bind(this)),
- this.IS_MASTER && this.messenger.subscribe("gameapi.game.adjustHeight", this.adjustHeight, this)
- }
- function r(e, t) {
- e = e || {},
- this.isMaster = e.isMaster,
- this.isStandalone = e.isStandalone,
- this.messenger = e.messenger,
- this.moduleReady = t ? t: !1
- }
- function o(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_STANDALONE = e.isStandalone,
- this.messenger = e.messenger,
- this.eventTracking = e.eventTracking,
- this.moduleReady = t ? t: !1,
- this.isAvailable = !1,
- this.locale = ""
- }
- function l(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_STANDALONE = e.isStandalone,
- this.messenger = e.messenger,
- this.eventTracking = e.eventTracking,
- this.moduleReady = t ? t: !1,
- this.isAvailable = !1
- }
- function p(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.moduleReady = t ? t: !1,
- this.messenger = e.messenger,
- this.data = e.data || null,
- this.eventTracking = e.eventTracking,
- this.initialHeight = e.initialHeight,
- this._setupMasterEvent()
- }
- function u(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.moduleReady = t ? t: !1,
- this.messenger = e.messenger,
- this.data = e.data || null,
- this.eventTracking = e.eventTracking,
- this.initialHeight = e.initialHeight,
- this._setupMasterEvent()
- }
- function d(e, t) {
- e = e || {},
- this.isMaster = e.isMaster,
- this.isStandalone = e.isStandalone,
- this.messenger = e.messenger,
- this.moduleReady = t ? t: !1,
- this.timeoutAfter = 500,
- this.timeout = !1,
- this.adRequested = !1,
- this._callbacks = {
- pause: !1,
- resume: !1
- }
- }
- function c(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.isStandalone = e.isStandalone,
- this.messenger = e.messenger,
- this.eventTracking = e.eventTracking,
- this.moduleReady = t ? t: !1,
- this.events = {
- GAME_START: "GAME_START",
- GAME_END: "GAME_END",
- GAME_PAUSE: "GAME_PAUSE",
- GAME_CONTINUE: "GAME_CONTINUE",
- GAME_MUTE: "GAME_MUTE",
- LEVEL_FAIL: "LEVEL_FAIL",
- LEVEL_COMPLETE: "LEVEL_COMPLETE"
- },
- this._setupEvents()
- }
- function h(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.IS_STANDALONE = e.isStandalone,
- this.data = e.data,
- this.messenger = e.messenger,
- this.moduleReady = t ? t: !1,
- this.gamePlayTracking = {
- started: !1,
- appid: null,
- host: null,
- timestamp: null
- },
- this.timeInGameTracking = {
- started: !1,
- appid: null,
- timestamp: null
- },
- this.isGamestate = !1
- }
- function g(e, t) {
- e = e || {},
- this.IS_MASTER = e.isMaster,
- this.IS_SLAVE = !this.IS_MASTER,
- this.IS_STANDALONE = e.isStandalone,
- this.moduleReady = t ? t: !1,
- this.messenger = e.messenger,
- this.components = e.components,
- this.data = e.data || null
- }
- function f(e) {
- var t = "string" == typeof e ? m(e) : e;
- t && (this.type = t.type, this.callbackId = t.callbackId, this.data = t.data)
- }
- function m(e) {
- var t, n, i, a = !1,
- s = [];
- if ("string" == typeof e && (s = e.split("|"), "gameapi" === s[0])) {
- s.shift(),
- t = s.shift(),
- i = parseInt(s.shift(), 10),
- n = s.join("|");
- try {
- a = {
- type: t,
- callbackId: i,
- data: "" !== n ? JSON.parse(n) : ""
- }
- } catch(r) {}
- }
- return a
- }
- function y(e) {
- e = e || {},
- this.IS_MASTER = "boolean" == typeof e.isMaster ? e.isMaster: !1,
- this.IS_SLAVE = !this.IS_MASTER,
- this.api = e.api ? e.api: {},
- this._targets = e.targets ? e.targets: [],
- this._callbacks = [],
- this._channels = [],
- this.IS_MASTER && e.dataStore && (this.dataStore = e.dataStore),
- this._setupEventListener()
- }
- function v(e, n, d, h, g) {
- window.outerHeight - window.innerHeight,
- this.version = "0.21.2",
- this.isReady = !1,
- this._setRole(),
- this.__ = {},
- this.__.dataStore = this.IS_MASTER ? new e({
- isMaster: !0
- }) : null,
- this.__.messenger = new n({
- isMaster: this.IS_MASTER,
- api: this,
- targets: this._getTargets(),
- dataStore: this.__.dataStore
- }),
- this.__.components = new t;
- var f = this._addBasic({});
- this.__.EventTracking = new h(f, !1);
- var m = this._addComponents(f),
- y = this._addEventTracking(m),
- v = this._addInitialHeight(y);
- this.AppToken = new i(y, !1),
- this.GameState = new a(this._addAppToken(y), !1),
- this.Branding = new d(m, !1),
- this.GameBreak = new g(f, !1),
- this.Game = new s(f, !1),
- this.Score = new p(v, !1),
- this.Award = new u(v, !1),
- this.User = new o(y, !1),
- this.Friends = new l(y, !1),
- this.GameEvent = new c(y, !1),
- this.Localization = new r(y, !1)
- } (function(e) {
- if ("function" == typeof bootstrap) bootstrap("promise", e);
- else if ("object" == typeof exports && "object" == typeof module) module.exports = e();
- else if ("function" == typeof define && define.amd) define(e);
- else if ("undefined" != typeof ses) {
- if (!ses.ok()) return;
- ses.makeQ = e
- } else {
- if ("undefined" == typeof window && "undefined" == typeof self) throw Error("This environment was not anticipated by Q. Please file a bug.");
- var t = "undefined" != typeof window ? window: self,
- n = t.Q;
- t.Q = e(),
- t.Q.noConflict = function() {
- return t.Q = n,
- this
- }
- }
- })(function() {
- function e(e) {
- return function() {
- return Q.apply(e, arguments)
- }
- }
- function t(e) {
- return e === Object(e)
- }
- function n(e) {
- return "[object StopIteration]" === nt(e) || e instanceof J
- }
- function i(e, t) {
- if (F && t.stack && "object" == typeof e && null !== e && e.stack && -1 === e.stack.indexOf(it)) {
- for (var n = [], i = t; i; i = i.source) i.stack && n.unshift(i.stack);
- n.unshift(e.stack);
- var s = n.join("\n" + it + "\n");
- e.stack = a(s)
- }
- }
- function a(e) {
- for (var t = e.split("\n"), n = [], i = 0; t.length > i; ++i) {
- var a = t[i];
- o(a) || s(a) || !a || n.push(a)
- }
- return n.join("\n")
- }
- function s(e) {
- return - 1 !== e.indexOf("(module.js:") || -1 !== e.indexOf("(node.js:")
- }
- function r(e) {
- var t = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);
- if (t) return [t[1], Number(t[2])];
- var n = /at ([^ ]+):(\d+):(?:\d+)$/.exec(e);
- if (n) return [n[1], Number(n[2])];
- var i = /.*@(.+):(\d+)$/.exec(e);
- return i ? [i[1], Number(i[2])] : void 0
- }
- function o(e) {
- var t = r(e);
- if (!t) return ! 1;
- var n = t[0],
- i = t[1];
- return n === B && i >= V && lt >= i
- }
- function l() {
- if (F) try {
- throw Error()
- } catch(e) {
- var t = e.stack.split("\n"),
- n = t[0].indexOf("@") > 0 ? t[1] : t[2],
- i = r(n);
- if (!i) return;
- return B = i[0],
- i[1]
- }
- }
- function p(e, t, n) {
- return function() {
- return "undefined" != typeof console && "function" == typeof console.warn && console.warn(t + " is deprecated, use " + n + " instead.", Error("").stack),
- e.apply(e, arguments)
- }
- }
- function u(e) {
- return e instanceof g ? e: v(e) ? k(e) : I(e)
- }
- function d() {
- function e(e) {
- t = e,
- s.source = e,
- z(n,
- function(t, n) {
- u.nextTick(function() {
- e.promiseDispatch.apply(e, n)
- })
- },
- void 0),
- n = void 0,
- i = void 0
- }
- var t, n = [],
- i = [],
- a = Z(d.prototype),
- s = Z(g.prototype);
- if (s.promiseDispatch = function(e, a, s) {
- var r = K(arguments);
- n ? (n.push(r), "when" === a && s[1] && i.push(s[1])) : u.nextTick(function() {
- t.promiseDispatch.apply(t, r)
- })
- },
- s.valueOf = function() {
- if (n) return s;
- var e = m(t);
- return y(e) && (t = e),
- e
- },
- s.inspect = function() {
- return t ? t.inspect() : {
- state: "pending"
- }
- },
- u.longStackSupport && F) try {
- throw Error()
- } catch(r) {
- s.stack = r.stack.substring(r.stack.indexOf("\n") + 1)
- }
- return a.promise = s,
- a.resolve = function(n) {
- t || e(u(n))
- },
- a.fulfill = function(n) {
- t || e(I(n))
- },
- a.reject = function(n) {
- t || e(E(n))
- },
- a.notify = function(e) {
- t || z(i,
- function(t, n) {
- u.nextTick(function() {
- n(e)
- })
- },
- void 0)
- },
- a
- }
- function c(e) {
- if ("function" != typeof e) throw new TypeError("resolver must be a function.");
- var t = d();
- try {
- e(t.resolve, t.reject, t.notify)
- } catch(n) {
- t.reject(n)
- }
- return t.promise
- }
- function h(e) {
- return c(function(t, n) {
- for (var i = 0,
- a = e.length; a > i; i++) u(e[i]).then(t, n)
- })
- }
- function g(e, t, n) {
- void 0 === t && (t = function(e) {
- return E(Error("Promise does not support operation: " + e))
- }),
- void 0 === n && (n = function() {
- return {
- state: "unknown"
- }
- });
- var i = Z(g.prototype);
- if (i.promiseDispatch = function(n, a, s) {
- var r;
- try {
- r = e[a] ? e[a].apply(i, s) : t.call(i, a, s)
- } catch(o) {
- r = E(o)
- }
- n && n(r)
- },
- i.inspect = n, n) {
- var a = n();
- "rejected" === a.state && (i.exception = a.reason),
- i.valueOf = function() {
- var e = n();
- return "pending" === e.state || "rejected" === e.state ? i: e.value
- }
- }
- return i
- }
- function f(e, t, n, i) {
- return u(e).then(t, n, i)
- }
- function m(e) {
- if (y(e)) {
- var t = e.inspect();
- if ("fulfilled" === t.state) return t.value
- }
- return e
- }
- function y(e) {
- return e instanceof g
- }
- function v(e) {
- return t(e) && "function" == typeof e.then
- }
- function S(e) {
- return y(e) && "pending" === e.inspect().state
- }
- function _(e) {
- return ! y(e) || "fulfilled" === e.inspect().state
- }
- function A(e) {
- return y(e) && "rejected" === e.inspect().state
- }
- function T() {
- at.length = 0,
- st.length = 0,
- ot || (ot = !0)
- }
- function w(e, t) {
- ot && ("object" == typeof process && "function" == typeof process.emit && u.nextTick.runAfter(function() { - 1 !== Y(st, e) && (process.emit("unhandledRejection", t, e), rt.push(e))
- }), st.push(e), t && t.stack !== void 0 ? at.push(t.stack) : at.push("(no stack) " + t))
- }
- function b(e) {
- if (ot) {
- var t = Y(st, e); - 1 !== t && ("object" == typeof process && "function" == typeof process.emit && u.nextTick.runAfter(function() {
- var n = Y(rt, e); - 1 !== n && (process.emit("rejectionHandled", at[t], e), rt.splice(n, 1))
- }), st.splice(t, 1), at.splice(t, 1))
- }
- }
- function E(e) {
- var t = g({
- when: function(t) {
- return t && b(this),
- t ? t(e) : this
- }
- },
- function() {
- return this
- },
- function() {
- return {
- state: "rejected",
- reason: e
- }
- });
- return w(t, e),
- t
- }
- function I(e) {
- return g({
- when: function() {
- return e
- },
- get: function(t) {
- return e[t]
- },
- set: function(t, n) {
- e[t] = n
- },
- "delete": function(t) {
- delete e[t]
- },
- post: function(t, n) {
- return null === t || void 0 === t ? e.apply(void 0, n) : e[t].apply(e, n)
- },
- apply: function(t, n) {
- return e.apply(t, n)
- },
- keys: function() {
- return tt(e)
- }
- },
- void 0,
- function() {
- return {
- state: "fulfilled",
- value: e
- }
- })
- }
- function k(e) {
- var t = d();
- return u.nextTick(function() {
- try {
- e.then(t.resolve, t.reject, t.notify)
- } catch(n) {
- t.reject(n)
- }
- }),
- t.promise
- }
- function R(e) {
- return g({
- isDef: function() {}
- },
- function(t, n) {
- return N(e, t, n)
- },
- function() {
- return u(e).inspect()
- })
- }
- function M(e, t, n) {
- return u(e).spread(t, n)
- }
- function G(e) {
- return function() {
- function t(e, t) {
- var r;
- if ("undefined" == typeof StopIteration) {
- try {
- r = i[e](t)
- } catch(o) {
- return E(o)
- }
- return r.done ? u(r.value) : f(r.value, a, s)
- }
- try {
- r = i[e](t)
- } catch(o) {
- return n(o) ? u(o.value) : E(o)
- }
- return f(r, a, s)
- }
- var i = e.apply(this, arguments),
- a = t.bind(t, "next"),
- s = t.bind(t, "throw");
- return a()
- }
- }
- function P(e) {
- u.done(u.async(e)())
- }
- function L(e) {
- throw new J(e)
- }
- function x(e) {
- return function() {
- return M([this, D(arguments)],
- function(t, n) {
- return e.apply(t, n)
- })
- }
- }
- function N(e, t, n) {
- return u(e).dispatch(t, n)
- }
- function D(e) {
- return f(e,
- function(e) {
- var t = 0,
- n = d();
- return z(e,
- function(i, a, s) {
- var r;
- y(a) && "fulfilled" === (r = a.inspect()).state ? e[s] = r.value: (++t, f(a,
- function(i) {
- e[s] = i,
- 0 === --t && n.resolve(e)
- },
- n.reject,
- function(e) {
- n.notify({
- index: s,
- value: e
- })
- }))
- },
- void 0),
- 0 === t && n.resolve(e),
- n.promise
- })
- }
- function O(e) {
- if (0 === e.length) return u.resolve();
- var t = u.defer(),
- n = 0;
- return z(e,
- function(i, a, s) {
- function r(e) {
- t.resolve(e)
- }
- function o() {
- n--,
- 0 === n && t.reject(Error("Can't get fulfillment value from any promise, all promises were rejected."))
- }
- function l(e) {
- t.notify({
- index: s,
- value: e
- })
- }
- var p = e[s];
- n++,
- f(p, r, o, l)
- },
- void 0),
- t.promise
- }
- function C(e) {
- return f(e,
- function(e) {
- return e = $(e, u),
- f(D($(e,
- function(e) {
- return f(e, W, W)
- })),
- function() {
- return e
- })
- })
- }
- function j(e) {
- return u(e).allSettled()
- }
- function U(e, t) {
- return u(e).then(void 0, void 0, t)
- }
- function H(e, t) {
- return u(e).nodeify(t)
- }
- var F = !1;
- try {
- throw Error()
- } catch(q) {
- F = !!q.stack
- }
- var B, J, V = l(),
- W = function() {},
- X = function() {
- function e() {
- for (var e, i; n.next;) n = n.next,
- e = n.task,
- n.task = void 0,
- i = n.domain,
- i && (n.domain = void 0, i.enter()),
- t(e, i);
- for (; o.length;) e = o.pop(),
- t(e);
- a = !1
- }
- function t(t, n) {
- try {
- t()
- } catch(i) {
- if (r) throw n && n.exit(),
- setTimeout(e, 0),
- n && n.enter(),
- i;
- setTimeout(function() {
- throw i
- },
- 0)
- }
- n && n.exit()
- }
- var n = {
- task: void 0,
- next: null
- },
- i = n,
- a = !1,
- s = void 0,
- r = !1,
- o = [];
- if (X = function(e) {
- i = i.next = {
- task: e,
- domain: r && process.domain,
- next: null
- },
- a || (a = !0, s())
- },
- "object" == typeof process && "[object process]" == "" + process && process.nextTick) r = !0,
- s = function() {
- process.nextTick(e)
- };
- else if ("function" == typeof setImmediate) s = "undefined" != typeof window ? setImmediate.bind(window, e) : function() {
- setImmediate(e)
- };
- else if ("undefined" != typeof MessageChannel) {
- var l = new MessageChannel;
- l.port1.onmessage = function() {
- s = p,
- l.port1.onmessage = e,
- e()
- };
- var p = function() {
- l.port2.postMessage(0)
- };
- s = function() {
- setTimeout(e, 0),
- p()
- }
- } else s = function() {
- setTimeout(e, 0)
- };
- return X.runAfter = function(e) {
- o.push(e),
- a || (a = !0, s())
- },
- X
- } (),
- Q = Function.call,
- K = e(Array.prototype.slice),
- z = e(Array.prototype.reduce ||
- function(e, t) {
- var n = 0,
- i = this.length;
- if (1 === arguments.length) for (;;) {
- if (n in this) {
- t = this[n++];
- break
- }
- if (++n >= i) throw new TypeError
- }
- for (; i > n; n++) n in this && (t = e(t, this[n], n));
- return t
- }),
- Y = e(Array.prototype.indexOf ||
- function(e) {
- for (var t = 0; this.length > t; t++) if (this[t] === e) return t;
- return - 1
- }),
- $ = e(Array.prototype.map ||
- function(e, t) {
- var n = this,
- i = [];
- return z(n,
- function(a, s, r) {
- i.push(e.call(t, s, r, n))
- },
- void 0),
- i
- }),
- Z = Object.create ||
- function(e) {
- function t() {}
- return t.prototype = e,
- new t
- },
- et = e(Object.prototype.hasOwnProperty),
- tt = Object.keys ||
- function(e) {
- var t = [];
- for (var n in e) et(e, n) && t.push(n);
- return t
- },
- nt = e(Object.prototype.toString);
- J = "undefined" != typeof ReturnValue ? ReturnValue: function(e) {
- this.value = e
- };
- var it = "From previous event:";
- u.resolve = u,
- u.nextTick = X,
- u.longStackSupport = !1,
- "object" == typeof process && process && process.env && process.env.Q_DEBUG && (u.longStackSupport = !0),
- u.defer = d,
- d.prototype.makeNodeResolver = function() {
- var e = this;
- return function(t, n) {
- t ? e.reject(t) : arguments.length > 2 ? e.resolve(K(arguments, 1)) : e.resolve(n)
- }
- },
- u.Promise = c,
- u.promise = c,
- c.race = h,
- c.all = D,
- c.reject = E,
- c.resolve = u,
- u.passByCopy = function(e) {
- return e
- },
- g.prototype.passByCopy = function() {
- return this
- },
- u.join = function(e, t) {
- return u(e).join(t)
- },
- g.prototype.join = function(e) {
- return u([this, e]).spread(function(e, t) {
- if (e === t) return e;
- throw Error("Can't join: not the same: " + e + " " + t)
- })
- },
- u.race = h,
- g.prototype.race = function() {
- return this.then(u.race)
- },
- u.makePromise = g,
- g.prototype.toString = function() {
- return "[object Promise]"
- },
- g.prototype.then = function(e, t, n) {
- function a(t) {
- try {
- return "function" == typeof e ? e(t) : t
- } catch(n) {
- return E(n)
- }
- }
- function s(e) {
- if ("function" == typeof t) {
- i(e, o);
- try {
- return t(e)
- } catch(n) {
- return E(n)
- }
- }
- return E(e)
- }
- function r(e) {
- return "function" == typeof n ? n(e) : e
- }
- var o = this,
- l = d(),
- p = !1;
- return u.nextTick(function() {
- o.promiseDispatch(function(e) {
- p || (p = !0, l.resolve(a(e)))
- },
- "when", [function(e) {
- p || (p = !0, l.resolve(s(e)))
- }])
- }),
- o.promiseDispatch(void 0, "when", [void 0,
- function(e) {
- var t, n = !1;
- try {
- t = r(e)
- } catch(i) {
- if (n = !0, !u.onerror) throw i;
- u.onerror(i)
- }
- n || l.notify(t)
- }]),
- l.promise
- },
- u.tap = function(e, t) {
- return u(e).tap(t)
- },
- g.prototype.tap = function(e) {
- return e = u(e),
- this.then(function(t) {
- return e.fcall(t).thenResolve(t)
- })
- },
- u.when = f,
- g.prototype.thenResolve = function(e) {
- return this.then(function() {
- return e
- })
- },
- u.thenResolve = function(e, t) {
- return u(e).thenResolve(t)
- },
- g.prototype.thenReject = function(e) {
- return this.then(function() {
- throw e
- })
- },
- u.thenReject = function(e, t) {
- return u(e).thenReject(t)
- },
- u.nearer = m,
- u.isPromise = y,
- u.isPromiseAlike = v,
- u.isPending = S,
- g.prototype.isPending = function() {
- return "pending" === this.inspect().state
- },
- u.isFulfilled = _,
- g.prototype.isFulfilled = function() {
- return "fulfilled" === this.inspect().state
- },
- u.isRejected = A,
- g.prototype.isRejected = function() {
- return "rejected" === this.inspect().state
- };
- var at = [],
- st = [],
- rt = [],
- ot = !0;
- u.resetUnhandledRejections = T,
- u.getUnhandledReasons = function() {
- return at.slice()
- },
- u.stopUnhandledRejectionTracking = function() {
- T(),
- ot = !1
- },
- T(),
- u.reject = E,
- u.fulfill = I,
- u.master = R,
- u.spread = M,
- g.prototype.spread = function(e, t) {
- return this.all().then(function(t) {
- return e.apply(void 0, t)
- },
- t)
- },
- u.async = G,
- u.spawn = P,
- u["return"] = L,
- u.promised = x,
- u.dispatch = N,
- g.prototype.dispatch = function(e, t) {
- var n = this,
- i = d();
- return u.nextTick(function() {
- n.promiseDispatch(i.resolve, e, t)
- }),
- i.promise
- },
- u.get = function(e, t) {
- return u(e).dispatch("get", [t])
- },
- g.prototype.get = function(e) {
- return this.dispatch("get", [e])
- },
- u.set = function(e, t, n) {
- return u(e).dispatch("set", [t, n])
- },
- g.prototype.set = function(e, t) {
- return this.dispatch("set", [e, t])
- },
- u.del = u["delete"] = function(e, t) {
- return u(e).dispatch("delete", [t])
- },
- g.prototype.del = g.prototype["delete"] = function(e) {
- return this.dispatch("delete", [e])
- },
- u.mapply = u.post = function(e, t, n) {
- return u(e).dispatch("post", [t, n])
- },
- g.prototype.mapply = g.prototype.post = function(e, t) {
- return this.dispatch("post", [e, t])
- },
- u.send = u.mcall = u.invoke = function(e, t) {
- return u(e).dispatch("post", [t, K(arguments, 2)])
- },
- g.prototype.send = g.prototype.mcall = g.prototype.invoke = function(e) {
- return this.dispatch("post", [e, K(arguments, 1)])
- },
- u.fapply = function(e, t) {
- return u(e).dispatch("apply", [void 0, t])
- },
- g.prototype.fapply = function(e) {
- return this.dispatch("apply", [void 0, e])
- },
- u["try"] = u.fcall = function(e) {
- return u(e).dispatch("apply", [void 0, K(arguments, 1)])
- },
- g.prototype.fcall = function() {
- return this.dispatch("apply", [void 0, K(arguments)])
- },
- u.fbind = function(e) {
- var t = u(e),
- n = K(arguments, 1);
- return function() {
- return t.dispatch("apply", [this, n.concat(K(arguments))])
- }
- },
- g.prototype.fbind = function() {
- var e = this,
- t = K(arguments);
- return function() {
- return e.dispatch("apply", [this, t.concat(K(arguments))])
- }
- },
- u.keys = function(e) {
- return u(e).dispatch("keys", [])
- },
- g.prototype.keys = function() {
- return this.dispatch("keys", [])
- },
- u.all = D,
- g.prototype.all = function() {
- return D(this)
- },
- u.any = O,
- g.prototype.any = function() {
- return O(this)
- },
- u.allResolved = p(C, "allResolved", "allSettled"),
- g.prototype.allResolved = function() {
- return C(this)
- },
- u.allSettled = j,
- g.prototype.allSettled = function() {
- return this.then(function(e) {
- return D($(e,
- function(e) {
- function t() {
- return e.inspect()
- }
- return e = u(e),
- e.then(t, t)
- }))
- })
- },
- u.fail = u["catch"] = function(e, t) {
- return u(e).then(void 0, t)
- },
- g.prototype.fail = g.prototype["catch"] = function(e) {
- return this.then(void 0, e)
- },
- u.progress = U,
- g.prototype.progress = function(e) {
- return this.then(void 0, void 0, e)
- },
- u.fin = u["finally"] = function(e, t) {
- return u(e)["finally"](t)
- },
- g.prototype.fin = g.prototype["finally"] = function(e) {
- return e = u(e),
- this.then(function(t) {
- return e.fcall().then(function() {
- return t
- })
- },
- function(t) {
- return e.fcall().then(function() {
- throw t
- })
- })
- },
- u.done = function(e, t, n, i) {
- return u(e).done(t, n, i)
- },
- g.prototype.done = function(e, t, n) {
- var a = function(e) {
- u.nextTick(function() {
- if (i(e, s), !u.onerror) throw e;
- u.onerror(e)
- })
- },
- s = e || t || n ? this.then(e, t, n) : this;
- "object" == typeof process && process && process.domain && (a = process.domain.bind(a)),
- s.then(void 0, a)
- },
- u.timeout = function(e, t, n) {
- return u(e).timeout(t, n)
- },
- g.prototype.timeout = function(e, t) {
- var n = d(),
- i = setTimeout(function() {
- t && "string" != typeof t || (t = Error(t || "Timed out after " + e + " ms"), t.code = "ETIMEDOUT"),
- n.reject(t)
- },
- e);
- return this.then(function(e) {
- clearTimeout(i),
- n.resolve(e)
- },
- function(e) {
- clearTimeout(i),
- n.reject(e)
- },
- n.notify),
- n.promise
- },
- u.delay = function(e, t) {
- return void 0 === t && (t = e, e = void 0),
- u(e).delay(t)
- },
- g.prototype.delay = function(e) {
- return this.then(function(t) {
- var n = d();
- return setTimeout(function() {
- n.resolve(t)
- },
- e),
- n.promise
- })
- },
- u.nfapply = function(e, t) {
- return u(e).nfapply(t)
- },
- g.prototype.nfapply = function(e) {
- var t = d(),
- n = K(e);
- return n.push(t.makeNodeResolver()),
- this.fapply(n).fail(t.reject),
- t.promise
- },
- u.nfcall = function(e) {
- var t = K(arguments, 1);
- return u(e).nfapply(t)
- },
- g.prototype.nfcall = function() {
- var e = K(arguments),
- t = d();
- return e.push(t.makeNodeResolver()),
- this.fapply(e).fail(t.reject),
- t.promise
- },
- u.nfbind = u.denodeify = function(e) {
- var t = K(arguments, 1);
- return function() {
- var n = t.concat(K(arguments)),
- i = d();
- return n.push(i.makeNodeResolver()),
- u(e).fapply(n).fail(i.reject),
- i.promise
- }
- },
- g.prototype.nfbind = g.prototype.denodeify = function() {
- var e = K(arguments);
- return e.unshift(this),
- u.denodeify.apply(void 0, e)
- },
- u.nbind = function(e, t) {
- var n = K(arguments, 2);
- return function() {
- function i() {
- return e.apply(t, arguments)
- }
- var a = n.concat(K(arguments)),
- s = d();
- return a.push(s.makeNodeResolver()),
- u(i).fapply(a).fail(s.reject),
- s.promise
- }
- },
- g.prototype.nbind = function() {
- var e = K(arguments, 0);
- return e.unshift(this),
- u.nbind.apply(void 0, e)
- },
- u.nmapply = u.npost = function(e, t, n) {
- return u(e).npost(t, n)
- },
- g.prototype.nmapply = g.prototype.npost = function(e, t) {
- var n = K(t || []),
- i = d();
- return n.push(i.makeNodeResolver()),
- this.dispatch("post", [e, n]).fail(i.reject),
- i.promise
- },
- u.nsend = u.nmcall = u.ninvoke = function(e, t) {
- var n = K(arguments, 2),
- i = d();
- return n.push(i.makeNodeResolver()),
- u(e).dispatch("post", [t, n]).fail(i.reject),
- i.promise
- },
- g.prototype.nsend = g.prototype.nmcall = g.prototype.ninvoke = function(e) {
- var t = K(arguments, 1),
- n = d();
- return t.push(n.makeNodeResolver()),
- this.dispatch("post", [e, t]).fail(n.reject),
- n.promise
- },
- u.nodeify = H,
- g.prototype.nodeify = function(e) {
- return e ? (this.then(function(t) {
- u.nextTick(function() {
- e(null, t)
- })
- },
- function(t) {
- u.nextTick(function() {
- e(t)
- })
- }), void 0) : this
- },
- u.noConflict = function() {
- throw Error("Q.noConflict only works when Q is used as a global")
- };
- var lt = l();
- return u
- }),
- function(e) {
- var t = "Promise" in e && "cast" in e.Promise && "resolve" in e.Promise && "reject" in e.Promise && "all" in e.Promise && "race" in e.Promise && "spread" in e.Promise;
- t || (e.Promise = e.Q.promise, e.Promise.all = e.Q.all, e.Promise.timeout = e.Q.timeout, e.Q.stopUnhandledRejectionTracking())
- } (e !== void 0 ? e: this);
- var S = {
- timeout: 3e3
- };
- S.getGameConfig = function() {
- var t = e.Q.defer();
- return SpilGames(["JSLib"],
- function(e) {
- var n = e.get("current.game.integration.info");
- n ? t.resolve(n) : t.reject(Error("No data retrieved from JSLib"))
- }),
- t.promise.timeout(this.timeout)
- },
- S.getBrandingConfig = function(t) {
- var n = e.Q.defer(),
- i = "./configs",
- a = t.portal.siteId,
- s = t.portal.channelId,
- r = t.portal.applicationId,
- o = "en-EN",
- l = [i, s, a, r].join("/");
- return navigator && "undefined" != typeof navigator && (navigator.languages !== void 0 && navigator.languages[0] !== void 0 ? o = navigator.languages[0] : navigator.userLanguage !== void 0 && (o = navigator.userLanguage)),
- l = l + "?locale=" + o,
- SpilGames(["Net", "JSLib"],
- function(e, t) {
- e.send({
- url: l,
- type: "GET",
- dataType: "JSON"
- },
- function(e) {
- if (e && e.configar) window.postMessage(new f({
- type: "success",
- callbackId: null,
- data: "log.configar.getBranding.success"
- }), "*"),
- n.resolve(e.configar);
- else {
- var i = {};
- try {
- i = t.get("configar.data.cached") || i
- } catch(a) {}
- n.reject(i)
- }
- })
- }),
- n.promise.timeout(this.timeout)
- };
- var _ = {};
- _.argsToArray = function(e) {
- return e ? Array.prototype.slice.apply(e) : []
- },
- _.isA10 = function() {
- return /4399.com/.test(window.location.host)
- },
- _.disableKeys = function(e) {
- var t = e.keyCode; (8 === t || 9 === t || t >= 32 && 40 >= t || 46 === t) && e.preventDefault()
- },
- _.trackGA = function() {
- try {
- if ("www8.agame.com" === window.location.host) {
- var e = function(e, t, n, i, a, s, r) {
- e.GoogleAnalyticsObject = a,
- e[a] = e[a] ||
- function() { (e[a].q = e[a].q || []).push(arguments)
- },
- e[a].l = 1 * new Date,
- s = t.createElement(n),
- r = t.getElementsByTagName(n)[0],
- s.async = 1,
- s.src = i,
- r.parentNode.insertBefore(s, r)
- };
- e(window, document, "script", "", "ga"),
- ga("create", "UA-8223336-3", "auto"),
- ga("send", "pageview")
- }
- } catch(t) {}
- },
- _.getRole = function() {
- var e = "function" == typeof window.SpilGames,
- t = window.self !== window.top,
- n = null;
- if (_.isA10()) return window.onkeydown = this.disableKeys,
- {
- IS_MASTER: !0,
- IS_SLAVE: !0,
- IS_STANDALONE: !0
- };
- if (e) {
- var i = document.getElementById("#iframegame");
- switch (i) {
- case "null":
- n = {
- IS_MASTER: !0,
- IS_SLAVE: !0,
- IS_STANDALONE: !1
- };
- break;
- default:
- n = {
- IS_MASTER: !0,
- IS_SLAVE: !1,
- IS_STANDALONE: !1
- }
- }
- } else t ? (window.onkeydown = this.disableKeys, this.trackGA(), n = {
- IS_MASTER: !1,
- IS_SLAVE: !0,
- IS_STANDALONE: !1
- }) : (window.onkeydown = this.disableKeys, this.trackGA(), n = {
- IS_MASTER: !0,
- IS_SLAVE: !0,
- IS_STANDALONE: !0
- });
- return n
- },
- _.callConfigar = function(e, t) {
- var n, i, a = e.site || 500,
- s = e.channel || 100,
- r = e.id || null;
- window.XDomainRequest ? (n = new XDomainRequest, n.onload = function() {
- t(200, n.responseText)
- },
- n.onerror = function() {
- t(404, null)
- },
- n.onprogress = function() {}) : window.XMLHttpRequest ? (n = new XMLHttpRequest, n.onreadystatechange = function() {
- 4 === n.readyState && t(n.status, n.responseText)
- }) : window.ActiveXObject && (n = new ActiveXObject("Microsoft.XMLHTTP"), n.onreadystatechange = function() {
- 4 === n.readyState && t(n.status, n.responseText)
- }),
- r && (i = ["./configs", s, a, r].join("/"), n.open("GET", i, !0), n.timeout = 3e3, n.ontimeout = function() {
- t(404, null)
- },
- n.send())
- },
- _.submitData = function(e, t, n) {
- var i, a = e || "",
- s = t || {},
- r = n ||
- function() {};
- window.XDomainRequest ? (i = new XDomainRequest, i.onload = function() {
- r(200, i.responseText)
- },
- i.onerror = function() {
- r(404, null)
- },
- i.onprogress = function() {},
- i.open("POST", a, !0)) : window.XMLHttpRequest ? (navigator.userAgent.match(/Trident\/7.0;.* rv:11/) ? i = this.getJSONP() : (i = new XMLHttpRequest, i.onreadystatechange = function() {
- 4 === i.readyState && r(i.status, i.responseText)
- }), i.open("POST", a, !0), i.setRequestHeader("Content-type", "application/x-www-form-urlencoded")) : window.ActiveXObject && (i = new ActiveXObject("Microsoft.XMLHTTP"), i.onreadystatechange = function() {
- 4 === i.readyState && r(i.status, i.responseText)
- },
- i.open("POST", a, !0)),
- i.timeout = 3e3,
- i.ontimeout = function() {
- r(404, null)
- }
- //,i.send(JSON.stringify(s))
- },
- _.getJSONP = function() {
- var e = "",
- t = "jsonpspilgames" + +new Date,
- n = {
- open: function(t, n) {
- t = null,
- e = n
- },
- onreadystatechange: function() {},
- setRequestHeader: function() {},
- set: function(e, t) {
- n.set[e] = t
- },
- send: function(i) {
- var a = n.set.callback || 0,
- s = n.set.data || 0; (i || a || s) && (e += /\?/.test(e) ? "&": "?", i && (e += s ? s + "=" + encodeURIComponent(i) : i, a && (e += "&")), a && (e += a + "=" + t));
- var r = document.createElement("script");
- r.src = e,
- document.getElementsByTagName("head")[0].appendChild(r)
- }
- };
- return window[t] = function() {
- n.onreadystatechange.apply(this, arguments)
- },
- n
- },
- _.xdr = function(e, t) {
- var n, i, a = e.url || "",
- s = (e.type || "GET").toUpperCase(),
- r = void 0 !== e.data ? e.data: {},
- o = e.headers || {},
- l = function() {
- t({
- isError: !0
- })
- },
- p = void 0 !== e.async ? e.async: !0;
- if (XMLHttpRequest) {
- if (n = new XMLHttpRequest, "withCredentials" in n) {
- n.open(s, a, p),
- n.onerror = l,
- n.onreadystatechange = function() {
- 4 === n.readyState && (n.status >= 200 && 400 > n.status ? t({
- data: n.responseText,
- status: n.status
- }) : t({
- isError: !0,
- status: n.status
- }))
- };
- for (i in o) o.hasOwnProperty(i) && n.setRequestHeader(i, o[i]);
- n.send(r)
- }
- } else if (XDomainRequest) {
- n = new XDomainRequest,
- n.open(s, a),
- n.onerror = l,
- n.onload = function() {
- t(n.responseText)
- };
- for (i in o) o.hasOwnProperty(i) && n.setRequestHeader(i, o[i]);
- n.send(r)
- } else t({
- isError: !0,
- message: "CORS not supported"
- })
- },
- _.log = function() {
- if (window.console && window.console.log) {
- var e = Array.prototype.slice.call(arguments);
- console.log.apply(console, e)
- }
- },
- _.getServiceEndpoint = function(e) {
- return "stg" === e ? "": ""
- },
- _.isWrapped = function() {
- return void 0 !== (window.PhoneGap || window.cordova || window.Cordova)
- },
- _.isArray = Array.isArray ||
- function(e) {
- return "[object Array]" === Object.prototype.toString.call(e)
- },
- _._getQueryString = function() {
- return window.location.search
- },
- _._getPortalHost = function() {
- return window && window.location && window.location.hostname ? window.location.hostname: "unknown"
- },
- _.validateSchema = function(e, t) {
- for (var n in t) if (t.hasOwnProperty(n)) {
- if (!e.hasOwnProperty(n)) return {
- error: "Wrong argument passed: " + n
- };
- if (e.hasOwnProperty(n)) {
- var i = "object" == typeof e[n] ? e[n].type: e[n];
- if (t[n].constructor.name !== i) return {
- error: "Wrong value type for " + n + ": expected " + e[n] + ", got " + t[n].constructor.name
- };
- var a = e[n] && e[n].values || [];
- if ( - 1 === a.indexOf(t[n])) return {
- error: "Wrong value for " + n + ": expected " + a.join(" or ") + ", got " + t[n]
- }
- }
- }
- return {
- error: !1
- }
- };
- var A = {};
- A.getGameConfig = function() {
- return S.getGameConfig().
- catch(function() {
- return A.getLocalConfig()
- })
- },
- A.getBrandingConfig = function(e) {
- return new Promise(function(t) {
- return S.getBrandingConfig(e).then(t,
- function(e) {
- t(e),
- window.postMessage(new f({
- type: "warning",
- callbackId: null,
- data: "log.configar.getBranding.failure"
- }), "*")
- })
- })
- },
- A.getLocalConfig = function(e) {
- e = e && Object.keys(e).length ? e: {
- portal: {},
- game: {},
- branding: {},
- user: {}
- };
- var t = {
- isLocal: e.isLocal || !1,
- game: {
- applicationId: e.portal.applicationId || "0",
- contentarId: e.portal.contentarId || "0",
- info: e.game.info || {},
- settings: e.game.objectSettings || {},
- properties: e.game.properties || {},
- features: {
- achievements: e.game.achievements || !1,
- gameSidePanel: e.game.gameSidePanel || !1,
- highscores: e.game.highscores || !1,
- recommendedGames: e.game.recommendedGames || !1
- }
- },
- user: {
- authenticated: e.portal.authenticated || !1,
- username: e.portal.username || "",
- appToken: e.user.appToken || "",
- userId: e.user.userId || ""
- },
- portal: {
- host: _._getPortalHost(),
- siteId: e.portal.siteId || 0,
- channelId: e.portal.channelId || 0,
- applicationId: e.portal.applicationId || "0",
- gamestate: e.portal.gamestate || !1,
- env: "stg" === e.portal.env ? "stg": "prd",
- spilStorageId: e.portal.spilStorageId || ""
- },
- branding: e.branding || {}
- };
- return t.branding.logo = t.branding.logo || {},
- t.branding.logo.url = t.branding.logo.url || !1,
- t.branding.logo.image = t.branding.logo.image || !1,
- t
- },
- A.configFromData = function(e) {
- var t = {
- game: {
- applicationId: e.id
- },
- user: {
- userId: e.userid ? e.userid: void 0,
- appToken: e.appToken ? e.appToken: void 0
- },
- portal: {
- applicationId: e.id,
- siteId: e.site ? e.site: 187,
- channelId: e.channel ? e.channel: 100,
- gamestate: e.gamestate ? e.gamestate: !1,
- env: "stg" === e.env ? "stg": "prd",
- spilStorageId: e.spilStorageId
- }
- };
- return t
- },
- A.setupStandaloneMode = function(e, t) {
- var n = {},
- i = {
- configar: {
- branding: {
- main: {
- label: "main",
- image: "",
- url: "",
- style: "",
- width: "202",
- height: "50",
- mime: "image/png",
- type: "png",
- handler: "newTab",
- blacklisted: !0
- },
- logo: {
- label: "logo",
- image: "",
- url: "",
- style: "",
- width: "202",
- height: "50",
- mime: "image/png",
- type: "png",
- handler: "newTab",
- blacklisted: !1
- },
- more_games: {
- label: "more_games",
- image: null,
- url: "",
- style: "",
- width: null,
- height: null,
- mime: null,
- type: null,
- handler: "newTab",
- blacklisted: !1
- },
- splash_screen: {
- label: "splash_screen",
- image: "place_holder_string",
- url: "",
- style: "",
- width: "0",
- height: "0",
- mime: "image/png",
- type: "png",
- handler: "newTab",
- blacklisted: !1
- }
- }
- }
- };
- n.JSLib = {
- memory: {},
- _channels: {},
- get: function(e) {
- return this.memory[e] ? this.memory[e] : !1
- },
- set: function(e, t) {
- return this.memory[e] = t,
- t
- },
- publish: function(e, t) {
- this._channels[e] && this._channels[e].forEach(function(e) {
- try {
- e.fn.call(this, t)
- } catch(n) {}
- })
- },
- subscribe: function(e, t) {
- if ("function" != typeof t) throw Error("Callback has to be a function");
- if ("string" != typeof e) throw Error("Channel name has to be a string");
- this._channels[e] || (this._channels[e] = []),
- this._channels[e].push({
- fn: t
- })
- }
- },
- n.Net = {
- send: function(e, t) {
- t.call(this, {})
- }
- },
- window.SpilGamesBootstrap = [],
- window.SpilGames = function() {
- var e = arguments;
- if (e[0] && "string" == typeof e[0]) n.JSLib.publish(e[0], e[1] || null);
- else if (e[0] && e[0] instanceof Array) {
- var t, i, a = [];
- for (t = 0, i = e[0].length; i > t; t++) a.push(n[e[0][t]]);
- e[1].apply(this, a)
- }
- },
- e && e.id ? _.callConfigar(e,
- function(n, a) {
- if (200 === n && "string" == typeof a && JSON.parse(a)) {
- var s = JSON.parse(a),
- r = A.configFromData(e);
- r.branding = s.configar && s.configar.branding ? s.configar.branding: i.configar.branding,
- t.call(this, r)
- } else t.call(this, {
- isLocal: !0,
- branding: i.configar.branding
- })
- }) : t.call(this, {
- isLocal: !0,
- branding: i.configar.branding
- })
- },
- A.getCachedConfig = function() {},
- t.prototype.newTab = function(e) {
-
- },
- t.prototype.moreGames = function(e) {
- var t = e.brandName || "a10";
- e.isStandalone ? this.newTab(e) : e.messenger && e.messenger.post && e.messenger.post("game.moregames", {
- branding: t
- })
- },
- t.prototype.displayOnTop = function(e) {
- if (e === void 0 || e.url === void 0 || "string" != typeof e.url || e.action === void 0 || "function" != typeof e.action) return e.callback !== void 0 || "function" == typeof e.callback ? (e.callback(), void 0) : void 0;
- var t = document.createElement("div"),
- n = e.url,
- i = e.action,
- a = e.callback;
- t.setAttribute("id", "spilgames-splash-screen-sample"),
- document.body.appendChild(t);
- var s = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
- r = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
- return t.style.left = "0",
- t.style.top = "0",
- t.style.width = s + "px",
- t.style.height = r + "px",
- t.style.position = "absolute",
- t.style.zIndex = "10000",
- t.onclick = i,
- n && (t.style.background = "url('" + n + "') center center no-repeat #FFF"),
- window.setTimeout(function() {
- var e = document.getElementById("spilgames-splash-screen-sample");
- e.parentNode.removeChild(e),
- a && a()
- },
- 2e3),
- t
- },
- n.prototype.get = function(e) {
- for (var t = this.dataStore,
- n = e.split("."), i = n.length, a = 0; i - 1 > a; a++) {
- if (!t[n[a]]) return null;
- t = t[n[a]]
- }
- return t[n[i - 1]] || null
- },
- n.prototype.put = function(e, t) {
- for (var n = this.dataStore,
- i = e.split("."), a = i.length, s = 0; a - 1 > s; s++) {
- var r = i[s];
- n[r] || (n[r] = {}),
- n = n[r]
- }
- n[i[a - 1]] = t
- },
- n.prototype.set = function(e, t) {
- this.put(e, t);
- var n = Date.parse(new Date);
- return this.notify({
- type: "new",
- key: e,
- current: t,
- previous: null,
- timestamp: n
- }),
- t
- },
- n.prototype.update = function(e, t) {
- var n, i, a = null;
- return this.get(e) ? (n = "update", a = this.get(e)) : n = "new",
- this.put(e, t),
- i = Date.parse(new Date),
- this.notify({
- type: n,
- key: e,
- current: t,
- previous: a,
- timestamp: i
- }),
- t
- },
- n.prototype.remove = function(e) {
- if (this.get(e)) {
- var t, n = this.get(e);
- return this.put(e, null),
- t = Date.parse(new Date),
- this.notify({
- type: "remove",
- key: e,
- current: null,
- previous: n,
- timestamp: t
- }),
- !0
- }
- return ! 1
- },
- n.prototype._setCache = function(e) {console.log(e)
- this.dataStore = e
- },
- n.prototype._getCache = function() {
- return this.dataStore
- },
- n.prototype.notify = function(e) {
- if (this.IS_MASTER) {
- var t = new f({
- type: "datachange",
- callbackId: null,
- data: e
- }).encode();
- return window.postMessage(t, "*"),
- t
- }
- },
- i.prototype.init = function(e) {
- e = e || {},
- this.data = e.data || this.data,
- this.data && this.data.game && this.data.user && (this.appId = this.data.game.applicationId || null, this.appToken = this.data.user.appToken || null),
- this._setupEvents(),
- (this.IS_SLAVE || this.IS_STANDALONE || _.isWrapped()) && this._scheduleRefresh()
- },
- i.prototype.getAppToken = function() {
- return this.appToken
- },
- i.prototype._setupEvents = function() {
- this.IS_MASTER ? this.messenger.subscribe("gameapi.apptoken.getAppToken", this._getAppToken, this) : this.messenger.subscribe("gameapi.apptoken.getAppTokenResponse", this._getAppTokenResponse, this)
- },
- i.prototype._retryAppToken = function(e) { (e || this.appTimerDelay !== this.appDelayMax) && (e && !this.appError && (this.appTimerDelay = this.appDelayMin, this.appError = !0), this._unschedule(), e ? this._increaseDelay() : this._resetDelay(), this._scheduleRefresh())
- },
- i.prototype._scheduleRefresh = function() {
- var e = this;
- null === this.appTimer && (this.appTimer = setInterval(function() {
- e._getAppToken()
- },
- this.appTimerDelay))
- },
- i.prototype._unschedule = function() {
- this.appTimer && clearTimeout(this.appTimer),
- this.appTimer = null
- },
- i.prototype._increaseDelay = function() {
- this.appTimerDelay = Math.min(2 * this.appTimerDelay, this.appDelayMax)
- },
- i.prototype._resetDelay = function() {
- this.appTimerDelay = this.appDelayMax
- },
- i.prototype._getAppToken = function() {
- var e = this.messenger;
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this.IS_MASTER || this.messenger._postMessage({},
- void 0, "gameapi.apptoken.getAppToken"),
- this.IS_MASTER && ("function" == typeof SpilGames ? SpilGames("api.account.getApplicationToken", {
- cache: !1,
- applicationId: this.appId
- },
- function(t) {
- t.error || !t.appAuth.token ? e._postMessage({},
- void 0, "gameapi.apptoken.getAppTokenResponse") : e._postMessage({
- appToken: t.appAuth.token,
- level: t.level
- },
- void 0, "gameapi.apptoken.getAppTokenResponse")
- }) : e._postMessage({},
- void 0, "gameapi.apptoken.getAppTokenResponse"))
- },
- i.prototype._getAppTokenResponse = function(e) {
- e.appToken ? (this.appToken = e.appToken, this._retryAppToken(!1)) : this._retryAppToken(!0)
- },
- a.prototype.init = function(e) {
- e = e || {},
- this.data = e.data || this.data,
- this.data && this.data.game && this.data.user && this.data.portal && (this.gameState.appId = this.data.game.applicationId || null, this.gameState.userId = this.data.user.userId || null, this.isGamestate = this.data.portal.gamestate || !1, this.endpoint = _.getServiceEndpoint(this.data.portal.env), this.spilStorageId = this.data.portal.spilStorageId),
- this.isGamestate && (this.IS_SLAVE || this.IS_STANDALONE || _.isWrapped()) && (this.listenStorageEvents(), this.preloadGameState())
- },
- a.prototype.listenStorageEvents = function() {
- var e = function(e) {
- this.onStorageEvent(e)
- }.bind(this);
- window.addEventListener("storage", e, !1)
- },
- a.prototype.flagDirtyKey = function(e) { - 1 === this.gameState.dirtyKeys.indexOf(e) && (this.gameState.dirtyKeys.push(e), this.scheduleSyncState())
- },
- a.prototype.unschedule = function() {
- this.flushTimer && clearTimeout(this.flushTimer),
- this.flushTimer = null
- },
- a.prototype.scheduleSyncState = function() {
- var e = this;
- null === this.flushTimer && (this.flushTimer = setInterval(function() {
- e.syncState()
- },
- this.flushTimerDelay))
- },
- a.prototype.increaseDelaySyncState = function() {
- this.flushTimerDelay = Math.min(2 * this.flushTimerDelay, this.flushDelayMax)
- },
- a.prototype.resetDelaySyncState = function() {
- this.flushTimerDelay = this.flushDelayMin
- },
- a.prototype.onStorageEvent = function(e) {
- e && e.url && e.url.indexOf("spilStorageId=" + this.spilStorageId) > 0 && this.flagDirtyKey(e.key)
- },
- a.prototype.preloadGameState = function() {
- var e = {
- url: this.endpoint + "/v1/gamestate/" + this.gameState.userId + "/" + this.gameState.appId,
- type: "GET",
- dataType: "JSON",
- headers: {
- "x-auth-token": this.appToken.getAppToken()
- }
- };
- _.xdr(e,
- function(e) {
- if (e.isError) _.log("GameAPIGameState failed preloading: " + e.status);
- else {
- var t = JSON.parse(e.data);
- if (t && t.gamestate) {
- var n = t.gamestate,
- i = 0,
- a = null;
- for (a in n) n.hasOwnProperty(a) && (window.localStorage[a] = n[a], i++);
- _.log("GameAPIGameState preloaded: " + i + " keys")
- }
- }
- })
- },
- a.prototype.retrySyncState = function(e) {
- _.log(e),
- this.increaseDelaySyncState(),
- this.scheduleSyncState()
- },
- a.prototype.syncState = function() {
- if (this.unschedule(), !this.gameState.appId) return this.retrySyncState("GameAPIGameState.prototype.syncStat no appId");
- if (!this.gameState.userId) return this.retrySyncState("GameAPIGameState.prototype.syncState no userId");
- for (var e, t = this.gameState.appId,
- n = this.gameState.userId,
- i = this.gameState.dirtyKeys,
- a = {
- set: {},
- remove: []
- },
- s = 0, r = this, o = 0; i.length > o; o++) e = window.localStorage[i[o]],
- void 0 === e ? a.remove.push(i[o]) : (a.set[i[o]] = e, s = Math.max(e.length, s));
- if (i.length > 0) {
- var l = {
- url: this.endpoint + "/v1/gamestate/" + n + "/" + t,
- type: "POST",
- data: JSON.stringify(a),
- async: !0,
- headers: {
- "x-auth-token": this.appToken.getAppToken()
- }
- };
- _.xdr(l,
- function(e) {
- e.isError ? r.retrySyncState("GameAPIGameState error syncing state") : (_.log("GameAPIGameState synced " + i.length + " keys"), r.resetDelaySyncState(), r.gameState.dirtyKeys = [])
- });
- var p = {
- numkeys: i.length,
- maxdatalength: s,
- userid: n
- };
- this.eventTracking.trackGameAPIEvent("gameState", p)
- }
- return ! 0
- },
- s.prototype.init = function(e) {
- this.data = e.data || null
- },
- s.prototype._performAction = function(e) {
- var t = new f(e.data || {}),
- n = this.messenger,
- i = this.subscribers || {};
- if (t && t.type && t.data) switch (t.type) {
- case "gameEvent":
- t.data[0] && i[t.data[0]] && i[t.data[0]].length > 0 ? i[t.data[0]].forEach(function(e) {
- e.call(this),
- n._postMessage([t.data[0], {
- origin: "slave"
- },
- null], null, "gameState")
- }) : t.data[0] && t.data[1] && "slave" === t.data[1].origin && "function" == typeof SWFtoJS && SWFtoJS({
- call: t.data[0],
- params: {}
- });
- break;
- case "gameState":
- t.data[0] && t.data[1] && "slave" === t.data[1].origin && (this.gameState = t.data[0])
- }
- },
- s.prototype.on = function(e, t) {
- this.IS_SLAVE && (this.subscribers[e] || (this.subscribers[e] = []), this.subscribers[e].push(t))
- },
- s.prototype.emit = function(e) {
- if (!this.IS_MASTER) throw Error("Only the master environment can emit game events");
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- if (e === this.gameState) throw Error("The game is already in state: `" + e + "`");
- this.messenger._postMessage([e, {
- origin: "master"
- },
- null], null, "gameEvent")
- },
- s.prototype.isSiteLock = function() {
- var e = !0;
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- return this.data && this.data.portal && this.data.portal.siteId && 500 > this.data.portal.siteId && (e = !1),
- e
- },
- s.prototype.adjustHeight = function(e) {
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this.IS_MASTER ? "function" == typeof SpilGames && SpilGames.Events !== void 0 && "function" == typeof SpilGames.Events.publish && SpilGames.Events.publish("portal.adjustheight", {
- height: e,
- onsuccess: function() {}
- }) : (this.messenger._postMessage(e, void 0, "gameapi.game.adjustHeight"), this.messenger._postMessage(["log.gameapi.game.adjustHeight", {
- origin: "slave",
- height: e
- },
- null], null, "log"))
- },
- r.prototype.init = function() {},
- r.prototype.getLocalizedText = function() {
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- return key
- },
- o.prototype.init = function(e) {
- this._setLocale(e),
- this._setupEvents(),
- e && e.data && e.data.portal && e.data.portal.siteId && 500 > e.data.portal.siteId && "0" !== e.data.portal.siteId && (this.isAvailable = !0)
- },
- o.prototype._setupEvents = function() {
- this.IS_MASTER ? (this.messenger.subscribe("gameapi.user.forceAuthentication", this.forceAuthentication, this), this.messenger.subscribe("gameapi.user.getUser", this.getUser, this)) : this.messenger.subscribe("gameapi.user.getUserResponse", this._getUserResponse, this)
- },
- o.prototype.forceAuthentication = function() {
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this.IS_MASTER ? "function" == typeof SpilGames && SpilGames.Portal !== void 0 && "function" == typeof SpilGames.Portal.forceAuthentication && SpilGames.Portal.forceAuthentication({
- onsuccess: function() {}
- }) : (this.messenger._postMessage({},
- void 0, "gameapi.user.forceAuthentication"), this.messenger._postMessage(["log.gameapi.user.forceAuthentication", {
- origin: "slave"
- },
- null], null, "log"))
- },
- o.prototype.getUser = function(e) {
- var t = this.messenger;
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- if (this.IS_MASTER)"function" == typeof SpilGames ? SpilGames(["JSLib"],
- function(e) {
- e && "function" == typeof e ? e("api.user.getExtended",
- function(e) {
- t._postMessage(e, void 0, "gameapi.user.getUserResponse")
- }) : t._postMessage({
- userInfoExtended: {}
- },
- void 0, "gameapi.user.getUserResponse")
- }) : t._postMessage({
- userInfoExtended: {}
- },
- void 0, "gameapi.user.getUserResponse");
- else {
- if ("function" != typeof e) throw Error("The argument passed to the GameAPI.User.getUser method should be a function");
- this.usercallback = e,
- t._postMessage({},
- void 0, "gameapi.user.getUser"),
- t._postMessage(["log.gameapi.user.getUser", {
- origin: "slave",
- argumentType: typeof e
- },
- null], null, "log")
- }
- },
- o.prototype._getUserResponse = function(e) {
- var t = e.userInfoExtended || {},
- n = this._validateData(t),
- i = !1;
- "" === t.guid && (i = !0),
- this.eventTracking.trackGameAPIEvent("userGet", {
- guid: n.guid || "",
- fail: i
- }),
- this.usercallback(n)
- },
- o.prototype._validateData = function(e) {
- var t = {
- uid: e.uid || "",
- guid: e.guid || "",
- displayName: e.name || "",
- pic_square: e.avatarUrl || "",
- pic_square_large: e.avatarLargeUrl || "",
- gender: e.gender || "",
- age: e.age || "",
- birthday: e.birthdate || "",
- level: e.level || "",
- locale: this.locale || ""
- };
- return t
- },
- o.prototype._setLocale = function(e) {
- e && e.data && e.data.portal && e.data.portal.siteId && (this.locale = this._getLang(e.data.portal.siteId))
- },
- o.prototype._getLang = function(e) {
- for (var t = [{
- siteid: 1,
- lang: "nl-NL"
- },
- {
- siteid: 2,
- lang: "en-US"
- },
- {
- siteid: 5,
- lang: "de-DE"
- },
- {
- siteid: 11,
- lang: "fr-FR"
- },
- {
- siteid: 12,
- lang: "fr-FR"
- },
- {
- siteid: 15,
- lang: "it-IT"
- },
- {
- siteid: 16,
- lang: "pl-PL"
- },
- {
- siteid: 24,
- lang: "en-US"
- },
- {
- siteid: 25,
- lang: "nl-NL"
- },
- {
- siteid: 26,
- lang: "de-DE"
- },
- {
- siteid: 44,
- lang: "sv-SE"
- },
- {
- siteid: 50,
- lang: "pt-BR"
- },
- {
- siteid: 55,
- lang: "en-ID"
- },
- {
- siteid: 79,
- lang: "en-US"
- },
- {
- siteid: 86,
- lang: "es-ES"
- },
- {
- siteid: 87,
- lang: "pt-BR"
- },
- {
- siteid: 88,
- lang: "en-US"
- },
- {
- siteid: 90,
- lang: "en-US"
- },
- {
- siteid: 91,
- lang: "pt-BR"
- },
- {
- siteid: 92,
- lang: "en-GB"
- },
- {
- siteid: 93,
- lang: "nl-NL"
- },
- {
- siteid: 94,
- lang: "de-DE"
- },
- {
- siteid: 95,
- lang: "fr-FR"
- },
- {
- siteid: 96,
- lang: "es-ES"
- },
- {
- siteid: 97,
- lang: "es-ES"
- },
- {
- siteid: 98,
- lang: "pl-PL"
- },
- {
- siteid: 99,
- lang: "it-IT"
- },
- {
- siteid: 100,
- lang: "sv-SE"
- },
- {
- siteid: 101,
- lang: "pt-BR"
- },
- {
- siteid: 102,
- lang: "en-GB"
- },
- {
- siteid: 103,
- lang: "ru-RU"
- },
- {
- siteid: 104,
- lang: "ru-RU"
- },
- {
- siteid: 105,
- lang: "ru-RU"
- },
- {
- siteid: 106,
- lang: "it-IT"
- },
- {
- siteid: 107,
- lang: "en-GB"
- },
- {
- siteid: 108,
- lang: "sv-SE"
- },
- {
- siteid: 109,
- lang: "pl-PL"
- },
- {
- siteid: 115,
- lang: "en-GB"
- },
- {
- siteid: 116,
- lang: "tr-TR"
- },
- {
- siteid: 118,
- lang: "ms-MY"
- },
- {
- siteid: 119,
- lang: "en-GB"
- },
- {
- siteid: 120,
- lang: "jp-JP"
- },
- {
- siteid: 121,
- lang: "en-US"
- },
- {
- siteid: 122,
- lang: "es-ES"
- },
- {
- siteid: 123,
- lang: "en-US"
- },
- {
- siteid: 124,
- lang: "en-US"
- },
- {
- siteid: 125,
- lang: "AR"
- },
- {
- siteid: 126,
- lang: "en-US"
- },
- {
- siteid: 127,
- lang: "en-US"
- },
- {
- siteid: 128,
- lang: "nl-NL"
- },
- {
- siteid: 129,
- lang: "es-AR"
- },
- {
- siteid: 130,
- lang: "es-MX"
- },
- {
- siteid: 131,
- lang: "de-DE"
- },
- {
- siteid: 132,
- lang: "en-EN"
- },
- {
- siteid: 133,
- lang: "en-EN"
- },
- {
- siteid: 134,
- lang: "en-ID"
- },
- {
- siteid: 135,
- lang: "de-DE"
- },
- {
- siteid: 136,
- lang: "pl-PL"
- },
- {
- siteid: 137,
- lang: "en-EN"
- },
- {
- siteid: 138,
- lang: "it-IT"
- },
- {
- siteid: 139,
- lang: "uk-UA"
- },
- {
- siteid: 140,
- lang: "en-ID"
- },
- {
- siteid: 141,
- lang: "uk-UA"
- },
- {
- siteid: 142,
- lang: "ja-JP"
- },
- {
- siteid: 143,
- lang: "nl-NL"
- },
- {
- siteid: 144,
- lang: "en-US"
- },
- {
- siteid: 145,
- lang: "en-US"
- },
- {
- siteid: 146,
- lang: "en-US"
- },
- {
- siteid: 147,
- lang: "en-US"
- },
- {
- siteid: 148,
- lang: "en-US"
- },
- {
- siteid: 149,
- lang: "en-IN"
- },
- {
- siteid: 150,
- lang: "tr-TR"
- },
- {
- siteid: 151,
- lang: "de-DE"
- },
- {
- siteid: 152,
- lang: "ru-RU"
- },
- {
- siteid: 153,
- lang: "ru-RU"
- },
- {
- siteid: 154,
- lang: "ru-RU"
- },
- {
- siteid: 155,
- lang: "en-US"
- },
- {
- siteid: 156,
- lang: "tr-TR"
- },
- {
- siteid: 157,
- lang: "tr-TR"
- },
- {
- siteid: 158,
- lang: "tr-TR"
- },
- {
- siteid: 159,
- lang: "en-US"
- },
- {
- siteid: 160,
- lang: "en-US"
- },
- {
- siteid: 161,
- lang: "en-US"
- },
- {
- siteid: 162,
- lang: "en-US"
- },
- {
- siteid: 163,
- lang: "en-US"
- },
- {
- siteid: 164,
- lang: "en-US"
- },
- {
- siteid: 165,
- lang: "en-US"
- },
- {
- siteid: 166,
- lang: "en-US"
- },
- {
- siteid: 167,
- lang: "en-US"
- },
- {
- siteid: 168,
- lang: "en-US"
- },
- {
- siteid: 169,
- lang: "en-US"
- },
- {
- siteid: 170,
- lang: "en-US"
- },
- {
- siteid: 171,
- lang: "en-US"
- },
- {
- siteid: 172,
- lang: "en-US"
- },
- {
- siteid: 173,
- lang: "en-US"
- },
- {
- siteid: 174,
- lang: "en-US"
- },
- {
- siteid: 175,
- lang: "en-US"
- },
- {
- siteid: 176,
- lang: "en-US"
- },
- {
- siteid: 177,
- lang: "en-US"
- },
- {
- siteid: 178,
- lang: "en-US"
- },
- {
- siteid: 179,
- lang: "en-US"
- },
- {
- siteid: 180,
- lang: "en-UK"
- },
- {
- siteid: 181,
- lang: "nl-NL"
- },
- {
- siteid: 182,
- lang: "fr-FR"
- },
- {
- siteid: 183,
- lang: "de-DE"
- },
- {
- siteid: 184,
- lang: "en-US"
- },
- {
- siteid: 185,
- lang: "en-US"
- },
- {
- siteid: 186,
- lang: "en-EN"
- },
- {
- siteid: 187,
- lang: "en-EN"
- },
- {
- siteid: 188,
- lang: "en-EN"
- },
- {
- siteid: 189,
- lang: "en-EN"
- },
- {
- siteid: 190,
- lang: "en-EN"
- },
- {
- siteid: 191,
- lang: "en-US"
- },
- {
- siteid: 192,
- lang: "pt-BR"
- },
- {
- siteid: 193,
- lang: "en-US"
- },
- {
- siteid: 450,
- lang: "en-US"
- },
- {
- siteid: 451,
- lang: "nl-NL"
- },
- {
- siteid: 452,
- lang: "de-DE"
- },
- {
- siteid: 453,
- lang: "fr-FR"
- },
- {
- siteid: 454,
- lang: "es-ES"
- },
- {
- siteid: 455,
- lang: "it-IT"
- },
- {
- siteid: 456,
- lang: "en-GB"
- },
- {
- siteid: 457,
- lang: "en-ID"
- },
- {
- siteid: 458,
- lang: "es-AR"
- },
- {
- siteid: 459,
- lang: "es-LA"
- },
- {
- siteid: 460,
- lang: "es-MX"
- },
- {
- siteid: 461,
- lang: "jp-JP"
- },
- {
- siteid: 462,
- lang: "ms-MY"
- },
- {
- siteid: 463,
- lang: "pl-PL"
- },
- {
- siteid: 464,
- lang: "pt-BR"
- },
- {
- siteid: 465,
- lang: "pt-PT"
- },
- {
- siteid: 466,
- lang: "ru-RU"
- },
- {
- siteid: 467,
- lang: "sv-SE"
- },
- {
- siteid: 468,
- lang: "tr-TR"
- }], n = 0; t.length > n; n++) if (t[n].siteid === e) return t[n].lang;
- return ""
- },
- l.prototype.init = function(e) {
- this._setupEvents(),
- e && e.data && e.data.portal && e.data.portal.siteId && 500 > e.data.portal.siteId && "0" !== e.data.portal.siteId && (this.isAvailable = !0)
- },
- l.prototype._setupEvents = function() {
- this.IS_MASTER ? (this.messenger.subscribe("gameapi.friends.showInvite", this.showInvite, this), this.messenger.subscribe("gameapi.friends.getFriends", this.getFriends, this)) : this.messenger.subscribe("gameapi.friends.getFriendsResponse", this._getFriendsResponse, this)
- },
- l.prototype.showInvite = function() {
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this.IS_MASTER ? "function" == typeof SpilGames && SpilGames.Events !== void 0 && "function" == typeof SpilGames.Events.publish && SpilGames.Events.publish("invitefriends.request") : (this.messenger._postMessage({},
- void 0, "gameapi.friends.showInvite"), this.messenger._postMessage(["log.gameapi.friends.showInvite", {
- origin: "slave"
- },
- null], null, "log"), this.eventTracking.trackGameAPIEvent("friendsInvite", {
- guid: this.guid || ""
- }))
- },
- l.prototype.getFriends = function(e) {
- var t = this.messenger;
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- if (this.IS_MASTER) {
- if ("function" == typeof SpilGames) {
- var n = this;
- SpilGames(["JSLib"],
- function(e) {
- e && "function" == typeof e ? e("api.user.getExtended",
- function(e) {
- e.userInfoExtended && "guest" !== e.userInfoExtended.name && e.userInfoExtended.guid ? (this.userGuid = e.userInfoExtended.guid, n._getFriendsFromPortal([], 1)) : t._postMessage({
- friendList: {}
- },
- void 0, "gameapi.friends.getFriendsResponse")
- }) : t._postMessage({
- friendList: {}
- },
- void 0, "gameapi.friends.getFriendsResponse")
- })
- }
- } else "function" == typeof e && (this.friendscallback = e),
- t._postMessage({},
- void 0, "gameapi.friends.getFriends"),
- t._postMessage(["log.gameapi.friends.getFriends", {
- origin: "slave"
- },
- null], null, "log")
- },
- l.prototype._getFriendsFromPortal = function(e, t) {
- var n = this.messenger,
- i = e;
- if ("function" == typeof SpilGames) {
- var a = this;
- SpilGames("api.friend.list", {
- guid: this.userGuid,
- pageControl: {
- page: t,
- pageSize: 500
- }
- },
- function(e) {
- e.error ? n._postMessage(i, void 0, "gameapi.friends.getFriendsResponse") : (i = i.concat(e.friendList), e.pageControl && e.pageControl.totalPages > t ? a._getFriendsFromPortal(i, t + 1) : n._postMessage({
- friendList: i
- },
- void 0, "gameapi.friends.getFriendsResponse"))
- })
- } else n._postMessage({
- friendList: e
- },
- void 0, "gameapi.friends.getFriendsResponse")
- },
- l.prototype._getFriendsResponse = function(e) {
- var t = this._validateData(e.friendList),
- n = !1;
- 0 === t.length && (n = !0),
- this.eventTracking.trackGameAPIEvent("friendsGet", {
- guid: this.guid || "",
- fail: n
- }),
- this.friendscallback(t)
- },
- l.prototype._validateData = function(e) {
- for (var t = [], n = 0; e.length > n; n++) {
- var i = {
- uid: e[n].uid || "",
- guid: e[n].guid || "",
- displayName: e[n].name || "",
- pic_square: e[n].avatarUrl || "",
- pic_square_large: e[n].avatarLargeUrl || "",
- gender: e[n].gender || "",
- age: e[n].age || ""
- };
- t.push(i)
- }
- return t
- },
- p.prototype._setupMasterEvent = function() {
- this.IS_MASTER && this.messenger.subscribe("gameapi.score", this.submit, this)
- },
- p.prototype.submit = function(e) {
- // updateShare(e);
- Play68.setRankingScoreDesc(e);
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- if (this.IS_MASTER) {
- var t = !1,
- n = window.outerHeight - window.innerHeight;
- n === this.initialHeight && (t = !0),
- this.eventTracking.trackGameAPIEvent("scoreSubmit", {
- score: e,
- initialheight: this.initialHeight,
- submitheight: n,
- equals: t
- }),
- "function" == typeof SWFtoJS && SWFtoJS({
- call: "UPDATE_HIGHSCORE",
- params: {
- score: e
- }
- })
- } else this.messenger._postMessage(e, void 0, "gameapi.score"),
- this.messenger._postMessage(["log.gameapi.score.submit", {
- origin: "slave",
- score: e
- },
- null], null, "log");
- return {
- success: !0,
- value: e
- }
- },
- u.prototype._setupMasterEvent = function() {
- this.IS_MASTER && this.messenger.subscribe("gameapi.award", this.submit, this)
- },
- u.prototype.submit = function(e) {
- var t = e.award || "";
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- if (this.IS_MASTER) {
- var n = !1;
- window.outerHeight - window.innerHeight === this.initialHeight && (n = !0),
- this.eventTracking.trackGameAPIEvent("awardSubmit", {
- award: t,
- initialheight: this.initialHeight,
- submitheight: window.outerHeight - window.innerHeight,
- equals: n
- })
- } else this.messenger._postMessage(e, void 0, "gameapi.award"),
- this.messenger._postMessage(["log.gameapi.award.submit", {
- origin: "slave",
- award: t
- },
- null], null, "log");
- return {
- success: !0,
- value: e.award
- }
- },
- d.prototype.init = function(e) {
- e = e || {},
- this.data = e.data || this.data,
- this._setupEvents()
- },
- d.prototype._setupEvents = function() {
- var e = this.messenger,
- t = this;
- this.isMaster ? (SpilGames(["JSLib"],
- function(n) {
- n.subscribe("ad.request.accepted",
- function(n) { ! 0 === n && t.adRequested && (t.adRequested = !1, SpilGames("game.ad.accepted", !0), e._postMessage(!0, void 0, "ad.request.accepted"))
- }),
- n.subscribe("ad.complete",
- function() {
- e._postMessage("", "", "ad.complete")
- })
- }), this.messenger.subscribe("gameapi.ad.request", this._setupAd, this), this.messenger.subscribe("game.ad.request", this._triggerAd, this), this.messenger.subscribe("game.force.break", this._forceGamebreak, this)) : (this.messenger.subscribe("ad.request.accepted", this._onAdAccepted, this), this.messenger.subscribe("ad.complete", this._onAdCompleted, this))
- },
- d.prototype._setupAd = function() {
- this.adRequested = !0
- },
- d.prototype._triggerAd = function() {
- SpilGames("game.ad.request")
- },
- d.prototype._forceGamebreak = function() {
- SpilGames("game.ad.accepted", !0)
- },
- d.prototype._runCallback = function(e) {
- this._callbacks[e] && (this._callbacks[e](), this._callbacks[e] = !1)
- },
- d.prototype.isAvailable = function() {
- var e = !1;
- return this.data && this.data.portal && this.data.portal.siteId && 500 > this.data.portal.siteId && (e = !0),
- e
- },
- d.prototype.reward = function(e, t) {
- if ("function" != typeof e) throw Error("pauseGame argument should be a function");
- if ("function" != typeof t) throw Error("resumeGame argument should be a function");
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- e(),
- this.isMaster ? t() : (this._callbacks.resume = t, this.messenger._postMessage(void 0, void 0, "game.force.break"))
- },
- d.prototype.request = function(e, t) {
- var n = this;
- if ("function" != typeof e) throw Error("pauseGame argument should be a function");
- if ("function" != typeof t) throw Error("resumeGame argument should be a function");
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this._callbacks.pause = e,
- this._callbacks.resume = t,
- this.isMaster || (this.messenger._postMessage(void 0, void 0, "gameapi.ad.request"), this.messenger._postMessage(["log.gameapi.ad.requested", {
- origin: "slave"
- },
- null], null, "log")),
- this.messenger._postMessage(void 0, void 0, "game.ad.request"),
- this.timeout = setTimeout(function() {
- n._requestTimeout()
- },
- this.timeoutAfter)
- },
- d.prototype._onAdAccepted = function(e) {
- var t = this.messenger;
- this.timeout && clearTimeout(this.timeout),
- !this.isMaster && e && (t._postMessage(["log.gameapi.ad.start", {
- origin: "slave"
- },
- null], null, "log"), this._runCallback("pause"))
- },
- d.prototype._onAdCompleted = function() {
- var e = this.messenger;
- this.isMaster || e._postMessage(["log.gameapi.ad.complete", {
- origin: "slave"
- },
- null], null, "log"),
- this._runCallback("resume")
- },
- d.prototype._requestTimeout = function() {
- this._onAdCompleted()
- },
- c.prototype._setupEvents = function() {
- this.IS_MASTER && this.messenger.subscribe("gameapi.gameevent", this.emit, this)
- },
- c.prototype._validateEvent = function(e) {
- var t = !1;
- return this.events[e] && this.events[e] !== void 0 && (t = !0),
- t
- },
- c.prototype.emit = function(e) {
- if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
- this._validateEvent(e) ? this.IS_MASTER ? "function" == typeof SWFtoJS && SWFtoJS({
- call: e
- }) : (this.messenger._postMessage(e, void 0, "gameapi.gameevent"), this.messenger._postMessage(["log.gameapi.gameevent.emit", {
- origin: "slave",
- evt: e
- },
- null], null, "log")) : this.IS_MASTER || this.messenger._postMessage(["log.gameapi.gameevent.emit", {
- origin: "slave"
- },
- null], null, "log")
- },
- h.prototype.init = function(e) {
- e = e || {},
- this.data = e.data || this.data;
- var t = this.data && this.data.game && this.data.game.applicationId ? this.data.game.applicationId: null,
- n = new Date,
- i = window.location.hostname;
- this.data && this.data.portal ? (this.isGamestate = this.data.portal.gamestate || !1, this.siteId = this.data.portal.siteId ? this.data.portal.siteId: null, this.channelId = this.data.portal.channelId ? this.data.portal.channelId: null) : (this.siteId = null, this.channelId = null),
- this.configureInternalTracking(t, n, i),
- this.isGamestate || (this.IS_SLAVE || this.IS_STANDALONE || _.isWrapped()) && this.startInternalTracking()
- },
- h.prototype._createEventObject = function(e, t, n) {
- return {
- eventCategory: e,
- eventAction: t,
- properties: n
- }
- },
- h.prototype._sendSETEvent = function(e, t, n) {
- return this.IS_STANDALONE ? _.submitData("", t, n) : this.messenger && this.messenger.post("tracker.event." + e, t, n),
- t
- },
- h.prototype.trackGamePlay = function(e) {
- if (!this.gamePlayTracking.started) return ! 1;
- var t = this.gamePlayTracking.appid,
- n = this.gamePlayTracking.timestamp,
- i = this.gamePlayTracking.host,
- a = this._createEventObject("game", "gameplay", {
- applicationId: t,
- start: n,
- host: i
- }),
- s = this.data.isLocal,
- r = !0,
- o = 0,
- l = 0;
- this.siteId && (o = parseInt(this.siteId, 10)),
- this.channelId && (l = parseInt(this.channelId, 10)),
- this.data && this.data.branding && this.data.branding.logo && this.data.branding.logo.image && (r = !1);
- var p = this._createEventObject("gameapi", "load", {
- siteid: o,
- appid: t,
- channelid: l,
- domainname: i,
- isstandalone: this.IS_STANDALONE,
- isfallbackconfig: s,
- iswhitelisted: r
- });
- return this._sendSETEvent("express", a, e),
- this._sendSETEvent("express", p,
- function() {}),
- a
- },
- h.prototype.trackTimeInGame = function(e) {
- if (!this.timeInGameTracking.started) return ! 1;
- var t = this.timeInGameTracking.appid,
- n = this.timeInGameTracking.timestamp,
- i = this._createEventObject("game", "heartbeat", {
- applicationId: t,
- start: n
- });
- return this._sendSETEvent("express", i, e),
- i
- },
- h.prototype.trackGameAPIEvent = function(e, t) {
- t.appid = this.gamePlayTracking.appid,
- t.domainname = this.gamePlayTracking.host,
- t.siteid = parseInt(this.siteId, 10),
- t.channelid = parseInt(this.channelId, 10);
- var n = this._createEventObject("gameapi", e, t);
- this._sendSETEvent("express", n,
- function() {})
- },
- h.prototype.configureInternalTracking = function(e, t, n) {
- return e ? (this.gamePlayTracking.appid = e, this.gamePlayTracking.timestamp = Date.parse(t), this.gamePlayTracking.host = n, this.timeInGameTracking.appid = e, this.timeInGameTracking.timestamp = Date.parse(t), void 0) : {
- error: "No application ID defined for this game"
- }
- },
- h.prototype.startInternalTracking = function() {
- var e = this,
- t = 6e4,
- n = function(e) {
- if (!e) throw "Could not save the time in game"
- };
- return this.moduleReady ? this.gamePlayTracking.appid ? (this.gamePlayTracking.started = !0, this.timeInGameTracking.started = !0, this.trackGamePlay(function(e) {
- if (!e) throw "Could not save the game play"
- }), this.trackTimeInGame(n), setInterval(function() {
- e.trackTimeInGame(n)
- },
- t), this.gamePlayTracking.started && this.timeInGameTracking.started) : {
- error: "No application ID defined for this game"
- }: {
- error: "This method cannot be called before the API is loaded"
- }
- },
- g.prototype.init = function(e) {
- var t;
- e = e || {},
- this.data = e.data || this.data,
- this.data && this.data.portal && this.data.portal.siteId && (t = this.data.portal.siteId, (t > 499 || 12 === t || 25 === t || 26 === t || 55 === t || 79 === t || 97 === t || 105 === t || 108 === t || 138 === t || 157 === t || 121 === t || 1 === t || 5 === t || 11 === t || 15 === t || 16 === t || 44 === t || 50 === t || 87 === t || 86 === t || 88 === t || 92 === t || 103 === t || 140 === t || 90 === t || 93 === t || 95 === t || 94 === t || 96 === t || 98 === t || 99 === t || 100 === t || 101 === t || 102 === t || 104 === t || 134 === t) && this.data.branding && this.data.branding.more_games && this.data.branding.more_games.handler && "moreGames" !== this.data.branding.more_games.handler && (this.data.branding.more_games.handler = "moreGames"))
- },
- g.prototype.getLogo = function(e) {
- if (!this.moduleReady) return {
- error: "This method cannot be called before the API is loaded"
- };
- var t = this.IS_MASTER ? "master": "slave";
- this.messenger._postMessage(["log.branding.getlogo", {
- origin: t
- },
- null], null, "log");
- var n, i, a = {
- type: {
- type: "String",
- values: ["png"]
- },
- width: "Number",
- height: "Number"
- };
- return n = this._getLink("logo"),
- e && "object" == typeof e && (i = _.validateSchema(a, e), i.error && (n.error = i.error)),
- n
- },
- g.prototype.getLink = function(e) {
- if (!e) return {
- error: "No link identifier provided"
- };
- var t = this.listLinks();
- if ( - 1 !== t.indexOf(e)) {
- var n = this.IS_MASTER ? "master": "slave";
- return this.messenger._postMessage(["log.branding.getlink", {
- origin: n,
- linkName: e
- },
- null], null, "log"),
- this._getLink(e)
- }
- return {
- error: "Invalid option: '" + e + "'",
- action: function() {}
- }
- },
- g.prototype._getLink = function(e) {
- if (!e) return {
- error: "No link identifier provided"
- };
- var t = this.data && this.data.branding ? this.data.branding: {};
- return t && t[e] ? {
- linkName: e,
- image: t[e].image || !1,
- action: this._executeHandler.bind(this, e)
- }: {
- error: "Invalid option: '" + e + "'",
- action: function() {}
- }
- },
- g.prototype._getGMLink = function(e) {
- var t = null;
- if (!e) return {
- error: "No link identifier provided"
- };
- var n = this.data && this.data.branding ? this.data.branding: {};
- return n && n[e] ? (t = this._tagUrl(n[e].url, e), {
- linkName: e,
- url: t
- }) : {
- error: "Invalid option: '" + e + "'",
- url: null
- }
- },
- g.prototype.getLinks = function() {
- var e = {},
- t = this.listLinks();
- if (0 === t.length) e = {
- more_games: {
- action: function() {}
- }
- };
- else for (var n = 0; t.length > n; n++) {
- var i = t[n];
- e[i] = this._getLink(i)
- }
- return e
- },
- g.prototype._executeHandler = function(e) {
- var t = this.data && this.data.branding ? this.data.branding: {},
- n = t[e],
- i = n.handler,
- a = this._tagUrl(n.url, e),
- s = this._getBrandName(t);
- if (n.url && n.url.length > 0 && i && this.components[i]) {
- var r = this.IS_MASTER ? "master": "slave";
- return this.messenger._postMessage(["log.branding.linkAction", {
- origin: r,
- linkName: e
- },
- null], null, "log"),
- this.components[i]({
- url: a,
- messenger: this.messenger,
- isStandalone: this.IS_STANDALONE,
- brandName: s
- })
- }
- return function() {}
- },
- g.prototype._getBrandName = function(e) {
- // var t = "a10";
- if (e && e.more_games && e.more_games.url) {
- _czc.push(["_trackEvent","open进入游戏","戳爆他们","","",""]);
- if(document.referrer)
- Play68.goHome();
- else
- play68_goHome();
- // var n = e.more_games.url;
- // t = n.replace(/(.*)www./, "").replace(/\..*/, "")
- }
- // return t
- },
- g.prototype.listLinks = function() {
- var e = [],
- t = this.data && this.data.branding ? this.data.branding: {},
- n = Object.keys(t);
- return e = n.filter(function(e) {
- return ! t[e].blacklisted
- })
- },
- g.prototype.getSplashScreen = function() {
- var e, t = this.IS_MASTER ? "master": "slave";
- if (this.data && this.data.branding && this.data.branding.splash_screen) {
- var n = !0;
- this.data.branding.splash_screen.image || this.data.branding.splash_screen.url || (n = !1),
- e = {
- show: n,
- action: this._getLink("splash_screen").action ||
- function() {}
- }
- } else e = {
- show: !0,
- action: function() {}
- };
- return this.messenger._postMessage(["log.branding.splashScreen", {
- origin: t
- },
- null], null, "log"),
- e
- },
- g.prototype.displaySplashScreen = function(e) {
- if ("function" != typeof e) throw Error("argument passed to displaySplashScreen method should be a function");
- var t = this.IS_MASTER ? "master": "slave",
- n = this._getLink("logo").image;
- n && this.getSplashScreen().show ? ("master" !== t && this.messenger._postMessage(["log.branding.displaySplashScreen", {
- origin: t
- },
- null], null, "log"), this.components.displayOnTop({
- url: n,
- action: this.getSplashScreen().action,
- callback: e
- })) : e()
- },
- g.prototype._tagUrl = function(e, t) {
- var n, i, a, s = this.data && this.data.portal ? this.data.portal: {},
- r = this.data && this.data.game ? this.data.game: {},
- o = parseInt(s.siteId, 10);
- if ("string" != typeof e) throw Error("No url specified");
- return n = "string" == typeof t ? t: "logo",
- i = "brandedgames_" + (o > 0 && 500 > o ? "internal": "external"),
- a = ["utm_medium=" + i, "utm_campaign=" + r.applicationId, "utm_source=" + s.host, "utm_content=" + n].join("&"),
- e += e.indexOf("?") > -1 ? "&": "?",
- e + a
- },
- f.prototype.encode = function() {
- var e = ["gameapi", this.type, this.callbackId, this.data ? JSON.stringify(this.data) : ""].join("|");
- return e
- },
- y.prototype._postMessage = function(e, t, n) {
- var i, a;
- i = _.isArray(e) && "function" == typeof e[e.length - 1] ? this._callbacks.push(e.pop()) - 1 : t,
- a = new f({
- type: n || "jslib",
- callbackId: i,
- data: e
- }).encode();
- for (var s = 0; this._targets.length > s; s++) this._targets[s].postMessage(a, "*")
- },
- y.prototype._callJSLib = function() {
- SpilGames.apply(SpilGames, _.argsToArray(arguments))
- },
- y.prototype._setupEventListener = function() {
- window.addEventListener ? window.addEventListener("message", this._handleMessage.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._handleMessage.bind(this))
- },
- y.prototype._handleMessage = function(e) {
- var t, n, i, a, s = this,
- r = new f(e.data);
- if (r) if (t = r.type, n = r.callbackId, i = r.data, a = this._callbacks[n] || !1, this.IS_MASTER) switch (t) {
- case "jslib":
- "Array" === i.constructor.name && i.push(function(e) {
- s._postMessage(e, n)
- }),
- this._callJSLib.apply(this, i);
- break;
- case "ugapi":
- this._handleUGARequest(e);
- break;
- case "datachange":
- this._postMessage(i, null, "datachange");
- break;
- default:
- this.publish(t, i)
- } else this.IS_SLAVE && ("function" == typeof a ? (delete this._callbacks[n], a(i)) : "datachange" === t || "jslib" !== t && this.publish(t, i));
- return ! 1
- },
- y.prototype._handleUGARequest = function(e) {
- var t, n, i, a = this,
- s = new f(e.data);
- if (s) switch (t = s.data[0], n = s.callbackId, i = s.data[1] ? s.data[1] : null, t) {
- case "GameAPI.data":
- a._postMessage(this.dataStore._getCache(), n, "ugapi");
- break;
- case "GameAPI.isReady":
- a._postMessage({
- isready:
- this.api.isReady
- },
- n, "ugapi")
- }
- },
- y.prototype.post = function() {
- var e = _.argsToArray(arguments);
- return this.IS_SLAVE ? this._postMessage(e) : this._callJSLib.apply(this, e),
- this
- },
- y.prototype.publish = function(e, t) {
- return this._channels[e] && this._channels[e].forEach(function(e) {
- try {
- e.fn.call(e.ctx, t)
- } catch(n) {}
- }),
- this
- },
- y.prototype.subscribe = function(e, t, n) {
- if ("function" != typeof t) throw Error("Callback has to be a function");
- if ("string" != typeof e) throw Error("Channel name has to be a string");
- return this._channels[e] || (this._channels[e] = []),
- this._channels[e].push({
- fn: t,
- ctx: n
- }),
- this
- },
- y.prototype.unsubscribe = function(e, t) {
- return this._channels[e] && "function" == typeof t && (this._channels[e] = this._channels[e].filter(function(e) {
- return e.fn !== t
- })),
- this
- },
- y.prototype.subscribeOnce = function(e, t, n) {
- function i(n) {
- a.unsubscribe(e, i),
- t.call(this, n)
- }
- var a = this;
- return this.subscribe(e, i, n)
- },
- y.prototype.requestFromParent = function(e, t, n) {
- if (!this.IS_SLAVE) throw "You are the parent, stop talking to yourself";
- t = t || {},
- this._postMessage([e, t, n], null, "ugapi")
- },
- v.prototype._addBasic = function(e, t) {
- var n = t || {};
- return n.isMaster = this.IS_MASTER,
- n.isStandalone = this.IS_STANDALONE,
- n.messenger = this.__.messenger,
- n.data = null,
- n
- },
- v.prototype._addEventTracking = function(e) {
- var t = e || {};
- return t.eventTracking = this.__.EventTracking,
- t
- },
- v.prototype._addComponents = function(e) {
- var t = e || {};
- return t.components = this.__.components,
- t
- },
- v.prototype._addInitialHeight = function(e) {
- var t = e || {};
- return t.initialHeight = window.outerHeight - window.innerHeight,
- t
- },
- v.prototype._addAppToken = function(e) {
- var t = e || {};
- return t.appToken = this.AppToken,
- t
- },
- v.prototype._setRole = function() {
- var e = _.getRole();
- this.IS_MASTER = e.IS_MASTER,
- this.IS_SLAVE = e.IS_SLAVE,
- this.IS_STANDALONE = e.IS_STANDALONE
- },
- v.prototype._getTargets = function() {
- if (this.IS_STANDALONE) return [window];
- if (this.IS_MASTER) {
- for (var e = ["iframegame", "iframeGameState"], t = null, n = [], i = 0; e.length > i; i++) t = document.getElementById(e[i]),
- t && t.contentWindow && n.push(t.contentWindow);
- return n
- }
- return [window.parent]
- },
- v.prototype.loadAPI = function(e, t) {
- function i(t) {
- p.IS_MASTER && (t = a(t));
- var n = t.portal.gamestate || !1;
- return p.isReady = !0,
- p.Branding.moduleReady = !0,
- p.__.EventTracking.moduleReady = !0,
- p.GameState.moduleReady = !0,
- p.GameBreak.moduleReady = !0,
- p.Game.moduleReady = !0,
- p.Score.moduleReady = !0,
- p.Award.moduleReady = !0,
- p.User.moduleReady = !0,
- p.Friends.moduleReady = !0,
- p.GameEvent.moduleReady = !0,
- p.Localization.moduleReady = !0,
- p.AppToken.moduleReady = !0,
- (n || p.IS_MASTER) && p.AppToken.init({
- data: t
- }),
- p.__.EventTracking.init({
- data: t
- }),
- n && p.GameState.init({
- data: t
- }),
- n || (p.Branding.init({
- data: t
- }), p.Game.init({
- data: t
- }), p.GameBreak.init({
- data: t
- }), p.Friends.init({
- data: t
- }), p.User.init({
- data: t
- }), p.Localization.init({
- data: t
- })),
- p.__.messenger._postMessage(["log.gameapi.loadapi.finish", {
- origin: u,
- version: p.version
- },
- null], null, "log"),
- e(p)
- }
- function a(e) {
- var t = e.game || {},
- n = e.user || {},
- i = e.portal || {},
- a = e.branding || {};
- return A.getLocalConfig({
- game: t,
- user: n,
- portal: i,
- branding: a
- })
- }
- function s() {
- p.__.messenger.requestFromParent("GameAPI.data", {},
- function(e) {
- i(e)
- })
- }
- function r() {
- p.IS_STANDALONE = !0,
- p.IS_MASTER = !0,
- p.IS_SLAVE = !0,
- p.__.dataStore = new n({
- isMaster: !0
- }),
- t = t || null,
- A.setupStandaloneMode(t,
- function(e) {
- p.__.dataStore._setCache(a(e)),
- i(e)
- })
- }
- function o() {
- p.__.messenger.requestFromParent("GameAPI.isReady", {},
- function(e) {
- l && clearTimeout(l),
- e.isready ? s() : 5 > d ? (d++, setTimeout(o, 500)) : (_.log("GameAPI:checkMasterReady not ready but reached max wait"), s())
- })
- }
- var l, p = this,
- u = this.IS_MASTER ? "master": "slave",
- d = 0;
- if (t !== void 0 && t.id !== void 0 && "576742227280293562" === t.id && (window.onkeydown = null), "function" != typeof e) throw Error("argument passed to loadAPI method should be a function");
- return ! 0 === this.isReady ? (_.log("WARNING: Detected multiple executions of GameAPI.loadAPI(). This method should only be executed once per page load!"), e(p)) : (this.__.messenger._postMessage(["log.gameapi.loadapi.start", {
- origin: u,
- version: p.version,
- spildata: t
- },
- null], null, "log"), this.IS_STANDALONE ? r() : this.IS_MASTER ? A.getGameConfig().then(function(e) {
- A.getBrandingConfig(e).then(function(t) {
- e && !e.isError ? (e.branding = t.branding, p.__.dataStore._setCache(a(e))) : _.log("GameAPI gameConfig error: ", e.isError),
- i(e)
- })
- }) : t && t.gamestate ? i(A.configFromData(t)) : (l = setTimeout(r, 600), o()), void 0)
- };
- var T = new v(n, y, g, h, d);
- "function" == typeof define && define.amd && define("GameAPI", T),
- e.GameAPI = T
- })(window),
- function() {
- "use strict";
- function e(e) {
- e && (e.setTargetValueAtTime || (e.setTargetValueAtTime = e.setTargetAtTime))
- }
- window.hasOwnProperty("AudioContext") && (window.webkitAudioContext = AudioContext, AudioContext.prototype.hasOwnProperty("internal_createGain") || (AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain, AudioContext.prototype.createGain = function() {
- var t = this.internal_createGain();
- return e(t.gain),
- t
- }), AudioContext.prototype.hasOwnProperty("internal_createDelay") || (AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay, AudioContext.prototype.createDelay = function() {
- var t = this.internal_createDelay();
- return e(t.delayTime),
- t
- }), AudioContext.prototype.hasOwnProperty("internal_createBufferSource") || (AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource, AudioContext.prototype.createBufferSource = function() {
- var t = this.internal_createBufferSource();
- return t.noteOn || (t.noteOn = t.start),
- t.noteGrainOn || (t.noteGrainOn = t.start),
- t.noteOff || (t.noteOff = t.stop),
- e(t.playbackRate),
- t
- }), AudioContext.prototype.hasOwnProperty("internal_createDynamicsCompressor") || (AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor, AudioContext.prototype.createDynamicsCompressor = function() {
- var t = this.internal_createDynamicsCompressor();
- return e(t.threshold),
- e(t.knee),
- e(t.ratio),
- e(t.reduction),
- e(t.attack),
- e(t.release),
- t
- }), AudioContext.prototype.hasOwnProperty("internal_createBiquadFilter") || (AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter, AudioContext.prototype.createBiquadFilter = function() {
- var t = this.internal_createBiquadFilter();
- e(t.frequency),
- e(t.detune),
- e(t.Q),
- e(t.gain);
- for (var n = ["LOWPASS", "HIGHPASS", "BANDPASS", "LOWSHELF", "HIGHSHELF", "PEAKING", "NOTCH", "ALLPASS"], i = 0; n.length > i; ++i) {
- var a = n[i],
- s = a.toLowerCase();
- t.hasOwnProperty(a) || (t[a] = s)
- }
- return t
- }), AudioContext.prototype.hasOwnProperty("internal_createOscillator") || AudioContext.prototype.hasOwnProperty("createOscillator") && (AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator, AudioContext.prototype.createOscillator = function() {
- var t = this.internal_createOscillator();
- t.noteOn || (t.noteOn = t.start),
- t.noteOff || (t.noteOff = t.stop),
- e(t.frequency),
- e(t.detune);
- for (var n = ["SINE", "SQUARE", "SAWTOOTH", "TRIANGLE", "CUSTOM"], i = 0; n.length > i; ++i) {
- var a = n[i],
- s = a.toLowerCase();
- t.hasOwnProperty(a) || (t[a] = s)
- }
- return t.hasOwnProperty("setWaveTable") || (t.setWaveTable = t.setPeriodicTable),
- t
- }), AudioContext.prototype.hasOwnProperty("internal_createPanner") || (AudioContext.prototype.internal_createPanner = AudioContext.prototype.createPanner, AudioContext.prototype.createPanner = function() {
- var e = this.internal_createPanner(),
- t = {
- EQUALPOWER: "equalpower",
- HRTF: "HRTF",
- LINEAR_DISTANCE: "linear",
- INVERSE_DISTANCE: "inverse",
- EXPONENTIAL_DISTANCE: "exponential"
- };
- for (var n in t) {
- var i = t[n];
- e.hasOwnProperty(n) || (e[n] = i)
- }
- return e
- }), AudioContext.prototype.hasOwnProperty("createGainNode") || (AudioContext.prototype.createGainNode = AudioContext.prototype.createGain), AudioContext.prototype.hasOwnProperty("createDelayNode") || (AudioContext.prototype.createDelayNode = AudioContext.prototype.createDelay), AudioContext.prototype.hasOwnProperty("createJavaScriptNode") || (AudioContext.prototype.createJavaScriptNode = AudioContext.prototype.createScriptProcessor), AudioContext.prototype.hasOwnProperty("createWaveTable") || (AudioContext.prototype.createWaveTable = AudioContext.prototype.createPeriodicWave))
- } ();
|