Switch and fix overlay clicks

This commit is contained in:
Zach Fox 2017-08-08 14:29:44 -07:00
parent 1493a310af
commit 7d26d2d88b
3 changed files with 16 additions and 10 deletions

View file

@ -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 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() { void ContextOverlayInterface::openMarketplace() {
// lets open the tablet and go to the current item in // lets open the tablet and go to the current item in
@ -250,7 +251,7 @@ void ContextOverlayInterface::openMarketplace() {
auto tablet = dynamic_cast<TabletProxy*>(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); auto tablet = dynamic_cast<TabletProxy*>(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
// construct the url to the marketplace item // construct the url to the marketplace item
QString url = MARKETPLACE_BASE_URL + _entityMarketplaceID; QString url = MARKETPLACE_BASE_URL + _entityMarketplaceID;
tablet->gotoWebScreen(url); tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_URL);
_hmdScriptingInterface->openTablet(); _hmdScriptingInterface->openTablet();
_isInMarketplaceInspectionMode = true; _isInMarketplaceInspectionMode = true;
} }

View file

@ -26,6 +26,8 @@
var xmlHttpRequest = null; var xmlHttpRequest = null;
var isPreparing = false; // Explicitly track download request status. var isPreparing = false; // Explicitly track download request status.
var confirmPurchases = true;
function injectCommonCode(isDirectoryPage) { function injectCommonCode(isDirectoryPage) {
// Supporting styles from marketplaces.css. // Supporting styles from marketplaces.css.
@ -97,18 +99,22 @@
} }
function injectHiFiCode() { function injectHiFiCode() {
if (confirmPurchases) {
$('.item-footer').find('#price-or-edit').find('a').attr('href', '#') $('.item-footer').find('#price-or-edit').find('a').attr('href', '#')
$('.item-footer').find('#price-or-edit').find('a').on('click', function () { $('.item-footer').find('#price-or-edit').find('a').on('click', function () {
buyButtonClicked("TEST ITEM", "Zach Fox", 10); buyButtonClicked("TEST ITEM", "Zach Fox", 10);
}); });
} }
}
function injectHiFiItemPageCode() { function injectHiFiItemPageCode() {
if (confirmPurchases) {
$('#side-info').find('.btn').attr('href', '#') $('#side-info').find('.btn').attr('href', '#')
$('#side-info').find('.btn').on('click', function () { $('#side-info').find('.btn').on('click', function () {
buyButtonClicked($('#top-center').find('h1').text(), $('#creator').find('.value').text(), 10); buyButtonClicked($('#top-center').find('h1').text(), $('#creator').find('.value').text(), 10);
}); });
} }
}
function updateClaraCode() { function updateClaraCode() {
// Have to repeatedly update Clara page because its content can change dynamically without location.href changing. // Have to repeatedly update Clara page because its content can change dynamically without location.href changing.

View file

@ -192,7 +192,6 @@
function fromQml(message) { function fromQml(message) {
switch (message.method) { switch (message.method) {
case 'checkout_cancelClicked': case 'checkout_cancelClicked':
print('fromQml: ' + JSON.stringify(message));
tablet.popFromStack(); tablet.popFromStack();
break; break;
case 'checkout_buyClicked': case 'checkout_buyClicked':