| Index: options/other.js |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/options/other.js |
| @@ -0,0 +1,56 @@ |
| +var otherParent = document.getElementById('other'); |
| + |
| +var section = document.createElement('h2'); |
| +section.appendChild(document.createTextNode(translate.get('other_preferences'))); |
| +otherParent.appendChild(section); |
| + |
| +//BUTTON |
| +var section = document.createElement('h3'); |
| +section.appendChild(document.createTextNode(translate.get('button'))); |
| +otherParent.appendChild(section); |
| + |
| +var subsection = document.createElement('div'); |
| +var label = document.createElement('label'); |
| + |
| +var checkbox = document.createElement('input'); |
| +checkbox.setAttribute('type', 'checkbox'); |
| +checkbox.setAttribute('name', 'button'); |
| +checkbox.setAttribute('id', 'button'); |
| +checkbox.setAttribute('onClick', 'setButton()'); |
| +checkbox.checked = preferences.bool('button'); |
| +label.appendChild(checkbox); |
| + |
| +var text = document.createElement('span'); |
| +text.innerHTML = translate.get('button_descript'); |
| +label.appendChild(text); |
| + |
| +subsection.appendChild(label); |
| +otherParent.appendChild(subsection); |
| + |
| +//INTERVAL |
| +var subsection = document.createElement('div'); |
| +var intervalTitle = document.createElement('h3'); |
| +intervalTitle.appendChild(document.createTextNode(translate.get('interval_title'))); |
| +subsection.appendChild(intervalTitle); |
| +var intervals = [43200000, 86400000, 172800000, 604800000, 2592000000]; |
| +intervalInput = document.createElement('select'); |
| +intervalInput.setAttribute('id', 'interval'); |
| +intervalInput.setAttribute('onChange', 'setInterval()'); |
| +for(i in intervals) { |
| + var element = document.createElement('option'); |
| + element.appendChild(document.createTextNode(translate.get('interval_' + intervals[i]))); |
| + if(preferences.int('interval') == intervals[i]) |
| + element.setAttribute('selected', 'selected'); |
| + element.setAttribute('value', intervals[i]); |
| + intervalInput.appendChild(element); |
| +} |
| +subsection.appendChild(intervalInput); |
| +otherParent.appendChild(subsection); |
| + |
| + |
| +function setInterval() { |
| + preferences.int('interval', document.getElementById('interval').value); |
| +} |
| +function setButton() { |
| + opera.extension.postMessage({request: 'button', enable: document.getElementById('button').checked}); |
| +} |