When I click on translation it turns red and I get errors:
Element.createShadowRoot is deprecated and will be removed in M73, around March 2019. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 for more details.
Kontekst
https://www.bbc.com/news/world-asia-china-49143207
Zrzut stosu
bubble_compiled.js:6160 (fk)
6207
6208
<5209 wiersze są niewidoczne>
},
definition_id: {
f: 1,
g: !1
}
};
hj.prototype.a = function() {
return xj
};
var yj = {
pos: {
f: 0,
g: !1
},
entry: {
f: 1,
B: function(a) {
return Z(hj, a)
},
A: function(a) {
return X(new hj(a))
},
g: !0
},
base_form: {
f: 2,
g: !1
}
};
ij.prototype.a = function() {
return yj
};
var zj = {
word: {
f: 0,
g: !0
}
};
jj.prototype.a = function() {
return zj
};
var Aj = {
spell_html_res: {
f: 0,
g: !1
},
spell_res: {
f: 1,
g: !1
},
correction_type: {
f: 2,
g: !0
},
correction_translation: {
f: 3,
g: !1
},
related: {
f: 4,
g: !1
},
confident: {
f: 5,
g: !1
}
};
kj.prototype.a = function() {
return Aj
};
var Bj = {
srclangs: {
f: 0,
g: !0
},
extended_srclangs: {
f: 3,
g: !0
},
detected_target: {
f: 1,
g: !1
},
srclangs_confidences: {
f: 2,
g: !0
}
};
lj.prototype.a = function() {
return Bj
};
var Cj = {
title: {
f: 0,
g: !1
},
description: {
f: 1,
g: !1
},
image_url: {
f: 2,
g: !1
},
image_ref_url: {
f: 3,
g: !1
}
};
mj.prototype.a = function() {
return Cj
};
mj.prototype.getTitle = function() {
var a = this.data[0];
return null != a ? a : ""
};
mj.prototype.setTitle = function(a) {
this.data[0] = a
};
var Dj = {
sentences: {
f: 0,
B: function(a) {
return Z(cj, a)
},
A: function(a) {
return X(new cj(a))
},
g: !0
},
dict: {
f: 1,
B: function(a) {
return Z(ej, a)
},
A: function(a) {
return X(new ej(a))
},
g: !0
},
src: {
f: 2,
g: !1
},
err: {
f: 3,
g: !1
},
styled_words: {
f: 4,
B: function(a) {
return Z(Zi, a)
},
A: function(a) {
return X(new Zi(a))
},
g: !0
},
alternative_translations: {
f: 5,
B: function(a) {
return Z($i, a)
},
A: function(a) {
return X(new $i(a))
},
g: !0
},
confidence: {
f: 6,
g: !1
},
spell: {
f: 7,
B: function(a) {
return Z(kj, a)
},
A: function(a) {
return X(new kj(a))
},
g: !1
},
autocorrection: {
f: 10,
g: !1
},
ld_result: {
f: 8,
B: function(a) {
return Z(lj, a)
},
A: function(a) {
return X(new lj(a))
},
g: !1
},
server_time: {
f: 9,
g: !1
},
synsets: {
f: 11,
B: function(a) {
return Z(ij, a)
},
A: function(a) {
return X(new ij(a))
},
g: !0
},
definitions: {
f: 12,
B: function(a) {
return Z(gj, a)
},
A: function(a) {
return X(new gj(a))
},
g: !0
},
examples: {
f: 13,
B: function(a) {
return Z(Wi, a)
},
A: function(a) {
return X(new Wi(a))
},
g: !1
},
related_words: {
f: 14,
B: function(a) {
return Z(jj, a)
},
A: function(a) {
return X(new jj(a))
},
g: !1
},
knowledge_results: {
f: 15,
B: function(a) {
return Z(mj,
a)
},
A: function(a) {
return X(new mj(a))
},
g: !0
}
};
nj.prototype.a = function() {
return Dj
};
var Ej = function(a, b) {
this.c = a;
this.a = "";
b && (this.a = b);
this.b = 0;
this.i = Si.N()
},
Fj = function(a) {
a = a.O("q").join("");
return Yb(a)
},
Gj = function(a, b, c, d, e) {
c = c.toString();
c += Fj(d);
d = d.toString();
var f = "POST";
b += "?" + c;
2E3 > b.length + d.length && (f = "GET", b += "&" + d, d = "");
++a.b;
zi(b, function(b) {
--a.b;
e(b)
}, f, d)
};
Ej.prototype.h = function(a, b, c) {
c = c.target;
if (!Ji(c) || "[" != Ki(c)[0] && "{" != Ki(c)[0]) {
a = c.h;
var d = a in Hj ? Hj[a] : 0;
var e = this.i;
a = new Pi;
e.a.store(a);
Tb(a, 31, 148);
e = new Qi;
Tb(e, 1, 156);
d && Tb(e, 5, d);
a.b || (a.b = {});
d = e ? e.wa() : e;
a.b[63] = e;
Tb(a, 63, d);
a = Yh.N();
d = String(c.i);
e = Ki(c);
a.log("invalidResponse", {
q: d.substring(0, 500),
ql: d.length,
r: e.substring(0, 500),
rl: e.length
});
b && b(Ii(c))
} else {
b = Ki(c);
c = {
"class": "trans.common.TranslationAPI",
func: "handleSingleResult_",
url: String(c.i)
};
try {
d = JSON.parse(b)
} catch (f) {
throw a =
Yh.N(), c.js = b, c.error = f.message, a.log("jsonParseErr", c), f;
}
w(d) && (d = new nj(d));
a(d)
}
};
var Ij = {},
Hj = (Ij[1] = 15, Ij[2] = 16, Ij[3] = 17, Ij[4] = 18, Ij[5] = 19, Ij[6] = 20, Ij[7] = 21, Ij[8] = 22, Ij[9] = 23, Ij);
var Vh = new Ph,
Jj = function() {};
ba(Jj);
var Kj = function(a, b, c, d) {
if ("" != a) {
window.selection = a;
a = new Ej("gtx", "https://translate.googleapis.com");
var e = chrome.i18n.getUILanguage ? chrome.i18n.getUILanguage() : "en";
d = d ? d : "auto";
var f = Rh(Vh);
c = new le("source=" + c);
var g = window.selection,
k = a.a + "/translate_a/single",
l = new le,
m = new le;
l.set("client", a.c);
l.set("sl", d);
l.set("tl", f);
l.set("hl", e);
e = ["t", "bd"];
l.remove("dt");
0 < e.length && (l.c = null, l.a.set(ne(l, "dt"), Ua(e)), l.b = Ca(l.b) + e.length);
l.set("dj", "1");
c && l.h(c);
m.set("q", g);
Gj(a, k, l, m, z(a.h,
a, b, void 0))
}
};
Jj.prototype.a = function(a, b, c, d) {
if (null != d) {
for (var e = d.src, f = Rh(Vh), g = [], k = [], l = d.sentences, m = 0; m < l.length; m++) g.push(l[m].orig), k.push(l[m].trans);
g = g.join("");
k = k.join("");
l = Wh("tl")[f].toUpperCase();
m = Wh("sl");
var v = [],
J;
for (J in m) v.push([J, m[J]]);
d = {
query: b,
Ob: k,
hc: l,
ec: e,
fc: v,
ub: d.dict,
popup: a
};
D(Xh, "Soy template may not be null.");
c.innerHTML = xe(Xh(d || we));
d = Jd("gtx-lang-selector", c);
xc(d, "change", z(this.b, this, a, b, c), !1, this);
var targets = c.getElementsByClassName("gtx-target");
for (var i = 0; i < targets.length; i++) {
var target = targets[i];
xc(target, 'click', function(e) {
var from = e.target.getAttribute('data-source');
var to = e.target.innerText;
chrome.storage.local.get(['ankiDeckNameSel', 'ankiModelNameSel'], ({ankiDeckNameSel, ankiModelNameSel, ankiConnectUrl}) => {
url = ankiConnectUrl || 'http://localhost:8765';
model = ankiModelNameSel || 'Basic';
deck = ankiDeckNameSel || 'Default';
var body = {
"action": "addNote",
"version": 5,
"params": {"note": {"fields": {"Front": from, "Back": to},
"modelName": model,
"deckName": deck,
"tags": []}}};
fetch(url, { method: "POST", body: JSON.stringify(body) }).then(r => r.json()).then(data => {
e.target.style.color = data.error ? 'red' : 'green';
})
});
}, !1, this);
}
b = new lh;
d = Jd("gtx-source-audio", c);
Af(b, d);
ph(b, g, e);
b = new lh;
// debugger;
g = Jd("gtx-target-audio", c);
Af(b, g);
ph(b, k, f);
e = "https://translate.google.com/?source=gtx_m#" + e + "/" + f + "/" + encodeURIComponent(window.selection);
a ? (a = Id(document, "more"), a.setAttribute("href", e), c = new S("", void 0, 4), zf(c, Id(document, "new-translation")), Te(Id(document, "new-translation"), !0), c = Id(document, "translate-page"), Vd(a, rh("MSG_OPEN_IN_TRANSLATE")), c.className = "gtx-a", c.setAttribute("style", "margin-left: 0px;"), Te(a, !0)) : (a = Sd(document, "a"), a.id = "off", a.className = "gtx-a", a.setAttribute("target",
"_blank"), Vd(a, rh("MSG_FOOTER_OPTIONS").toUpperCase()), a.setAttribute("href", chrome.runtime.getURL("options.html")), c.appendChild(a), a = Sd(document, "a"), a.id = "more", a.setAttribute("class", "gtx-a"), a.setAttribute("target", "_blank"), Vd(a, rh("MSG_MORE")), a.setAttribute("href", e), a.setAttribute("style", "color: #A2A2A2; float: right; padding-top: 16px;"), c.appendChild(a))
} else Vd(Id(document, "translation"), rh("MSG_TRANSLATION_ERROR"))
};
Jj.prototype.b = function(a, b, c, d) {
Kj(b, z(this.a, this, a, b, c), "ls", d.target.value)
};
var Lj = function() {},
Mj = new Lj,
Nj = ["click", G ? "keypress" : "keydown", "keyup"];
Lj.prototype.listen = function(a, b, c, d, e) {
var f = function(a) {
var c = yc(b),
e = a.target;
e = y(e) && 1 == e.nodeType ? a.target.getAttribute("role") || null : null;
// debugger;
"click" == a.type && kc(a) ? c.call(d, a) : 13 != a.keyCode && 3 != a.keyCode || "keyup" == a.type ? 32 != a.keyCode || "keyup" != a.type || "button" != e && "tab" != e || (c.call(d, a), a.preventDefault()) : (a.type = "keypress", c.call(d, a))
};
f.ac = b;
f.cc = d;
e ? e.listen(a, Nj, f, c) : xc(a, Nj, f, c)
};
Lj.prototype.S = function(a, b, c, d, e) {
for (var f, g = 0; f = Nj[g]; g++) {
var k = a;
var l = f;
var m = !!c;
l = mc(k) ? k.La(l, m) : k ? (k = Ac(k)) ? k.La(l, m) : [] : [];
for (k = 0; m = l[k]; k++) {
var v = m.listener;
if (v.ac == b && v.cc == d) {
e ? e.S(a, f, m.listener, c, d) : Ec(a, f, m.listener, c, d);
break
}
}
}
};
var Oj = function() {
M.call(this);
this.b = 0
};
B(Oj, M);
Oj.prototype.onStop = function() {
this.dispatchEvent("stop")
};
var Pj = function(a, b) {
w(b) || (b = [b]);
D(0 < b.length, "At least one Css3Property should be specified.");
b = Ma(b, function(a) {
if (q(a)) return a;
Fa(a, "Expected css3 property to be an object.");
var b = a.Lb + " " + a.duration + "s " + a.timing + " " + a.tb + "s";
D(a.Lb && r(a.duration) && a.timing && r(a.tb), "Unexpected css3 property value: %s", b);
return b
});
De(a, "transition", b.join(","))
},
Qj = function(a) {
var b = !1,
c;
return function() {
b || (c = a(), b = !0);
return c
}
}(function() {
if (F) return I("10.0");
var a = Sd(document, "DIV"),
b = H ? "-webkit" :
G ? "-moz" : F ? "-ms" : nb ? "-o" : null,
c = {
transition: "opacity 1s linear"
};
b && (c[b + "-transition"] = "opacity 1s linear");
b = {
style: c
};
if (!vd.test("div")) throw Error("Invalid tag name <div>.");
if ("DIV" in xd) throw Error("Tag name <div> is not allowed for SafeHtml.");
c = null;
var d = "";
if (b)
for (m in b) {
if (!vd.test(m)) throw Error('Invalid attribute name "' + m + '".');
var e = b[m];
if (null != e) {
var f = m;
var g = e;
if (g instanceof Vc) g = Wc(g);
else if ("style" == f.toLowerCase()) {
e = void 0;
if (!y(g)) throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, ' +
typeof g + " given: " + g);
if (!(g instanceof id)) {
var k = g;
g = "";
for (e in k) {
if (!/^[-_a-zA-Z0-9]+$/.test(e)) throw Error("Name allows only [-_a-zA-Z0-9], got: " + e);
var l = k[e];
null != l && (l = w(l) ? Ma(l, pd).join(" ") : pd(l), g += e + ":" + l + ";")
}
g ? (e = g, D(!/[<>]/.test(e), "Forbidden characters in style string: " + e), g = jd(g)) : g = kd
}
g instanceof id && g.constructor === id && g.b === hd ? e = g.a : (Ba("expected object of type SafeStyle, got '" + g + "' of type " + u(g)), e = "type_error:SafeStyle");
g = e
} else {
if (/^on/i.test(f)) throw Error('Attribute "' +
f + '" requires goog.string.Const value, "' + g + '" given.');
if (f.toLowerCase() in wd)
if (g instanceof Zc) g = $c(g);
else if (g instanceof cd) g = dd(g);
else if (q(g)) g = gd(g).Y();
else throw Error('Attribute "' + f + '" on tag "div" requires goog.html.SafeUrl, goog.string.Const, or string, value "' + g + '" given.');
}
g.ka && (g = g.Y());
D(q(g) || r(g), "String or number value expected, got " + typeof g + " with value: " + g);
f = f + '="' + ua(String(g)) + '"';
d += " " + f
}
}
var m = "<div" + d;
d = void 0;
null != d ? w(d) || (d = [d]) : d = [];
!0 === Tc.div ? (D(!d.length,
"Void tag <div> does not allow content."), m += ">") : (c = yd(d), m += ">" + sd(c) + "</div>", c = c.ua());
(b = b && b.dir) && (/^(ltr|rtl|auto)$/i.test(b) ? c = 0 : c = null);
b = td(m, c);
Bd(a, b);
a = a.firstChild;
D(a.nodeType == Node.ELEMENT_NODE);
b = a.style[xa("transition")];
return "" != ("undefined" !== typeof b ? b : a.style[Ce(a, "transition")] || "")
});
var Rj = function(a, b, c, d, e) {
Oj.call(this);
this.a = a;
this.i = b;
this.j = c;
this.c = d;
this.o = w(e) ? e : [e]
};
B(Rj, Oj);
h = Rj.prototype;
h.play = function() {
if (1 == this.b) return !1;
this.dispatchEvent("begin");
this.dispatchEvent("play");
ia();
this.b = 1;
if (Qj()) return De(this.a, this.j), this.h = Vg(this.bc, void 0, this), !0;
this.mb(!1);
return !1
};
h.bc = function() {
Re(this.a);
Pj(this.a, this.o);
De(this.a, this.c);
this.h = Vg(z(this.mb, this, !1), 1E3 * this.i)
};
h.stop = function() {
1 == this.b && this.mb(!0)
};
h.mb = function(a) {
De(this.a, "transition", "");
n.clearTimeout(this.h);
De(this.a, this.c);
ia();
this.b = 0;
if (a) this.onStop();
else this.dispatchEvent("finish");
this.dispatchEvent("end")
};
h.s = function() {
this.stop();
Rj.m.s.call(this)
};
h.pause = function() {
D(!1, "Css3 transitions does not support pause action.")
};
var Sj = function(a, b, c, d) {
return new Rj(a, .218, {
opacity: c
}, {
opacity: d
}, {
Lb: "opacity",
duration: .218,
timing: b,
tb: 0
})
};
var Uj = function(a, b) {
M.call(this);
this.a = new qf(this);
a = a || null;
Tj(this);
this.J = a;
b && (this.xa = b)
};
B(Uj, M);
h = Uj.prototype;
h.J = null;
h.ob = null;
h.ga = !1;
h.hb = -1;
h.xa = "toggle_display";
h.l = function() {
return this.J
};
var Tj = function(a) {
if (a.ga) throw Error("Can not change this state of the popup while showing.");
};
Uj.prototype.b = t;
var Vj = function(a, b) {
a.ga && a.dispatchEvent({
type: "beforehide",
target: b
}) && (a.a && a.a.removeAll(), a.ga = !1, ia(), a.c ? (wc(a.c, "end", A(a.qb, b), !1, a), a.c.play()) : a.qb(b))
};
h = Uj.prototype;
h.qb = function(a) {
"toggle_display" == this.xa ? this.$b() : "move_offscreen" == this.xa && (this.J.style.top = "-10000px");
this.dispatchEvent({
type: "hide",
target: a
})
};
h.$b = function() {
this.J.style.visibility = "hidden";
Te(this.J, !1)
};
h.Kb = function() {
this.dispatchEvent("show")
};
h.Jb = function(a) {
a = a.target;
Ud(this.J, a) || Wj(this, a) || 150 > ia() - this.hb || Vj(this, a)
};
h.Ib = function(a) {
var b = Gd(this.J);
if ("undefined" != typeof document.activeElement) {
if (a = b.activeElement, !a || Ud(this.J, a) || "BODY" == a.tagName) return
} else if (a.target != b) return;
150 > ia() - this.hb || Vj(this)
};
var Wj = function(a, b) {
return Na(a.ob || [], function(a) {
return b === a || Ud(a, b)
})
};
Uj.prototype.s = function() {
Uj.m.s.call(this);
this.a.X();
fc(this.h);
fc(this.c);
delete this.J;
delete this.a;
delete this.ob
};
var Xj = function(a, b) {
this.i = b || void 0;
Uj.call(this, a)
};
B(Xj, Uj);
Xj.prototype.b = function() {
if (this.i) {
var a = !this.ga && "move_offscreen" != this.xa,
b = this.l();
a && (b.style.visibility = "hidden", Te(b, !0));
this.i.wb(b, 8, this.j);
a && Te(b, !1)
}
};
var Yj = function(a) {
var b = '<div class="' + R("jfk-bubble") + '" role="alertdialog"' + (a.uid ? ' aria-describedby="' + R(a.uid) + '"' : "") + '><div class="' + R("jfk-bubble-content-id") + '"' + (a.uid ? ' id="' + R(a.uid) + '"' : "") + "></div>";
if (a.dc) {
a = b;
b = '<div class="' + R("jfk-bubble-closebtn-id") + " " + R("jfk-bubble-closebtn") + '" aria-label="';
var c = "Close".replace(jg, kg);
b = a + (b + c + '" role="button" tabindex=0></div>')
}
b += '<div class="' + R("jfk-bubble-arrow-id") + " " + R("jfk-bubble-arrow") + '"><div class="' + R("jfk-bubble-arrowimplbefore") +
'"></div><div class="' + R("jfk-bubble-arrowimplafter") + '"></div></div></div>';
return fg(b)
};
Yj.a = "jfk.templates.bubble.main";
var Zj = function(a) {
N.call(this, a);
this.v = new bh("jfk-bubble", !0);
this.c = new Xj;
this.V = []
};
B(Zj, N);
Zj.prototype.T = !1;
var ak = function(a, b) {
a = a.Ya();
if (b && a)
if (q(b)) Vd(a, b);
else if (b instanceof ue) {
if (b.aa === re) b = ud(b.toString());
else {
if (b.aa !== pe) throw Error("Sanitized content was not of kind TEXT or HTML.");
var c = Xc("Soy SanitizedContent of kind HTML produces SafeHtml-contract-compliant value.");
var d = b.toString();
b = b.sa;
Da(Wc(c), "must provide justification");
D(!/^[\s\xa0]*$/.test(Wc(c)), "must provide non-empty justification");
b = td(d, b || null)
}
Bd(a, b)
} else b instanceof rd ? Bd(a, b) : (Bd(a, zd), a.appendChild(b))
};
h = Zj.prototype;
h.Ya = function() {
return this.a ? Jd("jfk-bubble-content-id", this.a || this.h.a) : null
};
h.Xa = function() {
this.a = ze(Yj, {
dc: !0,
uid: "bubble-" + (this[da] || (this[da] = ++ea))
}, this.h);
ak(this, this.$);
Te(this.l(), !1);
var a = this.c,
b = this.l();
Tj(a);
a.J = b;
if (!qb) {
a = this.c;
b = Sj(this.l(), "ease-out", 0, 1);
var c = Sj(this.l(), "ease-in", 1, 0);
a.h = b;
a.c = c
}
Nc(this.l(), this.V)
};
h.ba = function() {
Zj.m.ba.call(this);
yf(this).listen(this.c, ["beforeshow", "show", "beforehide", "hide"], this.Zb);
var a = yf(this),
b = this.a ? Jd("jfk-bubble-closebtn-id", this.a || this.h.a) : null;
Mj.listen(b, A(this.Hb, !1), void 0, a.b || a, a);
a = this.l();
D(a, "getElement() returns null.");
b = this.a ? Jd("jfk-bubble-arrow-id", this.a || this.h.a) : null;
D(b, "No arrow element is found!");
var c = this.v;
c.a = a;
c.i = b;
a = this.c;
a.i = this.v || void 0;
a.ga && a.b()
};
h.Hb = function(a) {
var b = this.c;
b.h && b.h.stop();
b.c && b.c.stop();
if (a) {
if (!b.ga && b.dispatchEvent("beforeshow")) {
if (!b.J) throw Error("Caller must call setElement before trying to show the popup");
b.b();
a = Gd(b.J);
b.a.listen(a, "mousedown", b.Jb, !0);
if (F) {
try {
var c = a.activeElement
} catch (e) {}
for (; c && "IFRAME" == c.nodeName;) {
try {
var d = c.contentDocument || c.contentWindow.document
} catch (e) {
break
}
a = d;
c = a.activeElement
}
b.a.listen(a, "mousedown", b.Jb, !0);
b.a.listen(a, "deactivate", b.Ib)
} else b.a.listen(a, "blur", b.Ib);
"toggle_display" == b.xa ? (b.J.style.visibility = "visible", Te(b.J, !0)) : "move_offscreen" == b.xa && b.b();
b.ga = !0;
b.hb = ia();
b.h ? (wc(b.h, "end", b.Kb, !1, b), b.h.play()) : b.Kb()
}
} else Vj(b)
};
h.s = function() {
this.c.X();
delete this.c;
Zj.m.s.call(this)
};
h.Fb = function() {
Ne(this.l());
return !1
};
h.Zb = function(a) {
if ("show" == a.type || "hide" == a.type) {
var b = yf(this),
c = this.h;
c = F ? Nd(c.a) : c.a;
"show" == a.type ? b.listen(c, "scroll", this.Fb) : b.S(c, "scroll", this.Fb)
}
b = this.dispatchEvent(a.type);
this.T && "hide" == a.type && this.X();
return b
};
var bk = function(a) {
Zj.call(this);
this.T = !0;
D(!this.L, "Must call addClassName() before rendering");
this.V.push("gtx-bubble");
this.v.b = a;
this.c.ga && this.c.b();
var b = 2;
parseInt(a.style.top, 10) - Md(document).scrollTop + parseInt(a.style.height, 10) / 2 < window.innerHeight / 2 && (b = 1);
var c = 2;
a = parseInt(a.style.left, 10) + parseInt(a.style.width, 10) / 2;
217 >= a ? c = 0 : a >= window.innerWidth - 217 && (c = 1);
D(!this.L, "Must call setPosition() before rendering");
a = this.v;
null != b && (a.Ua = b);
null != c && (a.Ta = c);
r(0) && (a.nb = Math.max(0,
15));
r(-10) && (a.jb = -10)
},
ck, dk;
B(bk, Zj);
bk.prototype.s = function() {
bk.m.s.call(this);
chrome.runtime.sendMessage({
bubbleClosed: !0
});
Td(Id(document, "gtx-anchor"))
};
bk.prototype.j = null;
bk.prototype.D = null;
bk.prototype.W = function(a, b) {
var c = document.createElement("style");
c.innerHTML = b;
this.D.appendChild(c);
b = this.j;
D(q(b) || b.nodeType || b instanceof ue || b instanceof rd, "Content must be a string or HTML.");
this.$ = b;
ak(this, b);
c = this.j.cloneNode(!1);
c.id = "bubble-content";
c.className = "gtx-content";
this.D.appendChild(c);
b = document.createElement("div");
b.className = "content";
b.setAttribute("style", "margin: 0");
c.appendChild(b);
c = this.j.cloneNode(!1);
c.id = "translation";
c.style.display = "inline";
b.appendChild(c);
ek.a(!1, window.selection, c, a);
this.c.ga && this.c.b()
};
var gk = function(a, b, c) {
var d = Id(document, "gtx-trans");
Gc(d);
Td(d);
Kj(b, A(fk, a), "icon", c)
},
kk = function(a) {
if ("0" != Th.a) {
var b = window.getSelection(),
c = b.toString().trim();
hk(c) && (Qh ? ik(b, function(d) {
if (!Uh(d)) {
if ("zh" == d || "zh-Hant" == d) d = "zh-CN";
jk(a, b, c, d)
}
}) : !Qh && "1" == Th.a && Th.i && Uh(ck) || jk(a, b, c))
}
},
lk = function(a, b, c) {
if (a) {
var d = a.innerText || a.textContent || "";
d = decodeURIComponent(encodeURIComponent(d.trim()));
chrome.i18n.detectLanguage(d, function(d) {
d.isReliable ? c(d.languages[0].language) : 0 < b ? lk(a.parentNode,
b - 1, c) : c("")
})
} else c("")
},
jk = function(a, b, c, d) {
b = b.getRangeAt(0).getBoundingClientRect();
if (0 != b.top || 0 != b.left)
if ("1" == Th.a) {
var e = Sd(document, "div");
e.className = "gtx-trans-icon";
var f = Sd(document, "div");
f.appendChild(e);
f.id = "gtx-trans";
f.style.position = "absolute";
f.style.left = a.clientX + Md(document).scrollLeft - 13 + "px";
a = a.clientY;
a - b.top > b.height / 2 ? a = b.bottom + 1 : a = b.top - 1 - 27;
f.style.top = a + Md(document).scrollTop + "px";
document.body.appendChild(f);
xc(f, "click", A(gk, b, c, d))
} else Kj(c, A(fk, b), "bubble",
d)
},
ik = function(a, b) {
var c = a.toString().trim();
c = decodeURIComponent(encodeURIComponent(c));
chrome.i18n.detectLanguage(c, function(c) {
var d = null;
if (c.isReliable) return d = c.languages[0].language, b(d);
lk(a.anchorNode, 3, function(a) {
b(a)
})
})
},
hk = function(a) {
var b = /^[0-9!@#$\u20ac\u00a3%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/;
return 0 < a.length && !Jd("gtx-bubble") && 250 > a.length && !b.test(a) && 400 < window.innerWidth
},
fk = function(a, b) {
if ("1" == Th.a || b.src != Rh(Th)) {
var c = Sd(document, "div");
c.id = "gtx-anchor";
c.style.position =
"absolute";
c.style.visibility = "hidden";
c.style.left = String(a.left + Md(document).scrollLeft + "px");
c.style.top = String(a.top + Md(document).scrollTop + "px");
c.style.width = String(a.right - a.left + 1 + "px");
c.style.height = String(a.height + "px");
document.body.appendChild(c);
window.a = new bk(c);
zf(window.a, document.body);
a = window.a;
a.j = document.createElement("div");
a.j.id = "gtx-host";
a.j.setAttribute("style", "min-width: 200px; max-width: 400px;");
a.j.createShadowRoot ? a.D = a.j.createShadowRoot() : a.D = a.j.webkitCreateShadowRoot();
mk(chrome.runtime.getURL("popup_css_compiled.css"), z(a.W, a, b));
window.a.Hb(!0)
}
},
mk = function(a, b) {
var c = new XMLHttpRequest;
c.open("GET", a, !0);
c.onload = function() {
var a = null;
200 === c.status && (a = c.response);
return b(a)
};
c.send()
};
chrome.runtime.onMessage.addListener(function(a) {
a["gtx.detected"] && (ck = a["gtx.detected"], kk(dk))
});
var Th = new Ph,
ek = Jj.N();
xc(window, "mouseup", function(a) {
// debugger;
if (0 == a.button && !Id(document, "gtx-trans")) {
try {
// debugger;
chrome.runtime.sendMessage({
test: 1
})
} catch (b) {
return
}
Qh || "1" != Th.a || !Th.i || ck ? window.setTimeout(A(kk, a), 0) : (dk = a, chrome.runtime.sendMessage({
detectLanguage: 1
}))
}
});
xc(window, "mousedown", function(a) {
var b = Id(document, "gtx-trans");
b && (Ud(b, a.target) ? a.preventDefault() : (Gc(b), Td(b)));
a.target instanceof HTMLElement && -1 != a.target.className.indexOf("jfk-bubble-closebtn") && a.preventDefault()
}, !0);
var nk = function() {
window.a && window.a.X()
},
ok = ["disposeWindowBubble"],
pk = n;
ok[0] in pk || !pk.execScript || pk.execScript("var " + ok[0]);
for (var qk; ok.length && (qk = ok.shift());) !ok.length && p(nk) ? pk[qk] = nk : pk[qk] && pk[qk] !== Object.prototype[qk] ? pk = pk[qk] : pk = pk[qk] = {};
})();
Unchecked runtime.lastError: Cannot create item with duplicate id translate-and-anki
I have Anki connect installed and other Chromium add-on that I use Anki Quick Adder works ok (is adding cards to Anki).
Anki Version 2.1.14 (7b93e985)
Qt 5.12.1 PyQt 5.11.3
Operating System: Manjaro Linux
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.60.0
Qt Version: 5.13.0
Kernel Version: 5.1.19-1-MANJARO
OS Type: 64-bit
Thanks for reminder, probably we need to rebase the changes on top of latest google extensions, but this will take time from my side, however, PRs welcome
When I click on translation it turns red and I get errors:
I have Anki connect installed and other Chromium add-on that I use Anki Quick Adder works ok (is adding cards to Anki).
Anki Version 2.1.14 (7b93e985) Qt 5.12.1 PyQt 5.11.3 Operating System: Manjaro Linux KDE Plasma Version: 5.16.3 KDE Frameworks Version: 5.60.0 Qt Version: 5.13.0 Kernel Version: 5.1.19-1-MANJARO OS Type: 64-bit