Skip to content

Commit 514ebbc

Browse files
committed
AutoComplete message working. There are one case where it is not working well. When the user change from one tab to another and both have already loaded. In this case content.js doesn't execute again and doesn't send the message to popup.js
1 parent 020d2a1 commit 514ebbc

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Plugin/content.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
var msg = document.getElementsByClassName("TweetTextSize TweetTextSize--jumbo js-tweet-text tweet-text")[0].innerHTML;
2-
browser.runtime.sendMessage(msg, function(response) {
3-
console.log("Response: ", response);
4-
});
1+
var url = window.location.href;
2+
var oldUrl;
3+
4+
window.setInterval(function(){
5+
if (oldUrl != url){
6+
oldUrl = url;
7+
var msg = document.getElementsByClassName("TweetTextSize TweetTextSize--jumbo js-tweet-text tweet-text")[0].innerHTML;
8+
browser.runtime.sendMessage(msg, function(response) {
9+
console.log("Response: ", response);
10+
});
11+
}
12+
url = window.location.href;
13+
}, 250);
14+
15+
16+
17+

0 commit comments

Comments
 (0)