Created
October 27, 2019 03:58
-
-
Save titangene/878cf67e1d9b97a1eff8af1eb52de3ca to your computer and use it in GitHub Desktop.
Remove uncommonly used languages from Google Translate in chrome extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
translateElement = document.getElementById('gtx-host'); | |
translateContentElements = translateElement.shadowRoot.getElementById('bubble-content'); | |
translateOptions = [...translateContentElements.querySelectorAll('option')]; | |
languages = ['zh-CN', 'auto', 'en', 'ja']; | |
translateOptions.filter(option => !languages.includes(option.value)) | |
.forEach(option => option.remove()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
因 Google Translate 的 Chrome extension 於 2020/01/24 更新新版,而造成此程式碼無法使用,目前暫時用下面連結解決問題