Stub handler for kanji click
This commit is contained in:
parent
59989cd78c
commit
8143e372cd
@ -30,7 +30,7 @@ templates['kanji.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(co
|
||||
templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var helper;
|
||||
|
||||
return "<a href=\"#\">"
|
||||
return "<a href=\"#\" class=\"kanji-link\">"
|
||||
+ container.escapeExpression(((helper = (helper = helpers.kanji || (depth0 != null ? depth0.kanji : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"kanji","hash":{},"data":data}) : helper)))
|
||||
+ "</a>\n";
|
||||
},"useData":true});
|
||||
|
@ -17,3 +17,17 @@
|
||||
*/
|
||||
|
||||
|
||||
function onKanjiQuery(kanji) {
|
||||
alert(kanji);
|
||||
}
|
||||
|
||||
function registerKanjiLinks() {
|
||||
for (const link of [].slice.call(document.getElementsByClassName('kanji-link'))) {
|
||||
link.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
onKanjiQuery(e.target.innerHTML);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', registerKanjiLinks, false);
|
||||
|
@ -20,7 +20,7 @@
|
||||
"background": {"page": "bg/background.html"},
|
||||
"options_page": "bg/options.html",
|
||||
"permissions": ["storage"],
|
||||
"web_accessible_resources": ["fg/css/frame.css", "fg/css/frame.js"],
|
||||
"web_accessible_resources": ["fg/css/frame.css", "fg/js/frame.js"],
|
||||
|
||||
"content_scripts": [{
|
||||
"matches": ["*://*/*"],
|
||||
|
@ -1 +1 @@
|
||||
<a href="#">{{kanji}}</a>
|
||||
<a href="#" class="kanji-link">{{kanji}}</a>
|
||||
|
Loading…
Reference in New Issue
Block a user