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