Skip to content

Instantly share code, notes, and snippets.

@robfig
Created September 14, 2015 19:57
Show Gist options
  • Save robfig/ebfdd9b64f64fa07b913 to your computer and use it in GitHub Desktop.
Save robfig/ebfdd9b64f64fa07b913 to your computer and use it in GitHub Desktop.
function f() {
var c = [];
$(".js-donut-graph").each(function(g, e) {
var b = $(e);
e = {a:e, b:parseInt(b.css("width")), g:parseInt(b.data("score")), c:parseInt(b.data("avgScore")), canvas:void 0};
c.push(e);
b = h(e.b, e);
$(e.a).append(b);
e.canvas = b;
});
return c;
}
function h(c, g) {
var e = $("\x3ccanvas /\x3e", {"class":"donut-canvas"}).attr("height", c).attr("width", c)[0], b = g.g, p = g.c, a = e.getContext("2d"), d = Math.min(e.width, e.height) / 2, t = .75 * d, m = 2 * Math.PI, l = -Math.PI / 2;
p > b && (a.fillStyle = "rgb(179,188,198)", a.beginPath(), a.moveTo(d, d), a.arc(d, d, d, l, p / 100 * m + l), a.moveTo(d, d), a.closePath(), a.fill());
a.fillStyle = "rgb(0,70,144)";
a.beginPath();
a.moveTo(d, d);
a.arc(d, d, d, l, b / 100 * m + l);
a.moveTo(d, d);
a.closePath();
a.fill();
a.fillStyle = "rgb(255,255,255)";
a.beginPath();
a.arc(d, d, t, 0, m);
a.closePath();
a.fill();
return g["canvas" + c] = e;
}
function k(c) {
var g = c.f;
$(window).resize(function() {
$.each(g, function(e, b) {
var c = parseInt($(b.a).css("width"));
c != b.b && requestAnimationFrame(function() {
var a;
a = void 0 === b["canvas" + c] ? h(c, b) : b["canvas" + c];
$(b.canvas).detach();
$(b.a).append(a);
b.canvas = a;
b.b = c;
});
});
});
}
function n() {
var c = $(".nav");
c.click(function() {
620 >= parseInt($(window).width()) && c.toggleClass("show");
});
}
function q() {
$(".js-smartphone-footnote").click(function() {
$(this).find(".note").fadeToggle(200);
});
}
function r() {
$(".js-show-desktop-screenshot").click(function() {
$(this).find(".js-desktop-screenshot").fadeToggle(200);
});
$(".js-show-mobile-screenshot").click(function() {
$(this).find(".js-mobile-screenshot").fadeToggle(200);
});
}
function u() {
this.f = f();
k(this);
n();
q();
r();
}
var v = ["yext", "presencebuilder", "PresenceBuilder"], w = this;
v[0] in w || !w.execScript || w.execScript("var " + v[0]);
for (var x;v.length && (x = v.shift());) {
v.length || void 0 === u ? w = w[x] ? w[x] : w[x] = {} : w[x] = u;
}
;
var COMPILED = !0, goog = goog || {};
goog.global = this;
goog.isDef = function(a) {
return void 0 !== a;
};
goog.exportPath_ = function(a, b, c) {
a = a.split(".");
c = c || goog.global;
a[0] in c || !c.execScript || c.execScript("var " + a[0]);
for (var d;a.length && (d = a.shift());) {
!a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {};
}
};
goog.define = function(a, b) {
var c = b;
COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]));
goog.exportPath_(a, c);
};
goog.DEBUG = !1;
goog.LOCALE = "en";
goog.TRUSTED_SITE = !0;
goog.STRICT_MODE_COMPATIBLE = !1;
goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;
goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;
goog.provide = function(a) {
if (!COMPILED && goog.isProvided_(a)) {
throw Error('Namespace "' + a + '" already declared.');
}
goog.constructNamespace_(a);
};
goog.constructNamespace_ = function(a, b) {
if (!COMPILED) {
delete goog.implicitNamespaces_[a];
for (var c = a;(c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);) {
goog.implicitNamespaces_[c] = !0;
}
}
goog.exportPath_(a, b);
};
goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
goog.module = function(a) {
if (!goog.isString(a) || !a || -1 == a.search(goog.VALID_MODULE_RE_)) {
throw Error("Invalid module identifier");
}
if (!goog.isInModuleLoader_()) {
throw Error("Module " + a + " has been loaded incorrectly.");
}
if (goog.moduleLoaderState_.moduleName) {
throw Error("goog.module may only be called once per module.");
}
goog.moduleLoaderState_.moduleName = a;
if (!COMPILED) {
if (goog.isProvided_(a)) {
throw Error('Namespace "' + a + '" already declared.');
}
delete goog.implicitNamespaces_[a];
}
};
goog.module.get = function(a) {
return goog.module.getInternal_(a);
};
goog.module.getInternal_ = function(a) {
if (!COMPILED) {
return goog.isProvided_(a) ? a in goog.loadedModules_ ? goog.loadedModules_[a] : goog.getObjectByName(a) : null;
}
};
goog.moduleLoaderState_ = null;
goog.isInModuleLoader_ = function() {
return null != goog.moduleLoaderState_;
};
goog.module.declareLegacyNamespace = function() {
if (!COMPILED && !goog.isInModuleLoader_()) {
throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");
}
if (!COMPILED && !goog.moduleLoaderState_.moduleName) {
throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");
}
goog.moduleLoaderState_.declareLegacyNamespace = !0;
};
goog.setTestOnly = function(a) {
if (goog.DISALLOW_TEST_ONLY_CODE) {
throw a = a || "", Error("Importing test-only code into non-debug environment" + (a ? ": " + a : "."));
}
};
goog.forwardDeclare = function(a) {
};
COMPILED || (goog.isProvided_ = function(a) {
return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a));
}, goog.implicitNamespaces_ = {"goog.module":!0});
goog.getObjectByName = function(a, b) {
for (var c = a.split("."), d = b || goog.global, f;f = c.shift();) {
if (goog.isDefAndNotNull(d[f])) {
d = d[f];
} else {
return null;
}
}
return d;
};
goog.globalize = function(a, b) {
var c = b || goog.global, d;
for (d in a) {
c[d] = a[d];
}
};
goog.addDependency = function(a, b, c, d) {
if (goog.DEPENDENCIES_ENABLED) {
var f;
a = a.replace(/\\/g, "/");
for (var e = goog.dependencies_, g = 0;f = b[g];g++) {
e.nameToPath[f] = a, e.pathIsModule[a] = !!d;
}
for (d = 0;b = c[d];d++) {
a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0;
}
}
};
goog.ENABLE_DEBUG_LOADER = !0;
goog.logToConsole_ = function(a) {
goog.global.console && goog.global.console.error(a);
};
goog.require = function(a) {
if (!COMPILED) {
goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_ && goog.maybeProcessDeferredDep_(a);
if (goog.isProvided_(a)) {
return goog.isInModuleLoader_() ? goog.module.getInternal_(a) : null;
}
if (goog.ENABLE_DEBUG_LOADER) {
var b = goog.getPathFromDeps_(a);
if (b) {
return goog.included_[b] = !0, goog.writeScripts_(), null;
}
}
a = "goog.require could not find: " + a;
goog.logToConsole_(a);
throw Error(a);
}
};
goog.basePath = "";
goog.nullFunction = function() {
};
goog.abstractMethod = function() {
throw Error("unimplemented abstract method");
};
goog.addSingletonGetter = function(a) {
a.getInstance = function() {
if (a.instance_) {
return a.instance_;
}
goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
return a.instance_ = new a;
};
};
goog.instantiatedSingletons_ = [];
goog.LOAD_MODULE_USING_EVAL = !0;
goog.SEAL_MODULE_EXPORTS = goog.DEBUG;
goog.loadedModules_ = {};
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathIsModule:{}, nameToPath:{}, requires:{}, visited:{}, written:{}, deferred:{}}, goog.inHtmlDocument_ = function() {
var a = goog.global.document;
return "undefined" != typeof a && "write" in a;
}, goog.findBasePath_ = function() {
if (goog.isDef(goog.global.CLOSURE_BASE_PATH)) {
goog.basePath = goog.global.CLOSURE_BASE_PATH;
} else {
if (goog.inHtmlDocument_()) {
for (var a = goog.global.document.getElementsByTagName("SCRIPT"), b = a.length - 1;0 <= b;--b) {
var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d;
if ("base.js" == c.substr(d - 7, 7)) {
goog.basePath = c.substr(0, d - 7);
break;
}
}
}
}
}, goog.importScript_ = function(a, b) {
(goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_)(a, b) && (goog.dependencies_.written[a] = !0);
}, goog.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all), goog.importModule_ = function(a) {
goog.importScript_("", 'goog.retrieveAndExecModule_("' + a + '");') && (goog.dependencies_.written[a] = !0);
}, goog.queuedModules_ = [], goog.wrapModule_ = function(a, b) {
return goog.LOAD_MODULE_USING_EVAL && goog.isDef(goog.global.JSON) ? "goog.loadModule(" + goog.global.JSON.stringify(b + "\n//# sourceURL\x3d" + a + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + b + "\n;return exports});\n//# sourceURL\x3d" + a + "\n";
}, goog.loadQueuedModules_ = function() {
var a = goog.queuedModules_.length;
if (0 < a) {
var b = goog.queuedModules_;
goog.queuedModules_ = [];
for (var c = 0;c < a;c++) {
goog.maybeProcessDeferredPath_(b[c]);
}
}
}, goog.maybeProcessDeferredDep_ = function(a) {
goog.isDeferredModule_(a) && goog.allDepsAreAvailable_(a) && (a = goog.getPathFromDeps_(a), goog.maybeProcessDeferredPath_(goog.basePath + a));
}, goog.isDeferredModule_ = function(a) {
return (a = goog.getPathFromDeps_(a)) && goog.dependencies_.pathIsModule[a] ? goog.basePath + a in goog.dependencies_.deferred : !1;
}, goog.allDepsAreAvailable_ = function(a) {
if ((a = goog.getPathFromDeps_(a)) && a in goog.dependencies_.requires) {
for (var b in goog.dependencies_.requires[a]) {
if (!goog.isProvided_(b) && !goog.isDeferredModule_(b)) {
return !1;
}
}
}
return !0;
}, goog.maybeProcessDeferredPath_ = function(a) {
if (a in goog.dependencies_.deferred) {
var b = goog.dependencies_.deferred[a];
delete goog.dependencies_.deferred[a];
goog.globalEval(b);
}
}, goog.loadModule = function(a) {
var b = goog.moduleLoaderState_;
try {
goog.moduleLoaderState_ = {moduleName:void 0};
var c;
if (goog.isFunction(a)) {
c = a.call(goog.global, {});
} else {
if (goog.isString(a)) {
c = goog.loadModuleFromSource_.call(goog.global, a);
} else {
throw Error("Invalid module definition");
}
}
var d = goog.moduleLoaderState_.moduleName;
if (!goog.isString(d) || !d) {
throw Error('Invalid module name "' + d + '"');
}
goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && Object.seal(c);
goog.loadedModules_[d] = c;
} finally {
goog.moduleLoaderState_ = b;
}
}, goog.loadModuleFromSource_ = function(a) {
eval(a);
return {};
}, goog.writeScriptSrcNode_ = function(a) {
goog.global.document.write('\x3cscript type\x3d"text/javascript" src\x3d"' + a + '"\x3e\x3c/script\x3e');
}, goog.appendScriptSrcNode_ = function(a) {
var b = goog.global.document, c = b.createElement("script");
c.type = "text/javascript";
c.src = a;
c.defer = !1;
c.async = !1;
b.head.appendChild(c);
}, goog.writeScriptTag_ = function(a, b) {
if (goog.inHtmlDocument_()) {
var c = goog.global.document;
if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && "complete" == c.readyState) {
if (/\bdeps.js$/.test(a)) {
return !1;
}
throw Error('Cannot write "' + a + '" after document load');
}
var d = goog.IS_OLD_IE_;
void 0 === b ? d ? (d = " onreadystatechange\x3d'goog.onScriptLoad_(this, " + ++goog.lastNonModuleScriptIndex_ + ")' ", c.write('\x3cscript type\x3d"text/javascript" src\x3d"' + a + '"' + d + "\x3e\x3c/script\x3e")) : goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING ? goog.appendScriptSrcNode_(a) : goog.writeScriptSrcNode_(a) : c.write('\x3cscript type\x3d"text/javascript"\x3e' + b + "\x3c/script\x3e");
return !0;
}
return !1;
}, goog.lastNonModuleScriptIndex_ = 0, goog.onScriptLoad_ = function(a, b) {
"complete" == a.readyState && goog.lastNonModuleScriptIndex_ == b && goog.loadQueuedModules_();
return !0;
}, goog.writeScripts_ = function() {
function a(f) {
if (!(f in d.written)) {
if (!(f in d.visited) && (d.visited[f] = !0, f in d.requires)) {
for (var e in d.requires[f]) {
if (!goog.isProvided_(e)) {
if (e in d.nameToPath) {
a(d.nameToPath[e]);
} else {
throw Error("Undefined nameToPath for " + e);
}
}
}
}
f in c || (c[f] = !0, b.push(f));
}
}
var b = [], c = {}, d = goog.dependencies_, f;
for (f in goog.included_) {
d.written[f] || a(f);
}
for (var e = 0;e < b.length;e++) {
f = b[e], goog.dependencies_.written[f] = !0;
}
var g = goog.moduleLoaderState_;
goog.moduleLoaderState_ = null;
for (e = 0;e < b.length;e++) {
if (f = b[e]) {
d.pathIsModule[f] ? goog.importModule_(goog.basePath + f) : goog.importScript_(goog.basePath + f);
} else {
throw goog.moduleLoaderState_ = g, Error("Undefined script input");
}
}
goog.moduleLoaderState_ = g;
}, goog.getPathFromDeps_ = function(a) {
return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null;
}, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js"));
goog.normalizePath_ = function(a) {
a = a.split("/");
for (var b = 0;b < a.length;) {
"." == a[b] ? a.splice(b, 1) : b && ".." == a[b] && a[b - 1] && ".." != a[b - 1] ? a.splice(--b, 2) : b++;
}
return a.join("/");
};
goog.loadFileSync_ = function(a) {
if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
return goog.global.CLOSURE_LOAD_FILE_SYNC(a);
}
var b = new goog.global.XMLHttpRequest;
b.open("get", a, !1);
b.send();
return b.responseText;
};
goog.retrieveAndExecModule_ = function(a) {
if (!COMPILED) {
var b = a;
a = goog.normalizePath_(a);
var c = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_, d = goog.loadFileSync_(a);
if (null != d) {
d = goog.wrapModule_(a, d), goog.IS_OLD_IE_ ? (goog.dependencies_.deferred[b] = d, goog.queuedModules_.push(b)) : c(a, d);
} else {
throw Error("load of " + a + "failed");
}
}
};
goog.typeOf = function(a) {
var b = typeof a;
if ("object" == b) {
if (a) {
if (a instanceof Array) {
return "array";
}
if (a instanceof Object) {
return b;
}
var c = Object.prototype.toString.call(a);
if ("[object Window]" == c) {
return "object";
}
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) {
return "array";
}
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) {
return "function";
}
} else {
return "null";
}
} else {
if ("function" == b && "undefined" == typeof a.call) {
return "object";
}
}
return b;
};
goog.isNull = function(a) {
return null === a;
};
goog.isDefAndNotNull = function(a) {
return null != a;
};
goog.isArray = function(a) {
return "array" == goog.typeOf(a);
};
goog.isArrayLike = function(a) {
var b = goog.typeOf(a);
return "array" == b || "object" == b && "number" == typeof a.length;
};
goog.isDateLike = function(a) {
return goog.isObject(a) && "function" == typeof a.getFullYear;
};
goog.isString = function(a) {
return "string" == typeof a;
};
goog.isBoolean = function(a) {
return "boolean" == typeof a;
};
goog.isNumber = function(a) {
return "number" == typeof a;
};
goog.isFunction = function(a) {
return "function" == goog.typeOf(a);
};
goog.isObject = function(a) {
var b = typeof a;
return "object" == b && null != a || "function" == b;
};
goog.getUid = function(a) {
return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_);
};
goog.hasUid = function(a) {
return !!a[goog.UID_PROPERTY_];
};
goog.removeUid = function(a) {
"removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
try {
delete a[goog.UID_PROPERTY_];
} catch (b) {
}
};
goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0);
goog.uidCounter_ = 0;
goog.getHashCode = goog.getUid;
goog.removeHashCode = goog.removeUid;
goog.cloneObject = function(a) {
var b = goog.typeOf(a);
if ("object" == b || "array" == b) {
if (a.clone) {
return a.clone();
}
var b = "array" == b ? [] : {}, c;
for (c in a) {
b[c] = goog.cloneObject(a[c]);
}
return b;
}
return a;
};
goog.bindNative_ = function(a, b, c) {
return a.call.apply(a.bind, arguments);
};
goog.bindJs_ = function(a, b, c) {
if (!a) {
throw Error();
}
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function() {
var c = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(c, d);
return a.apply(b, c);
};
}
return function() {
return a.apply(b, arguments);
};
};
goog.bind = function(a, b, c) {
Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;
return goog.bind.apply(null, arguments);
};
goog.partial = function(a, b) {
var c = Array.prototype.slice.call(arguments, 1);
return function() {
var b = c.slice();
b.push.apply(b, arguments);
return a.apply(this, b);
};
};
goog.mixin = function(a, b) {
for (var c in b) {
a[c] = b[c];
}
};
goog.now = goog.TRUSTED_SITE && Date.now || function() {
return +new Date;
};
goog.globalEval = function(a) {
if (goog.global.execScript) {
goog.global.execScript(a, "JavaScript");
} else {
if (goog.global.eval) {
if (null == goog.evalWorksForGlobals_) {
if (goog.global.eval("var _evalTest_ \x3d 1;"), "undefined" != typeof goog.global._evalTest_) {
try {
delete goog.global._evalTest_;
} catch (b) {
}
goog.evalWorksForGlobals_ = !0;
} else {
goog.evalWorksForGlobals_ = !1;
}
}
if (goog.evalWorksForGlobals_) {
goog.global.eval(a);
} else {
var c = goog.global.document, d = c.createElement("SCRIPT");
d.type = "text/javascript";
d.defer = !1;
d.appendChild(c.createTextNode(a));
c.body.appendChild(d);
c.body.removeChild(d);
}
} else {
throw Error("goog.globalEval not available");
}
}
};
goog.evalWorksForGlobals_ = null;
goog.getCssName = function(a, b) {
var c = function(a) {
return goog.cssNameMapping_[a] || a;
}, d = function(a) {
a = a.split("-");
for (var b = [], d = 0;d < a.length;d++) {
b.push(c(a[d]));
}
return b.join("-");
}, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) {
return a;
};
return b ? a + "-" + d(b) : d(a);
};
goog.setCssNameMapping = function(a, b) {
goog.cssNameMapping_ = a;
goog.cssNameMappingStyle_ = b;
};
!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
goog.getMsg = function(a, b) {
b && (a = a.replace(/\{\$([^}]+)}/g, function(a, d) {
return d in b ? b[d] : a;
}));
return a;
};
goog.getMsgWithFallback = function(a, b) {
return a;
};
goog.exportSymbol = function(a, b, c) {
goog.exportPath_(a, b, c);
};
goog.exportProperty = function(a, b, c) {
a[b] = c;
};
goog.inherits = function(a, b) {
function c() {
}
c.prototype = b.prototype;
a.superClass_ = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
a.base = function(a, c, e) {
for (var g = Array(arguments.length - 2), h = 2;h < arguments.length;h++) {
g[h - 2] = arguments[h];
}
return b.prototype[c].apply(a, g);
};
};
goog.base = function(a, b, c) {
var d = arguments.callee.caller;
if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) {
throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");
}
if (d.superClass_) {
for (var f = Array(arguments.length - 1), e = 1;e < arguments.length;e++) {
f[e - 1] = arguments[e];
}
return d.superClass_.constructor.apply(a, f);
}
f = Array(arguments.length - 2);
for (e = 2;e < arguments.length;e++) {
f[e - 2] = arguments[e];
}
for (var e = !1, g = a.constructor;g;g = g.superClass_ && g.superClass_.constructor) {
if (g.prototype[b] === d) {
e = !0;
} else {
if (e) {
return g.prototype[b].apply(a, f);
}
}
}
if (a[b] === d) {
return a.constructor.prototype[b].apply(a, f);
}
throw Error("goog.base called from a method of one name to a method of a different name");
};
goog.scope = function(a) {
a.call(goog.global);
};
COMPILED || (goog.global.COMPILED = COMPILED);
goog.defineClass = function(a, b) {
var c = b.constructor, d = b.statics;
c && c != Object.prototype.constructor || (c = function() {
throw Error("cannot instantiate an interface (no constructor defined).");
});
c = goog.defineClass.createSealingConstructor_(c, a);
a && goog.inherits(c, a);
delete b.constructor;
delete b.statics;
goog.defineClass.applyProperties_(c.prototype, b);
null != d && (d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d));
return c;
};
goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG;
goog.defineClass.createSealingConstructor_ = function(a, b) {
if (goog.defineClass.SEAL_CLASS_INSTANCES && Object.seal instanceof Function) {
if (b && b.prototype && b.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]) {
return a;
}
var c = function() {
var b = a.apply(this, arguments) || this;
b[goog.UID_PROPERTY_] = b[goog.UID_PROPERTY_];
this.constructor === c && Object.seal(b);
return b;
};
return c;
}
return a;
};
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
goog.defineClass.applyProperties_ = function(a, b) {
for (var c in b) {
Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
}
for (var d = 0;d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;d++) {
c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d], Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
}
};
goog.tagUnsealableClass = function(a) {
!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES && (a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = !0);
};
goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";
var yext = {presencebuilder:{}};
yext.presencebuilder.colors = {SCORE_COLOR:"rgb(0,70,144)", OVERLAY_COLOR:"rgb(255,255,255)", AVERAGE_SCORE_COLOR:"rgb(179,188,198)"};
yext.presencebuilder.breakpoints = {BREAKPOINT_SMALL:620};
yext.presencebuilder.PresenceBuilder = function() {
this.donuts = this.createDonutGraphs();
this.bindResizeCanvasHandler();
this.bindNavHandler();
this.bindFootnoteClickHandler();
this.bindShowScreenshotHandlers();
};
yext.presencebuilder.PresenceBuilder.prototype.createDonutGraphs = function() {
var a = [];
$(".js-donut-graph").each(function(b, c) {
var d = $(c);
c = {container:c, currentSize:parseInt(d.css("width")), score:parseInt(d.data("score")), averageScore:parseInt(d.data("avgScore")), canvas:void 0};
a.push(c);
d = yext.presencebuilder.PresenceBuilder.createNewCanvas(c.currentSize, c);
$(c.container).append(d);
c.canvas = d;
});
return a;
};
yext.presencebuilder.PresenceBuilder.createNewCanvas = function(a, b) {
var c = $("\x3ccanvas /\x3e", {"class":"donut-canvas"}).attr("height", a).attr("width", a)[0];
yext.presencebuilder.PresenceBuilder.drawCanvas(c, b.score, b.averageScore);
return b["canvas" + a] = c;
};
yext.presencebuilder.PresenceBuilder.drawCanvas = function(a, b, c) {
var d = a.getContext("2d");
a = Math.min(a.width, a.height) / 2;
var f = .75 * a, e = 2 * Math.PI, g = -Math.PI / 2;
c > b && (d.fillStyle = yext.presencebuilder.colors.AVERAGE_SCORE_COLOR, d.beginPath(), d.moveTo(a, a), d.arc(a, a, a, g, c / 100 * e + g), d.moveTo(a, a), d.closePath(), d.fill());
d.fillStyle = yext.presencebuilder.colors.SCORE_COLOR;
d.beginPath();
d.moveTo(a, a);
d.arc(a, a, a, g, b / 100 * e + g);
d.moveTo(a, a);
d.closePath();
d.fill();
d.fillStyle = yext.presencebuilder.colors.OVERLAY_COLOR;
d.beginPath();
d.arc(a, a, f, 0, e);
d.closePath();
d.fill();
};
yext.presencebuilder.PresenceBuilder.prototype.bindResizeCanvasHandler = function() {
var a = this.donuts;
$(window).resize(function() {
$.each(a, function(a, c) {
var d = parseInt($(c.container).css("width"));
d != c.currentSize && requestAnimationFrame(function() {
var a;
a = void 0 === c["canvas" + d] ? yext.presencebuilder.PresenceBuilder.createNewCanvas(d, c) : c["canvas" + d];
$(c.canvas).detach();
$(c.container).append(a);
c.canvas = a;
c.currentSize = d;
});
});
});
};
yext.presencebuilder.PresenceBuilder.prototype.bindNavHandler = function() {
var a = $(".nav");
a.click(function() {
parseInt($(window).width()) <= yext.presencebuilder.breakpoints.BREAKPOINT_SMALL && a.toggleClass("show");
});
};
yext.presencebuilder.PresenceBuilder.prototype.bindFootnoteClickHandler = function() {
$(".js-smartphone-footnote").click(function() {
$(this).find(".note").fadeToggle(200);
});
};
yext.presencebuilder.PresenceBuilder.prototype.bindShowScreenshotHandlers = function() {
$(".js-show-desktop-screenshot").click(function() {
$(this).find(".js-desktop-screenshot").fadeToggle(200);
});
$(".js-show-mobile-screenshot").click(function() {
$(this).find(".js-mobile-screenshot").fadeToggle(200);
});
};
goog.exportSymbol("yext.presencebuilder.PresenceBuilder", yext.presencebuilder.PresenceBuilder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment