Skip to content

Instantly share code, notes, and snippets.

@pwim
Created March 2, 2012 02:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwim/1955148 to your computer and use it in GitHub Desktop.
Save pwim/1955148 to your computer and use it in GitHub Desktop.
Doorkeeper Widget
(function() {
<%= File.read(Rails.root.join("vendor/assets/javascripts/getElementsByClassName-1.0.1.js")) %>
<%= File.read(Rails.root.join("vendor/assets/javascripts/ready.js")) %>
domready(function() {
var widget_link, iframe, i, widget_links;
widget_links = getElementsByClassName('doorkeeper-registration-widget');
for (i = 0; i < widget_links.length; i++) {
widget_link = widget_links[i];
iframe = document.createElement('iframe');
iframe.setAttribute('src', widget_link.href + "/widget.html");
iframe.setAttribute('width', '300');
iframe.setAttribute('height', '240');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('scrolling', 'no');
widget_link.parentNode.replaceChild(iframe, widget_link);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment