(function (window) {
// API
window.ex = {
config: {
fbAppId: null, // required
fbAppPageId: null,
fbPricesUrl: null, // "https://d2fmgmkly4bg9q.cloudfront.net/rs/public/facebook/prices/"
fbVersion: "v3.1",
fbIsCanvas: (window.name != null && self !== top && document.location.href.indexOf("nofb=1") == -1),
fbPermissions: "email", // user_friends,publish_actions
fbStandalone: true, // false to disable FB api outside of Facebook
playstoreId: null,
appstoreId: null,
serverId: null, // required
title: null, // required
namespace: null, // required
staticUrl: null, // required
versionUrl: null, // required
flashUrl: null, // required
flashVersion: "11.8",
flashWidth: 755,
flashHeight: 650,
flashObject: null,
flashInstall: "./public/script/expressInstall.swf", // declare in index.html for deploy script to add version number!
lang: "en",
languages: {}, // override to extend lang DB
query: "{query}",
onFlashReady: null,
onConnected: $.noop,
onInstall: null,
onRegistration: null,
onNAU: null,
onNAPU: null,
onShowBanners: null,
trialPayVendorId: null,
trialPayCurrencyUrl: null,
fyberAppId: null,
fyberWidth: 1000,
fyberHeight: 1000,
affizAppId: null,
woobiAppId: null,
woobiColorSide: null,
woobiColorBack: null,
kongIsIframe: false,
kongInstance: null
},
init: init,
flash: {
show: flashShow,
hide: flashHide,
setup: flashSetup
},
facebook: {
login: facebookLogin,
request: facebookRequest,
share: facebookShare,
permissions: facebookPermissions,
like: {
show: facebookLike,
hide: facebookLikeHide
},
hideFlashCallback: facebookHideFlashCallback
},
twitter: {
tweet: twitterTweet
},
payment: {
show: paymentShow,
facebook: paymentFacebook,
kongregate: paymentKongregate
},
banners: {
insert: bannersInsert,
remove: bannersRemove
},
offerwall: {
trialPay: {
show: offerwallTrialPayShow,
onTransaction: offerwallTrialPayOnTransaction
}
},
videos: {
fyber: {
getVideos: fyberGetVideos,
showVideo: fyberShowVideo
},
affiz: {
getVideos: affizGetVideos,
showVideo: affizShowVideo
},
woobi: {
getVideos: woobiGetVideos,
showVideo: woobiShowVideo
}
},
analytics: {
view: analyticsView,
click: analyticsClick,
event: analyticsEvent,
load: analyticsTime,
error: analyticsError
},
lang: {
getLanguage: langGetLanguage,
t: langGetTranslation
},
support: {
ticket: supportTicket,
forum: supportForum
},
track: {
visit: trackVisit,
pixel: trackPixel
},
chromestore: {
install: chromestoreInstall
},
log: log,
scrolling: {
enable: scrollingEnable,
disable: scrollingDisable
},
utils: {
setCookie: utilsSetCookie,
getCookie: utilsGetCookie,
addParameter: utilsAddParameter,
getParameter: utilsGetParameter,
forward: utilsForward,
openWindow: utilsOpenWindow,
loadScript: utilsLoadScript,
loadStyle: utilsLoadStyle,
dialogs: {
create: dialogCreate,
showOnce: dialogShowOnce,
showWebView: dialogShowWebView
}
},
languages: {
"en": {
"close": "Close",
"skip": "Skip",
"like": "Like {title} and win awesome gifts on our Facebook page!",
"support": "Support",
"noflash": "In less than a month the game won't be available on web anymore, please select one of the 3 solutions",
"facebookPage": "Facebook page",
"init": "Initializing...",
"paused": "Game paused. Close all chat windows to resume.",
"flashRequired": "The Flash Player plugin is required to play this game. Please click below to enable the Flash Player.",
"adPlaceholder": "Advertisements assist us in the development of {title} so please keep advertising enabled and not use an ad blocker.
Any purchase will, of course, make the game completely advertisement free!",
"adRemove": "Remove Ad",
"offerwall": "Free credits",
"forum": "Forum"
},
"de": {
"close": "Schließen",
"skip": "Überspringen",
"like": "Like {title} und gewinne fantastische Geschenke auf unserer Facebook-Seite!",
"support": "Support",
"facebookPage": "Facebook-Seite",
"init": "Initialisiere…",
"paused": "Spiel pausiert",
"flashRequired": "The Flash Player plugin is required to play this game. Please click below to enable the Flash Player.",
"adPlaceholder": "Advertisements assist us in the development of {title} so please keep advertising enabled and not use an ad blocker.
Any purchase will, of course, make the game completely advertisement free!",
"adRemove": "Remove Ad",
"offerwall": "Free credits",
"forum": "Forum"
},
"fr": {
"close": "Fermer",
"skip": "Passer",
"like": "Aimez {title} et gagnez des cadeaux sur notre page Facebook !",
"support": "Support",
"noflash": "Dans moins d'un mois le jeu ne sera plus disponible sur le web, merci de choisir une des 3 solutions",
"facebookPage": "Page Facebook",
"init": "Initialisation...",
"paused": "Jeu en pause. Fermer toutes les fenêtres de chat pour reprendre.",
"flashRequired": "Le plugin Flash Player est requis pour jouer. Veuillez autoriser le Flash Player en cliquant ci-dessous.",
"adPlaceholder": "Les publicités nous aident dans le développement de {title}, c'est pourquoi nous t'incitons à ne pas les bloquer.
Bien entendu, tout achat retire les publicités de façon permanente !",
"adRemove": "Retirer Pub",
"offerwall": "Credits gratuits",
"forum": "Forum"
},
"ko": {
"close": "닫기",
"skip": "넘어가기",
"like": "{title}의 페이스북 페이지에 '좋아요'를 눌러주세요!",
"support": "고객문의",
"facebookPage": "페이스북 페이지",
"init": "재료 준비중...",
"paused": "대기 중",
"flashRequired": "The Flash Player plugin is required to play this game. Please install the Flash Player to continue.",
"adPlaceholder": "Advertisements assist us in the development of {title} so please keep advertising enabled and not use an ad blocker.
Any purchase will, of course, make the game completely advertisement free!",
"adRemove": "Remove Ad",
"offerwall": "Free credits",
"forum": "Forum"
},
"pt": {
"close": "Fechar",
"skip": "Pular",
"like": "Curta {title} e ganhe presentes incríveis em sua página do Facebook!",
"support": "Ajuda",
"facebookPage": "Página do Facebook",
"init": "Iniciando…",
"paused": "Jogo pausado",
"flashRequired": "The Flash Player plugin is required to play this game. Please install the Flash Player to continue.",
"adPlaceholder": "Advertisements assist us in the development of {title} so please keep advertising enabled and not use an ad blocker.
Any purchase will, of course, make the game completely advertisement free!",
"adRemove": "Remove Ad",
"offerwall": "Free credits",
"forum": "Forum"
},
"es": {
"close": "Cerrar",
"skip": "Omitir",
"like": "¡Pon \"Me gusta\" en {title} y gana increíbles premios en nuestra página en Facebook page!",
"support": "Ayuda",
"facebookPage": "Página en Facebook",
"init": "Inicializando...",
"paused": "Pausa de juego",
"flashRequired": "Se necesita el plugin de Flash Player para jugar este juego. Por favor, instale el Flash Player para continuar.",
"adPlaceholder": "Los avisos nos sirven en el desarrollo de {title}, de modo que rogamos mantener habilitados los avisos y no usar un bloqueador de avisos.
¡Después de la compra, el juego quedará por supuesto completamente liberado de avisos!",
"adRemove": "Eliminar anuncio",
"offerwall": "Free credits",
"forum": "Forum"
}
}
};
// INIT
function init(cfg) {
ex.config = $.extend(true, ex.config, cfg);
ex.config.lang = (ex.lang.getLanguage() in ex.languages ? ex.lang.getLanguage() : "en");
ex.languages = $.extend(true, ex.languages, ex.config.languages);
ex.log("init:", cfg, ex.config);
// Redirect mobile
var ua = navigator.userAgent;
if (ex.config.playstoreId && /Android/.test(ua)) {
document.location.href = "market://details?id=" + ex.config.playstoreId;
return;
}
if (ex.config.appstoreId && /iPhone|iPad|iPod/.test(ua)) {
document.location.href = "https://itunes.apple.com/app/id" + ex.config.appstoreId;
return;
}
// Handle session ?c=
if (ex.config.query == "{query}") {
ex.config.query = window.location.search.substring(1);
if (window.location.hash) {
var hash = window.location.hash.substring(1);
ex.config.query += (ex.config.query.length ? "&" : "") + hash;
window.location.hash = window.location.hash.replace(/(^[\#|\&]?)c\=[^\&]+[\&]?/, "$1"); // remove c=xxxx
}
}
window.fbAsyncInit = function() {
var fbOptions = {
appId: ex.config.fbAppId,
status: true,
cookie: true,
xfbml: true,
frictionlessRequests: true,
hideFlashCallback: ex.facebook.hideFlashCallback
};
if (ex.config.fbVersion) {
fbOptions.version = ex.config.fbVersion;
}
FB.init(fbOptions);
FB.Canvas.setUrlHandler(facebookUrlHandler);
};
window.fbAsyncLoaded = function() {
var isChromium = document.location.href.indexOf("chromium=") >= 0;
var popupUrl = "https://www2.sweetnitro.com/popups/noflash.php?server=" + ex.config.serverId;
if (isChromium) {
popupUrl += "&chromium=1";
}
setTimeout(function() {
ex.utils.dialogs.showWebView(getPortalUrl(popupUrl), 800, 600);
ex.flash.setup();
var styles = "@keyframes MoveUpDown { \n 0%, 100% { \n bottom: 0; \n } \n 50% { \n bottom: 150px; \n } \n}";
var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(searchString, position) {
position = position || 0;
return this.indexOf(searchString, position) === position;
};
}
window.addEventListener('message', function (event) {
if (event.data == 'show-arrow' && event.origin.startsWith('https://www2.sweetnitro.com')) {
$("#dialog_overlay").remove();
window.Arrow=function(window,document){"use strict";function _increaseOpacity(milliseconds){var arrow=document.getElementById("arrow-"+browser);arrow.style.display="block";var i=0,ieI=0,x=setInterval(function(){i+=.1,ieI+=10,"msie"===browser&&8>=browserVersion?arrow.filters&&(arrow.filters.item("DXImageTransform.Microsoft.Alpha").opacity=ieI):arrow.style.opacity=i},50);setTimeout(function(){clearInterval(x)},600),setTimeout(function(){_hide()},milliseconds||6e3)}function _decreaseOpacity(){var arrow=document.getElementById("arrow-"+browser),i=1,ieI=100,x=setInterval(function(){i-=.1,ieI-=10,"msie"===browser&&8>=browserVersion?arrow.filters&&(arrow.filters.item("DXImageTransform.Microsoft.Alpha").opacity=ieI):arrow.style.opacity=i},50);setTimeout(function(){clearInterval(x),arrow.style.display="none"},600)}function _applyStyleModern(node){node.style.position="fixed",node.style.zIndex=999,node.style.display="none",node.style.height="309px",node.style.width="186px",node.style.opacity=0,node.style.animation="MoveUpDown 1s linear infinite",node.style.backgroundImage="url(https://i.imgur.com/aMwoyfN.png)",node.style.backgroundRepeat="no-repeat",node.style.backgroundPositionX="0",node.style.backgroundPositionY="0"}function _applyStyleIE8(node){node.style.top="10px",node.style.left="20px";var opacity="progid:DXImageTransform.Microsoft.Alpha(opacity=0) ",imgSrc='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="https://i.imgur.com/aMwoyfN.png", sizingMethod="scale") ',rotation='progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=1.2246063538223773e-16, M21=-1.2246063538223773e-16, M22=-1, SizingMethod="auto expand") ';node.style.filter=opacity+imgSrc+rotation}function _applyStyleMs(node){node.style.bottom="50px",node.style.left="67%"}function _applyStyleMoz(node){node.style.top="0px",node.style.right="37px",node.style.transform="rotateX(180deg) rotateY(180deg)",node.style.MozTransform="rotateX(180deg) rotateY(180deg)"}function _applyStyleWebkit(node){node.style.bottom="50px",node.style.left="20px"}function _applyStyleSafari(node){node.style.top="0px",node.style.right="80px",node.style.transform="rotateX(180deg) rotateY(180deg)",node.style.webkitTransform="rotateX(180deg) rotateY(180deg)"}function _setStyleType(node){_applyStyleModern(node),"msie"===browser?8===browserVersion?_applyStyleIE8(node):(9===browserVersion||10===browserVersion)&&_applyStyleMs(node):"chrome"===browser||"opera"===browser?_applyStyleWebkit(node):"safari"===browser?_applyStyleSafari(node):"IE11"===browser||"edge"===browser?_applyStyleMs(node):"firefox"===browser&&browserVersion>=20&&_applyStyleMoz(node)}function _buildArrow(){var div=document.createElement("div");return div.setAttribute("id","arrow-"+browser),arrowNode=div,div}function _injectNode(node){document.body.appendChild(node)}function _isExist(){return!!document.getElementById("arrow-"+browser)}function _initArrow(){var arrow=_buildArrow();_setStyleType(arrow),_calculateArrowPosition(),_injectNode(arrow),_addWindowEvent("resize",_calculateArrowPosition),_addWindowEvent("scroll",_calculateArrowPosition)}function _addWindowEvent(event,functionReference){window.addEventListener?window.addEventListener(event,functionReference,!1):window.attachEvent&&window.attachEvent(event,functionReference)}function _calculateArrowPosition(){"number"==typeof window.innerWidth?(visibleWidth=window.innerWidth,visibleHeight=window.innerHeight):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)&&(visibleWidth=document.documentElement.clientWidth,visibleHeight=document.documentElement.clientHeight),"msie"===browser&&9===browserVersion&&(1005>visibleWidth?arrowNode.style.bottom="85px":visibleWidth>1006&&(arrowNode.style.bottom="50px"))}function _hide(){if(!_isExist())throw"Invalid usage: There are no arrows on the page.";_decreaseOpacity()}function show(seconds){if(!_isExist())throw"Invalid usage: arrow does not exist";_increaseOpacity(seconds)}var arrowNode,version="0.1.9",Arrow={},browser="",browserVersion=0,visibleHeight=0,visibleWidth=0;return function(){var tem,N=navigator.appName,ua=navigator.userAgent,M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);M&&null!=(tem=ua.match(/version\/([\.\d]+)/i))&&(M[2]=tem[1]),M=M?[M[1],M[2]]:[N,navigator.appVersion,"-?"],browser="netscape"==M[0].toLowerCase()?"IE11":-1!=ua.toLowerCase().indexOf("edge")?"edge":M[0].toLowerCase(),browserVersion=parseInt(M[1],10)}(),_initArrow(),Arrow._version=version,Arrow._browser=browser,Arrow._browserVersion=browserVersion,Arrow.show=show,Arrow}(window,window.document);
Arrow.show(15000);
}
});
}, 200);
}
window.URLSearchParams = window.URLSearchParams || function (searchString) {
var self = this;
self.searchString = searchString;
self.get = function (name) {
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(self.searchString);
if (results == null) {
return null;
}
else {
return decodeURI(results[1]) || 0;
}
};
}
if (ex.config.fbIsCanvas || ex.config.fbStandalone) {
ex.log("init: with FB login");
facebookInject(function () {
FB.getLoginStatus(function(response) {
if (response.status === "connected") {
window.fbAuthResponse = response.authResponse;
}
if (window.fbAuthResponse || !ex.config.fbIsCanvas) {
//ex.flash.setup();
window.fbAsyncLoaded();
} else {
FB.login(function(response) {
if (response.authResponse) {
window.fbAuthResponse = response.authResponse;
}
window.fbAsyncLoaded();
},
{
scope: ex.config.fbPermissions,
return_scopes: true
}
);
}
});
});
} else if (!ex.config.fbIsCanvas && !ex.config.fbStandalone) {
ex.log("init: without FB login");
//ex.flash.setup();
window.fbAsyncLoaded();
if (ex.config.fbAppId) {
facebookInject();
} else {
ex.log("init: without FB API, no appId");
}
} else {
ex.log("init: error");
}
if (ex.config.kongIsIframe) {
ex.utils.loadScript("https://cdn1.kongregate.com/javascripts/kongregate_api.js", false, false, function () {
log("kongregateAPI: loading", kongregateAPI);
kongregateAPI.loadAPI(function onComplete() {
ex.config.kongInstance = kongregateAPI.getAPI();
log("kongregateAPI: loaded", ex.config.kongInstance);
});
});
}
$(function () {
$("body").addClass("lang-" + ex.config.lang);
if (ex.utils.getParameter(window.location.href, "nostores") !== undefined) {
$("body").addClass("hide-stores");
}
$("#support-button").on("click", function (event) {
event.preventDefault();
ex.support.ticket();
});
$("#forum-button").on("click", function (event) {
event.preventDefault();
ex.support.forum();
});
$("a").on("mousedown", function(event) {
var link = $(this);
var url = link.attr("href");
try {
if (url.match(/^https?:\/\/(www\.)?(sublinet|sweetnitro)\.com\/(support|forum)\/((?![\?&]c=).)*$/)) {
var data = ex.config.flashObject.getSessionData(0);
if (data && data.c) {
link.attr("href", ex.utils.addParameter(url, "c", data.c));
}
}
} catch (e) {}
});
ex.track.visit();
langInject();
});
}
// LOG
function log() {
var args = Array.prototype.slice.call(arguments);
try {
window.console.log.apply(window.console, args);
} catch (error) {}
}
// LANG
function langInject() {
$("*[data-lang]").each(function (index, el) {
var e = $(el);
var key = e.data("lang");
if (key && key.length > 0) {
e.html(ex.lang.t(key));
}
});
}
function langGetTranslation(key, useLang) {
useLang = useLang || ex.config.lang;
try {
var l = ex.languages[useLang][key];
return l.replace("{title}", ex.config.title);
} catch (e) {
if (useLang == "en") {
return "{!" + key + "}";
} else {
return langGetTranslation(key, "en");
}
};
}
function langGetLanguage() {
try {
if (navigator.browserLanguage) {
return navigator.browserLanguage.substring(0, 2);
} else {
return navigator.language.substring(0, 2);
}
} catch (e) {
ex.log("ERROR getLanguage:", e);
return "en";
}
}
// BANNERS
function bannersInsert() {
$(".banner-close").unbind().show().bind("click", function (event) {
event.preventDefault();
var t = $(this);
var p = t.parents(".banner");
p.find(".banner-content").hide().empty();
p.find(".banner-text").fadeIn();
t.css("visibility", "hidden");
});
if (ex.config.onInsertBanners) {
ex.config.onInsertBanners();
}
}
function bannersRemove() {
$(".banner-content").empty();
$(".banner").hide();
}
// avoid flash issues
function bannersShowFlash() {
$(".banner-inner").show();
}
function bannersHideFlash() {
$(".banner-inner").hide();
}
// OFFERWALL
function offerwallTrialPayShow(serverId, memberId) {
try {
TRIALPAY.fb.show_overlay(
ex.config.fbAppId,
"fbdirect",
{
tp_vendor_id: ex.config.trialPayVendorId,
callback_url: "https://www.sweetnitro.com/en/payment2/return/callback.php?p=offers_trialpay",
currency_url: ex.config.trialPayCurrencyUrl,
sid: serverId + "-" + memberId,
onOpen: "ex.flash.hide",
onClose: "ex.flash.show",
onTransact: "ex.offerwall.trialPay.onTransaction",
zIndex: 1000
}
);
} catch (e) {
ex.log("offerwallTrialPayShow: failed", e);
}
}
function offerwallTrialPayOnTransaction(response) {
ex.log("offerwallTrialPayOnTransaction:", response);
try {
ex.config.flashObject.offerwallTransactionCallback(response);
} catch (e) {
ex.log("offerwallTrialPayOnTransaction: failed", e);
}
}
// VIDEOS
// FYBER
var fyberVideo = null;
function fyberGetVideos(userId, claimText) {
var options = {
appid: ex.config.fyberAppId,
width: ex.config.fyberWidth,
height: ex.config.fyberHeight,
uid: userId,
display_format: "bare_player",
callback_on_start: function (offer) {
ex.log("fyberGetVideo: start", offer);
try {
ex.config.flashObject.videosFyberSearchCallback(true);
} catch (e) {
ex.log("fyberGetVideo: start failed", e);
}
},
callback_no_offers: function () {
ex.log("fyberGetVideo: no offers");
try {
ex.config.flashObject.videosFyberSearchCallback(false);
} catch (e) {
ex.log("fyberGetVideo: no offers failed", e);
}
},
callback_on_close: function () {
ex.log("fyberGetVideo: closed");
ex.flash.show();
},
callback_on_conversion: function () {
ex.log("fyberGetVideo: conversion");
try {
ex.config.flashObject.videosFyberCompletedCallback();
} catch (e) {
ex.log("fyberGetVideo: conversion failed", e);
}
}
};
if (claimText) {
options.text_claim_button = claimText;
}
fyberVideo = new SPONSORPAY.Video.Iframe(options);
fyberVideo.backgroundLoad();
}
function fyberShowVideo() {
if (fyberVideo) {
ex.flash.hide();
fyberVideo.showVideo();
}
}
// AFFIZ
var affizVideo = null;
function affizGetVideos(userId, claimText) {
var options = {
site_id: ex.config.affizAppId,
clientid: userId,
modal: true,
load_callback: function () {
ex.log("affizGetVideos: load");
try {
ex.config.flashObject.videosAffizSearchCallback(true);
} catch (e) {
ex.log("affizGetVideos: load failed", e);
}
},
noads_callback: function () {
ex.log("affizGetVideos: no offers");
try {
ex.config.flashObject.videosAffizSearchCallback(false);
} catch (e) {
ex.log("affizGetVideos: no offers failed", e);
}
},
close_callback: function () {
ex.log("affizGetVideos: closed");
ex.flash.show();
},
complete_callback: function () {
ex.log("affizGetVideos: complete");
try {
ex.flash.show();
ex.config.flashObject.videosAffizCompletedCallback();
} catch (e) {
ex.log("affizGetVideos: complete failed", e);
}
}
};
if (claimText) {
options.text_claim_btn = claimText;
}
AFFIZVIDEO.init(options);
}
function affizShowVideo() {
if (AFFIZVIDEO && AFFIZVIDEO.show) {
ex.flash.hide();
AFFIZVIDEO.show();
}
}
// WOOBI
function woobiGetVideos(userId) {
try {
tokenads.config.appId = ex.config.woobiAppId;
tokenads.config.clientId = userId;
if (ex.config.woobiColorSide) {
tokenads.settings.view.colorTheme = ex.config.woobiColorSide;
}
if (ex.config.woobiColorBack) {
tokenads.settings.view.backColor = ex.config.woobiColorBack;
}
tokenads.config.listener.onClose = function () {
ex.log("woobiGetVideos: onClose");
ex.flash.show();
};
tokenads.config.listener.onCredit = function (credits) {
ex.log("woobiGetVideos: onCredit", credits);
try {
ex.config.flashObject.videosWoobiCompletedCallback();
} catch (e) {
ex.log("woobiGetVideos: onCredit failed", e);
}
};
tokenads.config.listener.onError = function (error) {
ex.log("woobiGetVideos: onError", error);
try {
ex.config.flashObject.videosWoobiSearchCallback(false);
} catch (e) {
ex.log("woobiGetVideos: onError callback failed", e);
}
};
tokenads.checkInventory(function (nbOffers) {
ex.log("woobiGetVideos: checkInventory", nbOffers);
try {
nbOffers = nbOffers || 0;
ex.config.flashObject.videosWoobiSearchCallback(nbOffers > 0);
} catch (e) {
ex.log("woobiGetVideos: checkInventory callback failed", e);
}
});
} catch (e) {
ex.log("woobiGetVideos: failed", e);
}
}
function woobiShowVideo() {
try {
ex.flash.hide();
tokenads.showPlayer();
} catch (e) {
ex.log("woobiShowVideo: failed", e);
}
}
// ANALYTICS
function analytics() {
var args = Array.prototype.slice.call(arguments);
try {
window.ga.apply(window, args);
} catch (error) {
ex.log("ERROR analytics:", error, "arguments:", args);
}
}
function analyticsTrigger(fnName) {
if (ex.config[fnName]) {
try {
var source = ex.utils.getCookie("source");
ex.config[fnName](source);
} catch (e) {
ex.log("ERROR: analyticsTrigger:", fnName, e);
}
}
}
function analyticsView(name) {
analytics("send", "pageview", name);
}
function analyticsEvent(category, action, label, value) {
if (category == "install" && action == "install") {
analyticsTrigger("onInstall");
}
if (category == "conversion" && action == "NAU") {
analyticsTrigger("onNAU");
}
if (category == "conversion" && action == "Registration") {
analyticsTrigger("onRegistration");
}
if (category == "conversion" && action == "NAPU") {
analyticsTrigger("onNAPU");
}
analytics("send", "event", category, action, label, value);
}
function analyticsClick(action, label, value) {
analytics("send", "event", "click", action, label, value);
}
function analyticsTime(category, action, label, value) {
analytics("send", "timing", category, action, value, label); // value & label inverted in web api
}
function analyticsError(fatal, description) {
analytics("send", "event", "exception", description, "fatal", fatal ? 1 : 0); // no exception
}
// SUPPORT
function supportTicket() {
var dump;
try {
dump = ex.config.flashObject.getSessionData();
} catch (e) {
ex.log("goToSupport: dump failed", e);
dump = {
logs: "Dump failed.."
};
}
var form = $('