Created
August 12, 2014 09:07
-
-
Save vitkarpov/a0371f2c002c90500639 to your computer and use it in GitHub Desktop.
Aviary bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var avpw_swfobject = function () { | |
function n() { | |
if (!B) { | |
try { | |
var n = N.getElementsByTagName("body")[0].appendChild(v("span")); | |
n.parentNode.removeChild(n) | |
} catch (t) { | |
return | |
} | |
B = !0; | |
for (var e = P.length, r = 0; e > r; r++) P[r]() | |
} | |
} | |
function t(n) { | |
B ? n() : P[P.length] = n | |
} | |
function e(n) { | |
if (typeof F.addEventListener != T) F.addEventListener("load", n, !1); | |
else if (typeof N.addEventListener != T) N.addEventListener("load", n, !1); | |
else if (typeof F.attachEvent != T) m(F, "onload", n); | |
else if ("function" == typeof F.onload) { | |
var t = F.onload; | |
F.onload = function () { | |
t(), n() | |
} | |
} else F.onload = n | |
} | |
function r() { | |
M ? i() : o() | |
} | |
function i() { | |
var n = N.getElementsByTagName("body")[0], | |
t = v($); | |
t.setAttribute("type", O); | |
var e = n.appendChild(t); | |
if (e) { | |
var r = 0; | |
! | |
function () { | |
if (typeof e.GetVariable != T) { | |
var i = e.GetVariable("$version"); | |
i && (i = i.split(" ")[1].split(","), H.pv = [parseInt(i[0], 10), parseInt(i[1], 10), parseInt(i[2], 10)]) | |
} else if (10 > r) return r++, setTimeout(arguments.callee, 10), void 0; | |
n.removeChild(t), e = null, o() | |
}() | |
} else o() | |
} | |
function o() { | |
var n = L.length; | |
if (n > 0) for (var t = 0; n > t; t++) { | |
var e = L[t].id, | |
r = L[t].callbackFn, | |
i = { | |
success: !1, | |
id: e | |
}; | |
if (H.pv[0] > 0) { | |
var o = g(e); | |
if (o) if (!y(L[t].swfVersion) || H.wk && H.wk < 312) if (L[t].expressInstall && u()) { | |
var l = {}; | |
l.data = L[t].expressInstall, l.width = o.getAttribute("width") || "0", l.height = o.getAttribute("height") || "0", o.getAttribute("class") && (l.styleclass = o.getAttribute("class")), o.getAttribute("align") && (l.align = o.getAttribute("align")); | |
for (var f = {}, p = o.getElementsByTagName("param"), h = p.length, d = 0; h > d; d++)"movie" != p[d].getAttribute("name").toLowerCase() && (f[p[d].getAttribute("name")] = p[d].getAttribute("value")); | |
c(l, f, e, r) | |
} else s(o), r && r(i); | |
else b(e, !0), r && (i.success = !0, i.ref = a(e), r(i)) | |
} else if (b(e, !0), r) { | |
var v = a(e); | |
v && typeof v.SetVariable != T && (i.success = !0, i.ref = v), r(i) | |
} | |
} | |
} | |
function a(n) { | |
var t = null, | |
e = g(n); | |
if (e && "OBJECT" == e.nodeName) if (typeof e.SetVariable != T) t = e; | |
else { | |
var r = e.getElementsByTagName($)[0]; | |
r && (t = r) | |
} | |
return t | |
} | |
function u() { | |
return !V && y("6.0.65") && (H.win || H.mac) && !(H.wk && H.wk < 312) | |
} | |
function c(n, t, e, r) { | |
V = !0, j = r || null, A = { | |
success: !1, | |
id: e | |
}; | |
var i = g(e); | |
if (i) { | |
"OBJECT" == i.nodeName ? (k = l(i), x = null) : (k = i, x = e), n.id = D, (typeof n.width == T || !/%$/.test(n.width) && parseInt(n.width, 10) < 310) && (n.width = "310"), (typeof n.height == T || !/%$/.test(n.height) && parseInt(n.height, 10) < 137) && (n.height = "137"), N.title = N.title.slice(0, 47) + " - Flash Player Installation"; | |
var o = H.ie && H.win ? "ActiveX" : "PlugIn", | |
a = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g, "%26") + "&MMplayerType=" + o + "&MMdoctitle=" + N.title; | |
if (typeof t.flashvars != T ? t.flashvars += "&" + a : t.flashvars = a, H.ie && H.win && 4 != i.readyState) { | |
var u = v("div"); | |
e += "SWFObjectNew", u.setAttribute("id", e), i.parentNode.insertBefore(u, i), i.style.display = "none", function () { | |
4 == i.readyState ? i.parentNode.removeChild(i) : setTimeout(arguments.callee, 10) | |
}() | |
} | |
f(n, t, e) | |
} | |
} | |
function s(n) { | |
if (H.ie && H.win && 4 != n.readyState) { | |
var t = v("div"); | |
n.parentNode.insertBefore(t, n), t.parentNode.replaceChild(l(n), t), n.style.display = "none", function () { | |
4 == n.readyState ? n.parentNode.removeChild(n) : setTimeout(arguments.callee, 10) | |
}() | |
} else n.parentNode.replaceChild(l(n), n) | |
} | |
function l(n) { | |
var t = v("div"); | |
if (H.win && H.ie) t.innerHTML = n.innerHTML; | |
else { | |
var e = n.getElementsByTagName($)[0]; | |
if (e) { | |
var r = e.childNodes; | |
if (r) for (var i = r.length, o = 0; i > o; o++)(1 != r[o].nodeType || "PARAM" != r[o].nodeName) && 8 != r[o].nodeType && t.appendChild(r[o].cloneNode(!0)) | |
} | |
} | |
return t | |
} | |
function f(n, t, e) { | |
var r, i = g(e); | |
if (H.wk && H.wk < 312) return r; | |
if (i) if (typeof n.id == T && (n.id = e), H.ie && H.win) { | |
var o = ""; | |
for (var a in n) n[a] != Object.prototype[a] && ("data" == a.toLowerCase() ? t.movie = n[a] : "styleclass" == a.toLowerCase() ? o += ' class="' + n[a] + '"' : "classid" != a.toLowerCase() && (o += " " + a + '="' + n[a] + '"')); | |
var u = ""; | |
for (var c in t) t[c] != Object.prototype[c] && (u += '<param name="' + c + '" value="' + t[c] + '" />'); | |
i.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + o + ">" + u + "</object>", U[U.length] = n.id, r = g(n.id) | |
} else { | |
var s = v($); | |
s.setAttribute("type", O); | |
for (var l in n) n[l] != Object.prototype[l] && ("styleclass" == l.toLowerCase() ? s.setAttribute("class", n[l]) : "classid" != l.toLowerCase() && s.setAttribute(l, n[l])); | |
for (var f in t) t[f] != Object.prototype[f] && "movie" != f.toLowerCase() && p(s, f, t[f]); | |
i.parentNode.replaceChild(s, i), r = s | |
} | |
return r | |
} | |
function p(n, t, e) { | |
var r = v("param"); | |
r.setAttribute("name", t), r.setAttribute("value", e), n.appendChild(r) | |
} | |
function h(n) { | |
var t = g(n); | |
t && "OBJECT" == t.nodeName && (H.ie && H.win ? (t.style.display = "none", function () { | |
4 == t.readyState ? d(n) : setTimeout(arguments.callee, 10) | |
}()) : t.parentNode.removeChild(t)) | |
} | |
function d(n) { | |
var t = g(n); | |
if (t) { | |
for (var e in t)"function" == typeof t[e] && (t[e] = null); | |
t.parentNode.removeChild(t) | |
} | |
} | |
function g(n) { | |
var t = null; | |
try { | |
t = N.getElementById(n) | |
} catch (e) {} | |
return t | |
} | |
function v(n) { | |
return N.createElement(n) | |
} | |
function m(n, t, e) { | |
n.attachEvent(t, e), q[q.length] = [n, t, e] | |
} | |
function y(n) { | |
var t = H.pv, | |
e = n.split("."); | |
return e[0] = parseInt(e[0], 10), e[1] = parseInt(e[1], 10) || 0, e[2] = parseInt(e[2], 10) || 0, t[0] > e[0] || t[0] == e[0] && t[1] > e[1] || t[0] == e[0] && t[1] == e[1] && t[2] >= e[2] ? !0 : !1 | |
} | |
function w(n, t, e, r) { | |
if (!H.ie || !H.mac) { | |
var i = N.getElementsByTagName("head")[0]; | |
if (i) { | |
var o = e && "string" == typeof e ? e : "screen"; | |
if (r && (S = null, I = null), !S || I != o) { | |
var a = v("style"); | |
a.setAttribute("type", "text/css"), a.setAttribute("media", o), S = i.appendChild(a), H.ie && H.win && typeof N.styleSheets != T && N.styleSheets.length > 0 && (S = N.styleSheets[N.styleSheets.length - 1]), I = o | |
} | |
H.ie && H.win ? S && typeof S.addRule == $ && S.addRule(n, t) : S && typeof N.createTextNode != T && S.appendChild(N.createTextNode(n + " {" + t + "}")) | |
} | |
} | |
} | |
function b(n, t) { | |
if (z) { | |
var e = t ? "visible" : "hidden"; | |
B && g(n) ? g(n).style.visibility = e : w("#" + n, "visibility:" + e) | |
} | |
} | |
function _(n) { | |
var t = /[\\\"<>\.;]/, | |
e = null != t.exec(n); | |
return e && typeof encodeURIComponent != T ? encodeURIComponent(n) : n | |
} | |
var k, x, j, A, S, I, T = "undefined", | |
$ = "object", | |
C = "Shockwave Flash", | |
E = "ShockwaveFlash.ShockwaveFlash", | |
O = "application/x-shockwave-flash", | |
D = "SWFObjectExprInst", | |
W = "onreadystatechange", | |
F = window, | |
N = document, | |
R = navigator, | |
M = !1, | |
P = [r], | |
L = [], | |
U = [], | |
q = [], | |
B = !1, | |
V = !1, | |
z = !0, | |
H = function () { | |
var n = typeof N.getElementById != T && typeof N.getElementsByTagName != T && typeof N.createElement != T, | |
t = R.userAgent.toLowerCase(), | |
e = R.platform.toLowerCase(), | |
r = e ? /win/.test(e) : /win/.test(t), | |
i = e ? /mac/.test(e) : /mac/.test(t), | |
o = /webkit/.test(t) ? parseFloat(t.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : !1, | |
a = !1, | |
u = [0, 0, 0], | |
c = null; | |
if (typeof R.plugins != T && typeof R.plugins[C] == $) c = R.plugins[C].description, c && (typeof R.mimeTypes == T || !R.mimeTypes[O] || !! R.mimeTypes[O].enabledPlugin) && (M = !0, a = !1, c = c.replace(/^.*\s+(\S+\s+\S+$)/, "$1"), u[0] = parseInt(c.replace(/^(.*)\..*$/, "$1"), 10), u[1] = parseInt(c.replace(/^.*\.(.*)\s.*$/, "$1"), 10), u[2] = /[a-zA-Z]/.test(c) ? parseInt(c.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0); | |
else if (typeof F.ActiveXObject != T) try { | |
var s = new ActiveXObject(E); | |
s && (c = s.GetVariable("$version"), c && (a = !0, c = c.split(" ")[1].split(","), u = [parseInt(c[0], 10), parseInt(c[1], 10), parseInt(c[2], 10)])) | |
} catch (l) {} | |
return { | |
w3: n, | |
pv: u, | |
wk: o, | |
ie: a, | |
win: r, | |
mac: i | |
} | |
}(); | |
return function () { | |
H.w3 && ((typeof N.readyState != T && "complete" == N.readyState || typeof N.readyState == T && (N.getElementsByTagName("body")[0] || N.body)) && n(), B || (typeof N.addEventListener != T && N.addEventListener("DOMContentLoaded", n, !1), H.ie && H.win && (N.attachEvent(W, function () { | |
"complete" == N.readyState && (N.detachEvent(W, arguments.callee), n()) | |
}), F == top && | |
function () { | |
if (!B) { | |
try { | |
N.documentElement.doScroll("left") | |
} catch (t) { | |
return setTimeout(arguments.callee, 0), void 0 | |
} | |
n() | |
} | |
}()), H.wk && | |
function () { | |
return B ? void 0 : /loaded|complete/.test(N.readyState) ? (n(), void 0) : (setTimeout(arguments.callee, 0), void 0) | |
}(), e(n))) | |
}(), function () { | |
H.ie && H.win && window.attachEvent("onunload", function () { | |
for (var n = q.length, t = 0; n > t; t++) q[t][0].detachEvent(q[t][1], q[t][2]); | |
for (var e = U.length, r = 0; e > r; r++) h(U[r]); | |
for (var i in H) H[i] = null; | |
H = null; | |
for (var o in avpw_swfobject) avpw_swfobject[o] = null; | |
avpw_swfobject = null | |
}) | |
}(), { | |
registerObject: function (n, t, e, r) { | |
if (H.w3 && n && t) { | |
var i = {}; | |
i.id = n, i.swfVersion = t, i.expressInstall = e, i.callbackFn = r, L[L.length] = i, b(n, !1) | |
} else r && r({ | |
success: !1, | |
id: n | |
}) | |
}, | |
getObjectById: function (n) { | |
return H.w3 ? a(n) : void 0 | |
}, | |
embedSWF: function (n, e, r, i, o, a, s, l, p, h) { | |
var d = { | |
success: !1, | |
id: e | |
}; | |
H.w3 && !(H.wk && H.wk < 312) && n && e && r && i && o ? (b(e, !1), t(function () { | |
r += "", i += ""; | |
var t = {}; | |
if (p && typeof p === $) for (var g in p) t[g] = p[g]; | |
t.data = n, t.width = r, t.height = i; | |
var v = {}; | |
if (l && typeof l === $) for (var m in l) v[m] = l[m]; | |
if (s && typeof s === $) for (var w in s) typeof v.flashvars != T ? v.flashvars += "&" + w + "=" + s[w] : v.flashvars = w + "=" + s[w]; | |
if (y(o)) { | |
var _ = f(t, v, e); | |
t.id == e && b(e, !0), d.success = !0, d.ref = _ | |
} else { | |
if (a && u()) return t.data = a, c(t, v, e, h), void 0; | |
b(e, !0) | |
} | |
h && h(d) | |
})) : h && h(d) | |
}, | |
switchOffAutoHideShow: function () { | |
z = !1 | |
}, | |
ua: H, | |
getFlashPlayerVersion: function () { | |
return { | |
major: H.pv[0], | |
minor: H.pv[1], | |
release: H.pv[2] | |
} | |
}, | |
hasFlashPlayerVersion: y, | |
createSWF: function (n, t, e) { | |
return H.w3 ? f(n, t, e) : void 0 | |
}, | |
showExpressInstall: function (n, t, e, r) { | |
H.w3 && u() && c(n, t, e, r) | |
}, | |
removeSWF: function (n) { | |
H.w3 && h(n) | |
}, | |
createCSS: function (n, t, e, r) { | |
H.w3 && w(n, t, e, r) | |
}, | |
addDomLoadEvent: t, | |
addLoadEvent: e, | |
getQueryParamValue: function (n) { | |
var t = N.location.search || N.location.hash; | |
if (t) { | |
if (/\?/.test(t) && (t = t.split("?")[1]), null == n) return _(t); | |
for (var e = t.split("&"), r = 0; r < e.length; r++) if (e[r].substring(0, e[r].indexOf("=")) == n) return _(e[r].substring(e[r].indexOf("=") + 1)) | |
} | |
return "" | |
}, | |
expressInstallCallback: function () { | |
if (V) { | |
var n = g(D); | |
n && k && (n.parentNode.replaceChild(k, n), x && (b(x, !0), H.ie && H.win && (k.style.display = "block")), j && j(A)), V = !1 | |
} | |
} | |
} | |
}(); | |
! | |
function (n) { | |
var t = /\s+/; | |
n.Events = { | |
on: function (n, e, r) { | |
var i, o, a; | |
if (!e) return this; | |
for (n = n.split(t), i = this._callbacks || (this._callbacks = {}); o = n.shift();) a = i[o] || (i[o] = []), a.push(e, r); | |
return this | |
}, | |
off: function (n, e, r) { | |
var i, o, a, u; | |
if (!(o = this._callbacks)) return this; | |
if (!(n || e || r)) return delete this._callbacks, this; | |
for (n = n ? n.split(t) : _.keys(o); i = n.shift();) if ((a = o[i]) && (e || r)) for (u = a.length - 2; u >= 0; u -= 2) e && a[u] !== e || r && a[u + 1] !== r || a.splice(u, 2); | |
else delete o[i]; | |
return this | |
}, | |
trigger: function (n) { | |
var e, r, i, o, a, u, c, s; | |
if (!(r = this._callbacks)) return this; | |
for (s = [], n = n.split(t), o = 1, a = arguments.length; a > o; o++) s[o - 1] = arguments[o]; | |
for (; e = n.shift();) { | |
if ((c = r.all) && (c = c.slice()), (i = r[e]) && (i = i.slice()), i) for (o = 0, a = i.length; a > o; o += 2) i[o].apply(i[o + 1] || this, s); | |
if (c) for (u = [e].concat(s), o = 0, a = c.length; a > o; o += 2) c[o].apply(c[o + 1] || this, u) | |
} | |
return this | |
} | |
} | |
}(window.AV || (window.AV = {}), window, document), "undefined" == typeof AV && (AV = {}), AV.JSON = {}, function () { | |
function f(n) { | |
return 10 > n ? "0" + n : n | |
} | |
function quote(n) { | |
return escapable.lastIndex = 0, escapable.test(n) ? '"' + n.replace(escapable, function (n) { | |
var t = meta[n]; | |
return "string" == typeof t ? t : "\\u" + ("0000" + n.charCodeAt(0).toString(16)).slice(-4) | |
}) + '"' : '"' + n + '"' | |
} | |
function str(n, t) { | |
var e, r, i, o, a, u = gap, | |
c = t[n]; | |
switch (c && "object" == typeof c && "function" == typeof c.toJSON && (c = c.toJSON(n)), "function" == typeof rep && (c = rep.call(t, n, c)), typeof c) { | |
case "string": | |
return quote(c); | |
case "number": | |
return isFinite(c) ? String(c) : "null"; | |
case "boolean": | |
case "null": | |
return String(c); | |
case "object": | |
if (!c) return "null"; | |
if (gap += indent, a = [], "[object Array]" === Object.prototype.toString.apply(c)) { | |
for (o = c.length, e = 0; o > e; e += 1) a[e] = str(e, c) || "null"; | |
return i = 0 === a.length ? "[]" : gap ? "[\n" + gap + a.join(",\n" + gap) + "\n" + u + "]" : "[" + a.join(",") + "]", gap = u, i | |
} | |
if (rep && "object" == typeof rep) for (o = rep.length, e = 0; o > e; e += 1) r = rep[e], "string" == typeof r && (i = str(r, c), i && a.push(quote(r) + (gap ? ": " : ":") + i)); | |
else for (r in c) Object.hasOwnProperty.call(c, r) && (i = str(r, c), i && a.push(quote(r) + (gap ? ": " : ":") + i)); | |
return i = 0 === a.length ? "{}" : gap ? "{\n" + gap + a.join(",\n" + gap) + "\n" + u + "}" : "{" + a.join(",") + "}", gap = u, i | |
} | |
} | |
"function" != typeof Date.prototype.toJSON && (Date.prototype.toJSON = function () { | |
return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null | |
}, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { | |
return this.valueOf() | |
}); | |
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
gap, indent, meta = { | |
"\b": "\\b", | |
" ": "\\t", | |
"\n": "\\n", | |
"\f": "\\f", | |
"\r": "\\r", | |
'"': '\\"', | |
"\\": "\\\\" | |
}, | |
rep; | |
"function" != typeof AV.JSON.stringify && (AV.JSON.stringify = function (n, t, e) { | |
var r; | |
if (gap = "", indent = "", "number" == typeof e) for (r = 0; e > r; r += 1) indent += " "; | |
else "string" == typeof e && (indent = e); | |
if (rep = t, !t || "function" == typeof t || "object" == typeof t && "number" == typeof t.length) return str("", { | |
"": n | |
}); | |
throw new Error("AV.JSON.stringify") | |
}), "function" != typeof AV.JSON.parse && (AV.JSON.parse = function (text, reviver) { | |
function walk(n, t) { | |
var e, r, i = n[t]; | |
if (i && "object" == typeof i) for (e in i) Object.hasOwnProperty.call(i, e) && (r = walk(i, e), void 0 !== r ? i[e] = r : delete i[e]); | |
return reviver.call(n, t, i) | |
} | |
var j; | |
if (text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function (n) { | |
return "\\u" + ("0000" + n.charCodeAt(0).toString(16)).slice(-4) | |
})), /^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), "function" == typeof reviver ? walk({ | |
"": j | |
}, "") : j; | |
throw new SyntaxError("AV.JSON.parse") | |
}) | |
}(), function (n) { | |
n.build = { | |
version: "3.1.0.270", | |
bundled: !1, | |
MINIMUM_FLASH_PLAYER_VERSION: "10.2.0", | |
feather_baseURL: "http://feather.aviary.com/3.1.0.270/", | |
feather_baseURL_SSL: "https://dme0ih8comzn4.cloudfront.net/3.1.0.270/", | |
feather_stickerURL: "http://feather.aviary.com/stickers/", | |
feather_stickerURL_SSL: "https://dme0ih8comzn4.cloudfront.net/stickers/", | |
imgrecvBase: "http://featherservices.aviary.com/", | |
imgrecvBase_SSL: "https://featherservices.aviary.com/", | |
featherTargetAnnounce: "http://featherservices.aviary.com/feather_target_announce_v3.html", | |
featherTargetAnnounce_SSL: "https://featherservices.aviary.com/feather_target_announce_v3.html", | |
imgrecvServer: "http://featherservices.aviary.com/FeatherReceiver.aspx", | |
imgrecvServer_SSL: "https://featherservices.aviary.com/FeatherReceiver.aspx", | |
jsonp_imgserver: "http://featherservices.aviary.com/imgjsonpserver.aspx", | |
jsonp_imgserver_SSL: "https://featherservices.aviary.com/imgjsonpserver.aspx", | |
proxyServer: "http://featherservices.aviary.com/proxy.aspx", | |
proxyServer_SSL: "https://featherservices.aviary.com/proxy.aspx", | |
asyncImgrecvBase: "http://api.aviary.com/", | |
asyncImgrecvBase_SSL: "https://api.aviary.com/", | |
partnerAssetURL: "http://api.aviary.com/getassets", | |
partnerAssetURL_SSL: "https://api.aviary.com/getassets", | |
asyncFeatherTargetAnnounce: "http://api.aviary.com/feather_target_announce_v3.html", | |
asyncFeatherTargetAnnounce_SSL: "https://api.aviary.com/feather_target_announce_v3.html", | |
asyncImgrecvCreateJob: "http://api.aviary.com/createjob", | |
asyncImgrecvCreateJob_SSL: "https://api.aviary.com/createjob", | |
asyncImgrecvGetJobStatus: "http://api.aviary.com/getjobstatus", | |
asyncImgrecvGetJobStatus_SSL: "https://api.aviary.com/getjobstatus", | |
googleTracker: "UA-84575-16", | |
inAppPurchaseFrameURL: "http://purchases.viary.com/gateway.aspx?p=flickr", | |
filterServer: "http://featherservices.aviary.com/moa.ashx", | |
filterServer_SSL: "https://featherservices.aviary.com/moa.ashx", | |
featherFilterAnnounce: "http://featherservices.aviary.com/feather_filter_announce.html", | |
featherFilterAnnounce_SSL: "https://featherservices.aviary.com/feather_filter_announce.html" | |
} | |
}(AV = window.AV || {}), "undefined" == typeof AV && (AV = {}), AV.validLanguages = { | |
en: !0, | |
zh_hant: !0, | |
nl: !0, | |
fr: !0, | |
de: !0, | |
it: !0, | |
ja: !0, | |
ko: !0, | |
pl: !0, | |
pt: !0, | |
pt_br: !0, | |
ru: !0, | |
es: !0, | |
tr: !0, | |
bg: !0, | |
ca: !0, | |
zh_hans: !0, | |
cs: !0, | |
da: !0, | |
fi: !0, | |
he: !0, | |
hu: !0, | |
id: !0, | |
lv: !0, | |
lt: !0, | |
sv: !0, | |
vi: !0, | |
no: !0, | |
android: !0, | |
ua: !0, | |
el: !0, | |
sk: !0, | |
sl: !0, | |
ar: !0, | |
th: !0 | |
}, function (n, t, e) { | |
n.util = { | |
getX: function (n) { | |
for (var t = 0; null != n;) t += n.offsetLeft, n = n.offsetParent; | |
return t | |
}, | |
getY: function (n) { | |
for (var t = 0; null != n;) t += n.offsetTop, n = n.offsetParent; | |
return t | |
}, | |
getTouch: function (n) { | |
var t; | |
return n.originalEvent && (n = n.originalEvent), t = n.changedTouches && 1 == n.changedTouches.length ? n.changedTouches[0] : n.touches && 1 == n.touches.length ? n.touches[0] : !1 | |
}, | |
getScaledDims: function (n, t, e, r) { | |
r = r || e; | |
var i = n, | |
o = t, | |
a = n / t; | |
return (n > e || t > r) && (n - e > a * (t - r) ? (i = e, o = 0 | e * t / n + .5) : (i = 0 | r * a + .5, o = r)), { | |
width: i, | |
height: o | |
} | |
}, | |
nextFrame: function (n) { | |
setTimeout(n, 1) | |
}, | |
getDomain: function (n, t) { | |
var e, r, i, o, a, u, c; | |
return e = "http://" == n.substr(0, 7) ? 7 : "https://" == n.substr(0, 8) ? 8 : "ftp://" == n.substr(0, 6) ? 6 : 0, i = n.indexOf("/", e), -1 == i && (i = n.length), t ? r = e : (u = n, c = n.lastIndexOf(":"), u = c > e ? n.substring(e, c) : n.substring(e, i), u.match(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/) ? r = e : (o = n.lastIndexOf(".", i), a = n.lastIndexOf(".", o - 1), r = -1 == a ? e : a + 1)), n.substring(r, i) | |
}, | |
extend: function () { | |
var n, t, e, r, i, o, a = arguments[0] || {}, | |
u = 1, | |
c = arguments.length, | |
s = !1; | |
for ("boolean" == typeof a && (s = a, a = arguments[1] || {}, u = 2), "object" == typeof a || jQuery.isFunction(a) || (a = {}), c === u && (a = this, --u); c > u; u++) if (null != (n = arguments[u])) for (t in n) e = a[t], r = n[t], a !== r && (s && r && (jQuery.isPlainObject(r) || (i = jQuery.isArray(r))) ? (i ? (i = !1, o = e && jQuery.isArray(e) ? e : []) : o = e && jQuery.isPlainObject(e) ? e : {}, a[t] = jQuery.extend(s, o, r)) : void 0 !== r && (a[t] = r)); | |
return a | |
}, | |
findItemByKeyValueFromArray: function (n, t, e) { | |
var r, i; | |
for (e.length, r = 0; r < e.length; r++) if (e[r] && e[r][n] && e[r][n] === t) { | |
i = e[r]; | |
break | |
} | |
return i | |
}, | |
loadFile: function () { | |
var n, t, r, i, o = 0, | |
a = function (n, t) { | |
function e(n) { | |
(4 == this.readyState || "complete" == this.readyState || "loaded" == this.readyState) && t(n) | |
} | |
t && ("Microsoft Internet Explorer" == navigator.appName ? n.onreadystatechange = e : n.onload = t) | |
}; | |
return n = a, function (a, u, c) { | |
var s; | |
return "js" == u ? (s = e.createElement("script"), s.setAttribute("type", "text/javascript"), n(s, c), s.setAttribute("src", a)) : "css" == u ? e.createStyleSheet ? e.createStyleSheet(a, o++) : (s = e.createElement("link"), s.setAttribute("rel", "stylesheet"), s.setAttribute("type", "text/css"), s.setAttribute("href", a)) : "img" == u && (s = e.createElement("img"), n(s, c), s.setAttribute("src", a)), s && (t = t || e.getElementsByTagName("head")[0], "js" == u ? t.appendChild(s) : "css" == u && (r = r || e.createDocumentFragment(), r.appendChild(s), t.insertBefore(s, i))), s | |
} | |
}(), | |
getImageElem: function (n) { | |
return "string" == typeof n ? e.getElementById(n) : n.length ? n[0] : n | |
}, | |
getImageId: function (n) { | |
return "string" == typeof n ? n : n.id | |
}, | |
imgOnLoad: function (n, t) { | |
var e = avpw$(n); | |
e.load(t), (1 == e[0].complete || 4 == e[0].readyState || "complete" == e[0].readyState || "loaded" == e[0].readyState) && e.trigger("load") | |
}, | |
color_is_white: function (n) { | |
return n = n.toLowerCase(), "#fff" == n || "#ffffff" == n || "white" == n || "rgb(255,255,255)" == n || "rgb(255, 255, 255)" == n | |
}, | |
color_is_light: function (t) { | |
var e, r, i, o, a; | |
return e = r = i = 0, a = n.util.color_to_array(t), e = a[0], r = a[1], i = a[2], o = .2 * e + .7 * r + .1 * i, o > 127.5 | |
}, | |
color_expand: function (n) { | |
var t, e, r; | |
return 4 == n.length && (t = n.charAt(1), e = n.charAt(2), r = n.charAt(3), n = "#" + t + t + e + e + r + r), n | |
}, | |
color_to_array: function (t) { | |
var e, r, i; | |
return "#" == t.charAt(0) ? (t = n.util.color_expand(t), e = parseInt(t.substr(1, 2), 16), r = parseInt(t.substr(3, 2), 16), i = parseInt(t.substr(5, 2), 16)) : "r" == t.charAt(0).toLowerCase() && (t = n.util.rgb_to_color(t), e = parseInt(t.substr(1, 2), 16), r = parseInt(t.substr(3, 2), 16), i = parseInt(t.substr(5, 2), 16)), t = [e, r, i, 1] | |
}, | |
array_to_color: function (t) { | |
var e = n.util.array_to_rgb(t); | |
return e = n.util.rgb_to_color(e) | |
}, | |
array_to_rgb: function (n) { | |
var t = "rgb(0,0,0)"; | |
return n.join && (n.length > 3 && (n = n.slice(0, 3)), t = "rgb(" + n.join(",") + ")"), t | |
}, | |
color_to_rgb: function (t) { | |
return t = n.util.color_to_array(t), t = n.util.array_to_rgb(t) | |
}, | |
rgb_to_color: function (n) { | |
var t, e, r, i = /\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/, | |
o = n.match(i); | |
return o ? (t = parseInt(o[1]).toString(16), 1 == t.length && (t = "0" + t), e = parseInt(o[2]).toString(16), 1 == e.length && (e = "0" + e), r = parseInt(o[3]).toString(16), 1 == r.length && (r = "0" + r), "#" + t + e + r) : n | |
}, | |
color_to_int: function (t) { | |
return t = n.util.color_expand(t), t = n.util.rgb_to_color(t), parseInt(t.substr(1), 16) | |
}, | |
loadImagesSync: function (t, e) { | |
for (var r = 0, i = t.length, o = 0; i > o; o++) { | |
var a = t[o].img, | |
u = t[o].src; | |
a.onload = function () { | |
r++, e && r == t.length && n.util.nextFrame(e) | |
}, a.src = u | |
} | |
}, | |
getApiVersion: function (n) { | |
return n && n.apiVersion ? parseInt(n.apiVersion, 10) : 1 | |
}, | |
getUserFriendlyToolName: function (n) { | |
var t = { | |
overlay: "Stickers", | |
drawing: "Draw", | |
textwithfont: "Text", | |
colorsplash: "Splash", | |
tiltshift: "Tilt Shift", | |
forcecrop: "Crop" | |
}, | |
e = ""; | |
return n && (e = t[n] || n.substr(0, 1).toUpperCase() + n.substr(1)), e | |
}, | |
keyDownHandlerNumber: function (n, t) { | |
9 == n.keyCode || 27 == n.keyCode || 65 == n.keyCode && (n.ctrlKey === !0 || n.metaKey === !0) || n.keyCode >= 35 && n.keyCode <= 39 || ((n.keyCode < 48 || n.keyCode > 57) && (n.keyCode < 96 || n.keyCode > 105) && 46 !== n.keyCode && 8 !== n.keyCode ? n.preventDefault() : t && t.apply(this, [n])) | |
}, | |
addFontToPage: function (t, e) { | |
t || e && e(); | |
var r = t.value; | |
if (t.system) e && e(t); | |
else if (n.WebFont) { | |
var i = { | |
loading: function () { | |
n.controlsWidgetInstance && n.controlsWidgetInstance.showWaitThrobber(!0) | |
}, | |
active: function () { | |
n.controlsWidgetInstance && n.controlsWidgetInstance.showWaitThrobber(!1), e && e(t) | |
}, | |
inactive: function () { | |
n.controlsWidgetInstance && n.controlsWidgetInstance.showWaitThrobber(!1), n.errorNotify("UNSUPPORTED_FONT", [r]), e && e() | |
} | |
}; | |
t.custom ? (i.custom = { | |
families: [r], | |
urls: [t.url] | |
}, i.active = function () { | |
n.controlsWidgetInstance && n.controlsWidgetInstance.showWaitThrobber(!1), e && n.util.nextFrame(function () { | |
e(t) | |
}, 500) | |
}) : i.google = { | |
families: [r] | |
}, n.WebFont.load(i) | |
} | |
} | |
} | |
}(window.AV || (window.AV = {}), window, document), "undefined" == typeof AV && (AV = {}), AV.FlashAPI = function () { | |
var n = "avpw_canvas_swf", | |
t = null, | |
e = function () { | |
var n = function (n, t, e) { | |
var r = document.createElement("param"); | |
r.setAttribute("name", t), r.setAttribute("value", e), n.appendChild(r) | |
}, | |
t = function (t, e, r) { | |
var i = document.getElementById(r); | |
if (i) if ("undefined" == typeof t.id && (t.id = r), AV.msie) { | |
var o = ""; | |
for (var a in t) t[a] != Object.prototype[a] && ("data" == a.toLowerCase() ? e.movie = t[a] : "styleclass" == a.toLowerCase() ? o += ' class="' + t[a] + '"' : "classid" != a.toLowerCase() && (o += " " + a + '="' + t[a] + '"')); | |
var u = ""; | |
for (var c in e) e[c] != Object.prototype[c] && (u += '<param name="' + c + '" value="' + e[c] + '" />'); | |
i.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + o + ">" + u + "</object>", "undefined" == typeof objIdArr && (objIdArr = []), objIdArr[objIdArr.length] = t.id | |
} else { | |
var s = document.createElement("object"); | |
s.setAttribute("type", "application/x-shockwave-flash"); | |
for (var l in t) t[l] != Object.prototype[l] && ("styleclass" == l.toLowerCase() ? s.setAttribute("class", t[l]) : "classid" != l.toLowerCase() && s.setAttribute(l, t[l])); | |
for (var f in e) e[f] != Object.prototype[f] && "movie" != f.toLowerCase() && n(s, f, e[f]); | |
i.parentNode.replaceChild(s, i) | |
} | |
}, | |
e = function (n, e, r, i, o, a, u, c, s) { | |
r += "", i += ""; | |
var l = {}; | |
if (s && "object" == typeof s) for (var f in s) l[f] = s[f]; | |
l.data = n, l.width = r, l.height = i; | |
var p = {}; | |
if (c && "object" == typeof c) for (var h in c) p[h] = c[h]; | |
if (u && "object" == typeof u) for (var d in u)"undefined" != typeof p.flashvars ? p.flashvars += "&" + d + "=" + u[d] : p.flashvars = d + "=" + u[d]; | |
t(l, p, e) | |
}; | |
return function (n, t, r, i, o) { | |
o = o || {}; | |
var a = {}; | |
a.quality = "high", a.bgcolor = "#808080", a.allowscriptaccess = "always", a.allowfullscreen = "true"; | |
var u = {}; | |
u.id = n, u.name = n, AV.msie && AV.msie < 9 && (u.align = "center"), e(t, n + "_replace", r || "100%", i || "100%", "10.0.32", "", o, a, u) | |
} | |
}(), | |
r = function () {}; | |
r.prototype = function () { | |
return { | |
getPlugins: function () { | |
return [] | |
}, | |
createCanvas: function () { | |
this.initsize ? e(n, AV.build.feather_baseURL + "canvas.swf", this.initsize.width, this.initsize.height) : e(n, AV.build.feather_baseURL + "canvas.swf") | |
}, | |
_onComponentLoaded: function (t) { | |
switch (t) { | |
case "canvas": | |
var e = document.getElementById(n); | |
AV.FlashAPI._onCanvasLoaded(e); | |
break; | |
case "controls": | |
} | |
}, | |
_onComponentReady: function (n) { | |
var t = AV.paintWidgetInstance; | |
"canvas" === n && t.canvasReadyCallback && t.canvasReadyCallback.resolve() | |
} | |
} | |
}(); | |
var i = function () { | |
var n = [], | |
t = function () { | |
for (var t = 0; 256 > t; t++) n[t] = String.fromCharCode(t); | |
n[0] = String.fromCharCode(1) + String.fromCharCode(1), n[1] = String.fromCharCode(1) + String.fromCharCode(2) | |
}, | |
e = function (t) { | |
for (var e = "", r = 0; r < t.length; r += 4) e += n[t[r + 3]], e += n[t[r]], e += n[t[r + 1]], e += n[t[r + 2]]; | |
return e | |
}, | |
r = function (n) { | |
for (var t, e = [], r = 0, i = 0, o = [0, 0, 1]; i < n.length;) e[r++] = 1 != (t = n.charCodeAt(i++)) ? t : o[n.charCodeAt(i++)]; | |
return e | |
}, | |
i = {}; | |
return i.init = t, i.shutdown = function () { | |
n = [] | |
}, i.decode = r, i.encode = e, i | |
}(); | |
return function () { | |
var n = !1, | |
e = !1; | |
return { | |
mapToFlashToolName: function (n) { | |
switch (n) { | |
case "rotate": | |
return "rotate90" | |
} | |
return n | |
}, | |
mapFromFlashToolName: function (n) { | |
switch (n) { | |
case "rotate90": | |
return "rotate" | |
} | |
return n | |
}, | |
customBridge: function (n) { | |
var t = function () {}; | |
t.prototype = new r, t.prototype.constructor = r; | |
for (var e in n) t.prototype[e] = n[e]; | |
return t | |
}, | |
activate: function (n) { | |
this.bridge = n || new r, this.goldenEggCallback = null | |
}, | |
setHiresSize: function (n, t) { | |
this.canvas && this.canvas.setHiresSize(n, t) | |
}, | |
hiresSizeChanged: function (n, t) { | |
AV.paintWidgetInstance && AV.paintWidgetInstance.actions && AV.paintWidgetInstance.actions.setDims(n, t) | |
}, | |
startEditing: function (n) { | |
this.canvas = null, this.active_target = n, this.bridge.createCanvas() | |
}, | |
restartEditing: function (n) { | |
this.active_target = n, this._setupEditing() | |
}, | |
close: function () {}, | |
runGoldenEgg: function (n, t, e, r) { | |
this.goldenEggCallback = r, this.canvas.renderGoldenEgg(n, t, e) | |
}, | |
doCrop: function () { | |
this.canvas.executeCrop() | |
}, | |
activatePlugin: function (n) { | |
this.canvas.activatePlugin(n) | |
}, | |
deactivatePlugin: function (n) { | |
this.canvas.deactivatePlugin(n) | |
}, | |
changeProperty: function (n, t) { | |
this.canvas.changeProperty(n, t) | |
}, | |
applyPreviewFromPlugin: function (n) { | |
this.canvas.applyPreviewFromPlugin(n) | |
}, | |
commitChangesFromPlugin: function (n) { | |
this.canvas.commitChangesFromPlugin(n) | |
}, | |
discardChangesFromPlugin: function (n) { | |
this.canvas.discardChangesFromPlugin(n) | |
}, | |
resizeCanvas: function (n, t) { | |
var e = this.canvas; | |
e.width = n + "px", e.height = t + "px", AV.paintWidgetInstance && AV.paintWidgetInstance.setDimensions(n, t) | |
}, | |
hideCanvas: function () { | |
this.canvas && (this.canvas.style.visibility = "hidden") | |
}, | |
showCanvas: function () { | |
this.canvas && (this.canvas.style.visibility = "visible") | |
}, | |
executePlugin: function () { | |
this.canvas.executePlugin() | |
}, | |
renderPreview: function (n, t) { | |
this.canvas.renderPreview(n, t) | |
}, | |
getDynamicPropertyDefaultValue: function (n) { | |
return this.canvas.getDynamicPropertyDefaultValue(n) | |
}, | |
syncProperty: function () {}, | |
syncPreview: function () {}, | |
setCanvasDataArray: function (n, t, e) { | |
AV.canvasDataReceiver && AV.canvasDataReceiver.apply(this, [n, t, e]) | |
}, | |
setThumb: function () {}, | |
getHistory: function () { | |
return this.canvas.getHistory() | |
}, | |
getHiResStickerUrl: function (n) { | |
return AV.paintWidgetInstance && AV.paintWidgetInstance.overlayRegistry ? AV.paintWidgetInstance.overlayRegistry.getHiRes(n) : null | |
}, | |
getImageData: function (n, e) { | |
e && "function" == typeof e && (t = e), this.canvas.commit({}) | |
}, | |
getMaxSize: function () { | |
var n = AV.launchData.maxEditSize || AV.launchData.maxSize; | |
return n | |
}, | |
getMaxBitmapSize: function () { | |
return AV.launchData.maxSize | |
}, | |
_cropSelectionStarted: function () {}, | |
_onPreviewRendered: function () {}, | |
_onPluginLoaded: function (n) { | |
var t = AV.paintWidgetInstance; | |
t.moduleLoadedCallback && t.moduleLoadedCallback[n] && t.moduleLoadedCallback[n].resolve() | |
}, | |
_onImageLoaded: function (n, t) { | |
AV.paintWidgetLauncher_Flash_stage2 && AV.paintWidgetLauncher_Flash_stage2(n, t) | |
}, | |
_onGoldenEggComplete: function () { | |
this.goldenEggCallback && this.goldenEggCallback() | |
}, | |
_onCanvasLoaded: function (n) { | |
this.canvas = n, this._setupEditing(AV.launchData.url || null) | |
}, | |
_onGetImageDataComplete: function (n) { | |
t && (t.apply(this, [n]), t = null) | |
}, | |
_setupEditing: function (n) { | |
var t = this.bridge.getPlugins(); | |
n = n || this.active_target.src, this.canvas.setup(n, AV.build.proxyServer, t) | |
}, | |
_canUndo: function () { | |
return n | |
}, | |
_onUndo: function () { | |
this.canvas.undo() | |
}, | |
_canRedo: function () { | |
return e | |
}, | |
_onRedo: function () { | |
this.canvas.redo() | |
}, | |
_onHistoryChange: function (t, r) { | |
n = t, e = r, AV.controlsWidgetInstance && AV.controlsWidgetInstance.layoutNotify(AV.launchData.openType, "updateUndoRedo", [t, r]) | |
}, | |
setCheckpoint: function (n) { | |
this.canvas.setCheckpoint(n) | |
}, | |
isACheckpoint: function (n) { | |
return this.canvas.isACheckpoint(n) | |
}, | |
undoToCheckpoint: function () { | |
this.canvas.undoToCheckpoint() | |
}, | |
redoToCheckpoint: function () { | |
return this.canvas.redoToCheckpoint() | |
}, | |
truncateActionList: function () { | |
this.canvas.truncateActionList() | |
}, | |
_onError: function (n, t) { | |
"BAD_IMAGE" === n && (AV.paintWidgetCloser(!0), AV.launchData.url && (n = "BAD_URL")), AV.errorNotify(n, t) | |
}, | |
init: function (n) { | |
function t() { | |
if (!n) return new r; | |
if (n.plugins) { | |
for (var t = [], e = n.plugins, i = 0; i < e.length; ++i) { | |
var o = AV.FlashAPI.mapToFlashToolName(e[i]), | |
a = AV.toolDefaults[e[i]]; | |
a && a.files && t.push({ | |
id: o, | |
presets: a.presetsFlash, | |
files: a.files | |
}) | |
} | |
t.length > 0 && (n.getPlugins = function () { | |
return t | |
}), delete n.plugins | |
} | |
var u = function () {}; | |
u.prototype = new r, u.prototype.constructor = r; | |
for (var c in n) u.prototype[c] = n[c]; | |
return new u | |
} | |
AV.FlashAPI.activate(t()), i.init() | |
}, | |
pibeca: i | |
} | |
}() | |
}(), function (n) { | |
n.AV = n.AV || {}; | |
var t = n.AV; | |
return t.ImageSizeTracker = function () { | |
var n = this; | |
n.setImageScaledIndicator = function () { | |
t.controlsWidgetInstance.layoutNotify(t.launchData.openType, "updateImageScaledIndicator") | |
}, n.setOrigSize = function (e, r, i) { | |
var o, a; | |
if (e.hiresWidth && e.hiresHeight) o = parseInt(e.hiresWidth, 10), a = parseInt(e.hiresHeight, 10); | |
else if (e.hiresUrl) o = r.width, a = r.height; | |
else { | |
if (!e.displayImageSize) return null; | |
o = i.width, a = i.height | |
} | |
return t.paintWidgetInstance.actions.setOrigSize(o, a), n.setImageScaledIndicator(), { | |
width: o, | |
height: a | |
} | |
}, n.isDisplayingImageSize = function (n) { | |
return n.hiresWidth || n.hiresHeight || n.displayImageSize | |
}, n.isUsingHiResDimensions = function (n) { | |
return n.hiresWidth || n.hiresHeight || n.displayImageSize && n.hiresUrl | |
} | |
}, n | |
}(this, "undefined" != typeof window ? window : {}, "undefined" != typeof document ? document : {}), function (n, t, e) { | |
n.AV = n.AV || {}; | |
var r = n.AV, | |
i = r.Events; | |
return r.ToolManager = function (n) { | |
var o = null, | |
a = function (t) { | |
var e, i, o = n.activeTools, | |
a = !1; | |
if (o) for (i = o.length, e = 0; i > e; e++) if (o[e] === t) { | |
a = !0; | |
break | |
} | |
return "forcecrop" === t && r.launchData.forceCropPreset ? !0 : (a || r.errorNotify("UNSUPPORTED_TOOL", [t]), a) | |
}, | |
u = function (t, e, r) { | |
return n.objectNotify("tool", t, e, r) | |
}, | |
c = function (n) { | |
null != n && (avpw$(".avpw_controlpanel").each(function () { | |
avpw$(this).hide() | |
}), avpw$("#avpw_controlpanel_" + n).show()) | |
}, | |
s = function () { | |
var e, a = function (a) { | |
u(o, "panelWillClose"), u(a, "panelWillOpen"), i.trigger("canvas:activate", n.panelMode2WidgetMode(a)), c(a), u(a, "resetUI"), t.setTimeout(function (n) { | |
return function () { | |
u(n, "panelDidClose"), o = a, u(a, "panelDidOpen"), e = !1 | |
} | |
}(o), 200), o = a, n.layoutNotify(r.launchData.openType, "disableZoomMode") | |
}; | |
return function (n) { | |
e || (e = !0, a(n)) | |
} | |
}(), | |
l = function (t) { | |
if (!n.paintWidget || !n.paintWidget.busy) { | |
if (n.layoutNotify(r.launchData.openType, "showView", ["editpanel"]), s(t), r.controlsWidgetInstance.onEggWaitThrobber.stop(), "mobile" == r.launchData.openType) { | |
var i, o = e.getElementById("avpw_main_" + t); | |
o && (i = o.getAttribute("data-header"), i && (e.getElementById("avpw_control_toolname").innerHTML = i)) | |
} | |
r.usageTracker.addUsage(t) | |
} | |
}, | |
f = function () { | |
i.on("tool:open", d), i.on("tool:close", h), i.on("tool:init", g), i.on("tool:shutdown", y), i.on("tool:commit", v), i.on("tool:cancel", m), i.on("tool:undo", x), i.on("tool:redo", j) | |
}, | |
p = function () { | |
i.off("tool:open", d), i.off("tool:close", h), i.off("tool:init", g), i.off("tool:shutdown", y), i.off("tool:commit", v), i.off("tool:cancel", m), i.off("tool:undo", x), i.off("tool:redo", j) | |
}, | |
h = function () { | |
n.layoutNotify(r.launchData.openType, "showView", ["main"]), s(null) | |
}, | |
d = function (t, e) { | |
t = r.publicName2PanelMode(t), (a(t) || r.launchData.forceCropPreset) && n.paintWidget && !n.paintWidget.moduleLoaded(t, l) && e && (n.onEggWaitThrobber.stop(), n.onEggWaitThrobber.spin(avpw$(e).children(".avpw_icon_waiter")[0])), i.trigger("usage:tool", t, "opened"), i.trigger("usage:firstclick", t) | |
}, | |
g = function (t) { | |
u(t, "init", [n]) | |
}, | |
v = function () { | |
var n, t = o; | |
t && (n = u(o, "commit"), n !== !1 && (i.trigger("usage:tool", t, "applied", n !== !0 ? n : ""), i.trigger("tool:commitDone"))) | |
}, | |
m = function () { | |
u(o, "cancel"), i.trigger("usage:tool", o, "canceled") | |
}, | |
y = function (n) { | |
u(n, "shutdown") | |
}, | |
w = function () { | |
return n.paintWidget.busy ? !1 : u(o, "onUndo") === !1 ? !1 : (n.paintWidget.actions.undo(), u(o, "onUndoComplete"), !1) | |
}, | |
b = function () { | |
return n.paintWidget.busy ? !1 : u(o, "onUndo", [{ | |
global: !0 | |
}]) === !1 ? !1 : (n.paintWidget.actions.undoToCheckpoint(), u(o, "onUndoComplete", [{ | |
global: !0 | |
}]), !1) | |
}, | |
_ = function () { | |
return n.paintWidget.busy ? !1 : u(o, "onRedo") === !1 ? !1 : (n.paintWidget.actions.redo(), u(o, "onRedoComplete"), !1) | |
}, | |
k = function () { | |
if (n.paintWidget.busy) return !1; | |
if (u(o, "onRedo", [{ | |
global: !0 | |
}]) === !1) return !1; | |
var t = n.paintWidget.actions.redoToCheckpoint(); | |
return t && u(o, "onRedoComplete", [{ | |
global: !0 | |
}]), t | |
}, | |
x = function () { | |
i.trigger("usage:tool", "undo", "applied", o || ""), n.paintWidget.actions.isACheckpoint() ? b() : w() | |
}, | |
j = function () { | |
i.trigger("usage:tool", "redo", "applied", o || ""), k() || _() | |
}, | |
A = this; | |
return A.init = f, A.shutdown = p, A.notify = u, A.getActiveTool = function () { | |
return o | |
}, f(), A | |
}, n | |
}(this, "undefined" != typeof window ? window : {}, "undefined" != typeof document ? document : {}), function (n, t) { | |
n.AssetManager = function (e, r) { | |
var i, o = { | |
EFFECT: "effect", | |
STICKER: "sticker", | |
IMAGEBORDER: "imageborder", | |
PERMISSION: "permission", | |
FONTPACK: "fontpack" | |
}, | |
a = {}, | |
u = function () { | |
t.avpw_purchase_frame || avpw$("#avpw_messaging").append(n.template[n.launchData.layout].inAppPurchaseFrame({ | |
src: n.build.inAppPurchaseFrameURL | |
})) | |
}, | |
c = function (t) { | |
var e = t.resourceUrl; | |
e && (-1 === e.indexOf("http") && (e = n.build.feather_baseURL + e), t.resourceUrl = e) | |
}, | |
s = function (t) { | |
for (var e = 0; e < i.length; e++) for (var r = 0; r < t.length; r++) t[r].assetId === i[e].assetId && (i[e].purchased = !0, n.util.extend(i[e], t[r]), c(i[e])) | |
}, | |
l = function (n) { | |
var t = []; | |
if (n) { | |
n = o[n]; | |
for (var e = 0; e < i.length; e++) i[e].assetType === n && t.push(i[e]) | |
} else t = i.slice(0); | |
return t | |
}, | |
f = function (t, e) { | |
if (i) { | |
for (var r = 0; r < i.length; r++) c(i[r]); | |
e && e.apply(this, [l(t)]) | |
} else a.getPartnerAssets || (a.getPartnerAssets = [], m.authenticate()), a.getPartnerAssets.push(function (r) { | |
r && r.assets ? i = r.assets : (n.errorNotify("ERROR_AUTHENTICATING"), d()), n.util.nextFrame(function () { | |
if (i) { | |
for (var n = 0; n < i.length; n++) c(i[n]); | |
e && e.apply(this, [l(t)]) | |
} | |
}) | |
}) | |
}, | |
p = function (n, e) { | |
t.setTimeout(function () { | |
try { | |
return t.avpw_purchase_frame.postMessage("getAssets", "*"), a.getAssets = e, !0 | |
} catch (n) { | |
return !1 | |
} | |
}, 2e3) | |
}, | |
h = function (n, e) { | |
if (!i) return p(n, function (t) { | |
i = t; | |
for (var r = 0; r < i.length; r++) c(i[r]); | |
v(n, e) | |
}), !1; | |
try { | |
return t.avpw_purchase_frame.postMessage("getPurchasedAssets", "*"), a.getPurchasedAssets = function (t) { | |
s(t), e && e.apply(this, [l(n)]) | |
}, !0 | |
} catch (r) { | |
return !1 | |
} | |
}, | |
d = function (t, e) { | |
i = [{ | |
needsPurchase: !1, | |
assetId: "default_effects", | |
assetType: "effect", | |
displayName: "Default", | |
resourceUrl: "js/proclist_default_effects.js" | |
}, { | |
needsPurchase: !1, | |
assetId: "original_effects", | |
assetType: "effect", | |
displayName: "Original", | |
resourceUrl: "js/proclist_original_effects.js" | |
}, { | |
needsPurchase: !1, | |
assetId: "original_stickers", | |
assetType: "sticker", | |
displayName: "Original", | |
resourceUrl: "js/stickers_original_stickers.js" | |
}, { | |
needsPurchase: !1, | |
assetId: "borders", | |
assetType: "imageborder", | |
displayName: "Default Image Borders", | |
resourceUrl: "js/borders_original.js" | |
}]; | |
for (var r = 0; r < i.length; r++) c(i[r]); | |
return e && n.util.nextFrame(function () { | |
e.apply(this, [l(t)]) | |
}), !0 | |
}, | |
g = function (n) { | |
var t, e, r; | |
if (n.messageName && (r = a[n.messageName])) { | |
if ("function" == typeof r) r.apply(this, [n.data]); | |
else for (e = r.length, t = 0; e > t; t++) r[t].apply(this, [n.data]); | |
r = null | |
} | |
}, | |
v = e ? f : r ? h : d, | |
m = this; | |
return m.getAssets = v, m.getById = function (n) { | |
for (var t = 0; t < i.length; t++) if (i[t].assetId === n) return i[t] | |
}, m.showAssetPurchaseView = function (e, r) { | |
var i = { | |
messageName: "showAssetPurchaseView", | |
assetId: e | |
}; | |
i = n.JSON.stringify(i); | |
try { | |
return t.avpw_purchase_frame.postMessage(i, "*"), a.showAssetPurchaseView = function () { | |
m.showAssetPurchasePopup(e, r) | |
}, !0 | |
} catch (o) { | |
return !1 | |
} | |
}, m.showAssetPurchasePopup = function (t, e) { | |
avpw$("#avpw_purchase_frame").show(), n.controlsWidgetInstance.messager.show("avpw_purchase_pack", !0), avpw$("#avpw_purchase_pack_close").bind("click", m.hideAssetPurchasePopup), a.getPurchasedAssets = function (n) { | |
s(n); | |
var r = m.getById(t); | |
e && "function" == typeof e && r && e.apply(this, [r]), m.hideAssetPurchasePopup() | |
} | |
}, m.hideAssetPurchasePopup = function () { | |
a.getPurchasedAssets = null, avpw$("#avpw_purchase_frame").hide(), n.controlsWidgetInstance.messager.hide("avpw_purchase_pack"), avpw$("#avpw_purchase_pack_close").unbind("click", m.hideAssetPurchasePopup) | |
}, m.authenticate = function () { | |
var t = function (n) { | |
var t = { | |
messageName: "getPartnerAssets", | |
data: n | |
}; | |
g(t) | |
}; | |
return function () { | |
return n.controlsWidgetInstance.serverMessaging.sendMessage({ | |
id: "avpw_auth_form", | |
action: n.build.partnerAssetURL, | |
method: "POST", | |
dataType: "json", | |
announcer: n.build.asyncFeatherTargetAnnounce, | |
origin: n.build.asyncImgrecvBase, | |
keyValues: { | |
apikey: n.launchData.apiKey, | |
timestamp: n.launchData.timestamp, | |
signature: n.launchData.signature, | |
salt: n.launchData.salt, | |
encryptionmethod: n.launchData.encryptionMethod | |
}, | |
callback: t | |
}) | |
} | |
}(), m.types = o, r && u(), m | |
} | |
}(window.AV || (window.AV = {}), window, document), function (n, t, e) { | |
n.ServerMessaging = function () { | |
var r = [], | |
i = function (t, e) { | |
var i, o, a = !0, | |
u = r.shift(); | |
if (u && (e && u.origin && (a = e === n.util.getDomain(u.origin)), u.id && (i = avpw$("#" + u.id), o = i.attr("target"), avpw$("#" + o).unbind("load"), avpw$("#" + u.id + "_target_holder").empty(), i.remove()), a && u.callback)) { | |
if (u.dataType && "json" === u.dataType && "string" == typeof t) try { | |
t = n.JSON.parse(t) | |
} catch (c) {} | |
u.callback.call(this, t) | |
} | |
r.length > 0 && p() | |
}, | |
o = function (t, e, r, i, o) { | |
return avpw$.ajax({ | |
url: t, | |
type: e, | |
data: r, | |
dataType: i, | |
error: function () { | |
n.errorNotify("ERROR_SAVING", [n.build.imgrecvServer]) | |
}, | |
success: o | |
}) | |
}, | |
a = function (n, t, r, i, o) { | |
var a = avpw$("<form></form>").attr({ | |
id: n, | |
action: t, | |
target: r, | |
method: i || "POST" | |
}).css({ | |
display: "none" | |
}), | |
u = e.createDocumentFragment(); | |
for (var c in o) o.hasOwnProperty(c) && u.appendChild(avpw$("<input></input>").attr({ | |
name: c, | |
value: o[c], | |
type: "hidden" | |
})[0]); | |
return a.html(u), a.appendTo("#avpw_holder"), a | |
}, | |
u = function (t, e, r) { | |
return r || (r = n.build.feather_baseURL + "blank.html"), e || (e = t), ['<iframe width="1" height="1" ', 'style="position:absolute;left:-9999px;" ', 'id="' + t + '" name="' + e + '" src="' + r + '">', "</iframe>"].join("") | |
}, | |
c = function (n, t, e) { | |
if (!n) return null; | |
var r = n + "_target_holder", | |
i = Math.floor(4294967295 * Math.random()).toString(16), | |
o = "avpw_form_target_" + i, | |
a = avpw$("#" + r); | |
return a && a.length || (a = avpw$('<div id="' + r + '"></div>').css({ | |
position: "absolute", | |
top: 0, | |
left: 0 | |
}).appendTo("#avpw_holder")), a.html(u(o)), t ? avpw$("#" + o).load(function () { | |
l(o, n, t) | |
}) : avpw$("#" + o).load(e), o | |
}, | |
s = function (n, t, e, r, i, o, u) { | |
var s = c(n, o, u); | |
t += "?responsecontenttypeheader=" + escape("text/html"); | |
var l = a(n, t, s, e, i); | |
return l.submit(), l | |
}, | |
l = function (e, r, o) { | |
var a, c = r + "_announcer"; | |
if (t.postMessage) t[c] ? t[c].postMessage("avpw_load:" + e, "*") : (a = avpw$(u(c, c, o)), a.load(function () { | |
n.util.nextFrame(function () { | |
t[c].postMessage("avpw_load:" + e, "*") | |
}) | |
}), avpw$("#avpw_holder").append(a)); | |
else { | |
var s, l = function () { | |
avpw$(s).unbind().remove() | |
}, | |
f = r + "_observer", | |
p = f, | |
h = 0, | |
d = function () { | |
var t; | |
try { | |
if ("about:blank" == s.contentWindow.location) return | |
} catch (e) {} | |
2 === h && (t = s.contentWindow.name, t && (h = 3, t !== p && t.substr && "avpw:" == t.substr(0, 5) ? (t = t.substr(5), i(t)) : (n.errorNotify("ERROR_SAVING", [n.build.imgrecvServer]), i()), l())), 1 === h && (h = 2, s.contentWindow.location = ""), h || (h = 1) | |
}; | |
s = avpw$(u(f, p, o + "#" + e))[0], avpw$(s).load(d), avpw$(s).appendTo("#avpw_holder") | |
} | |
}, | |
f = function (t) { | |
var e = t.data, | |
r = n.util.getDomain(t.origin); | |
e.substr && "avpw:" == e.substr(0, 5) && (e = e.substr(5), i(e, r)) | |
}, | |
p = function () { | |
var n = r[0]; | |
n && s(n.id, n.action, n.method, n.origin, n.keyValues, n.announcer) | |
}, | |
h = function (n) { | |
n.announcer ? (r.push(n), 1 === r.length && p()) : s(n.id, n.action, n.method, n.origin, n.keyValues, n.announcer, n.callback) | |
}, | |
d = function (t) { | |
var e, r = t.transport || "xhr"; | |
"xhr" === r && avpw$.support.cors && (!n.firefox || n.firefox >= 4) ? (e = o(t.action, t.method, t.keyValues, t.dataType, t.callback), e || h(t)) : h(t) | |
}, | |
g = function () { | |
t.addEventListener ? t.addEventListener("message", f, !1) : t.attachEvent && t.attachEvent("onmessage", f) | |
}, | |
v = this; | |
return v.shutdown = function () { | |
t.removeEventListener ? t.removeEventListener("message", f, !1) : t.detachEvent && t.detachEvent("onmessage", f), r = [] | |
}, v.sendMessage = d, g(), v | |
} | |
}(window.AV || (window.AV = {}), window, document), function (n, t, e) { | |
n.AV = n.AV || {}; | |
var r = n.AV, | |
i = r.Events; | |
return r.usageTracker = { | |
clear: function () {}, | |
setup: function () {}, | |
shutdown: function () {}, | |
getUUID: function () {}, | |
addUsage: function () {}, | |
setPageCount: function () {}, | |
addPageHit: function () {}, | |
submit: function () {} | |
}, r.getActiveTools = function (n) { | |
var t = r.featherUseFlash ? r.flashSupportedTools : r.defaultTools, | |
e = n; | |
e && "all" !== e && "All" !== e && "ALL" !== e && "" !== e || (e = t), "string" == typeof e && (e = n.split(",")); | |
var i, o, a = [], | |
u = {}; | |
for (o = 0; o < t.length; o++) i = t[o], u[i] = !0; | |
for (o = 0; o < e.length; o++)(!r.launchData.forceCropPreset || "resize" !== e[o] && "orientation" !== e[o] && "crop" !== e[o]) && (i = r.publicName2PanelMode(e[o]), i in u && a.push(i)); | |
return a | |
}, r.paintWidgetGetPopupEmbedDiv = function (n) { | |
var t = avpw$("#avpw_canvas_embed_popup"); | |
if (n) { | |
var r, i, o, a = avpw$(n), | |
u = ["top", "left", "bottom", "right", "margin-top", "margin-right", "margin-bottom", "margin-left", "border-top", "border-right", "border-bottom", "border-left", "padding-top", "padding-right", "padding-bottom", "padding-left"], | |
c = { | |
position: "relative" | |
}; | |
for (i = 0; i < u.length; i++) o = u[i], c[o] = a.css(o); | |
r = avpw$(n).css("display"), ("" == r || "inline" == r) && (r = "inline-block"), c.display = r, 0 == t.length && (t = e.createElement("div"), t.id = "avpw_canvas_embed_popup"), avpw$(t).hide().css(c).insertBefore(n) | |
} | |
return t | |
}, r.paintWidgetLauncher = function (n, t) { | |
return r.paintWidgetInstance ? void 0 : (r.usageTracker.clear(), r.featherUseFlash ? r.paintWidgetLauncher_Flash(n, t) : r.paintWidgetLauncher_HTML(n, t)) | |
}, r.paintWidgetLauncher_Flash = function (n, o) { | |
function a() { | |
avpw$(c).unbind("load", a), r.msie && 7 == r.msie && (avpw$("#avpw_controls").css("visibility", "hidden"), avpw$("#avpw_controls").show()), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "placeControls_Flash", [r.util.getApiVersion(r.launchData) > 1 ? r.launchData.appendTo : void 0]), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "enableControls"), l = r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getScaledImageDims_Flash", [c]), f = l.width, p = l.height, h = f > p ? f : p, r.launchData.maxEditSize = h, r.paintWidgetInstance = new r.PaintWidget(f, p, new r.Actions, new r.ModeManager, new r.FilterManager, new r.OverlayRegistry, new r.ImageBorderManager), r.paintWidgetInstance.setOrigSize(f, p); | |
var e = r.template[r.launchData.layout].flashCanvasBox({ | |
id: "avpw_canvas_swf_replace" | |
}); | |
avpw$(s).append(e), r.controlsWidgetInstance.initAllTools.call(r.controlsWidgetInstance); | |
var u = { | |
initsize: l, | |
plugins: g, | |
action: { | |
origUrl_: o ? o : y.src, | |
sessionID_: r.usageTracker.getUUID(), | |
referrerUrl_: t.location.href, | |
url: r.build.imgrecvServer, | |
name: "file" | |
} | |
}; | |
r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "hideOriginalImage", [y]), r.util.nextFrame(function () { | |
r.controlsWidgetInstance.setupScrollPanels() | |
}), r.msie && 7 == r.msie && (avpw$("#avpw_controls").hide(), avpw$("#avpw_controls").css("visibility", "visible")), avpw$("#avpw_controls").fadeIn(m), r.launchData.noCloseButton && avpw$("#avpw_control_cancel_pane").css("display", "none"), setTimeout(function () { | |
r.FlashAPI.init(u), r.FlashAPI.startEditing(n), r.controlsWidgetInstance.initWithPaintWidget(r.paintWidgetInstance), i.trigger("tool:close"), r.controlsWidgetInstance.loaderPhase = 1 | |
}, m) | |
} | |
function u() { | |
r.util.imgOnLoad(c, a), avpw$(c).attr("src", o ? o : w) | |
} | |
var c, s, l, f, p, h, d, g, v, m = r.launchData.launchDelay, | |
y = r.util.getImageElem(n), | |
w = y.src; | |
g = r.getActiveTools(r.launchData.tools), v = new r.AssetManager(r.launchData.isPremiumPartner, r.launchData.allowInAppPurchase), r.controlsWidgetInstance = new r.ControlsWidget(null, n, g, v, new r.ServerMessaging), r.controlsWidgetInstance.origURL = o ? o : avpw$(y).attr("src"), avpw$(".avpw_isa_previewcanvas").hide(), s = r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getEmbedElement", [y]), avpw$(s).show(), d = "js/featherpaint_flash.js", c = e.createElement("img"), avpw$(c).css({ | |
display: "block", | |
visibility: "hidden", | |
position: "absolute" | |
}).attr("src", o ? o : y.src), r.build.bundled ? u() : r.util.loadFile(r.build.feather_baseURL + d, "js", u) | |
}, r.paintWidgetLauncher_Flash_stage2 = function (n, t) { | |
r.controlsWidgetInstance.loaderPhase = 2, r.controlsWidgetInstance.imageSizeTracker.setOrigSize(r.launchData, { | |
width: n, | |
height: t | |
}, { | |
width: r.paintWidgetInstance.width, | |
height: r.paintWidgetInstance.height | |
}), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "launchStage2_Flash"), r.controlsWidgetInstance.showWaitThrobber(!1), avpw$(r.controlsWidgetInstance.onEggWaitThrobber).hide(), i.trigger("usage:submit", "launch"), r.fireLaunchComplete() | |
}, r.paintWidgetLauncher_HTML = function (n, t) { | |
var i, o, a, u, c, s, l = r.launchData.launchDelay, | |
f = r.util.getImageElem(n); | |
return c = r.getActiveTools(r.launchData.tools), r.isRelaunched && "undefined" != typeof f.avpw_prevURL && (t = f.avpw_prevURL), s = new r.AssetManager(r.launchData.isPremiumPartner, r.launchData.allowInAppPurchase), r.controlsWidgetInstance = new r.ControlsWidget(null, n, c, s, new r.ServerMessaging), r.launchData.image instanceof HTMLImageElement && !t && (t = n.src), t && 0 === t.indexOf("//") && (t = e.location.protocol + t), r.controlsWidgetInstance.origURL = t ? t : avpw$(f).attr("src"), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "placeControls", [r.util.getApiVersion(r.launchData) > 1 ? r.launchData.appendTo : void 0]), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "enableControls"), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "bindEvents"), avpw$("#avpw_controls").fadeIn(l), r.util.nextFrame(function () { | |
"mobile" == r.launchData.openType && r.setPageWidth(avpw$("#avpw_controls").width()), r.controlsWidgetInstance.setupScrollPanels() | |
}), r.launchData.noCloseButton && avpw$("#avpw_control_cancel_pane").css("display", "none"), f && "canvas" === f.nodeName.toLowerCase() ? (r.mockLauncher(f), void 0) : (a = "js/featherpaint.js", o = r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getEmbedElement", [f]), i = e.createElement("img"), i.id = "avpw_temp_loading_image", r.tempLoadingImageSrc = i.src, avpw$(i).load(function () { | |
u = r.controlsWidgetInstance.getScaledDims(avpw$(f).width(), avpw$(f).height()), i.width = u.width, i.height = u.height, r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getScaledImageDims", [i]), avpw$(i).unbind(), i.style.display = "block", avpw$(o).append(i), r.controlsWidgetInstance.showWaitThrobber(!0), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "hideOriginalImage", [f]), avpw$(o).show(), r.util.nextFrame(function () { | |
r.build.bundled ? r.paintWidgetLauncher_stage2(n, t) : r.util.loadFile(r.build.feather_baseURL + a, "js", function () { | |
r.paintWidgetLauncher_stage2(n, t) | |
}) | |
}) | |
}).error(function () { | |
r.paintWidgetCloser(!0), r.errorNotify("BAD_IMAGE", [t]) | |
}), i.src = f.src, !1) | |
}, r.mockLauncher = function (n) { | |
var t = r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getEmbedElement", [n]); | |
r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getScaledImageDims", [n]), avpw$(n).detach(), avpw$(t).append(n), avpw$(t).show(), r.controlsWidgetInstance.showWaitThrobber(!0), r.util.nextFrame(function () { | |
var n = function () {}; | |
r.controlsWidgetInstance.initAllTools = function () { | |
for (var n in this.activeTools) { | |
var t = this.activeTools[n]; | |
this.tool.hasOwnProperty(t) && i.trigger("tool:init", t) | |
} | |
}, r.controlsWidgetInstance.initWithPaintWidget = function (n) { | |
this.paintWidget = n, this.initAllTools(), this.bindControls(), this.paintWidget.showWaitThrobber = this.showWaitThrobber.AV_bindInst(this) | |
}, r.controlsWidgetInstance.loaderPhase = 1, r.paintWidgetInstance = { | |
moduleLoaded: function (n, t) { | |
return t.call(this) | |
}, | |
setMode: n, | |
setCurrentLayerByName: n, | |
shutdown: n, | |
actions: { | |
setCheckpoint: n | |
} | |
}, r.controlsWidgetInstance.initWithPaintWidget(r.paintWidgetInstance), r.controlsWidgetInstance.showWaitThrobber(!1), r.controlsWidgetInstance.loaderPhase = 2, r.fireLaunchComplete() | |
}) | |
}, r.paintWidgetLauncher_stage2 = function (n, t) { | |
var e, o, a = r.util.getImageElem(n), | |
u = function (n) { | |
r.controlsWidgetInstance && r.paintWidgetInstance && (e = new Image, avpw$.support.cors && r.launchData.enableCORS && -1 === n.indexOf("data:") && (e.crossOrigin = "Anonymous"), avpw$(e).load(function () { | |
if (r.controlsWidgetInstance && r.paintWidgetInstance) { | |
if (o = r.controlsWidgetInstance.getScaledDims(e.width, e.height), r.controlsWidgetInstance.imageSizeTracker.setOrigSize(r.launchData, e, o), e.width = o.width, e.height = o.height, r.paintWidgetInstance.setDimensions(o.width, o.height), !r.paintWidgetInstance.setBackground(e)) return r.paintWidgetCloser(!0), r.errorNotify("IMAGE_NOT_CLEAN", [t]), !1; | |
r.paintWidgetInstance.setOrigSize(o.width, o.height), a.src !== t && r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "scaleCanvas"), avpw$(r.paintWidgetInstance.canvas).insertBefore("#avpw_temp_loading_image"), c.remove(), r.tempLoadingImageSrc = t, r.controlsWidgetInstance.showWaitThrobber(!1), r.controlsWidgetInstance.loaderPhase = 2, r.launchData.actionListJSON && r.paintWidgetInstance.actions.importJSON(r.launchData.actionListJSON, r.fireLaunchComplete) | |
} | |
}).attr("src", n)) | |
}; | |
o = r.controlsWidgetInstance.getScaledDims(avpw$(a).width(), avpw$(a).height()), r.controlsWidgetInstance.loaderPhase = 1, r.paintWidgetInstance = new r.PaintWidget(o.width, o.height, new r.Actions, new r.ModeManager, new r.FilterManager, new r.OverlayRegistry, new r.ImageBorderManager), r.controlsWidgetInstance.canvasUI = new r.PaintUI(r.paintWidgetInstance.canvas, r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "getEmbedElement")), r.controlsWidgetInstance.initWithPaintWidget(r.paintWidgetInstance), r.paintWidgetInstance.setOrigSize(o.width, o.height), r.controlsWidgetInstance.imageSizeTracker.setOrigSize(r.launchData, a, o); | |
var c = avpw$("#avpw_temp_loading_image"); | |
if (r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "scaleCanvas"), null != t)!avpw$.support.cors || !r.launchData.enableCORS || avpw$.browser.msie || avpw$.browser.safari && -1 === navigator.userAgent.indexOf("Chrome") ? -1 === t.indexOf("data:") ? avpw$.ajax({ | |
type: "GET", | |
dataType: "json", | |
url: r.build.jsonp_imgserver + "?callback=?", | |
data: { | |
url: escape(t) | |
}, | |
success: function (n) { | |
u(n.data) | |
}, | |
error: function (n, e) { | |
200 === n.status && "parsererror" === e && r.controlsWidgetInstance && (r.controlsWidgetInstance.showWaitThrobber(!1), r.util.nextFrame(function () { | |
r.paintWidgetCloser(!0), r.errorNotify("BAD_URL", [t]) | |
})) | |
} | |
}) : u(t) : u(t); | |
else { | |
if (!r.paintWidgetInstance.setBackground(a)) return r.paintWidgetCloser(!0), r.launchData.enableCORS && avpw$.support.cors ? r.errorNotify("ERROR_BAD_IMAGE_WITHOUT_CORS") : r.errorNotify("IMAGE_NOT_CLEAN", [t]), !1; | |
avpw$("#avpw_controls").insertAfter(r.paintWidgetInstance.canvas), avpw$(r.paintWidgetInstance.canvas).insertBefore(c), c.remove(), r.tempLoadingImageSrc = a.src, r.controlsWidgetInstance.showWaitThrobber(!1), r.controlsWidgetInstance.loaderPhase = 2, r.launchData.actionListJSON && r.paintWidgetInstance.actions.importJSON(r.launchData.actionListJSON, r.fireLaunchComplete) | |
} | |
return i.trigger("usage:submit", "launch"), r.launchData.actionListJSON || r.fireLaunchComplete(), !1 | |
}, r.fireLaunchComplete = function () { | |
var n = r.launchData.initTool; | |
n && (r.util.nextFrame(function () { | |
i.trigger("tool:open", n) | |
}), r.paintWidgetInstance.moduleLoaded(n, function () { | |
r.util.nextFrame(function () { | |
avpw$("#avpw_holder").removeClass("avpw_init_hide") | |
}) | |
})), "function" == typeof r.launchData.onReady && r.launchData.onReady() | |
}, r.paintWidgetShutdown = function () { | |
i.trigger("usage:submit", "close"), r.paintWidgetInstance && r.paintWidgetInstance.shutdown(), r.controlsWidgetInstance && (r.controlsWidgetInstance.serverMessaging && (r.controlsWidgetInstance.serverMessaging.shutdown(), r.controlsWidgetInstance.serverMessaging = null), r.controlsWidgetInstance.shutdown()), r.featherUseFlash && r.FlashAPI.close(), avpw$("#avpw_controls").hide(), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "onShutdown"), "function" == typeof r.launchData.onClose && r.launchData.onClose(r.paintWidgetInstance.dirty), r.paintWidgetInstance = null, r.controlsWidgetInstance = null, r.tempLoadingImageSrc = null | |
}, r.paintWidgetCloser = function (n) { | |
var t = r.launchData.closeDelay; | |
r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "onClose", [n]), n || 0 === t ? (avpw$("#avpw_controls").hide(), r.paintWidgetShutdown()) : avpw$("#avpw_controls").fadeOut(t, function () { | |
r.paintWidgetInstance && r.paintWidgetShutdown() | |
}) | |
}, r.controlsWidget_saveResponder = function (n, t, e) { | |
var o; | |
if ("function" == typeof n && (o = n.apply(r.launchData, [r.util.getImageId(r.controlsWidgetInstance.paintImgIdElem), t, e])), r.controlsWidgetInstance) { | |
var a = r.util.getImageElem(r.controlsWidgetInstance.paintImgIdElem); | |
a.avpw_prevURL = t, i.trigger("tool:close"), o && r.controlsWidgetInstance.messager.show("avpw_aviary_beensaved", !0), r.controlsWidgetInstance.paintWidget.dirty = !1, r.controlsWidgetInstance.saving = !1 | |
} | |
}, r.controlsWidget_onImageSaved = function (n, t) { | |
r.controlsWidget_saveResponder(r.launchData.onSave, n, t) | |
}, r.controlsWidget_onHiResImageSaved = function (n) { | |
"https:" === e.location.protocol && (n = n.replace("http:", "https:")), r.controlsWidget_saveResponder(r.launchData.onSaveHiRes, n) | |
}, r.ControlsWidget = function (n, t, e, o, a) { | |
this.maxWidth = parseInt(r.launchData.maxSize), this.maxHeight = this.maxWidth, this.saving = !1, this.origURL = null, this.activeTools = e, this.quitCount = 0, r.usageTracker.setup(), this.paintImgIdElem = t, i.on("layout:resize", this.setupScrollPanels, this), this.layoutNotify(r.launchData.openType, "showView", ["main"]), n && this.initWithPaintWidget(n); | |
var u = { | |
className: "avpw_canvas_spinner", | |
lines: 12, | |
length: 6, | |
width: 2, | |
radius: 6, | |
color: "#fff", | |
speed: .5, | |
trail: 70 | |
}, | |
c = { | |
className: "avpw_tool_spinner", | |
lines: 12, | |
length: 6, | |
width: 2, | |
radius: 6, | |
color: "#fff", | |
speed: .5, | |
trail: 70 | |
}; | |
"mobile" != r.launchData.openType && (c.color = "#555", c.length = 4), this.waitThrobber = new r.Spinner(u), this.onEggWaitThrobber = new r.Spinner(c), this.toolManager = new r.ToolManager(this), this.assetManager = o, this.serverMessaging = a | |
}, r.ControlsWidget.prototype.tool = {}, r.ControlsWidget.prototype.layout = {}, r.ControlsWidget.prototype.layoutNotify = function (n, t, e) { | |
return this.objectNotify("layout", n, t, e) | |
}, r.ControlsWidget.prototype.objectNotify = function (n, t, e, r) { | |
if ("object" == typeof this[n][t]) { | |
var i = this[n][t]; | |
if ("function" == typeof i[e]) { | |
var o = i[e]; | |
return r || (r = []), o.apply(i, r) | |
} | |
} | |
return !0 | |
}, r.ControlsWidget.prototype.shutdown = function () { | |
this.canvasUI && this.canvasUI.shutdown(), this.messager && this.messager.hide(), i.off("layout:resize", this.setupScrollPanels), this.shutdownAllTools(), this.unbindControls(), this.toolsPager && (this.toolsPager.shutdown(), this.toolsPager = null), this.paintWidget && (this.paintWidget.showWaitThrobber = null), r.usageTracker.shutdown(), this.waitThrobber.stop(), this.onEggWaitThrobber.stop(), this.waitThrobber = null, this.onEggWaitThrobber = null, this.showPanel(null), this.toolManager.shutdown(), this.toolManager = null | |
}, r.ControlsWidget.prototype.initAllTools = function () { | |
r.paintWidgetInstance.filterManager.loadPack("tools"); | |
for (var n in this.activeTools) { | |
var t = this.activeTools[n]; | |
this.tool.hasOwnProperty(t) && r.paintWidgetInstance.moduleLoaded(t, function (n) { | |
i.trigger("tool:init", n) | |
}.AV_bindInst(this)) | |
} | |
r.launchData.forceCropPreset && r.paintWidgetInstance.moduleLoaded("forcecrop", function () { | |
i.trigger("tool:init", "forcecrop") | |
}.AV_bindInst(this)) | |
}, r.ControlsWidget.prototype.shutdownAllTools = function () { | |
for (var n in this.activeTools) { | |
var t = this.activeTools[n]; | |
i.trigger("tool:shutdown", t) | |
} | |
}, r.ControlsWidget.prototype.bindControls = function () {}, r.ControlsWidget.prototype.unbindControls = function () {}, r.ControlsWidget.prototype.initWithPaintWidget = function (n) { | |
this.paintWidget = n, this.imageSizeTracker = new r.ImageSizeTracker(n.actions), r.featherUseFlash || this.initAllTools(), this.bindControls(), this.paintWidget.showWaitThrobber = this.showWaitThrobber.AV_bindInst(this) | |
}, r.ControlsWidget.prototype.showWaitThrobber = function (n, e) { | |
var i = 300, | |
o = this; | |
if (n) { | |
var a = this.layoutNotify(r.launchData.openType, "getEmbedElement"); | |
a.is(":visible") && (this.waitThrobber.spin(a[0]), avpw$(this.waitThrobber).fadeIn(i)) | |
} else avpw$(o.waitThrobber.el).fadeOut(i, o.waitThrobber.stop); | |
e && t.setTimeout(e, 5) | |
}, r.publicName2PanelMode = function (n) { | |
return "stickers" === n && (n = "overlay"), "draw" === n && (n = "drawing"), "text" !== n || r.featherUseFlash || (n = "textwithfont"), n | |
}, r.ControlsWidget.prototype.panelMode2WidgetMode = function (n) { | |
switch (n) { | |
case "rotate": | |
return "rotate90"; | |
case "greeneye": | |
return "redeye"; | |
case "pinch": | |
return "bulge" | |
} | |
return n | |
}, r.ControlsWidget.prototype.setupScrollPanels = function () { | |
if (this.activeTools && this.activeTools.length) { | |
var n, t, e, o = this, | |
a = {}, | |
u = this.layoutNotify(r.launchData.openType, "getDims").TOOLS_BROWSER_WIDTH, | |
c = function () { | |
o.toolsPager = new r.Pager(s) | |
}, | |
s = { | |
itemCount: this.activeTools.length, | |
itemsPerPage: this.layoutNotify(r.launchData.openType, "getToolsPerPage"), | |
pageWidth: u, | |
leftArrow: avpw$("#avpw_lftArrow"), | |
rightArrow: avpw$("#avpw_rghtArrow"), | |
itemBuilder: function (e) { | |
return n = o.activeTools[e], t = r.util.getUserFriendlyToolName(n), t = r.getLocalizedString(t), r.template[r.launchData.layout].eggIcon({ | |
optionName: n, | |
capOptionName: t | |
}) | |
}, | |
pageTemplate: r.template[r.launchData.layout].genericScrollPanel, | |
pipTemplate: r.template[r.launchData.layout].scrollPanelPip, | |
lastPageTemplate: e, | |
lastPageContents: a, | |
pageContainer: avpw$("#avpw_control_main_scrolling_region"), | |
pipContainer: avpw$("#avpw_tools_pager ul"), | |
onPageChange: function (n) { | |
r.usageTracker.addPageHit(n) | |
} | |
}; | |
c(), avpw$("#avpw_control_main_scrolling_region").css("width", o.toolsPager.getPageCount() * u + "px"), this.assetManager.getAssets("PERMISSION", function (n) { | |
var t = !0; | |
if (n) for (var e = 0; e < n.length; e++) if (n[e] && "whitelabel" === n[e].assetId) { | |
t = !1; | |
break | |
} | |
t ? (avpw$("#avpw_powered_branding").html(r.template[r.launchData.layout].poweredByFooterLogo).click(function () { | |
i.trigger("modal:show", "avpw_aviary_aviaryfeedback", !1, !1) | |
}), o.toolsPager.shutdown(), c(), avpw$("#avpw_control_main_scrolling_region").css("width", o.toolsPager.getPageCount() * u + "px"), o.toolsPager.changePage()) : avpw$("#avpw_controls").addClass("avpw_white_label") | |
}), r.usageTracker.setPageCount(o.toolsPager.getPageCount()), o.toolsPager.changePage() | |
} | |
}, r.ControlsWidget.prototype.messager = function () { | |
var n, e, o, a = {}, | |
u = 1e3, | |
c = { | |
show: function (i, o, c) { | |
n = n || avpw$("#avpw_messaging"), e = e || avpw$("#avpw_messaging_inner"); | |
var s = a[i] || (a[i] = avpw$("#" + i)); | |
e.append(s), n.fadeIn(150), o ? (n.data("needsConfirmation", !0), r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "disableControls")) : (n.data("needsConfirmation", !1), c || t.setTimeout(this.hide, u)) | |
}, | |
hide: function (e, i) { | |
if (n = n || avpw$("#avpw_messaging"), o = o || avpw$("#avpw_messages"), e) { | |
var u = a[e]; | |
u && o.append(u) | |
} else avpw$.each(a, function (n, t) { | |
o.append(t) | |
}); | |
n.data("needsConfirmation") ? (t.setTimeout(function () { | |
i && i() | |
}, 400), r.controlsWidgetInstance && r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "enableControls")) : (n.hide(), i && i()) | |
}, | |
addMessage: function (n) { | |
o = o || avpw$("#avpw_messages"), n && (o[0].innerHTML += n) | |
} | |
}; | |
return i.on("modal:show", c.show), i.on("modal:hide", c.hide), c | |
}(), r.ControlsWidget.prototype.orientationChanged = function () {}, r.ControlsWidget.prototype.windowResized = function () { | |
var n = null; | |
return function () { | |
t.clearTimeout(n), n = t.setTimeout(function () { | |
i.trigger("layout:resize"), n = null | |
}, 500) | |
} | |
}(), r.ControlsWidget.prototype.Slider = function (n) { | |
var t = !1, | |
e = function (e, r) { | |
!t && n.onstart && n.onstart.apply(this, [e, r]) | |
}, | |
r = function (e, r) { | |
!t && n.onchange && n.onchange.apply(this, [e, r]) | |
}, | |
i = function (e, r) { | |
!t && n.onslide && n.onslide.apply(this, [e, r]) | |
}, | |
o = avpw$(n.element).slider({ | |
range: "min", | |
max: n.max, | |
min: n.min, | |
value: n.defaultValue || n.max / 2, | |
delay: n.delay | |
}); | |
return this.getValue = function () { | |
return o.slider("value") | |
}, this.setValue = function (n) { | |
return o.slider("value", n) | |
}, this.reset = function () { | |
t = !0, this.setValue(n.defaultValue), t = !1 | |
}, this.addListeners = function () { | |
o.bind("slidestart", e).bind("slidechange", r).bind("slide", i) | |
}, this.removeListeners = function () { | |
o.unbind("slidestart").unbind("slide").unbind("slidechange") | |
}, this.shutdown = function () { | |
o.slider("destroy") | |
}, this | |
}, r.ControlsWidget.prototype._drawUICircle = function (n, t, e, i, o) { | |
r.featherUseFlash || this._drawUICircle_HTML(n, t, e, i, o) | |
}, r.ControlsWidget.prototype._drawUICircle_HTML = function (n, t, e, i, o) { | |
var a, u = avpw$(n)[0], | |
c = u.getContext("2d"); | |
c.clearRect(0, 0, u.width, u.height), o && "transparent" !== i && this._drawUIGrid(c, u.width, u.height), c.globalCompositeOperation = "source-over", null != e ? (c.strokeStyle = o && ("transparent" == e || r.util.color_is_white(e) || null == i) ? "#444" : e, a = 3) : (c.strokeStyle = "rgba(0,0,0,0)", a = 1), c.lineWidth = a, c.beginPath(), c.arc(u.width / 2, u.height / 2, t, 0, 2 * Math.PI, !0), c.stroke(), c.closePath(), null != i && (c.save(), c.clip(), o && "transparent" == i ? this._drawUIGrid(c, u.width, u.height) : (c.fillStyle = i, c.fillRect(0, 0, u.width, u.height)), c.restore()) | |
}, r.ControlsWidget.prototype._drawUIGrid = function (n, t, e, r) { | |
var i, o; | |
for (r || (r = 5), o = 0; e + r > o; o += r) for (i = 0; e + r > i; i += r) n.fillStyle = 1 == (1 & i + o) ? "#fff" : "#ddd", n.fillRect(i, o, r, r) | |
}, r.ControlsWidget.prototype.showPanel = function (n) { | |
null != n && (avpw$(".avpw_controlpanel").each(function () { | |
avpw$(this).hide() | |
}), avpw$("#avpw_controlpanel_" + n).show()) | |
}, r.ControlsWidget.prototype.save = function () { | |
var n = null, | |
e = !0, | |
o = 1e3, | |
a = function () { | |
return { | |
apikey: r.launchData.apiKey, | |
timestamp: r.launchData.timestamp, | |
signature: r.launchData.signature, | |
salt: r.launchData.salt, | |
encryptionmethod: r.launchData.encryptionMethod | |
} | |
}, | |
u = function (n, t, e) { | |
var i = r.controlsWidgetInstance; | |
if (i.layoutNotify(r.launchData.openType, "enableControls", [!0]), i.paintWidget.showWaitThrobber(!1), n) { | |
var o = avpw$(r.util.getImageElem(i.paintImgIdElem)); | |
o.avpw_prevURL = n, r.controlsWidget_onImageSaved(n, t) | |
} else r.errorNotify("ERROR_SAVING", [r.build.imgrecvServer, e]), r.controlsWidgetInstance.saving = !1 | |
}, | |
c = function (n, t) { | |
var e = r.controlsWidgetInstance; | |
if (e.layoutNotify(r.launchData.openType, "enableControls", [!0]), e.paintWidget.showWaitThrobber(!1), n) { | |
var i = avpw$(r.util.getImageElem(e.paintImgIdElem)); | |
i.avpw_prevURL = n, r.controlsWidget_onHiResImageSaved(n) | |
} else r.errorNotify("ERROR_SAVING", [r.build.asyncImgrecvBase, t]), r.controlsWidgetInstance.saving = !1 | |
}, | |
s = function (n, t) { | |
var e, r, i, o, a = ""; | |
if ("string" == typeof n) e = n.split("---FEATHER-POSTMESSAGE---"), r = e[0], i = e[1]; | |
else if (o = avpw$(n).find("error"), o.length > 0) a = o.text(); | |
else { | |
var c = avpw$(n).find("url"); | |
c && (r = c.text(), r = r.replace(/^\s+|\s+$/g, "")); | |
var s = avpw$(n).find("hiresurl"); | |
s && (i = s.text(), i = i.replace(/^\s+|\s+$/g, "")) | |
} | |
var l = [r, i, a]; | |
"function" == typeof t ? t.apply(this, l) : u.apply(this, l) | |
}, | |
l = function (n) { | |
var t = this; | |
t.paintWidget.exportImage(null, function (e) { | |
var i, o, u = e.indexOf(";", 0), | |
c = e.indexOf(",", u); | |
i = e.slice(5, u), o = e.slice(c + 1), e = "", r.controlsWidgetInstance.serverMessaging.sendMessage({ | |
id: "avpw_save_form", | |
action: r.build.imgrecvServer, | |
method: "POST", | |
announcer: r.build.featherTargetAnnounce, | |
origin: r.build.imgrecvBase, | |
keyValues: r.util.extend(a(), { | |
file: o, | |
postdata: r.launchData.postData, | |
posturl: r.launchData.postUrl, | |
sessionid: r.usageTracker.getUUID(), | |
actionlist: t.paintWidget.actions.exportJSON(!0), | |
origurl: t.origURL, | |
hiresurl: r.launchData.hiresUrl, | |
contenttype: r.launchData.fileFormat, | |
jpgquality: r.launchData.jpgQuality, | |
debug: r.launchData.debug, | |
asyncsave: r.launchData.asyncSave, | |
usecustomfileexpiration: r.launchData.useCustomFileExpiration, | |
encodedas: "base64text" | |
}), | |
callback: n || s | |
}) | |
}) | |
}, | |
f = function (n, t, e) { | |
var r = Math.round(10 * (t * e / 1e6)) / 10, | |
o = ["didHitAzure:" + (n ? "Yes" : "No"), " width:" + t, " height:" + e, " megaPixels:" + r].join(""); | |
i.trigger("usage:submit", "saveHiRes", o) | |
}, | |
p = function () { | |
var i = r.paintWidgetInstance.getScaledSize(), | |
u = function () { | |
if (f(!0, i.hiresWidth, i.hiresHeight), !r.launchData.hiresUrl) return r.errorNotify("ERROR_MISSING_HI_RES_URL"), void 0; | |
var u = r.util.extend(a(), { | |
actionlist: this.paintWidget.actions.exportJSON(!0), | |
origurl: r.launchData.hiresUrl, | |
fileformat: r.launchData.fileFormat, | |
notificationmethod: "GET", | |
backgroundcolor: "0xffffffff", | |
jpgquality: r.launchData.jpgQuality | |
}), | |
s = function (r) { | |
!r || r && "JobFailed" === r.JobStatusCode ? (c(null, r), t.clearInterval(n)) : r && "JobCompleted" === r.JobStatusCode && (t.clearInterval(n), c(r.JobStatus)), e = !0 | |
}, | |
l = function (i) { | |
var u; | |
i && i.JobId ? (u = i.JobId, n = t.setInterval(function () { | |
e && r.controlsWidgetInstance.serverMessaging.sendMessage({ | |
id: "avpw_save_form", | |
action: r.build.asyncImgrecvGetJobStatus, | |
method: "POST", | |
dataType: "json", | |
announcer: r.build.asyncFeatherTargetAnnounce, | |
origin: r.build.asyncImgrecvBase, | |
keyValues: r.util.extend(a(), { | |
jobid: u | |
}), | |
callback: s | |
}), e = !1 | |
}, o)) : c(null, i) | |
}; | |
r.controlsWidgetInstance.serverMessaging.sendMessage({ | |
id: "avpw_save_form", | |
action: r.build.asyncImgrecvCreateJob, | |
method: "POST", | |
dataType: "json", | |
announcer: r.build.asyncFeatherTargetAnnounce, | |
origin: r.build.asyncImgrecvBase, | |
keyValues: u, | |
callback: l | |
}) | |
}, | |
p = this, | |
h = function () { | |
l.apply(p, [function (n) { | |
f(!1, i.hiresWidth, i.hiresHeight), s.apply(this, [n, c]) | |
}]) | |
}, | |
d = -1 !== navigator.userAgent.indexOf("MSIE"); | |
if (d || r.launchData.forceHiResSave || r.launchData.hiresUrl !== r.launchData.url) u.call(this); | |
else { | |
var i = r.paintWidgetInstance.getScaledSize(), | |
g = r.launchData.maxSize, | |
v = r.launchData.hiresWidth, | |
m = r.launchData.hiresHeight; | |
v && m ? v > g && m > g ? u.call(this) : i.hiresWidth < g && i.hiresHeight < g ? h.call(this) : u.call(this) : u.call(this) | |
} | |
}, | |
h = function (n, t, e) { | |
var i = this; | |
i.paintWidget.exportImage(e, function (e) { | |
var i = r.controlsWidgetInstance; | |
i.saving = !1, i.layoutNotify(r.launchData.openType, "enableControls", [!0]), i.paintWidget.showWaitThrobber(!1), n && "function" == typeof n && (t ? t = n(e) === !1 ? !1 : !0 : n(e)), t && r.util.nextFrame(function () { | |
r.controlsWidget_onImageSaved(i.origURL) | |
}) | |
}) | |
}, | |
d = function (n, t, e, i) { | |
var o = !r.featherUseFlash; | |
o && this.layoutNotify(r.launchData.openType, "disableControls"), this.paintWidget.showWaitThrobber(o, function () { | |
switch (n) { | |
case "saveHiRes": | |
p.call(a); | |
break; | |
case "getImageData": | |
h.call(a, t, e, i); | |
break; | |
default: | |
l.call(a) | |
} | |
}); | |
var a = this; | |
return !1 | |
}; | |
return function (n, t, e, o) { | |
return r.controlsWidgetInstance.loaderPhase < 2 ? !1 : this.saving ? !1 : (i.trigger("tool:commit"), i.trigger("tool:close"), this.saving = !0, r.prevActionList = this.paintWidget.actions.exportJSON(!0), r.launchData.postData && "string" != typeof r.launchData.postData && (r.launchData.postData = r.JSON.stringify(r.launchData.postData)), d.apply(this, [n, t, e, o])) | |
} | |
}(), r.ControlsWidget.prototype.onSaveButtonClicked = function () { | |
if (i.trigger("usage:submit", "saveclicked"), "function" == typeof r.launchData.onSaveButtonClicked) { | |
var n = r.launchData.onSaveButtonClicked.apply(r.launchData, [r.util.getImageId(r.controlsWidgetInstance.paintImgIdElem)]); | |
if (n === !1) return !1 | |
} | |
return r.controlsWidgetInstance.save() | |
}, r.ControlsWidget.prototype.showAreYouSure = function () { | |
this.messager.show("avpw_aviary_quitareyousure", !0) | |
}, r.ControlsWidget.prototype.cancel = function () { | |
this.quitCount++; | |
var n = this.quitCount > 0 && this.paintWidget && this.paintWidget.dirty; | |
if ("function" == typeof r.launchData.onCloseButtonClicked) { | |
var t = r.launchData.onCloseButtonClicked.apply(r.launchData, [n]); | |
if (t === !1) return !1 | |
} | |
return n ? this.showAreYouSure() : r.paintWidgetCloser(), !1 | |
}, r.ControlsWidget.prototype.getScaledDims = function (n, t) { | |
return r.util.getScaledDims(n, t, this.maxWidth, this.maxHeight) | |
}, r.TransformStyle = function (n) { | |
var t = this, | |
e = n || ""; | |
return t.set = function (n) { | |
if (e) for (var t in n) { | |
var r = t + "\\([^\\)]*", | |
i = new RegExp(r), | |
o = !1, | |
a = function () { | |
return o = !0, t + "(" + n[t] | |
}; | |
e = e.replace(i, a), o || (e += " " + t + "(" + n[t] + ")") | |
} else for (var t in n) e += " " + t + "(" + n[t] + ")" | |
}, t.serialize = function () { | |
return e | |
}, t | |
}, n | |
}(this, "undefined" != typeof window ? window : {}, "undefined" != typeof document ? document : {}), function (n) { | |
n.errorNotify = function (t, e) { | |
var r = { | |
BAD_IMAGE: { | |
code: 1, | |
message: "There was a problem loading your image provided to the `image` config key. Either it's not actually an image file or it doesn't really exist." | |
}, | |
UNSUPPORTED: { | |
code: 2, | |
message: "It looks like you're using a browser that doesn't support the HTML canvas element (and also doesn't have Flash installed either). Please try accessing this page through a modern browser like Chrome, Firefox, Safari, or Internet Explorer (version 9 or higher). Your internets will thank you." | |
}, | |
BAD_URL: { | |
code: 3, | |
message: "There was a problem loading your image provided by URI to the `url` config key. It is not reachable by the public (and our service at " + (n.featherUseFlash ? n.build.proxyServer : n.build.imgrecvBase) + ")" | |
}, | |
UNSUPPORTED_TOOL: { | |
code: 4, | |
message: "So sorry, but this tool is not available because it is not part of the set chosen with the `tools` config key. It's alternatively possible that your browser does not support this specific tool." | |
}, | |
IMAGE_NOT_CLEAN: { | |
code: 5, | |
message: "Uh oh! We can't edit this image because the editor wasn't set up correctly to load external files via their address. You must either provide images from the same domain as the web page with the editor OR pass the external image address via the `url` config key in order for Aviary to be able to get permission from the browser to open it for editing. Sorry for the inconvenience!" | |
}, | |
UNSUPPORTED_FONT: { | |
code: 6, | |
message: "So sorry, but this font looks to be unsupported by your browser or platform" | |
}, | |
ERROR_SAVING: { | |
code: 7, | |
message: "There was a problem saving your photo. Please try again." | |
}, | |
NO_APIKEY: { | |
code: 8, | |
message: "apiKey is required and not provided. See http://www.aviary.com/web-documentation#constructor-config-apikey." | |
}, | |
ERROR_AUTHENTICATING: { | |
code: 9, | |
message: "There was a problem retrieving access to content from our server. Please ensure all authentication keys are present or do not attempt premium partner authentication." | |
}, | |
ERROR_BAD_THEME: { | |
code: 10, | |
message: "Selected theme does not exist. Please use 'dark', 'light' or 'minimum' or see aviary.com/web for more info." | |
}, | |
ERROR_BAD_IMAGE_WITHOUT_CORS: { | |
code: 11, | |
message: "The image URL you are trying to use is either not on the same domain or is not configured for CORS. See http://enable-cors.org/ for more info." | |
} | |
}, | |
i = function () {}, | |
o = r[t], | |
a = o.message; | |
return "function" == typeof n.launchData.onError && (o.args = e, a = n.launchData.onError(o) || a), a && i(a), a | |
} | |
}(window.AV || (window.AV = {}), window, document), function (n, t, e) { | |
n.AV = n.AV || {}; | |
var r = n.AV, | |
i = r.Events; | |
n.Aviary = r, r.feather_loaded = !1, r.feather_loading = !1, r.build = r.build || { | |
version: "", | |
imgrecvServer: "imgrecvserver", | |
flashGatewayServer: "", | |
imgrecvBase: "", | |
inAppPurchaseFrameURL: "", | |
imgtrackServer: "imgtrackserver", | |
filterServer: "", | |
jsonp_imgserver: "", | |
featherTargetAnnounce: "feather_target_announce_v3.html", | |
proxyServer: "", | |
feather_baseURL: "", | |
feather_stickerURL: "", | |
googleTracker: "", | |
MINIMUM_FLASH_PLAYER_VERSION: "10.2.0" | |
}, r.defaultTools = ["enhance", "effects", "frames", "overlay", "crop", "resize", "orientation", "focus", "brightness", "contrast", "saturation", "warmth", "sharpness", "colorsplash", "drawing", "textwithfont", "redeye", "whiten", "blemish"], r.flashSupportedTools = ["enhance", "effects", "overlay", "crop", "resize", "orientation", "brightness", "contrast", "saturation", "sharpness", "drawing", "text", "redeye", "blemish"]; | |
var o = {}; | |
return o.image = null, o.apiKey = void 0, o.apiVersion = 1, o.appendTo = null, o.language = "en", o.theme = null, o.minimumStyling = !1, o.maxSize = 800, o.noCloseButton = !1, o.launchDelay = 300, o.closeDelay = 300, o.forceCropPreset = null, o.forceHiResSave = !1, o.authenticationURL = null, o.tools = void 0, o.initTool = "", o.cropPresets = ["Custom", "Original", ["Square", "1:1"], "3:2", "3:5", "4:3", "4:5", "4:6", "5:7", "8:10", "16:9"], o.cropPresetDefault = "Custom", o.cropPresetsStrict = !1, o.url = null, o.enableCORS = !1, o.postUrl = void 0, o.postData = null, o.fileFormat = "", o.jpgQuality = 100, o.displayImageSize = !1, o.hiresMaxSize = 1e4, o.hiresWidth = null, o.hiresHeight = null, o.onLoad = void 0, o.onReady = void 0, o.onSaveButtonClicked = void 0, o.onSave = void 0, o.onSaveHiRes = void 0, o.onClose = void 0, o.onError = void 0, o.signature = null, o.timestamp = null, o.hiresUrl = void 0, o.useCustomFileExpiration = !1, o.allowInAppPurchase = !1, o.forceFlash = !1, o.forceSupport = !1, o.poweredByURL = "http://www.aviary.com", o.giveFeedbackURL = "http://support.aviary.com/", o.getWidgetURL = "http://www.aviary.com", o.debug = !1, o.asyncSave = !0, r.baseConfig = o, function (n) { | |
var t = function (n) { | |
return { | |
language: n.Feather_Language, | |
forceFlash: n.Feather_ForceFlash, | |
forceSupport: n.AV_Feather_ForceSupport, | |
onLoad: n.Feather_OnLoad, | |
onReady: n.Feather_OnLaunchComplete, | |
onClose: n.Feather_OnClose, | |
onSave: n.Feather_OnSave, | |
noCloseButton: n.Feather_NoCloseButton, | |
maxSize: n.Feather_MaxSize || n.Feather_MaxDisplaySize, | |
tools: n.Feather_EditOptions, | |
cropPresets: n.Feather_CropSizes, | |
resizePresets: n.Feather_ResizeSizes, | |
apiKey: n.Feather_APIKey, | |
hiresUrl: n.Feather_HiResURL, | |
postUrl: n.Feather_PostURL, | |
fileFormat: n.Feather_FileFormat || n.Feather_ContentType, | |
jpgQuality: n.Feather_FileQuality, | |
signature: n.Feather_Signature, | |
timestamp: n.Feather_Timestamp | |
} | |
}; | |
if (r.baseConfig = r.util.extend(r.baseConfig, t(n)), "https:" == n.location.protocol || "chrome-extension:" == n.location.protocol) { | |
var e, i; | |
for (var o in r.build) i = o.split("_SSL"), 2 === i.length && r.build[o] && (e = i[0], r.build[e] = r.build[o]) | |
}(n.Feather_Theme || n.Feather_OpenType || n.Feather_APIKey) && r.util.nextFrame(function () { | |
var e = new r.Feather(r.baseConfig); | |
n.aviaryeditor = function (i, o, a, u) { | |
r.launchData = r.util.extend(r.baseConfig, t(n)); | |
var c = r.util.extend(r.launchData, { | |
image: i, | |
url: o, | |
postData: a, | |
appendTo: u | |
}); | |
e.launch(c) | |
}, n.aviaryeditor_close = e.close, n.aviaryeditor_relaunch = e.relaunch, n.aviaryeditor_activatetool = e.activateTool, n.aviarynewimage = e.replaceImage | |
}) | |
}(t), r.getLocalizedString = function (n) { | |
try { | |
var t = r.lang[r.launchData.language][n]; | |
return void 0 === t && (t = n), t | |
} catch (e) {} | |
return n | |
}, Function.prototype.AV_bindInst = function (n) { | |
var t = this; | |
return function () { | |
return t.apply(n, arguments) | |
} | |
}, r.injectControls = function () { | |
var n, t; | |
if ("popup" == r.launchData.openType ? (n = "", t = r.template[r.launchData.layout].saveBlock()) : (n = r.template[r.launchData.layout].saveBlock(), t = ""), r.criticalLayoutStyles && !r.feather_loaded) { | |
var i = e.createElement("style"); | |
i.type = "text/css"; | |
var o = e.createTextNode(r.criticalLayoutStyles); | |
i.styleSheet ? i.styleSheet.cssText = o.nodeValue : i.appendChild(o); | |
var a = e.getElementsByTagName("head")[0]; | |
a.appendChild(i) | |
} | |
var u = r.template[r.launchData.layout].controls({ | |
internalSaveBlock: n, | |
externalSaveBlock: t | |
}), | |
c = e.createElement("div"); | |
c.id = "avpw_holder"; | |
var s = ""; | |
r.featherUseFlash && (s = "avpw_flash "), r.msie && (s += "avpw_ie" + r.msie), s && (c.className = s); | |
var l = e.getElementsByTagName("body"); | |
l && (l = l[0]), l || (l = e.documentElement), l.appendChild(c), c.innerHTML = u | |
}, r.Feather = function (n) { | |
var t = this; | |
n.authenticationURL && (n.isPremiumPartner = !0, i.on("auth:update", function (n) { | |
o(n) | |
})); | |
var o = function (e) { | |
avpw$.ajax({ | |
url: n.authenticationURL, | |
cache: !1, | |
type: "GET", | |
contentType: "application/json" | |
}).done(function (n) { | |
for (var i, o = ["salt", "timestamp", "signature", "encryptionMethod"], a = [], u = 0; u < o.length; u++) i = o[u], n[i] || a.push(i); | |
a.length > 0 && r.errorNotify("ERROR_BAD_AUTHENTICATION_PARAMETERS", [a.join(", ")]), t.updateConfig({ | |
salt: n.salt, | |
timestamp: n.timestamp, | |
signature: n.signature, | |
encryptionMethod: n.encryptionMethod | |
}), e && e() | |
}) | |
}, | |
a = function () { | |
r.injectControls(), r.util.nextFrame(r.loadStageFinal) | |
}, | |
u = function () { | |
"undefined" != typeof avpw$ ? avpw$(e).ready(a) : a() | |
}; | |
n && (n.openType = "aviary", n.layout = "desktop"), n = n || {}, r.launchData = r.util.extend(r.baseConfig, n); | |
var c = function () { | |
function n(n) { | |
var t = r.build.feather_baseURL + "css/" + n; | |
r.util.loadFile(t + ".css", "css") | |
} | |
var t, e; | |
if (r.featherUseFlash = !r.featherHtmlOk() && r.featherFlashOk(), r.featherUseFlash && (r.launchData.forceHiResSave = !0), r.launchData.language = r.launchData.language.toLowerCase(), !r.feather_loaded && !r.feather_loading) { | |
switch (r.feather_loading = !0, t = r.launchData.language || "en", e = "js/feathercontrols_desktop", e += r.validLanguages && r.validLanguages[t] ? "_" + t + ".js" : "_en.js", !r.launchData.theme && r.launchData.minimumStyling && (r.launchData.theme = "minimum"), "minimum" == r.launchData.theme && (r.launchData.minimumStyling = !0), r.launchData.theme || (r.launchData.theme = "dark"), r.launchData.theme) { | |
case "dark": | |
case "light": | |
case "minimum": | |
break; | |
default: | |
r.errorNotify("ERROR_BAD_THEME") | |
} | |
var i; | |
i = r.launchData.minimumStyling ? "feather_core_" : "feather_theme_aviary_", i += r.launchData.theme, n(i), r.build.bundled ? u() : r.util.loadFile(r.build.feather_baseURL + e, "js", u) | |
} | |
}; | |
r.launchData.apiVersion = 3, r.util.getApiVersion(r.launchData), c(); | |
var s = function () { | |
return r.paintWidgetInstance ? !1 : (r.paintWidgetLauncher(r.launchData.image, r.launchData.url), void 0) | |
}; | |
return t.launch = function (n) { | |
if (!r.feather_loaded) return !1; | |
var i = e.getElementById("avpw_holder"); | |
if (i || r.injectControls(), r.paintWidgetInstance) { | |
if (i) return !1; | |
t.close(!0) | |
} | |
if (r.launchData && (r.launchData.hiresWidth || r.launchData.hiresHeight) && (r.launchData.hiresWidth = null, r.launchData.hiresHeight = null), n && n.language && delete n.language, r.launchData = n ? r.util.extend(r.launchData, n) : r.launchData, !r.launchData.image) return r.errorNotify("BAD_IMAGE"), !1; | |
if ("object" == typeof n.forceCropPreset ? (r.launchData.forceCropPreset = [n.forceCropPreset], r.launchData.initTool = "forcecrop") : r.launchData.forceCropPreset = null, r.launchData.initTool && (i.className = "avpw_init_hide"), r.featherUseFlash) s(); | |
else { | |
if (!r.featherSupported()) return r.errorNotify("UNSUPPORTED") && (r.controlsWidgetInstance = new r.ControlsWidget, r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "placeControls", [r.util.getApiVersion(r.launchData) > 1 ? r.launchData.appendTo : void 0]), r.controlsWidgetInstance.bindControls(), e.getElementById("avpw_controls").style.display = "block", r.controlsWidgetInstance.messager.show("avpw_aviary_unsupported", !0)), !0; | |
r.util.nextFrame(s) | |
} | |
return !0 | |
}, t.showWaitIndicator = function () { | |
return r.controlsWidgetInstance && r.controlsWidgetInstance.showWaitThrobber ? (r.controlsWidgetInstance.showWaitThrobber(!0), !0) : !1 | |
}, t.hideWaitIndicator = function () { | |
return r.controlsWidgetInstance && r.controlsWidgetInstance.showWaitThrobber ? (r.controlsWidgetInstance.showWaitThrobber(!1), !0) : !1 | |
}, t.getImageDimensions = function () { | |
var n = null; | |
return r.paintWidgetInstance && (n = r.paintWidgetInstance.getScaledSize(), r.launchData.hiresWidth && r.launchData.hiresHeight || (delete n.hiresWidth, delete n.hiresHeight)), n | |
}, t.save = function () { | |
return r.paintWidgetInstance ? r.controlsWidgetInstance.save() : !1 | |
}, t.saveHiRes = function () { | |
return r.paintWidgetInstance ? r.launchData.authenticationURL ? (i.trigger("auth:update", function () { | |
r.controlsWidgetInstance.save("saveHiRes") | |
}), !0) : r.controlsWidgetInstance.save("saveHiRes") : !1 | |
}, t.getImageData = function (n, t, e) { | |
return r.paintWidgetInstance ? r.controlsWidgetInstance.save("getImageData", n, t, e) : !1 | |
}, t.close = function (n) { | |
return r.paintWidgetInstance ? (r.paintWidgetCloser(n), void 0) : !1 | |
}, t.relaunch = function () { | |
return i.trigger("usage:interact", "api", "relaunch"), r.isRelaunched = !0, r.launchData ? (t.launch(r.launchData), void 0) : !1 | |
}, t.activateTool = function (n) { | |
i.trigger("tool:open", n, r.controlsWidgetInstance) | |
}, t.replaceImage = function (n) { | |
return i.trigger("usage:interact", "api", "replaceImage"), r.launchData ? (t.close(!0), r.util.nextFrame(function () { | |
r.launchData.url = n, t.launch(r.launchData) | |
}), void 0) : !1 | |
}, t.updateConfig = function (n, t) { | |
if (!r.launchData) return !1; | |
if (n && "object" == typeof n) for (var e in n) n.hasOwnProperty(e) && (r.launchData[e] = n[e]); | |
else { | |
if (!n || "string" != typeof n) return !1; | |
r.launchData[n] = t | |
} | |
}, t.getIsDirty = function () { | |
return r.paintWidgetInstance ? r.paintWidgetInstance.dirty : !1 | |
}, t.getActionList = function () { | |
return r.paintWidgetInstance ? (i.trigger("tool:commit"), r.paintWidgetInstance.actions.exportJSON(!0)) : void 0 | |
}, t.disableControls = function () { | |
r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "disableControls") | |
}, t.enableControls = function () { | |
r.controlsWidgetInstance.layoutNotify(r.launchData.openType, "enableControls") | |
}, t.on = function (n, t) { | |
i && n && t && "function" == typeof t && i.on(n, t) | |
}, t.off = function (n, t) { | |
i && n && t && "function" == typeof t && i.off(n, t) | |
}, t | |
}, r.loadStageFinal = function () { | |
r.feather_loaded = !0; | |
var n = function () { | |
"function" == typeof r.launchData.onLoad && r.launchData.onLoad() | |
}; | |
r.launchData.authenticationURL ? i.trigger("auth:update", n) : n() | |
}, r.featherSupported = function () { | |
return r.featherHtmlOk() || r.featherFlashOk() || r.launchData.forceSupport | |
}, r.featherFlashOk = function () { | |
return r.launchData.forceFlash ? !0 : avpw_swfobject && avpw_swfobject.hasFlashPlayerVersion(r.build.MINIMUM_FLASH_PLAYER_VERSION) | |
}, r.featherHtmlOk = function () { | |
if (r.launchData.forceFlash) return !1; | |
var n = !! e.createElement("canvas").getContext, | |
i = "function" == typeof t.postMessage; | |
return n && i | |
}, r.getFlashMovie = function (n) { | |
var r = t[n] || e[n]; | |
return r | |
}, r.msie = function () { | |
for (var n, t = 3, r = e.createElement("div"), i = r.getElementsByTagName("i"); r.innerHTML = "<!--[if gt IE " + ++t + "]><i></i><![endif]-->", i[0];); | |
return t > 4 ? t : n | |
}(), r.firefox = function () { | |
var n; | |
return "Gecko" === t.navigator.product && (n = navigator.userAgent.split("Firefox/")[1], n = parseInt(n, 10)), n | |
}(), r.PAGE_WIDTH = 360, r.setPageWidth = function (n) { | |
r.PAGE_WIDTH = n | |
}, n | |
}(this, "undefined" != typeof window ? window : {}, "undefined" != typeof document ? document : {}), function (n, t, e) { | |
n.support = function (n) { | |
var t = n.navigator.userAgent, | |
r = n.screen.width; | |
n.screen.height; | |
var i, o = { | |
0: /Android/i, | |
1: /webOS/i, | |
2: /iPhone/i, | |
3: /iPod/i, | |
4: /BlackBerry/i, | |
5: /iPad/i | |
}, | |
a = 0, | |
u = 0, | |
c = 0, | |
s = 0; | |
for (var l in o) t.match(o[l]) && (a = 1, i = parseInt(l)); | |
if (t.match(/AppleWebKit/i) && (u = 1), 0 === i && (c = 1), 1 === c) { | |
var f = t.match(/Android [0-9].[0-9]/).toString(); | |
f && (s = parseFloat(f.split("Android ")[1])) | |
} | |
var p = {}; | |
return p.isAppleWebkit = function () { | |
return 1 === u | |
}, p.isMobileWebkit = function () { | |
return 1 === u && r && (480 >= r || s > 0 && 2.3 >= s) | |
}, p.isIPhoneOrIPod = function () { | |
return 2 === i || 3 === i | |
}, p.isAndroid = function () { | |
return 1 === c | |
}, p.getAndroidVersion = function () { | |
return s | |
}, p.getVendorProperty = function () { | |
var n = {}, | |
t = function (n, t) { | |
var e, r, i = ["webkit", "ms", "Moz", "O"], | |
o = n.style; | |
if (void 0 !== o[t]) return t; | |
for (t = t.charAt(0).toUpperCase() + t.slice(1), r = 0; r < i.length; r++) if (e = i[r] + t, void 0 !== o[e]) return e | |
}; | |
return function (r) { | |
return n[r] || (n[r] = t(e.createElement("div"), r)) | |
} | |
}(), p | |
}(t) | |
}(window.AV || (window.AV = {}), window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment