First steps

This commit is contained in:
Zach Fox 2017-08-07 14:29:47 -07:00
parent 36453644e0
commit 7d4fd995f2
2 changed files with 24 additions and 1 deletions

View file

@ -87,8 +87,26 @@
});
}
function buyButtonClicked(name, author, price) {
EventBridge.emitWebEvent(JSON.stringify({
type: "CHECKOUT",
itemName: name,
itemAuthor: author,
itemPrice: price
}));
}
function injectHiFiCode() {
// Nothing to do.
$('#side-info').find('.btn').attr('href', '#')
$('#side-info').find('.btn').on('click', function () {
buyButtonClicked("TEST ITEM", "Zach Fox", 10);
});
$('.item-footer').find('#price-or-edit').find('a').attr('href', '#')
$('.item-footer').find('#price-or-edit').find('a').on('click', function () {
buyButtonClicked("TEST ITEM", "Zach Fox", 10);
});
}
function updateClaraCode() {

View file

@ -59,6 +59,11 @@
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
tablet.webEventReceived.connect(function (message) {
if (message.type === "CHECKOUT") {
print("ZRF: Buy Button Clicked: ", JSON.stringify(message));
//tablet.pushOntoStack("");
}
if (message === GOTO_DIRECTORY) {
tablet.gotoWebScreen(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
}