summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-03-04 20:27:46 -0800
committerAlex Yatskov <alex@foosoft.net>2017-03-04 20:27:46 -0800
commit6b6190ade7eb825720dd5cbe4485a360d6985ad2 (patch)
treef70f1c8c126baf99bbffd846500ee7ae6bf77e7a
parent5daf2accf4d6628131cd8e054ca6258a669eb715 (diff)
misc fixes
-rw-r--r--ext/bg/js/templates.js2
-rw-r--r--ext/fg/js/util.js22
-rw-r--r--tmpl/kanji.html2
3 files changed, 13 insertions, 13 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 8c8f4204..2a8bf5b3 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -302,7 +302,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
return " <a href=\"#\" title=\"Add Kanji\" class=\"action-add-note pending disabled\" data-mode=\"kanji\" data-index=\""
+ container.escapeExpression(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
- + "\"><img src=\"/mixed/img/add_kanji.png\"></a>\n";
+ + "\"><img src=\"/mixed/img/add-kanji.png\"></a>\n";
},"4":function(container,depth0,helpers,partials,data) {
var stack1;
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index ac6ee428..be809bfb 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -119,8 +119,17 @@ function docImposterHide() {
}
function docRangeFromPoint(point, imposter) {
- if (!document.elementFromPoint) {
- document.elementFromPoint = (x, y) => {
+ const element = document.elementFromPoint(point.x, point.y);
+ if (element !== null) {
+ if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
+ return new TextSourceElement(element);
+ } else if (imposter && (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA')) {
+ docImposterCreate(element);
+ }
+ }
+
+ if (!document.caretRangeFromPoint) {
+ document.caretRangeFromPoint = (x, y) => {
const position = document.caretPositionFromPoint(x,y);
if (position === null) {
return null;
@@ -133,15 +142,6 @@ function docRangeFromPoint(point, imposter) {
};
}
- const element = document.elementFromPoint(point.x, point.y);
- if (element !== null) {
- if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
- return new TextSourceElement(element);
- } else if (imposter && (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA')) {
- docImposterCreate(element);
- }
- }
-
const range = document.caretRangeFromPoint(point.x, point.y);
if (range !== null) {
docImposterHide();
diff --git a/tmpl/kanji.html b/tmpl/kanji.html
index c9e6959d..d6d51799 100644
--- a/tmpl/kanji.html
+++ b/tmpl/kanji.html
@@ -2,7 +2,7 @@
<p>
<div class="actions">
{{#if addable}}
- <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="/mixed/img/add_kanji.png"></a>
+ <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="/mixed/img/add-kanji.png"></a>
{{/if}}
</div>