Skip to content

Commit

Permalink
init checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Qureshi committed Oct 20, 2014
1 parent dd0af9e commit e928e2e
Show file tree
Hide file tree
Showing 16 changed files with 2,149 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
chrome.webRequest.onBeforeSendHeaders.addListener(function(req){
var blockingResponse = {};
// Determine whether to block this image req
var safe = req.url.indexOf('safe-img-pbz') > 0? true:false;
console.log('safe? ' + safe);

//Check if this request came from gmail
var fromGmail = false, headers = req.requestHeaders;
for(var i = 0; i < headers.length; i++) {
if(headers[i].name.toLowerCase() == 'referer'){
if(headers[i].value.indexOf('//mail.google.com/mail') > 0){
fromGmail = true;
break;
}
}
}

if(req.type == 'image' && !safe && fromGmail){
console.log(JSON.stringify(req));
blockingResponse.cancel = true;
}
return blockingResponse;
},
{urls: [ "*://*.googleusercontent.com/proxy/*" ]},['requestHeaders','blocking']);
43 changes: 43 additions & 0 deletions cs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

window.onload = function () {
// jquery
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
document.getElementsByTagName('body')[0].appendChild(jq);

// gmail.js
var gmsrc = document.createElement('script');
gmsrc.src = chrome.extension.getURL('scripts/gmail.min.js');
document.getElementsByTagName('body')[0].appendChild(gmsrc);
console.log("Gmail.js ready to go!");

// main.js
var sm = document.createElement('script');
sm.src = chrome.extension.getURL('scripts/main.js');
document.getElementsByTagName('body')[0].appendChild(sm);
console.log('PixelBlock Ready!');

// throw images in
var redEye = document.createElement('img');
redEye.src = chrome.extension.getURL('images/track-block.png');
redEye.id = 'red-eye';
redEye.style.display = 'none';
redEye.height = 14;
redEye.width = 25;
redEye.style.verticalAlign = "-3px";
redEye.style.paddingLeft = '5px';
redEye.style.cursor = 'pointer';
document.getElementsByTagName('body')[0].appendChild(redEye);

// add boostrap
var bs = document.createElement('script');
bs.id = 'bs-script';
bs.setAttribute('data-src', chrome.extension.getURL('scripts/bootstrap.js'));
document.getElementsByTagName('body')[0].appendChild(bs);

//add bootstrap css
var css = document.createElement('link');
css.href = chrome.extension.getURL('styles/bootstrap.css');
css.rel = 'stylesheet';
document.getElementsByTagName('body')[0].appendChild(css);
}
Binary file added images/logo128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/logo48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-eye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/track-block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"manifest_version": 2,
"name": "PixelBlock",
"version": "0.0.7",
"permissions": [
"*://*.googleusercontent.com/proxy/*", "webRequest", "webRequestBlocking"
],
"description": "PixelBlock is a Gmail extension that blocks people from tracking when you open/read their emails.",
"background": {
"scripts": ["bg.js"],
"persistent": true
},
"icons": {
"48": "images/logo48.png",
"128": "images/logo128.png"
},
"content_scripts": [
{
"matches": ["*://mail.google.com/*"],
"js": ["cs.js"],
"run_at":"document_end"
}
],
"web_accessible_resources": [
"scripts/*.js",
"images/*.png",
"styles/*.css"
]
}

Binary file added mq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e928e2e

Please sign in to comment.