Sep 14 2011

New Facebook Invite all friends hack

Category: Facebook,JavascriptGiulio Pons @ 12:19 pm

So, you want to invote all your friends but the old hack doesn’t work anymore?

With the last facebook friends groups restyle the code trick to send invitation to all friends do not work anymore. Moreover, you’ve installed the last Firefox, and you can’t use anymore the url address bar to input javascript commands.

It was the same for me. But I’ve find this path to invite all your friends to your new brand facebook page, follow this steps.

1) Use Firefox 6.

2) Open your facebook fan page.

3) Click on “Invite friends”.

4) The grid of friends is opened.

5) Select “Search all friends” and scroll down, so all your friends are loaded.

6) Press Ctrl+Shift+K.

7) A firefox panel is opened on the top of the page, here you can put the javascript code (put the two lines in a single line):

elms=document.getElementById('pop_content').getElementsByTagName('li');
for(var fid in elms){if(typeof elms[fid] === 'object'){elms[fid].click();}}

This code will select eache friend and perform a click on it.

8) Press “enter”.

9) Wait the selecetion (it could take some minute).

10) Press “submit”.

Today (09/14/2011) it works.

Share

Tags: , , , , ,


Nov 25 2010

Get URL parameter in javascript

Category: JavascriptGiulio Pons @ 10:55 am

Sometimes in javascript you have the variable that you need to use in the url, as a parameter passed in GET to the page, but you don’t have it in page. You can retrieve those data analyzing the window.location.href string. Here is the Javascript function that does the work, pass to it the variable name of the variable you need:

function gup( varname ) {
	varname = varname.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+varname+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null ) return ""; else return results[1];
}

Another usefull function is the one that get the file name of the current page from the url.

Share

Tags: , , , , , , , ,


Nov 25 2010

Get file name in javascript

Category: JavascriptGiulio Pons @ 10:49 am

How to get the file name of the page? When you need to read the file name of the current page in javascript you can use the document.location.href string and parse it to find the filename, here is the script that strips away the other chars and keep only the script file name:

function getFileName() {
	var url = document.location.href;
	url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
	url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
	url = url.substring(url.lastIndexOf("/") + 1, url.length);
	return url;
}

Another usefull function is the one that get the parameters from the url.

Share

Tags: , , , , ,