From a4af973ae4f8e3d16facf26bc5c763831e8f8174 Mon Sep 17 00:00:00 2001 From: kunalgosar Date: Tue, 21 Mar 2017 14:12:54 -0700 Subject: [PATCH 1/3] fixed back button on marketplace --- scripts/system/html/js/marketplacesInject.js | 13 ++++++++++--- scripts/system/tablet-users.js | 6 +++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index 10970a7749..ab89765615 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -25,7 +25,9 @@ var canWriteAssets = false; var xmlHttpRequest = null; var isPreparing = false; // Explicitly track download request status. - + + var lastPage = "https://metaverse.highfidelity.com/marketplace?"; + function injectCommonCode(isDirectoryPage) { // Supporting styles from marketplaces.css. @@ -65,7 +67,7 @@ // Footer actions. $("#back-button").on("click", function () { - window.history.back(); + window.location = lastPage; }); $("#all-markets").on("click", function () { EventBridge.emitWebEvent(GOTO_DIRECTORY); @@ -341,8 +343,13 @@ break; } } - + + function locationChanged() { + lastPage = location.href; + } + // Load / unload. window.addEventListener("load", onLoad); // More robust to Web site issues than using $(document).ready(). + window.addEventListener("hashchange", locationChanged); }()); diff --git a/scripts/system/tablet-users.js b/scripts/system/tablet-users.js index 88ffa33a88..41c66e29ec 100644 --- a/scripts/system/tablet-users.js +++ b/scripts/system/tablet-users.js @@ -69,7 +69,11 @@ function onWebEventReceived(event) { print("Script received a web event, its type is " + typeof event); if (typeof event === "string") { - event = JSON.parse(event); + try { + event = JSON.parse(event); + } catch(e) { + return; + } } if (event.type === "ready") { // send username to html From 30d2ea0ea5f287334316a2ac914b6f24910ad83a Mon Sep 17 00:00:00 2001 From: kunalgosar Date: Tue, 21 Mar 2017 14:15:56 -0700 Subject: [PATCH 2/3] spacing issues --- scripts/system/html/js/marketplacesInject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index ab89765615..d0038411b1 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -25,9 +25,9 @@ var canWriteAssets = false; var xmlHttpRequest = null; var isPreparing = false; // Explicitly track download request status. - + var lastPage = "https://metaverse.highfidelity.com/marketplace?"; - + function injectCommonCode(isDirectoryPage) { // Supporting styles from marketplaces.css. From f09ee92fe1efacc07e5820fee707b78ae80d1eef Mon Sep 17 00:00:00 2001 From: kunalgosar Date: Tue, 21 Mar 2017 14:16:49 -0700 Subject: [PATCH 3/3] spacing issues --- scripts/system/html/js/marketplacesInject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index d0038411b1..d4937ac9db 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -343,11 +343,11 @@ break; } } - + function locationChanged() { lastPage = location.href; } - + // Load / unload. window.addEventListener("load", onLoad); // More robust to Web site issues than using $(document).ready(). window.addEventListener("hashchange", locationChanged);