Skip to content

Commit 020d2a1

Browse files
committed
Autocomplete works fine but only if you refresh the tab because content.js is only executed at the beginning
1 parent 9727b29 commit 020d2a1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Plugin/background.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
var message;
12
browser.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
2-
console.log("Received msg: ", msg, sender.tab, sender.frameId);
3+
message = msg;
34
sendResponse("Gotcha!");
4-
});
5+
});

Plugin/block.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@
296296

297297
function CompleteFields(){
298298
var pathArray;
299+
browser.runtime.getBackgroundPage().then((get)=>{
300+
console.log(get.message);
301+
document.getElementById("msg").value = get.message;
302+
});
299303
browser.tabs.query({active: true, currentWindow: true}).then((tabs)=>{
300304
pathArray = tabs[0].url.split('/');
301305
if(pathArray[2] == "twitter.com"){
@@ -350,7 +354,7 @@
350354

351355
}
352356
}
353-
357+
354358
function onError(e) {
355359
console.error(e);
356360
}

0 commit comments

Comments
 (0)