-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Omar Qureshi
committed
Oct 20, 2014
1 parent
dd0af9e
commit e928e2e
Showing
16 changed files
with
2,149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
|
Oops, something went wrong.