Skip to content

Instantly share code, notes, and snippets.

@chrismytton
Created January 14, 2012 14:51
Show Gist options
  • Save chrismytton/1611710 to your computer and use it in GitHub Desktop.
Save chrismytton/1611710 to your computer and use it in GitHub Desktop.
Bookmarklet templates for #rusichackday
(function(document) {
// Grab the video id from the vimeo oembed api, then post it across to the space.
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'http://hectic.rusic.com/ideas/new?custom1=' + JSON.parse(xhr.responseText).video_id);
iframe.setAttribute('id', 'rusic-modal');
iframe.setAttribute('style', 'position: fixed; z-index: 999999; width: 500px; height: 300px; right: 0; top: 0; border: none; overflow: hidden;');
body = document.getElementsByTagName('body')[0];
body.appendChild(iframe);
}
};
xhr.open('GET', 'http://vimeo.com/api/oembed.json?url=' + encodeURIComponent(window.location.href), true);
xhr.send(null);
})(document);
@chrismytton
Copy link
Author

For a script to compile bookmarklets, check out the comments on this gist.

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