| OLD | NEW |
| (Empty) |
| 1 var listsParent = document.getElementById('lists'); | |
| 2 | |
| 3 var section = document.createElement('h2'); | |
| 4 section.appendChild(document.createTextNode(translate.get('adblock_lists'))); | |
| 5 listsParent.appendChild(section); | |
| 6 | |
| 7 sectionInfo = document.createElement('p'); | |
| 8 sectionInfo.appendChild(document.createTextNode(translate.get('adblock_lists_inf
o'))); | |
| 9 listsParent.appendChild(sectionInfo); | |
| 10 | |
| 11 function createItem(section, key) { | |
| 12 var br = document.createElement('br'); | |
| 13 var label = document.createElement('label'); | |
| 14 label.setAttribute('id', key); | |
| 15 | |
| 16 var checkbox = document.createElement('input'); | |
| 17 checkbox.setAttribute('type', 'checkbox'); | |
| 18 checkbox.setAttribute('name', key); | |
| 19 checkbox.setAttribute('id', key + '-check'); | |
| 20 checkbox.setAttribute('onClick', 'listClick("' + key + '")'); | |
| 21 checkbox.checked = lists.status(key); | |
| 22 | |
| 23 label.appendChild(checkbox); | |
| 24 var text = document.createElement('span'); | |
| 25 text.appendChild(document.createTextNode(sources.name(key) + ' ')); | |
| 26 label.appendChild(text); | |
| 27 if(sources.style[key] == 'opera') { | |
| 28 var icon = document.createElement('img'); | |
| 29 icon.setAttribute('src', '/images/opera_small.png'); | |
| 30 label.appendChild(icon); | |
| 31 } | |
| 32 if(sources.url(key).match(/^https/)) { | |
| 33 var icon = document.createElement('img'); | |
| 34 icon.setAttribute('src', '/images/secure.png'); | |
| 35 label.appendChild(icon); | |
| 36 } | |
| 37 var time = document.createElement('i'); | |
| 38 time.setAttribute('class', 'update_time'); | |
| 39 label.appendChild(time); | |
| 40 section.appendChild(label); | |
| 41 return section.appendChild(br); | |
| 42 } | |
| 43 | |
| 44 var section = document.createElement('h3'); | |
| 45 section.appendChild(document.createTextNode('Fanboy')); | |
| 46 listsParent.appendChild(section); | |
| 47 | |
| 48 section = document.createElement('div'); | |
| 49 section.setAttribute('class', 'section'); | |
| 50 for(key in sources.fanboy) { | |
| 51 createItem(section, key) | |
| 52 } | |
| 53 listsParent.appendChild(section); | |
| 54 | |
| 55 section = document.createElement('h3'); | |
| 56 section.appendChild(document.createTextNode('EasyList')); | |
| 57 listsParent.appendChild(section); | |
| 58 | |
| 59 section = document.createElement('div'); | |
| 60 section.setAttribute('class', 'section'); | |
| 61 for(key in sources.easy) { | |
| 62 createItem(section, key) | |
| 63 } | |
| 64 listsParent.appendChild(section); | |
| 65 | |
| 66 section = document.createElement('h3'); | |
| 67 section.appendChild(document.createTextNode(translate.get('other_lists'))); | |
| 68 listsParent.appendChild(section); | |
| 69 | |
| 70 section = document.createElement('div'); | |
| 71 section.setAttribute('class', 'section'); | |
| 72 for(key in sources.others) { | |
| 73 createItem(section, key) | |
| 74 } | |
| 75 listsParent.appendChild(section); | |
| 76 | |
| 77 function listClick(key) { | |
| 78 window.setTimeout("opera.extension.postMessage({request: 'list', key: '"
+ key + "', enable: " + document.getElementById(key + '-check').checked + "});"
, 650); //Avoid CSS animation bug | |
| 79 } | |
| OLD | NEW |