sdfsfe
This commit is contained in:
parent
bb5b01e027
commit
a8989ee13a
@ -14,15 +14,13 @@ data = readUrl()
|
||||
});
|
||||
|
||||
function handleMessages(message,sender,sendResponse,tab,data){
|
||||
if(message === "Button_clicked")
|
||||
if(message.state === "Button_clicked")
|
||||
{
|
||||
browser.tabs.executeScript(tab.id,{
|
||||
file:"spawn.js"
|
||||
file:"spawn.js"
|
||||
});
|
||||
console.log("pass tab data to run, in promise");
|
||||
console.log(tab);
|
||||
console.log(data);
|
||||
//nextUrl(data,tab,i);
|
||||
}
|
||||
else if(message === "Content_Loaded")
|
||||
{
|
||||
|
@ -1,5 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
<div id="picker_zone" style="margin:20px ;color:blue">
|
||||
<input type="file" accept="*.json" id="input">
|
||||
</div>
|
||||
test
|
||||
<button type="submit" id="id_run" value="run importer" name="b_submit">RUNRUNRUN</button>
|
||||
<script type="text/javascript" language="javascript" src="home.js"></script>
|
||||
|
13
home.js
13
home.js
@ -1,12 +1,19 @@
|
||||
const fileField = document.querySelector('input[type="file"]');
|
||||
|
||||
fileField.addEventListener("change",() =>
|
||||
{
|
||||
console.log(fileField.files[0]);
|
||||
});
|
||||
|
||||
document.getElementById("id_run").addEventListener("click", function(e){
|
||||
console.log("triggered!!");
|
||||
alert("judihudi");
|
||||
alert("Run script");
|
||||
startBackgroundScript();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function startBackgroundScript()
|
||||
{
|
||||
browser.runtime.sendMessage("Button_clicked");
|
||||
browser.runtime.sendMessage({state : "Button_clicked",
|
||||
fileHandler:fileField);
|
||||
console.log("home.js sent button_clicked message...");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user