Skip to content

Commit

Permalink
add ToutApp to blacklist + revert to old tracking-image detector algo…
Browse files Browse the repository at this point in the history
…rithm
  • Loading branch information
Omar Qureshi committed Jul 28, 2015
1 parent 85674a1 commit 40f5f56
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ var pixelblock = (function(){
{name:'RJ Metrics', pattern:'go.rjmetrics.com', url:'http://rjmetrics.com'},
{name:'Mixpanel', pattern:'api.mixpanel.com/track', url:'http://mixpanel.com'},
{name:'Front App', pattern:'web.frontapp.com/api', url:'http://frontapp.com'},
{name:'Mailtrack.io', pattern:'mailtrack.io/trace', url:'http://mailtrack.io'}];
{name:'Mailtrack.io', pattern:'mailtrack.io/trace', url:'http://mailtrack.io'},
{name:'ToutApp', pattern:'go.toutapp.com', url:'http://toutapp.com'}
];

/*
*
Expand All @@ -46,34 +48,9 @@ var pixelblock = (function(){
});

// block all images left over that are 1 x 1 (or less, regardless)
if (!blacklisted) {
var elem = $(img)[0];
// fetch all possible height values
var w1 = clean_height_width(elem.style.width);
var w2 = clean_height_width(elem.style.maxWidth);

var w3 = -1;
// check if width attr exists (otherwise dom always returns 0)
if(typeof $(img).attr('width') != 'undefined') {
w3 = clean_height_width(elem.width) ;
}

// fetch all possible width values
var h1 = clean_height_width(elem.style.height);
var h2 = clean_height_width(elem.style.maxHeight);

var h3 = -1;
// check if height attr exists (otherwise dom always returns 0)
if(typeof $(img).attr('height') != 'undefined') {
h3 = clean_height_width(elem.height);
}

if ( (w1 == 0 || w1 == 1 || w2 == 0 || w2 == 1 || w3 == 0 || w3 == 1) &&
(h1 == 0 || h1 == 1 || h2 == 0 || h2 == 1 || h3 == 0 || h3 == 1)
) {
img.tracker_info = {pattern:'', name:'Unknown', url:''};
blacklisted = true;
}
if(!blacklisted && $(img).width() <= 1 && $(img).height() <= 1){
img.tracker_info = {pattern:'', name:'Unknown', url:''};
blacklisted = true;
}

// if blacklisted, hide image (ie. prevent the tracking img from loading)
Expand Down

0 comments on commit 40f5f56

Please sign in to comment.