Skip to content

Instantly share code, notes, and snippets.

@arielcr
arielcr / embed.js
Created July 17, 2013 17:52
The embed.js script
function parseQuery ( query ) {
var Params = new Object ();
if ( ! query ) return Params;
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) continue;
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
@arielcr
arielcr / embed.html
Created July 17, 2013 17:48
Embed script using javascript
<!-- Embed -->
<div id="my-embed-content"></div>
<script>(function(d, s, id) {
var my_account = 123;
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//the.location.of/my/embed.js#acc="+my_account+"&w=900&h=700";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'my-embed'));</script>
@arielcr
arielcr / fbshare.html
Last active April 22, 2019 10:23
How to pass custom parameters to a Facebook Share button
<a id="facebook-Link"
href="http://www.facebook.com/sharer.php?
s=100
&p[url]=the url you want to share
&p[images][0]=the image you want to share
&p[title]=the title you want to share
&p[summary]=the description/summary you want to share"
target="_blank">
<img src="your/path/to/facebook-icon.png"
alt="Share on Facebook" />
@arielcr
arielcr / share.js
Last active December 19, 2015 20:19
Sharing Links
/*
* Share on Facebook
*/
$('#facebook-Link').click(function () {
var sharer = "https://www.facebook.com/sharer/sharer.php?u=";
window.open(sharer + location.href, 'sharer', 'width=626,height=436');
});
/*
* Share on Twitter