Skip to content

Instantly share code, notes, and snippets.

@pwim
Created Mar 2, 2012
Embed
What would you like to do?
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