Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options/listsDisplay.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 2, 2012, 1:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« files/sources.js ('K') | « options/help.js ('k') | options/other.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options/listsDisplay.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/options/listsDisplay.js
@@ -0,0 +1,79 @@
+var listsParent = document.getElementById('lists');
+
+var section = document.createElement('h2');
+section.appendChild(document.createTextNode(translate.get('adblock_lists')));
+listsParent.appendChild(section);
+
+sectionInfo = document.createElement('p');
+sectionInfo.appendChild(document.createTextNode(translate.get('adblock_lists_info')));
+listsParent.appendChild(sectionInfo);
+
+function createItem(section, key) {
+ var br = document.createElement('br');
+ var label = document.createElement('label');
+ label.setAttribute('id', key);
+
+ var checkbox = document.createElement('input');
+ checkbox.setAttribute('type', 'checkbox');
+ checkbox.setAttribute('name', key);
+ checkbox.setAttribute('id', key + '-check');
+ checkbox.setAttribute('onClick', 'listClick("' + key + '")');
+ checkbox.checked = lists.status(key);
+
+ label.appendChild(checkbox);
+ var text = document.createElement('span');
+ text.appendChild(document.createTextNode(sources.name(key) + ' '));
+ label.appendChild(text);
+ if(sources.style[key] == 'opera') {
+ var icon = document.createElement('img');
+ icon.setAttribute('src', '/images/opera_small.png');
+ label.appendChild(icon);
+ }
+ if(sources.url(key).match(/^https/)) {
+ var icon = document.createElement('img');
+ icon.setAttribute('src', '/images/secure.png');
+ label.appendChild(icon);
+ }
+ var time = document.createElement('i');
+ time.setAttribute('class', 'update_time');
+ label.appendChild(time);
+ section.appendChild(label);
+ return section.appendChild(br);
+}
+
+var section = document.createElement('h3');
+section.appendChild(document.createTextNode('Fanboy'));
+listsParent.appendChild(section);
+
+section = document.createElement('div');
+section.setAttribute('class', 'section');
+for(key in sources.fanboy) {
+ createItem(section, key)
+}
+listsParent.appendChild(section);
+
+section = document.createElement('h3');
+section.appendChild(document.createTextNode('EasyList'));
+listsParent.appendChild(section);
+
+section = document.createElement('div');
+section.setAttribute('class', 'section');
+for(key in sources.easy) {
+ createItem(section, key)
+}
+listsParent.appendChild(section);
+
+section = document.createElement('h3');
+section.appendChild(document.createTextNode(translate.get('other_lists')));
+listsParent.appendChild(section);
+
+section = document.createElement('div');
+section.setAttribute('class', 'section');
+for(key in sources.others) {
+ createItem(section, key)
+}
+listsParent.appendChild(section);
+
+function listClick(key) {
+ window.setTimeout("opera.extension.postMessage({request: 'list', key: '" + key + "', enable: " + document.getElementById(key + '-check').checked + "});", 650); //Avoid CSS animation bug
+}
« files/sources.js ('K') | « options/help.js ('k') | options/other.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld