Skip to content

Instantly share code, notes, and snippets.

@CTimmerman
Last active January 6, 2019 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CTimmerman/a7ed927fabc44b68d411 to your computer and use it in GitHub Desktop.
Save CTimmerman/a7ed927fabc44b68d411 to your computer and use it in GitHub Desktop.
Like-o-matic bookmarklet based on http://marklets.com/Like-o-matic.aspx
javascript:(function(){try{var url='https://www.facebook.com/plugins/like.php?href='+encodeURIComponent(location.href);eval('');var ifr=document.createElement('iframe');ifr.style.cssText='border:0px;z-index:9000;position:fixed;top:100px;left:10px;width:200px;height:70px';ifr.src=url;document.getElementsByTagName('body')[0].appendChild(ifr)}catch(e){window.open(url)}})()
javascript:(function(){var w=window.open('',"LikeOMatic","height=200,width=350,top="+(screenY+outerHeight/2-100)+",left="+(screenX+outerWidth/2-175));w.document.title=document.title;var ifr=w.document.createElement('iframe');ifr.style.cssText='border:0px';ifr.src='https://www.facebook.com/plugins/like.php?href='+encodeURIComponent(location.href);w.document.body.innerHTML='';w.document.getElementsByTagName('body')[0].appendChild(ifr)})()
javascript:location.href="https://www.facebook.com/plugins/like.php?href="+encodeURIComponent(location.href)
@CTimmerman
Copy link
Author

Supports GitHub and YouTube. Choose fancy inline or new tab version, popups (IE9 or better), or simplicity.

I use eval('') to catch CSP exceptions in Chrome, like i read on some Angular page.

@CTimmerman
Copy link
Author

@CTimmerman
Copy link
Author

For the record, this is when FB likes were shared on one's public timeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment