LEFT | RIGHT |
1 var otherParent = document.getElementById('other'); | 1 var otherParent = document.getElementById('other'); |
2 | 2 |
3 var section = document.createElement('h2'); | 3 var section = document.createElement('h2'); |
4 section.appendChild(document.createTextNode(translate.get('other_preferences')))
; | 4 section.appendChild(document.createTextNode(translate.get('other_preferences')))
; |
5 otherParent.appendChild(section); | 5 otherParent.appendChild(section); |
6 | 6 |
7 //BUTTON | 7 //BUTTON |
| 8 /* |
8 var section = document.createElement('h3'); | 9 var section = document.createElement('h3'); |
9 section.appendChild(document.createTextNode(translate.get('button'))); | 10 section.appendChild(document.createTextNode(translate.get('button'))); |
10 otherParent.appendChild(section); | 11 otherParent.appendChild(section); |
11 | 12 |
12 var subsection = document.createElement('div'); | 13 var subsection = document.createElement('div'); |
13 var label = document.createElement('label'); | 14 var label = document.createElement('label'); |
14 | 15 |
15 var checkbox = document.createElement('input'); | 16 var checkbox = document.createElement('input'); |
16 checkbox.setAttribute('type', 'checkbox'); | 17 checkbox.setAttribute('type', 'checkbox'); |
17 checkbox.setAttribute('name', 'button'); | 18 checkbox.setAttribute('name', 'button'); |
18 checkbox.setAttribute('id', 'button'); | 19 checkbox.setAttribute('id', 'button'); |
19 checkbox.setAttribute('onClick', 'setButton()'); | 20 checkbox.setAttribute('onClick', 'setButton()'); |
20 checkbox.checked = preferences.bool('button'); | 21 checkbox.checked = preferences.bool('button'); |
21 label.appendChild(checkbox); | 22 label.appendChild(checkbox); |
22 | 23 |
23 var text = document.createElement('span'); | 24 var text = document.createElement('span'); |
24 text.innerHTML = translate.get('button_descript'); | 25 text.innerHTML = translate.get('button_descript'); |
25 label.appendChild(text); | 26 label.appendChild(text); |
26 | 27 |
27 subsection.appendChild(label); | 28 subsection.appendChild(label); |
28 otherParent.appendChild(subsection); | 29 otherParent.appendChild(subsection);*/ |
29 | 30 |
30 //INTERVAL | 31 //INTERVAL |
31 var subsection = document.createElement('div'); | 32 var subsection = document.createElement('div'); |
32 var intervalTitle = document.createElement('h3'); | 33 var intervalTitle = document.createElement('h3'); |
33 intervalTitle.appendChild(document.createTextNode(translate.get('interval_title'
))); | 34 intervalTitle.appendChild(document.createTextNode(translate.get('interval_title'
))); |
34 subsection.appendChild(intervalTitle); | 35 subsection.appendChild(intervalTitle); |
35 var intervals = [43200000, 86400000, 172800000, 604800000, 2592000000]; | 36 var intervals = [43200000, 86400000, 172800000, 604800000, 2592000000]; |
36 intervalInput = document.createElement('select'); | 37 intervalInput = document.createElement('select'); |
37 intervalInput.setAttribute('id', 'interval'); | 38 intervalInput.setAttribute('id', 'interval'); |
38 intervalInput.setAttribute('onChange', 'setInterval()'); | 39 intervalInput.setAttribute('onChange', 'setInterval()'); |
39 for(i in intervals) { | 40 for(i in intervals) { |
40 var element = document.createElement('option'); | 41 var element = document.createElement('option'); |
41 element.appendChild(document.createTextNode(translate.get('interval_' +
intervals[i]))); | 42 element.appendChild(document.createTextNode(translate.get('interval_' +
intervals[i]))); |
42 if(preferences.int('interval') == intervals[i]) | 43 if(preferences.int('interval') == intervals[i]) |
43 element.setAttribute('selected', 'selected'); | 44 element.setAttribute('selected', 'selected'); |
44 element.setAttribute('value', intervals[i]); | 45 element.setAttribute('value', intervals[i]); |
45 intervalInput.appendChild(element); | 46 intervalInput.appendChild(element); |
46 } | 47 } |
47 subsection.appendChild(intervalInput); | 48 subsection.appendChild(intervalInput); |
48 otherParent.appendChild(subsection); | 49 otherParent.appendChild(subsection); |
49 | 50 |
50 | 51 |
51 function setInterval() { | 52 function setInterval() { |
52 preferences.int('interval', document.getElementById('interval').value); | 53 preferences.int('interval', document.getElementById('interval').value); |
53 } | 54 } |
54 function setButton() { | 55 function setButton() { |
55 opera.extension.postMessage({request: 'button', enable: document.getElem
entById('button').checked}); | 56 opera.extension.postMessage({request: 'button', enable: document.getElem
entById('button').checked}); |
56 } | 57 } |
LEFT | RIGHT |