Fix marketplacesInject.js for local Metaverse

This commit is contained in:
Zach Fox 2018-01-02 12:22:40 -08:00
parent a63538c4e9
commit 25e76c668b

View file

@ -30,6 +30,7 @@
var userIsLoggedIn = false;
var walletNeedsSetup = false;
var metaverseServerURL = "https://metaverse.highfidelity.com";
var marketplaceBaseURL = "https://highfidelity.com";
function injectCommonCode(isDirectoryPage) {
@ -58,7 +59,7 @@
);
// Footer.
var isInitialHiFiPage = location.href === metaverseServerURL + "/marketplace?";
var isInitialHiFiPage = location.href === marketplaceBaseURL + "/marketplace?";
$("body").append(
'<div id="marketplace-navigation">' +
(!isInitialHiFiPage ? '<input id="back-button" type="button" class="white" value="&lt; Back" />' : '') +
@ -70,7 +71,7 @@
// Footer actions.
$("#back-button").on("click", function () {
(document.referrer !== "") ? window.history.back() : window.location = (metaverseServerURL + "/marketplace?");
(document.referrer !== "") ? window.history.back() : window.location = (marketplaceBaseURL + "/marketplace?");
});
$("#all-markets").on("click", function () {
EventBridge.emitWebEvent(GOTO_DIRECTORY);
@ -89,7 +90,7 @@
window.location = "https://clara.io/library?gameCheck=true&public=true";
});
$('#exploreHifiMarketplace').on('click', function () {
window.location = "http://www.highfidelity.com/marketplace";
window.location = marketplaceBaseURL + "/marketplace";
});
}
@ -658,9 +659,9 @@
var HIFI_ITEM_PAGE = 3;
var pageType = DIRECTORY;
if (location.href.indexOf("highfidelity.com/") !== -1) { pageType = HIFI; }
if (location.href.indexOf(marketplaceBaseURL + "/") !== -1) { pageType = HIFI; }
if (location.href.indexOf("clara.io/") !== -1) { pageType = CLARA; }
if (location.href.indexOf("highfidelity.com/marketplace/items/") !== -1) { pageType = HIFI_ITEM_PAGE; }
if (location.href.indexOf(marketplaceBaseURL + "/marketplace/items/") !== -1) { pageType = HIFI_ITEM_PAGE; }
injectCommonCode(pageType === DIRECTORY);
switch (pageType) {
@ -695,6 +696,11 @@
userIsLoggedIn = !!parsedJsonMessage.data.userIsLoggedIn;
walletNeedsSetup = !!parsedJsonMessage.data.walletNeedsSetup;
metaverseServerURL = parsedJsonMessage.data.metaverseServerURL;
if (metaverseServerURL.indexOf('metaverse.') !== -1) {
marketplaceBaseURL = metaverseServerURL.replace('metaverse.', '');
} else {
marketplaceBaseURL = metaverseServerURL;
}
injectCode();
}
}