diff --git a/.eslintrc.json b/.eslintrc.json
index 4ec8f0f6..48746bdb 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -120,6 +120,7 @@
"files": ["ext/**/*.js"],
"excludedFiles": [
"ext/js/core.js",
+ "ext/js/document-start.js",
"ext/js/**/sandbox/**/*.js"
],
"globals": {
@@ -146,6 +147,7 @@
"files": ["ext/**/*.js"],
"excludedFiles": [
"ext/js/core.js",
+ "ext/js/document-start.js",
"ext/js/yomichan.js",
"ext/js/**/sandbox/**/*.js"
],
diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json
index 52581350..0de348b9 100644
--- a/dev/data/manifest-variants.json
+++ b/dev/data/manifest-variants.json
@@ -33,11 +33,14 @@
},
"content_scripts": [
{
+ "run_at": "document_idle",
"matches": [
"http://*/*",
"https://*/*",
"file://*/*"
],
+ "match_about_blank": true,
+ "all_frames": true,
"js": [
"js/core.js",
"js/yomichan.js",
@@ -59,9 +62,20 @@
"js/language/text-scanner.js",
"js/script/dynamic-loader.js",
"js/app/content-script-main.js"
+ ]
+ },
+ {
+ "run_at": "document_start",
+ "matches": [
+ "http://*/*",
+ "https://*/*",
+ "file://*/*"
],
"match_about_blank": true,
- "all_frames": true
+ "all_frames": true,
+ "js": [
+ "js/document-start.js"
+ ]
}
],
"minimum_chrome_version": "57.0.0.0",
diff --git a/ext/data/schemas/options-schema.json b/ext/data/schemas/options-schema.json
index 1565cfe6..d1fb28ad 100644
--- a/ext/data/schemas/options-schema.json
+++ b/ext/data/schemas/options-schema.json
@@ -72,7 +72,8 @@
"anki",
"sentenceParsing",
"inputs",
- "clipboard"
+ "clipboard",
+ "accessibility"
],
"properties": {
"general": {
@@ -1109,6 +1110,18 @@
"minimum": 0
}
}
+ },
+ "accessibility": {
+ "type": "object",
+ "required": [
+ "forceGoogleDocsHtmlRendering"
+ ],
+ "properties": {
+ "forceGoogleDocsHtmlRendering": {
+ "type": "boolean",
+ "default": false
+ }
+ }
}
}
}
diff --git a/ext/js/accessibility/google-docs.js b/ext/js/accessibility/google-docs.js
new file mode 100644
index 00000000..f9ba0f7f
--- /dev/null
+++ b/ext/js/accessibility/google-docs.js
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 Yomichan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ Google Docs is moving from HTML-based rendering to + canvas-based + rendering to display content[2], + which prevents Yomichan from being able to scan text. + Enabling this option will force HTML-based rendering to be used. +
++ Less… +
+