Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate ShareMeNot functionality #196

Merged
merged 14 commits into from
Jun 10, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support for newer version of Facebook button, and fixed race condition.
  • Loading branch information
froeschele committed Jun 10, 2014
commit ba482376b7b84513fdd23c85e7d4026bc3f2a68f
8 changes: 6 additions & 2 deletions src/socialwidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,14 @@ function replaceScriptsRecurse(node) {
*/
function replaceTrackerButtonsHelper(trackers, trackerButtonsToReplace) {
trackers.forEach(function(tracker) {
var replaceTrackerButtons = trackerButtonsToReplace[tracker.name];
// There's a weird race condition where background might not yet know
// about a widget to replace, so just try them all.
// If the list of buttons to replace gets long, may want to optimize here.
var replaceTrackerButtons = true;//trackerButtonsToReplace[tracker.name];

if (replaceTrackerButtons) {
console.log("replacing tracker button for " + tracker.name);
//console.log("replacing tracker button for " + tracker.name);

// makes a comma separated list of CSS selectors that specify
// buttons for the current tracker; used for document.querySelectorAll
var buttonSelectorsString = tracker.buttonSelectors.toString();
Expand Down
3 changes: 2 additions & 1 deletion src/socialwidgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"domain": "www.facebook.com",
"buttonSelectors": [
"fb\\:like",
"iframe[src*='://www.facebook.com/plugins/like.php']"
"iframe[src*='://www.facebook.com/plugins/like.php']",
".fb-like"
],
"replacementButton": {
"details": "https://www.facebook.com/plugins/like.php?href=",
Expand Down
2 changes: 1 addition & 1 deletion src/webrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ chrome.runtime.onMessage.addListener(
sendResponse(cookieBlock);
}
if(request.checkReplaceButton && Utils.isPrivacyBadgerEnabled(tabHost) && Utils.isSocialWidgetReplacementEnabled()){
var socialWidgetBlockList = getSocialWidgetBlockList(sender.tab.id);
var socialWidgetBlockList = getSocialWidgetBlockList(sender.tab.id);
sendResponse(socialWidgetBlockList);
}
if(request.unblockSocialWidget){
Expand Down