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

Side by Side Diff: options/whitelist.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 2, 2012, 1:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« files/sources.js ('K') | « options/time.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 var section = document.createElement('h3');
2 section.appendChild(document.createTextNode(translate.get('whitelist')));
3 listsParent.appendChild(section);
4
5 var descript = document.createElement('p');
6 descript.innerHTML = translate.get('whitelist_descript');
7 listsParent.appendChild(descript);
8
9 var element = document.createElement('div');
10 element.setAttribute('id', 'whitelist');
11 element.setAttribute('class', 'section');
12 listsParent.appendChild(element);
13
14 var element = document.createElement('input');
15 element.setAttribute('id', 'newWhitelist');
16 element.setAttribute('type', 'text');
17 element.setAttribute('placeholder', translate.get('whitelist_holder'));
18 listsParent.appendChild(element);
19
20 var elementParent = document.createElement('div');
21 elementParent.setAttribute('class', 'button_parent');
22 var element = document.createElement('button');
23 element.setAttribute('onClick', 'whitelist.add()');
24 element.appendChild(document.createTextNode(translate.get('save_apply')));
25 elementParent.appendChild(element)
26 listsParent.appendChild(elementParent);
27
28 const whitelist = {
29 add: function() {
30 var rule = document.getElementById('newWhitelist').value;
31 if(rule != "") {
32 lists.whitelist.add(rule, true);
33 document.getElementById('newWhitelist').value = "";
34 opera.extension.postMessage({request: 'ping', type: 'css '});
35 this.display();
36 }
37 },
38 remove: function(rule) {
39 lists.whitelist.remove(rule, true);
40 opera.extension.postMessage({request: 'ping', type: 'css'});
41 this.display();
42 },
43 display: function() {
44 var container = document.createElement('div');
45 var whitelist = lists.whitelist.get();
46 for(i in whitelist) {
47 var element = document.createElement('span');
48 var removeLink = document.createElement('a');
49 var removeButton = document.createElement('img');
50 removeButton.setAttribute('src', '/images/remove14.png') ;
51 removeButton.setAttribute('style', 'vertical-align: midd le;');
52 removeLink.appendChild(removeButton);
53 removeLink.setAttribute('onClick', 'whitelist.remove("' + whitelist[i] +'")');
54 element.appendChild(removeLink);
55 element.appendChild(document.createTextNode(' ' + whitel ist[i]));
56 container.appendChild(element);
57 var br = document.createElement('br');
58 container.appendChild(br);
59 }
60
61 var whiteParent = document.getElementById('whitelist');
62 whiteParent.innerHTML = '';
63 whiteParent.appendChild(container);
64 }
65 }
66 whitelist.display();
OLDNEW
« files/sources.js ('K') | « options/time.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld