Start at HiFi marketplace page instead of directory page

This commit is contained in:
David Rowe 2016-12-14 00:12:52 +13:00
parent 8195393205
commit 4890e92733
3 changed files with 13 additions and 15 deletions

View file

@ -23,6 +23,7 @@
'#marketplace-navigation .text { color: #fff; font-size: 18px; line-height: 50px; vertical-align: top; position: relative; top: 1px; }' +
'#marketplace-navigation input#back-button { position: absolute; left: 20px; margin-top: 12px; padding-left: 0; padding-right: 5px; }' +
'#marketplace-navigation input#all-markets { position: absolute; right: 20px; margin-top: 12px; padding-left: 15px; padding-right: 15px; }' +
'#marketplace-navigation .right { position: absolute; right: 20px; }' +
'</style>'
);
@ -38,12 +39,13 @@
);
// Footer.
var isInitialDirectoryPage = location.href.match(/\/scripts\/system\/html\/marketplaces\.html$/);
var isInitialHiFiPage = location.href === "https://metaverse.highfidelity.com/marketplace?";
$("body").append(
'<div id="marketplace-navigation">' +
(isInitialDirectoryPage ? '<span class="glyph">&#x1f6c8;</span> <span class="text">Select a marketplace to explore.</span>' : '') +
(!isInitialDirectoryPage ? '<input id="back-button" type="button" class="white" value="&lt; Back" />' : '') +
(!isInitialHiFiPage ? '<input id="back-button" type="button" class="white" value="&lt; Back" />' : '') +
(isInitialHiFiPage ? '<span class="glyph">&#x1f6c8;</span> <span class="text">See also other marketplaces.</span>' : '') +
(!isDirectoryPage ? '<input id="all-markets" type="button" class="white" value="See All Markets" />' : '') +
(isDirectoryPage ? '<span class="right"><span class="glyph">&#x1f6c8;</span> <span class="text">Select a marketplace to explore.</span><span>' : '') +
'</div>'
);

View file

@ -48,7 +48,7 @@
</div>
</div>
</div>
<!-- The following code is injected; it is included here to help with CSS styling.
<!-- Code similar to the following is injected; the following is included here to help with CSS styling.
<div id="marketplace-navigation">
<span class="glyph">&#x1f6c8;</span> <span class="text">Select a marketplace to explore.</span>
<input id="all-markets" type="button" class="white" value="See All Markets" />

View file

@ -15,8 +15,9 @@ Script.include("../libraries/WebTablet.js");
var toolIconUrl = Script.resolvePath("../assets/images/tools/");
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var MARKETPLACE_URL_INITIAL = MARKETPLACE_URL + "?"; // Append "?" to signal injected script that it's the initial page.
var MARKETPLACES_URL = Script.resolvePath("../html/marketplaces.html");
var MARKETPLACES_URL_AMENDED = MARKETPLACES_URL + "?"; // Append "?" to signal injected script that it's not the initial page.
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("../html/js/marketplacesInject.js");
var marketplaceWindow = new OverlayWebWindow({
@ -29,7 +30,7 @@ var marketplaceWindow = new OverlayWebWindow({
marketplaceWindow.setScriptURL(MARKETPLACES_INJECT_SCRIPT_URL);
marketplaceWindow.webEventReceived.connect(function (data) {
if (data === "GOTO_DIRECTORY") {
marketplaceWindow.setURL(MARKETPLACES_URL_AMENDED);
marketplaceWindow.setURL(MARKETPLACES_URL);
}
});
@ -50,24 +51,19 @@ function shouldShowWebTablet() {
return HMD.active && (leftPose.valid || rightPose.valid || hasHydra);
}
function showMarketplace(marketplaceID) {
function showMarketplace() {
if (shouldShowWebTablet()) {
updateButtonState(true);
marketplaceWebTablet = new WebTablet(MARKETPLACES_URL, null, null, true);
marketplaceWebTablet = new WebTablet(MARKETPLACE_URL_INITIAL, null, null, true);
Settings.setValue(persistenceKey, marketplaceWebTablet.pickle());
marketplaceWebTablet.setScriptURL(MARKETPLACES_INJECT_SCRIPT_URL);
marketplaceWebTablet.getOverlayObject().webEventReceived.connect(function (data) {
if (data === "GOTO_DIRECTORY") {
marketplaceWebTablet.setURL(""); // Force reload of URL to work around WetTablet bug.
marketplaceWebTablet.setURL(MARKETPLACES_URL_AMENDED);
marketplaceWebTablet.setURL(MARKETPLACES_URL);
}
});
} else {
var url = MARKETPLACES_URL;
if (marketplaceID) {
url = url + "/items/" + marketplaceID;
}
marketplaceWindow.setURL(url);
marketplaceWindow.setURL(MARKETPLACE_URL_INITIAL);
marketplaceWindow.setVisible(true);
}