-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateOrder.js
46 lines (43 loc) · 1.38 KB
/
createOrder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$("#amount").on('keyup',function(){
var price = $("#price").val();
var amount = $("#amount").val();
$("#total").html(price*amount);
})
$("#price").on('keyup',function(){
var price = $("#price").val();
var amount = $("#amount").val();
$("#total").html(price*amount);
})
$('#target').submit(function (eventObject) {
event.preventDefault();
var data = $( this ).serialize();
var params = data.split("&");
var dictionary = {};
for (var i = 0; i < params.length; i++) {
var key = params[i].substring(0,params[i].indexOf("="));
dictionary[key]=params[i].substring(params[i].indexOf("=")+1,params[i].length);
}
var request = {
sender:"createOrder",
data:{
actType: dictionary["actType"],
type: dictionary["type"],
price: dictionary["price"],
amount: dictionary["amount"],
total: dictionary["total"],
currency: dictionary["currency"]
}
}
chrome.runtime.sendMessage(request, function (response) {
alert(response);
});
});
function init() {
chrome.tabs.getSelected(null, function(tab) {
if(tab.url.includes("https://idex.market/eth/")){
}
var currency = tab.url.replace("https://idex.market/eth/","");
$('select option[value='+currency+'').attr("selected",true);
});
};
window.onload = init;