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

Side by Side Diff: includes/cssFilter.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 8, 2012, 5:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « images/secure.png ('k') | index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // ==UserScript==
2 // @include *
3 // ==/UserScript==
4
5 opera.extension.onmessage = function (event) {
6 //opera.postError('INJECTED: got a ' + event.data.request + ' request fo r ' + document.location.href);
7 if(event.data.request == 'css') {//Ensure the received message is for th e right URL
8 var css = document.getElementById(event.data.id);
9 if(!css) {
10 css = document.createElement('style');
11 css.setAttribute('type', 'text/css');
12 css.setAttribute('id', event.data.id);
13 css.setAttribute('class', 'OAB'); //To allow easy remova l by the user to view the original source code
14 css.appendChild(document.createTextNode(event.data.reply ));
15 try {
16 document.getElementsByTagName('html')[0].getElem entsByTagName('head')[0].appendChild(css); //Only append if the file is an HTML file
17 //opera.postError('INJECTED: CSS added - ' + eve nt.data.id);
18 }
19 catch(e) {}
20 }
21 else {
22 css.innerHTML = event.data.reply;
23 //opera.postError('INJECTED: CSS updated - ' + event.dat a.id);
24 }
25 }
26 else if(event.data.request == 'ping') {
27 if(event.data.type == 'css')
28 event.source.postMessage({request: 'css', url: document. location.href});
29 }
30 };
31
32 opera.extension.postMessage({request: 'css', url: document.location.href});
OLDNEW
« no previous file with comments | « images/secure.png ('k') | index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld