blob: 17eed531aae7a536ef6b373b89ead8c1e57e7a05 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
var ExtensionManager = require('./src/extension_manager.js');
var extension_manager = new ExtensionManager();
var profile = tizen.systeminfo.getCapability('http://tizen.org/feature/profile');
var activate = function(extension) {
console.log('activate : ' + extension.name);
extension.activate = true;
extension_manager.activate(extension.name);
if (extension.type.toUpperCase() === 'API') {
extension_manager.build(true);
extension_manager.generateJsFromAPIs();
}
extension_manager.saveJsonDB();
}
var deactivate = function(extension) {
console.log('deactivate : ' + extension.name);
extension.activate = false;
extension_manager.deactivate(extension.name);
if (extension.type.toUpperCase() === 'API') {
extension_manager.build(true);
extension_manager.generateJsFromAPIs();
}
extension_manager.saveJsonDB();
}
var extDiv = document.getElementById('extDiv');
var uninstallExtension = function(extension) {
console.log('uninstall ' + extension.name);
extension_manager.uninstallExtension(extension);
}
var refreshAllList = function() {
refreshExtensionsList();
}
var refreshExtensionsList = function() {
extDiv.innerText = "";
var table = document.createElement('table');
if (profile === 'WEARABLE')
table.style.width = "70%";
var tr = document.createElement('tr');
var td_1 = document.createElement('td');
var td_2 = document.createElement('td');
tr.appendChild(td_1);
tr.appendChild(td_2);
td_1.textContent = 'Addons List';
table.appendChild(tr);
extension_manager.loadJsonDB();
for (i in extension_manager.extensions_list_) {
var extension = extension_manager.extensions_list_[i];
tr = document.createElement('tr');
td_1 = document.createElement('td');
td_2 = document.createElement('td');
tr.appendChild(td_1);
tr.appendChild(td_2);
var div = document.createElement('div');
var contents = '<b>' + extension.name + '</b>';
var button = document.createElement('a');
if (extension.type.toUpperCase() === 'INSTALLER') {
button.setAttribute('class', 'button dark_grey');
button.textContent = 'INSTALLED';
} else {
button.setAttribute('class', 'button black');
var btnContent = 'Off';
if (!extension.activate) btnContent = 'On';
button.textContent = btnContent;
button.extension = extension;
button.onclick = function(ev) {
if (this.textContent == 'On') {
activate(this.extension);
this.textContent = 'Off';
} else {
deactivate(this.extension);
this.textContent = 'On';
}
};
}
// delete button
var button2 = document.createElement('a');
button2.setAttribute('class', 'button dsgnmoo');
button2.textContent = 'X';
button2.extension = extension;
button2.onclick = function(ev) {
uninstallExtension(this.extension)
setTimeout(function(){
refreshAllList();
}, 1000);
}
td_1.innerHTML = contents;
td_2.appendChild(button);
td_2.appendChild(button2);
table.appendChild(tr);
}
extDiv.appendChild(table);
}
refreshExtensionsList();
|