-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
60 lines (48 loc) · 1.84 KB
/
index.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(function () {
var smsSettings = {
initialize: function initialize() {
var sms_button = document.querySelector('#messages-options-button');
sms_button.addEventListener('click', this.renderItems);
},
renderItems: function renderItems() {
function onClickSetting() {
document.querySelector('form.visible').classList.remove('visible');
new MozActivity({
name: 'configure',
data: {
target: 'device',
section: 'messaging'
}
});
}
var sms_form = document.querySelector('form.visible > menu');
if(sms_form && sms_form.lastElementChild.previousElementSibling.dataset.l10nId !== "settings") {
var sms_settingButton = document.createElement('button');
sms_settingButton.dataset.l10nId = 'settings';
sms_form.insertBefore(sms_settingButton, sms_form.lastElementChild);
sms_settingButton.addEventListener('click', onClickSetting);
}
}
};
/*if (document.documentElement) {
smsSettings.initialize();
} else {
window.addEventListener('load', smsSettings.initialize);
}/*
/*navigator.mozApps.mgmt.addEventListener('enabledstatechange', function(event) {
var app = event.application;
if (app.manifestURL === 'app://sms.gaiamobile.org/manifest.webapp') {
smsSettings.initialize();
}
});*/
// If injecting into an app that was already running at the time
// the app was enabled, simply initialize it.
if (document.documentElement) {
smsSettings.initialize();
} else {
// Otherwise, we need to wait for the DOM to be ready before
// starting initialization since add-ons are usually (always?)
// injected *before* `document.documentElement` is defined.
window.addEventListener('DOMContentLoaded', smsSettings.initialize);
}
}());