Skip to content

Instantly share code, notes, and snippets.

@gregjw
Last active March 5, 2020 15:19
Show Gist options
  • Save gregjw/9c097b7e0f60179dbf179883ff53c10b to your computer and use it in GitHub Desktop.
Save gregjw/9c097b7e0f60179dbf179883ff53c10b to your computer and use it in GitHub Desktop.
pollfish
var PollfishHelper = function (e, i) {
var t = function (e, t) {
var r = new Date;
r.setTime(r.getTime() + 15768e7);
var o = "expires=" + r.toUTCString();
i.cookie = e + "=" + t + "; " + o
},
r = function (e) {
for (var t = e + "=", r = i.cookie.split(";"), o = 0; o < r.length; o++) {
for (var n = r[o];
" " === n.charAt(0);) n = n.substring(1);
if (0 === n.indexOf(t)) return n.substring(t.length, n.length)
}
return ""
},
o = function () {
var e = "Pxxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) {
var i = 16 * Math.random() | 0,
t = "x" === e ? i : 3 & i | 8;
return t.toString(16)
});
return PollfishHelper.setCookie("uuid", e), e
},
n = function (e) {
return e.indexOf("Chrome") > -1 ? "Chrome" : e.indexOf("Safari") > -1 ? "Safari" : e.indexOf("Opera") > -1 ? "Opera" : e.indexOf("Firefox") > -1 ? "Firefox" : e.indexOf("MSIE") > -1 ? "Internet Explorer" : void 0
},
a = function () {
var e = i.createElement("style");
return e.appendChild(i.createTextNode("")), i.head.appendChild(e), e.sheet
}();
return {
styleSheet: a,
setCookie: t,
getCookie: r,
generateUUID: o,
detectBrowser: n
}
}(window, document);
jQuery.fn.on || (jQuery.fn.on = function (e, i, t, r) {
var o = this,
n = arguments.length;
return n > 3 ? o.delegate(i, e, t, r) : n > 2 ? "string" == typeof i ? o.delegate(i, e, t) : o.bind(e, i, t) : o.bind(e, i)
});
var Pollfish = function (e, i, t, r) {
var o = {
api_key: "",
indicator_position: "BOTTOM_RIGHT",
debug: !1,
survey_format: void 0,
offerwall: !1,
id: ""
},
n = !1,
a = !1,
l = {},
s = location.search.split("isDev=")[1] ? "https://staging.pollfish.com" : "https://wss.pollfish.com",
u = s + "/v2/device/register/true",
d = {},
c = "https://epicsgg.s3-eu-west-1.amazonaws.com/assets/icons/earn-coins.png";
return surveyCompleted = !1, initMarkup = function () {
var i = t("<div>", {
id: "pollfishIndicator"
});
d.indicator = i, i.css({
cursor: "pointer",
zIndex: "99999",
display: "none"
}), t("body").append('<img style="display:none;" id="pollfish-analytics" src="https://bcp.crwdcntrl.net/map/c=6081/tp=POLF/tpid=' + r.getCookie("uuid") + '" />');
var n = {
src: c,
width: 50,
height: "auto"
};
if (t("body").append(i), "BOTTOM_RIGHT" === o.indicator_position) {
var a = t("<img />", n);
i.css({
position: "fixed",
bottom: 0,
right: 100
})
} else if ("BOTTOM_LEFT" === o.indicator_position) {
var a = t("<img />", n);
i.css({
position: "fixed",
bottom: 20,
left: 100
})
} else if ("TOP_LEFT" === o.indicator_position) {
var a = t("<img />", n);
i.css({
position: "fixed",
top: 40,
left: 100
})
} else {
var a = t("<img />", n);
i.css({
position: "fixed",
top: 40,
right: 100
})
}
d.indicatorImage = a, a.on("load", function () {
i.append(a)
});
var l = t("<div>", {
id: "pollfishSurveyContainer"
}),
s = "100%";
e.innerHeight > 700 && (s = "700px"), t(e).on("orientationchange", function () {
animateHideDiv(d.indicator, 50), animateHideDiv(d.surveyContainer, 50)
}), /Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e.navigator.userAgent) ? (r.styleSheet.addRule(".pf-is-fixed", "position: fixed"), l.css({
width: "100%",
height: e.innerHeight,
maxWidth: "400px",
maxHeight: s,
position: "fixed",
bottom: "0",
display: "none",
zIndex: "99998",
"overflow-y": "auto",
"-webkit-overflow-scrolling": "touch"
})) : l.css({
width: "90%",
height: "90%",
maxWidth: "400px",
maxHeight: s,
position: "fixed",
bottom: "5%",
display: "none",
zIndex: "99998"
}), d.surveyContainer = l, t("body").append(l);
var u = t("<div>", {
id: "pollfishOverlay"
});
u.css({
position: "fixed",
width: "100%",
height: "100%",
display: "none",
background: "rgba(50,50,50,0.5)",
zIndex: "99997",
top: 0,
left: 0
}), d.overlay = u, t("body").append(u);
var p = t("<iframe />", {
id: "pollfishSurveyFrame",
width: "100%",
height: "100%",
frameBorder: 0,
seamless: "seamless"
});
p.css({
overflow: "hidden"
}), d.iframe = p, d.surveyContainer.append(p), "BOTTOM_RIGHT" === o.indicator_position || "TOP_RIGHT" === o.indicator_position ? l.css({
right: 100, bottom: 0
}) : l.css({
left: 100
}), registerClickEvents(), requestSurvey()
}, animateShowDiv = function (e, i) {
i = void 0 === i ? 280 : i, e.css("display", "block"), "BOTTOM_RIGHT" === o.indicator_position || "TOP_RIGHT" === o.indicator_position ? e.animate({
right: 100, bottom: 0
}, 280) : "BOTTOM_LEFT" !== o.indicator_position && "TOP_LEFT" !== o.indicator_position || e.animate({
left: 0
}, 280)
}, animateHideDiv = function (e, i) {
i = void 0 === i ? 280 : i, d.overlay.css("display", "none"), "BOTTOM_RIGHT" === o.indicator_position || "TOP_RIGHT" === o.indicator_position ? e.animate({
right: -e.width()
}, 280) : "BOTTOM_LEFT" !== o.indicator_position && "TOP_LEFT" !== o.indicator_position || e.animate({
left: -e.width()
}, 280)
}, registerClickEvents = function () {
d.indicator.on("click", function () {
animateHideDiv(d.indicator, 50), animateShowDiv(d.surveyContainer), d.overlay.css("display", "block"), t("body").addClass("pf-is-fixed"), sendSurveySeenEvent()
}), d.overlay.on("click", function () {
animateHideDiv(d.surveyContainer, 50), surveyCompleted || "isReady" in o || (animateShowDiv(d.indicator), showIndicator()), "closeCallback" in o && o.closeCallback()
})
}, requestSurvey = function () {
var i = t("<div>", {
id: "pollfishGetDpi"
});
i.css({
position: "absolute",
visibility: "hidden",
width: "1in",
padding: 0
}), t("body").append(i);
var r = i.outerWidth(),
n = Math.sqrt(Math.pow(e.outerWidth / r, 2) + Math.pow(e.outerHeight / r, 2));
t("#pollfishGetDpi").remove();
var a = "",
l = -1,
s = Pollfish.platform.ua.split(")")[0].split("(")[1].split(";");
a = s[s.length - 1].trim().split("Build")[0], l = "Android" === Pollfish.platform.os.family ? 0 : "iOS" === Pollfish.platform.os.family ? 1 : "Windows Phone" === Pollfish.platform.os.family ? 2 : 3, 1 !== l && 3 !== l || (a = "UNKNOWN");
var c = "connection" in e.navigator ? e.navigator.connection.type : "UNKNOWN",
p = {
api_key: o.api_key,
debug: o.debug.toString(),
offerwall: o.offerwall.toString(),
device_id: o.id,
timestamp: Date.now() ? Date.now().toString() : "",
encryption: "NONE",
version: "9",
device_descr: a,
os: l.toString(),
os_ver: Pollfish.platform.os.version ? Pollfish.platform.os.version.toString() : "",
scr_h: e.outerHeight ? e.outerHeight.toString() : "",
src_w: e.outerWidth ? e.outerWidth.toString() : "",
scr_size: n ? n.toString() : "",
manufacturer: Pollfish.platform.manufacturer ? Pollfish.platform.manufacturer : "UNKNOWN",
locale: e.navigator.languages ? e.navigator.languages.join() : "",
request_uuid: o.uuid ? o.uuid.toString() : "",
hardware_accelerated: "false",
video: "true",
always_return_content: !0
};
o.user && (p.gender = o.user.gender, p.year_of_birth = o.user.year_of_birth, p.marital_status = o.user.marital_status, p.parental = o.user.parental, p.education = o.user.education, p.employment = o.user.employment, p.career = o.user.career, p.race = o.user.race, p.income = o.user.income), void 0 !== o.survey_format && (p.survey_format = o.survey_format), o.reward_name && (p.reward_name = o.reward_name.toString()), o.reward_conversion && (p.reward_conversion = o.reward_conversion.toString()), "UNKNOWN" !== c && (p.con_type = c);
var f = JSON.stringify(p),
b = d.surveyContainer.css("width"),
v = u + "?json=" + encodeURIComponent(f) + "&dontencrypt=true&webplugin=true&iframewidth=" + encodeURIComponent(b) + "&position=" + o.indicator_position;
d.iframe.attr("src", v)
}, createRequestObject = function (e) {
var i = e;
i.api_key = o.api_key, i.device_id = o.id;
const t = new Date;
return i.timestamp = t.getTime().toString(), i.encryption = "NONE", i.version = "9", i.app_api_key = o.app_api_key, i.always_return_content = o.always_return_content, i.request_uuid = o.uuid ? o.uuid.toString() : "", i.debug = o.debug.toString(), i.offerwall = o.debug.toString(), i
}, sendSurveySeenEvent = function () {
var e = o && o.survey_id || !1;
if (e && (e = "" + e, !l[e])) {
l[e] = !0;
var i = createRequestObject({
s_id: e
}),
r = "json=" + JSON.stringify(i) + "&dontencrypt=true&hash=false";
t.ajax({
url: s + "/v2/device/set/survey/viewed",
type: "POST",
crossDomain: !0,
data: r
})
}
}, surveyNotAvailable = function () {
"surveyNotAvailable" in o && o.surveyNotAvailable()
}, showIndicator = function () {
const e = n && o.offerwall,
i = o.always_return_content,
r = n && a,
l = e || r || !r && i;
return !!l && (animateShowDiv(d.indicator), t("body").removeClass("pf-is-fixed"), !0)
}, initPostMessages = function () {
o.surveyInfo = null, e.onmessage = function (e) {
if ("webViewLoaded" === e.data) n = !0, "isReady" in o ? o.isReady() : showIndicator(), o.survey_id = o.surveyInfo && o.surveyInfo.s_id, o.survey_id && "surveyAvailable" in o && o.surveyAvailable({
revenue: o.surveyInfo.revenue,
playful: o.surveyInfo.playful,
survey_loi: o.surveyInfo.survey_loi,
survey_ir: o.surveyInfo.survey_ir,
survey_class: o.surveyInfo.survey_class
});
else if ("close" === e.data) d.overlay.trigger("click"), surveyCompleted || "isReady" in o || showIndicator();
else if ("userNotEligible" === e.data) "userNotEligibleCallback" in o && o.userNotEligibleCallback();
else if ("noSurveyFound" === e.data) {
noSurveyFound = !0;
var i = o.offerwall,
t = i && o.always_return_content;
i && (n = !0), t && ("isReady" in o ? o.isReady() : showIndicator()), "surveyNotAvailable" in o && o.surveyNotAvailable()
} else if ("closeAndNoShow" === e.data) animateHideDiv(d.surveyContainer, 50), "closeAndNoShowCallback" in o && o.closeAndNoShowCallback();
else if ("setSurveyCompleted" === e.data) updateSurveyAndClose(), "surveyCompletedCallback" in o && o.surveyCompletedCallback();
else if ("userRejectedSurvey" === e.data) "userRejectedSurvey" in o && o.userRejectedSurvey();
else if (e && e.data && e.data.indexOf)
if (e.data.indexOf("surveyInfo") > -1) {
var r = JSON.parse(e.data);
"surveyInfo" === r.type && (a = !0, o.surveyInfo = {
survey_loi: r.survey_loi,
survey_ir: r.survey_ir,
survey_class: r.survey_class,
revenue: r.revenue,
playful: r.playful,
s_id: r.s_id
})
} else if (e.data.indexOf("setSurveyCompleted") > -1) {
var r = JSON.parse(e.data);
"setSurveyCompleted" === r.type && o.surveyCompletedCallback && o.surveyCompletedCallback({
survey_price: r.survey_price,
reward_name: r.reward_name,
reward_value: r.reward_value,
survey_class: r.survey_class,
survey_loi: r.survey_loi,
survey_ir: r.survey_ir
})
}
}
}, updateSurveyAndClose = function () {
t("body").removeClass("pf-is-fixed"), surveyCompleted = !0
}, showFullSurvey = function () {
return !n && o.always_return_content ? (animateHideDiv(d.indicator, 50), animateShowDiv(d.surveyContainer), d.overlay.css("display", "block"), !0) : !!n && (sendSurveySeenEvent(), animateHideDiv(d.indicator, 50), animateShowDiv(d.surveyContainer), d.overlay.css("display", "block"), !0)
}, hide = function () {
animateHideDiv(d.indicator, 50), animateHideDiv(d.surveyContainer, 50)
}, start = function (i) {
if (!e.jQuery) return void initError("NO_JQUERY");
var t = jQuery.fn.jquery.split("."),
n = parseInt(t[0]) >= 2 || parseInt(t[0]) >= 1 && parseInt(t[1]) >= 4;
if (!n) return void initError("NO_JQUERY_VERSION");
if (void 0 === i) return void initError("NO_CONFIG");
if (!("api_key" in i)) return void initError("NO_API_KEY");
if (o.api_key = i.api_key, "indicator_position" in i ? o.indicator_position = i.indicator_position : o.indicator_position = "BOTTOM_RIGHT", "debug" in i ? o.debug = i.debug : o.debug = !1, "offerwall" in i ? o.offerwall = i.offerwall : o.offerwall = !1, "survey_format" in i ? o.survey_format = i.survey_format : o.survey_format = "-1", "alwaysReturnContent" in i ? o.always_return_content = i.alwaysReturnContent : o.always_return_content = !1, "rewardName" in i ? o.reward_name = i.rewardName : o.reward_name = !1, "rewardConversion" in i ? o.reward_conversion = i.rewardConversion : o.reward_conversion = !1, "uuid" in i ? o.uuid = i.uuid : o.uuid = "", "closeCallback" in i && (o.closeCallback = i.closeCallback), "userNotEligibleCallback" in i && (o.userNotEligibleCallback = i.userNotEligibleCallback), "surveyCompletedCallback" in i && (o.surveyCompletedCallback = i.surveyCompletedCallback), "closeAndNoShowCallback" in i && (o.closeAndNoShowCallback = i.closeAndNoShowCallback), "userRejectedSurvey" in i && (o.userRejectedSurvey = i.userRejectedSurvey), "surveyAvailable" in i && (o.surveyAvailable = i.surveyAvailable), "noSurveyFoundCallback" in i && (o.noSurveyFoundCallback = i.noSurveyFoundCallback), "ready" in i && (o.isReady = i.ready), "surveyNotAvailable" in i && (o.surveyNotAvailable = i.surveyNotAvailable), "user" in i) {
for (var a = i.user, l = ["gender", "year_of_birth", "marital_status", "parental", "education", "employment", "career", "race", "income"], s = [], u = 0; u < l.length; u++) {
var d = l[u],
c = a[d],
p = void 0 === c;
p || isFinite(c) || s.push(d)
}
if (s.length > 0) return void initError("DEMOGRAPHICS: FIELDS NEED TO BE NUMBERS - " + JSON.stringify(s));
o.user = a
}
o.id = r.getCookie("uuid").length > 0 ? r.getCookie("uuid") : r.generateUUID(), initPollfish()
}, initError = function (e) {
throw new Error(e)
}, initPollfish = function () {
initMarkup(), initPostMessages()
}, {
start: start,
showFullSurvey: showFullSurvey,
showIndicator: showIndicator,
hide: hide
}
}(window, document, jQuery, PollfishHelper);
"function" != typeof String.prototype.trim && (String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, "")
}),
function () {
"use strict";
function e(e) {
return e = String(e), e.charAt(0).toUpperCase() + e.slice(1)
}
function i(e, i, t) {
var o = {
6.4: "10",
6.3: "8.1",
6.2: "8",
6.1: "Server 2008 R2 / 7",
"6.0": "Server 2008 / Vista",
5.2: "Server 2003 / XP 64-bit",
5.1: "XP",
5.01: "2000 SP1",
"5.0": "2000",
"4.0": "NT",
"4.90": "ME"
};
return i && t && /^Win/i.test(e) && (o = o[/[\d.]+$/.exec(e)]) && (e = "Windows " + o), e = String(e), i && t && (e = e.replace(RegExp(i, "i"), t)), e = r(e.replace(/ ce$/i, " CE").replace(/\bhpw/i, "web").replace(/\bMacintosh\b/, "Mac OS").replace(/_PowerPC\b/i, " OS").replace(/\b(OS X) [^ \d]+/i, "$1").replace(/\bMac (OS X)\b/, "$1").replace(/\/(\d)/, " $1").replace(/_/g, ".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, "").replace(/\bx86\.64\b/gi, "x86_64").replace(/\b(Windows Phone) OS\b/, "$1").split(" on ")[0])
}
function t(e, i) {
var t = -1,
r = e ? e.length : 0;
if ("number" == typeof r && r > -1 && r <= h)
for (; ++t < r;) i(e[t], t, e);
else o(e, i)
}
function r(i) {
return i = u(i), /^(?:webOS|i(?:OS|P))/.test(i) ? i : e(i)
}
function o(e, i) {
for (var t in e) x.call(e, t) && i(e[t], t, e)
}
function n(i) {
return null == i ? e(i) : w.call(i).slice(8, -1)
}
function a(e, i) {
var t = null != e ? typeof e[i] : "number";
return !(/^(?:boolean|number|string|undefined)$/.test(t) || "object" == t && !e[i])
}
function l(e) {
return String(e).replace(/([ -])(?!$)/g, "$1?")
}
function s(e, i) {
var r = null;
return t(e, function (t, o) {
r = i(r, t, o, e)
}), r
}
function u(e) {
return String(e).replace(/^ +| +$/g, "")
}
function d(e) {
function t(i) {
return s(i, function (i, t) {
return i || RegExp("\\b" + (t.pattern || l(t)) + "\\b", "i").exec(e) && (t.label || t)
})
}
function c(i) {
return s(i, function (i, t, r) {
return i || (t[J] || t[/^[a-z]+(?: +[a-z]+\b)*/i.exec(J)] || RegExp("\\b" + l(r) + "(?:\\b|\\w*\\d)", "i").exec(e)) && r
})
}
function b(i) {
return s(i, function (i, t) {
return i || RegExp("\\b" + (t.pattern || l(t)) + "\\b", "i").exec(e) && (t.label || t)
})
}
function v(t) {
return s(t, function (t, r) {
var o = r.pattern || l(r);
return !t && (t = RegExp("\\b" + o + "(?:/[\\d.]+|[ \\w.]*)", "i").exec(e)) && (t = i(t, o, r.label || r)), t
})
}
function y(i) {
return s(i, function (i, t) {
var o = t.pattern || l(t);
return !i && (i = RegExp("\\b" + o + " *\\d+[.\\w_]*", "i").exec(e) || RegExp("\\b" + o + "(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)", "i").exec(e)) && ((i = String(t.label && !RegExp(o, "i").test(t.label) ? t.label : i).split("/"))[1] && !/[\d.]+/.test(i[0]) && (i[0] += " " + i[1]), t = t.label || t, i = r(i[0].replace(RegExp(o, "i"), t).replace(RegExp("; *(?:" + t + "[_-])?", "i"), " ").replace(RegExp("(" + t + ")[-_.]?(\\w)", "i"), "$1 $2"))), i
})
}
function h(i) {
return s(i, function (i, t) {
return i || (RegExp(t + "(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)", "i").exec(e) || 0)[1] || null
})
}
function S() {
return this.description || ""
}
var x = p,
_ = e && "object" == typeof e && "String" != n(e);
_ && (x = e, e = null);
var O = x.navigator || {},
C = O.userAgent || "";
e || (e = C);
var P, k, E = _ || g == f,
I = _ ? !!O.likeChrome : /\bChrome\b/.test(e) && !/internal|\n/i.test(w.toString()),
M = "Object",
T = _ ? M : "ScriptBridgingProxyObject",
N = _ ? M : "Environment",
R = _ && x.java ? "JavaPackage" : n(x.java),
A = _ ? M : "RuntimeObject",
B = /\bJava/.test(R) && x.java,
W = B && n(x.environment) == N,
F = B ? "a" : "α",
j = B ? "b" : "β",
H = x.document || {},
D = x.operamini || x.opera,
G = m.test(G = _ && D ? D["[[Class]]"] : n(D)) ? G : D = null,
$ = e,
K = [],
U = null,
X = e == C,
L = X && D && "function" == typeof D.version && D.version(),
z = t(["Trident", {
label: "WebKit",
pattern: "AppleWebKit"
}, "iCab", "Presto", "NetFront", "Tasman", "KHTML", "Gecko"]),
q = b(["Adobe AIR", "Arora", "Avant Browser", "Breach", "Camino", "Epiphany", "Fennec", "Flock", "Galeon", "GreenBrowser", "iCab", "Iceweasel", {
label: "SRWare Iron",
pattern: "Iron"
}, "K-Meleon", "Konqueror", "Lunascape", "Maxthon", "Midori", "Nook Browser", "PhantomJS", "Raven", "Rekonq", "RockMelt", "SeaMonkey", {
label: "Silk",
pattern: "(?:Cloud9|Silk-Accelerated)"
}, "Sleipnir", "SlimBrowser", "Sunrise", "Swiftfox", "WebPositive", "Opera Mini", {
label: "Opera Mini",
pattern: "OPiOS"
}, "Opera", {
label: "Opera",
pattern: "OPR"
}, "Chrome", {
label: "Chrome Mobile",
pattern: "(?:CriOS|CrMo)"
}, {
label: "Firefox",
pattern: "(?:Firefox|Minefield)"
}, {
label: "IE",
pattern: "IEMobile"
}, {
label: "IE",
pattern: "MSIE"
}, "Safari"]),
J = y([{
label: "BlackBerry",
pattern: "BB10"
}, "BlackBerry", {
label: "Galaxy S",
pattern: "GT-I9000"
}, {
label: "Galaxy S2",
pattern: "GT-I9100"
}, {
label: "Galaxy S3",
pattern: "GT-I9300"
}, {
label: "Galaxy S4",
pattern: "GT-I9500"
}, "Google TV", "Lumia", "iPad", "iPod", "iPhone", "Kindle", {
label: "Kindle Fire",
pattern: "(?:Cloud9|Silk-Accelerated)"
}, "Nook", "PlayBook", "PlayStation 4", "PlayStation 3", "PlayStation Vita", "TouchPad", "Transformer", {
label: "Wii U",
pattern: "WiiU"
}, "Wii", "Xbox One", {
label: "Xbox 360",
pattern: "Xbox"
}, "Xoom"]),
V = c({
Apple: {
iPad: 1,
iPhone: 1,
iPod: 1
},
Amazon: {
Kindle: 1,
"Kindle Fire": 1
},
Asus: {
Transformer: 1
},
"Barnes & Noble": {
Nook: 1
},
BlackBerry: {
PlayBook: 1
},
Google: {
"Google TV": 1
},
HP: {
TouchPad: 1
},
HTC: {},
LG: {},
Microsoft: {
Xbox: 1,
"Xbox One": 1
},
Motorola: {
Xoom: 1
},
Nintendo: {
"Wii U": 1,
Wii: 1
},
Nokia: {
Lumia: 1
},
Samsung: {
"Galaxy S": 1,
"Galaxy S2": 1,
"Galaxy S3": 1,
"Galaxy S4": 1
},
Sony: {
"PlayStation 4": 1,
"PlayStation 3": 1,
"PlayStation Vita": 1
}
}),
Q = v(["Windows Phone ", "Android", "CentOS", "Debian", "Fedora", "FreeBSD", "Gentoo", "Haiku", "Kubuntu", "Linux Mint", "Red Hat", "SuSE", "Ubuntu", "Xubuntu", "Cygwin", "Symbian OS", "hpwOS", "webOS ", "webOS", "Tablet OS", "Linux", "Mac OS X", "Macintosh", "Mac", "Windows 98;", "Windows "]);
if (z && (z = [z]), V && !J && (J = y([V])), (P = /\bGoogle TV\b/.exec(J)) && (J = P[0]), /\bSimulator\b/i.test(e) && (J = (J ? J + " " : "") + "Simulator"), "Opera Mini" == q && /\bOPiOS\b/.test(e) && K.push("running in Turbo/Uncompressed mode"), /^iP/.test(J) ? (q || (q = "Safari"), Q = "iOS" + ((P = / OS ([\d_]+)/i.exec(e)) ? " " + P[1].replace(/_/g, ".") : "")) : "Konqueror" != q || /buntu/i.test(Q) ? V && "Google" != V && (/Chrome/.test(q) && !/\bMobile Safari\b/i.test(e) || /\bVita\b/.test(J)) ? (q = "Android Browser", Q = /\bAndroid\b/.test(Q) ? Q : "Android") : q && !(P = !/\bMinefield\b|\(Android;/i.test(e) && /\b(?:Firefox|Safari)\b/.exec(q)) || (q && !J && /[\/,]|^[^(]+?\)/.test(e.slice(e.indexOf(P + "/") + 8)) && (q = null), (P = J || V || Q) && (J || V || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(Q)) && (q = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(Q) ? Q : P) + " Browser")) : Q = "Kubuntu", (P = /\((Mobile|Tablet).*?Firefox\b/i.exec(e)) && P[1] && (Q = "Firefox OS", J || (J = P[1])), L || (L = h(["(?:Cloud9|CriOS|CrMo|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|Silk(?!/[\\d.]+$))", "Version", l(q), "(?:Firefox|Minefield|NetFront)"])), "iCab" == z && parseFloat(L) > 3 ? z = ["WebKit"] : "Trident" != z && (P = /\bOpera\b/.test(q) && (/\bOPR\b/.test(e) ? "Blink" : "Presto") || /\b(?:Midori|Nook|Safari)\b/i.test(e) && "WebKit" || !z && /\bMSIE\b/i.test(e) && ("Mac OS" == Q ? "Tasman" : "Trident")) ? z = [P] : /\bPlayStation\b(?! Vita\b)/i.test(q) && "WebKit" == z && (z = ["NetFront"]), "IE" == q && (P = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(e) || 0)[1]) ? (q += " Mobile", Q = "Windows Phone " + (/\+$/.test(P) ? P : P + ".x"), K.unshift("desktop mode")) : /\bWPDesktop\b/i.test(e) ? (q = "IE Mobile", Q = "Windows Phone 8+", K.unshift("desktop mode"), L || (L = (/\brv:([\d.]+)/.exec(e) || 0)[1])) : "IE" != q && "Trident" == z && (P = /\brv:([\d.]+)/.exec(e)) ? (/\bWPDesktop\b/i.test(e) || (q && K.push("identifying as " + q + (L ? " " + L : "")), q = "IE"), L = P[1]) : "Chrome" != q && "IE" == q || !(P = /\bEdge\/([\d.]+)/.exec(e)) || (q = "IE", L = P[1], z = ["Trident"], K.unshift("platform preview")), X) {
if (a(x, "global"))
if (B && (P = B.lang.System, $ = P.getProperty("os.arch"), Q = Q || P.getProperty("os.name") + " " + P.getProperty("os.version")), E && a(x, "system") && (P = [x.system])[0]) {
Q || (Q = P[0].os || null);
try {
P[1] = x.require("ringo/engine").version, L = P[1].join("."), q = "RingoJS"
} catch (Y) {
P[0].global.system == x.system && (q = "Narwhal")
}
} else "object" == typeof x.process && (P = x.process) ? (q = "Node.js", $ = P.arch, Q = P.platform, L = /[\d.]+/.exec(P.version)[0]) : W && (q = "Rhino");
else n(P = x.runtime) == T ? (q = "Adobe AIR", Q = P.flash.system.Capabilities.os) : n(P = x.phantom) == A ? (q = "PhantomJS", L = (P = P.version || null) && P.major + "." + P.minor + "." + P.patch) : "number" == typeof H.documentMode && (P = /\bTrident\/(\d+)/i.exec(e)) && (L = [L, H.documentMode], (P = +P[1] + 4) != L[1] && (K.push("IE " + L[1] + " mode"), z && (z[1] = ""), L[1] = P), L = "IE" == q ? String(L[1].toFixed(1)) : L[0]);
Q = Q && r(Q)
}
return L && (P = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(L) || /(?:alpha|beta)(?: ?\d)?/i.exec(e + ";" + (X && O.appMinorVersion)) || /\bMinefield\b/i.test(e) && "a") && (U = /b/i.test(P) ? "beta" : "alpha", L = L.replace(RegExp(P + "\\+?$"), "") + ("beta" == U ? j : F) + (/\d+\+?/.exec(P) || "")), "Fennec" == q || "Firefox" == q && /\b(?:Android|Firefox OS)\b/.test(Q) ? q = "Firefox Mobile" : "Maxthon" == q && L ? L = L.replace(/\.[\d.]+/, ".x") : "Silk" == q ? (/\bMobi/i.test(e) || (Q = "Android", K.unshift("desktop mode")), /Accelerated *= *true/i.test(e) && K.unshift("accelerated")) : /\bXbox\b/i.test(J) ? (Q = null, "Xbox 360" == J && /\bIEMobile\b/.test(e) && K.unshift("mobile mode")) : !/^(?:Chrome|IE|Opera)$/.test(q) && (!q || J || /Browser|Mobi/.test(q)) || "Windows CE" != Q && !/Mobi/i.test(e) ? "IE" == q && X && null === x.external ? K.unshift("platform preview") : (/\bBlackBerry\b/.test(J) || /\bBB10\b/.test(e)) && (P = (RegExp(J.replace(/ +/g, " *") + "/([.\\d]+)", "i").exec(e) || 0)[1] || L) ? (P = [P, /BB10/.test(e)], Q = (P[1] ? (J = null, V = "BlackBerry") : "Device Software") + " " + P[0], L = null) : this != o && "Wii" != J && (X && D || /Opera/.test(q) && /\b(?:MSIE|Firefox)\b/i.test(e) || "Firefox" == q && /\bOS X (?:\d+\.){2,}/.test(Q) || "IE" == q && (Q && !/^Win/.test(Q) && L > 5.5 || /\bWindows XP\b/.test(Q) && L > 8 || 8 == L && !/\bTrident\b/.test(e))) && !m.test(P = d.call(o, e.replace(m, "") + ";")) && P.name && (P = "ing as " + P.name + ((P = P.version) ? " " + P : ""), m.test(q) ? (/\bIE\b/.test(P) && "Mac OS" == Q && (Q = null), P = "identify" + P) : (P = "mask" + P, q = G ? r(G.replace(/([a-z])([A-Z])/g, "$1 $2")) : "Opera", /\bIE\b/.test(P) && (Q = null), X || (L = null)), z = ["Presto"], K.push(P)) : q += " Mobile", (P = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(e) || 0)[1]) && (P = [parseFloat(P.replace(/\.(\d)$/, ".0$1")), P], "Safari" == q && "+" == P[1].slice(-1) ? (q = "WebKit Nightly", U = "alpha", L = P[1].slice(0, -1)) : L != P[1] && L != (P[2] = (/\bSafari\/([\d.]+\+?)/i.exec(e) || 0)[1]) || (L = null), P[1] = (/\bChrome\/([\d.]+)/i.exec(e) || 0)[1], 537.36 == P[0] && 537.36 == P[2] && parseFloat(P[1]) >= 28 && "IE" != q && (z = ["Blink"]), X && (I || P[1]) ? (z && (z[1] = "like Chrome"), P = P[1] || (P = P[0], P < 530 ? 1 : P < 532 ? 2 : P < 532.05 ? 3 : P < 533 ? 4 : P < 534.03 ? 5 : P < 534.07 ? 6 : P < 534.1 ? 7 : P < 534.13 ? 8 : P < 534.16 ? 9 : P < 534.24 ? 10 : P < 534.3 ? 11 : P < 535.01 ? 12 : P < 535.02 ? "13+" : P < 535.07 ? 15 : P < 535.11 ? 16 : P < 535.19 ? 17 : P < 536.05 ? 18 : P < 536.1 ? 19 : P < 537.01 ? 20 : P < 537.11 ? "21+" : P < 537.13 ? 23 : P < 537.18 ? 24 : P < 537.24 ? 25 : P < 537.36 ? 26 : "Blink" != z ? "27" : "28")) : (z && (z[1] = "like Safari"), P = P[0], P = P < 400 ? 1 : P < 500 ? 2 : P < 526 ? 3 : P < 533 ? 4 : P < 534 ? "4+" : P < 535 ? 5 : P < 537 ? 6 : P < 538 ? 7 : P < 601 ? 8 : "8"), z && (z[1] += " " + (P += "number" == typeof P ? ".x" : /[.+]/.test(P) ? "" : "+")), "Safari" == q && (!L || parseInt(L) > 45) && (L = P)), "Opera" == q && (P = /\bzbov|zvav$/.exec(Q)) ? (q += " ", K.unshift("desktop mode"), "zvav" == P ? (q += "Mini", L = null) : q += "Mobile", Q = Q.replace(RegExp(" *" + P + "$"), "")) : "Safari" == q && /\bChrome\b/.exec(z && z[1]) && (K.unshift("desktop mode"), q = "Chrome Mobile", L = null, /\bOS X\b/.test(Q) ? (V = "Apple", Q = "iOS 4.3+") : Q = null), L && 0 == L.indexOf(P = /[\d.]+$/.exec(Q)) && e.indexOf("/" + P + "-") > -1 && (Q = u(Q.replace(P, ""))), z && !/\b(?:Avant|Nook)\b/.test(q) && (/Browser|Lunascape|Maxthon/.test(q) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Sleipnir|Web)/.test(q) && z[1]) && (P = z[z.length - 1]) && K.push(P), K.length && (K = ["(" + K.join("; ") + ")"]), V && J && J.indexOf(V) < 0 && K.push("on " + V), J && K.push((/^on /.test(K[K.length - 1]) ? "" : "on ") + J), Q && (P = / ([\d.+]+)$/.exec(Q), k = P && "/" == Q.charAt(Q.length - P[0].length - 1), Q = {
architecture: 32,
family: P && !k ? Q.replace(P[0], "") : Q,
version: P ? P[1] : null,
toString: function () {
var e = this.version;
return this.family + (e && !k ? " " + e : "") + (64 == this.architecture ? " 64-bit" : "")
}
}), (P = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec($)) && !/\bi686\b/i.test($) && (Q && (Q.architecture = 64, Q.family = Q.family.replace(RegExp(" *" + P), "")), q && (/\bWOW64\b/i.test(e) || X && /\w(?:86|32)$/.test(O.cpuClass || O.platform) && !/\bWin64; x64\b/i.test(e)) && K.unshift("32-bit")), e || (e = null), Pollfish.platform = {}, Pollfish.platform.description = e, Pollfish.platform.layout = z && z[0], Pollfish.platform.manufacturer = V, Pollfish.platform.name = q, Pollfish.platform.prerelease = U, Pollfish.platform.product = J, Pollfish.platform.ua = e, Pollfish.platform.version = q && L, Pollfish.platform.os = Q || {
architecture: null,
family: null,
version: null,
toString: function () {
return "null"
}
}, Pollfish.platform.parse = d, Pollfish.platform.toString = S, Pollfish.platform.version && K.unshift(L), Pollfish.platform.name && K.unshift(q), Q && q && (Q != String(Q).split(" ")[0] || Q != q.split(" ")[0] && !J) && K.push(J ? "(" + Q + ")" : "on " + Q), K.length && (Pollfish.platform.description = K.join(" ")), Pollfish.platform
}
var c = {
"function": !0,
object: !0
},
p = c[typeof window] && window || this,
f = p,
b = c[typeof exports] && exports,
v = c[typeof module] && module && !module.nodeType && module,
y = b && v && "object" == typeof global && global;
!y || y.global !== y && y.window !== y && y.self !== y || (p = y);
var h = Math.pow(2, 53) - 1,
m = /\bOpera/,
g = this,
S = Object.prototype,
x = S.hasOwnProperty,
w = S.toString;
"function" == typeof define && "object" == typeof define.amd && define.amd ? define(function () {
return d()
}) : b && v ? o(d(), function (e, i) {
b[i] = e
}) : p.platform = d()
}.call(this), jQuery(document).ready(function () {
"undefined" != typeof pollfishConfig && Pollfish.start(pollfishConfig)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment