From 7d26d2d88b84f55e66703a2481fe7500fce765cd Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 8 Aug 2017 14:29:44 -0700 Subject: [PATCH] Switch and fix overlay clicks --- .../ui/overlays/ContextOverlayInterface.cpp | 3 ++- scripts/system/html/js/marketplacesInject.js | 22 ++++++++++++------- scripts/system/marketplaces/marketplaces.js | 1 - 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp index 77b9424d2f..50778d26e8 100644 --- a/interface/src/ui/overlays/ContextOverlayInterface.cpp +++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp @@ -241,6 +241,7 @@ void ContextOverlayInterface::contextOverlays_hoverLeaveEntity(const EntityItemI } static const QString MARKETPLACE_BASE_URL = "https://metaverse.highfidelity.com/marketplace/items/"; +static const QString MARKETPLACES_INJECT_SCRIPT_URL = PathUtils::resourcesPath() + "../scripts/system/html/js/marketplacesInject.js"; void ContextOverlayInterface::openMarketplace() { // lets open the tablet and go to the current item in @@ -250,7 +251,7 @@ void ContextOverlayInterface::openMarketplace() { auto tablet = dynamic_cast(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); // construct the url to the marketplace item QString url = MARKETPLACE_BASE_URL + _entityMarketplaceID; - tablet->gotoWebScreen(url); + tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_URL); _hmdScriptingInterface->openTablet(); _isInMarketplaceInspectionMode = true; } diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index 068625b792..93f2258810 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -25,6 +25,8 @@ var canWriteAssets = false; var xmlHttpRequest = null; var isPreparing = false; // Explicitly track download request status. + + var confirmPurchases = true; function injectCommonCode(isDirectoryPage) { @@ -97,17 +99,21 @@ } function injectHiFiCode() { - $('.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); - }); + if (confirmPurchases) { + $('.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 injectHiFiItemPageCode() { - $('#side-info').find('.btn').attr('href', '#') - $('#side-info').find('.btn').on('click', function () { - buyButtonClicked($('#top-center').find('h1').text(), $('#creator').find('.value').text(), 10); - }); + if (confirmPurchases) { + $('#side-info').find('.btn').attr('href', '#') + $('#side-info').find('.btn').on('click', function () { + buyButtonClicked($('#top-center').find('h1').text(), $('#creator').find('.value').text(), 10); + }); + } } function updateClaraCode() { diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 503eb69cc3..87b920fab1 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -192,7 +192,6 @@ function fromQml(message) { switch (message.method) { case 'checkout_cancelClicked': - print('fromQml: ' + JSON.stringify(message)); tablet.popFromStack(); break; case 'checkout_buyClicked':