A
A
armalko2018-06-24 00:57:40
JavaScript
armalko, 2018-06-24 00:57:40

How to automatically change the content of certain elements of the site through Google Extensions?

I am writing a translator extension for Google Chrome. Yes, I know what it is, it's just more interesting myself. It can now translate a word by highlighting, right-clicking, and selecting "Translate with My_own_translator". But I would like it to automatically find certain elements when entering a certain site and translate them itself. For example, when entering personal correspondence on VKontakte, he would find the element using the search class = "im-mess--text wall_module _im_log_body", would automatically translate the message and replace the content of the element with the translation. This is implemented in the Google Translate Extension - when you visit a foreign site, it automatically offers to translate it completely. Unfortunately, I did not find the Google Translate Extension code, and in all the articles that I read about extensions there was no implementation of such a function.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2018-06-24
@alekssamos

Well, try to access the DOM of the page through innerHTML there is some.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question