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

Side by Side Diff: options/cssDisplay.js

Issue 8560083: adblockplusopera: Port UI code from Chrome (Closed)
Patch Set: Created Oct. 12, 2012, 1:11 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
OLDNEW
(Empty)
1 var cssParent = document.getElementById('css');
2
3 var section = document.createElement('h2');
4 section.appendChild(document.createTextNode(translate.get('css_filter')));
5 cssParent.appendChild(section);
6
7 sectionInfo = document.createElement('p');
8 sectionInfo.appendChild(document.createTextNode(translate.get('css_filter_info') ));
9 cssParent.appendChild(sectionInfo);
10
11 section = document.createElement('div');
12 section.setAttribute('class', 'section');
13 for(key in sources.css) {
14 var br = document.createElement('br');
15 var label = document.createElement('label');
16
17 var checkbox = document.createElement('input');
18 checkbox.setAttribute('type', 'checkbox');
19 checkbox.setAttribute('name', key);
20 checkbox.setAttribute('id', key + '-check');
21 checkbox.setAttribute('onClick', 'cssClick("' + key + '")');
22 checkbox.checked = css.status(key);
23
24 label.appendChild(checkbox);
25 var text = document.createElement('span');
26 text.appendChild(document.createTextNode(sources.name(key) + ' '));
27 label.appendChild(text);
28 var icon = document.createElement('img');
29 icon.setAttribute('src', '/images/opera_small.png');
30 label.appendChild(icon);
31 if(sources.css[key].match(/^https/)) {
32 var icon = document.createElement('img');
33 icon.setAttribute('src', '/images/secure.png');
34 label.appendChild(icon);
35 }
36 var time = document.createElement('i');
37 time.setAttribute('class', 'update_time');
38 label.appendChild(time);
39 section.appendChild(label);
40 section.appendChild(br);
41 }
42 cssParent.appendChild(section);
43
44
45 var section = document.createElement('h3');
46 section.appendChild(document.createTextNode(translate.get('perso_css')));
47 cssParent.appendChild(section);
48
49 var element = document.createElement('div');
50 var descript = document.createElement('p');
51 descript.innerHTML = translate.get('perso_css_descript');
52 element.appendChild(descript);
53
54 var cssPersoElement = document.createElement('textarea');
55 cssPersoElement.value = css.personal().join('\n');
56 cssPersoElement.setAttribute('id', 'css-perso');
57 cssPersoElement.setAttribute('placeholder', translate.get('perso_css_holder'));
58 element.appendChild(cssPersoElement);
59
60 var cssPersoButtonParent = document.createElement('div');
61 cssPersoButtonParent.setAttribute('class', 'button_parent');
62 var cssPersoButton = document.createElement('button');
63 cssPersoButton.setAttribute('onClick', 'cssPerso()');
64 cssPersoButton.appendChild(document.createTextNode(translate.get('save_apply'))) ;
65 cssPersoButtonParent.appendChild(cssPersoButton)
66 element.appendChild(cssPersoButtonParent);
67
68 cssParent.appendChild(element);
69
70 function cssClick(key){
71 if(document.getElementById(key + '-check').checked) {
72 window.setTimeout("css.enable('" + key + "', true);", 650); //Av oid CSS animation bug
73 }
74 else
75 window.setTimeout("css.disable('" + key + "', true);", 650); //A void CSS animation bug
76 }
77 function cssPerso() {
78 preferences.array('css-perso-content', document.getElementById('css-pers o').value.split("\n"));
79 opera.extension.postMessage({request: 'ping', type: 'css'});
80 }
OLDNEW
« options.html ('K') | « options/about.js ('k') | options/help.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld