jquery - Coinbase custom button in Chrome Extension -
i'm trying add custom coinbase payment button in google chrome extension.
i've gotten work in jsfiddle: http://jsfiddle.net/hqhlv/
$(document).ready(function () { code = "65a580d7449cc35869c9bd0d49cf77bd"; function get_button_html(code) { var button_html = "<div class='coinbase-button' data-code='65a580d7449cc35869c9bd0d49cf77bd' data-button-style='none'></div>"; return button_html; } function loadbutton(code) { $('body').after("<a href='' class='my-custom-link'>show me modal!</a>", get_button_html(code)); }; loadbutton(code); $.getscript("https://coinbase.com/assets/button.js"); $('.my-custom-link').click(function () { console.log('coinbase_show_modal'); $(document).trigger('coinbase_show_modal', '65a580d7449cc35869c9bd0d49cf77bd'); return false; }); $(document).on('coinbase_payment_complete', function (event, code) { console.log("payment completed button " + code); window.location = "/confirmation.html"; });
});
however, copying code content script file in extension. idea might cause?
Comments
Post a Comment