diff options
Diffstat (limited to 'ext/js/app')
-rw-r--r-- | ext/js/app/frontend.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index 4f704faf..3a262c65 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -17,6 +17,7 @@ /* global * DocumentUtil + * GoogleDocsUtil * TextScanner * TextSourceRange */ @@ -164,6 +165,7 @@ class Frontend { ['Frontend.getPageInfo', {async: false, handler: this._onApiGetPageInfo.bind(this)}] ]); + this._prepareSiteSpecific(); this._updateContentScale(); this._signalFrontendReady(); } @@ -770,4 +772,21 @@ class Frontend { } return null; } + + _prepareSiteSpecific() { + switch (location.hostname.toLowerCase()) { + case 'docs.google.com': + this._prepareGoogleDocs(); + break; + } + } + + async _prepareGoogleDocs() { + if (typeof GoogleDocsUtil !== 'undefined') { return; } + await yomichan.api.loadExtensionScripts([ + '/js/accessibility/google-docs-util.js' + ]); + if (typeof GoogleDocsUtil === 'undefined') { return; } + DocumentUtil.registerGetRangeFromPointHandler(GoogleDocsUtil.getRangeFromPoint.bind(GoogleDocsUtil)); + } } |