aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fg/js/client.js4
-rw-r--r--ext/fg/js/source-image.js2
-rw-r--r--ext/fg/js/source-range.js12
3 files changed, 9 insertions, 9 deletions
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index 67400f34..60aa6883 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -90,12 +90,12 @@ class Client {
textSourceFromPoint(point) {
const element = document.elementFromPoint(point.x, point.y);
if (element !== null && element.nodeName === 'IMG') {
- return new ImageSource(element);
+ return new TextSourceImage(element);
}
const range = document.caretRangeFromPoint(point.x, point.y);
if (range !== null) {
- return new RangeSource(range);
+ return new TextSourceRange(range);
}
return null;
diff --git a/ext/fg/js/source-image.js b/ext/fg/js/source-image.js
index 8c87e31e..bbc0ba46 100644
--- a/ext/fg/js/source-image.js
+++ b/ext/fg/js/source-image.js
@@ -17,7 +17,7 @@
*/
-class ImageSource {
+class TextSourceImage {
constructor(image) {
this.img = image;
this.length = -1;
diff --git a/ext/fg/js/source-range.js b/ext/fg/js/source-range.js
index bd13a1b6..e09ec33a 100644
--- a/ext/fg/js/source-range.js
+++ b/ext/fg/js/source-range.js
@@ -17,7 +17,7 @@
*/
-class RangeSource {
+class TextSourceRange {
constructor(range) {
this.rng = range;
}
@@ -27,7 +27,7 @@ class RangeSource {
}
setLength(length) {
- const end = RangeSource.seekEnd(this.rng.startContainer, this.rng.startOffset + length);
+ const end = TextSourceRange.seekEnd(this.rng.startContainer, this.rng.startOffset + length);
this.rng.setEnd(end.node, end.offset);
}
@@ -70,18 +70,18 @@ class RangeSource {
static seekEnd(node, length) {
const state = {node, offset: 0, length};
- if (!RangeSource.seekEndRecurse(node, state)) {
+ if (!TextSourceRange.seekEndRecurse(node, state)) {
return {node: state.node, offset: state.offset};
}
for (let sibling = node.nextSibling; sibling !== null; sibling = sibling.nextSibling) {
- if (!RangeSource.seekEndRecurse(sibling, state)) {
+ if (!TextSourceRange.seekEndRecurse(sibling, state)) {
return {node: state.node, offset: state.offset};
}
}
for (let sibling = node.parentElement.nextSibling; sibling !== null; sibling = sibling.nextSibling) {
- if (!RangeSource.seekEndRecurse(sibling, state)) {
+ if (!TextSourceRange.seekEndRecurse(sibling, state)) {
return {node: state.node, offset: state.offset};
}
}
@@ -97,7 +97,7 @@ class RangeSource {
state.length -= consumed;
} else {
for (let i = 0; i < node.childNodes.length; ++i) {
- if (!RangeSource.seekEndRecurse(node.childNodes[i], state)) {
+ if (!TextSourceRange.seekEndRecurse(node.childNodes[i], state)) {
break;
}
}