diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2023-12-27 00:59:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 05:59:33 +0000 |
commit | 7cc20964b5ae69967945a802c4137be9052ea93b (patch) | |
tree | 0fb824d94045d1c424e99ccc510e342761e2a176 /ext/js/app/frontend.js | |
parent | ff412d2010a41da47e37e86f0167452c2f9c72ca (diff) |
Google docs fixes (#455)
* Simplify GoogleDocsUtil deferred import
* Remove loadExtensionScripts
Diffstat (limited to 'ext/js/app/frontend.js')
-rw-r--r-- | ext/js/app/frontend.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index c8b63813..b68b55f3 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -16,7 +16,6 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import {GoogleDocsUtil} from '../accessibility/google-docs-util.js'; import {EventListenerCollection, invokeMessageHandler, log, promiseAnimationFrame} from '../core.js'; import {DocumentUtil} from '../dom/document-util.js'; import {TextSourceElement} from '../dom/text-source-element.js'; @@ -964,7 +963,7 @@ export class Frontend { _prepareSiteSpecific() { switch (location.hostname.toLowerCase()) { case 'docs.google.com': - this._prepareGoogleDocsWrapper(); + this._prepareGoogleDocs(); break; } } @@ -972,19 +971,8 @@ export class Frontend { /** * @returns {Promise<void>} */ - async _prepareGoogleDocsWrapper() { - if (typeof GoogleDocsUtil !== 'undefined') { return; } - await yomitan.api.loadExtensionScripts([ - '/js/accessibility/google-docs-util.js' - ]); - this._prepareGoogleDocs(); - } - - /** - * @returns {Promise<void>} - */ async _prepareGoogleDocs() { - if (typeof GoogleDocsUtil === 'undefined') { return; } + const {GoogleDocsUtil} = await import('../accessibility/google-docs-util.js'); DocumentUtil.registerGetRangeFromPointHandler(GoogleDocsUtil.getRangeFromPoint.bind(GoogleDocsUtil)); } } |