Repository navigation
Expand file tree
/
Copy pathdeveloper.js
More file actions
59 lines (49 loc) · 1.67 KB
/
Copy pathdeveloper.js
File metadata and controls
59 lines (49 loc) · 1.67 KB
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
/* global ScreenLayout, Settings */
'use strict';
var Developer = {
init: function about_init() {
document.getElementById('ftuLauncher').>
// hide software home button whenever the device has no hardware home button
if (!ScreenLayout.getCurrentLayout('hardwareHomeButton')) {
document.getElementById('software-home-button').style.display = 'none';
// always set homegesture enabled on tablet, so hide the setting
if (!ScreenLayout.getCurrentLayout('tiny')) {
document.getElementById('homegesture').style.display = 'none';
}
}
},
launchFTU: function about_launchFTU() {
var settings = Settings.mozSettings;
if (!settings) {
return;
}
var key = 'ftu.manifestURL';
var req = settings.createLock().get(key);
req. ftuManifest() {
var ftuManifestURL = req.result[key];
// fallback if no settings present
if (!ftuManifestURL) {
ftuManifestURL = document.location.protocol +
'//communications.gaiamobile.org' +
(location.port ? (':' + location.port) : '') +
'/manifest.webapp';
}
var ftuApp = null;
navigator.mozApps.mgmt.getAll(). gotApps(evt) {
var apps = evt.target.result;
for (var i = 0; i < apps.length && ftuApp == null; i++) {
var app = apps[i];
if (app.manifestURL == ftuManifestURL) {
ftuApp = app;
}
}
if (ftuApp) {
ftuApp.launch('ftu');
} else {
alert(navigator.mozL10n.get('no-ftu'));
}
};
};
}
};
navigator.mozL10n.ready(Developer.init.bind(Developer));