-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinvestmentProgram.js
43 lines (41 loc) · 1.03 KB
/
investmentProgram.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
function init() {
var params = window
.location
.search
.replace('?','')
.split('&')
.reduce(
function(p,e){
var a = e.split('=');
p[ decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
return p;
},
{}
);
$("#app").html(params['id']);
if(params['id'] != undefined){
getProgram(params['id']);
}else
{
var request = {
sender : "investmentProgram",
method : "getProgramId"
};
chrome.runtime.sendMessage(request, function (response) {
getProgram(response);
});
}
};
window.onload = init;
function getProgram(id){
var request = {
sender : "investmentProgram",
method : "getProgram",
id : id
};
chrome.runtime.sendMessage(request, function (response) {
response = JSON.parse(response);
$("#title").html(response.investmentProgram.title);
$("#description").html(response.investmentProgram.description);
});
}