From eaa0ba9e32050e606be26d6822b294477dc8649f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 1 Apr 2016 14:08:30 -0700 Subject: [PATCH 1/3] rename marketplace.js to examples.js --- examples/defaultScripts.js | 2 +- examples/{marketplace.js => examples.js} | 54 ++++++++++++------------ 2 files changed, 27 insertions(+), 29 deletions(-) rename examples/{marketplace.js => examples.js} (66%) diff --git a/examples/defaultScripts.js b/examples/defaultScripts.js index ab3ff956d4..54b02250ef 100644 --- a/examples/defaultScripts.js +++ b/examples/defaultScripts.js @@ -11,7 +11,7 @@ Script.load("away.js"); Script.load("progress.js"); Script.load("edit.js"); -Script.load("marketplace.js"); +Script.load("examples.js"); Script.load("selectAudioDevice.js"); Script.load("notifications.js"); Script.load("users.js"); diff --git a/examples/marketplace.js b/examples/examples.js similarity index 66% rename from examples/marketplace.js rename to examples/examples.js index 146e55c496..bfa85473de 100644 --- a/examples/marketplace.js +++ b/examples/examples.js @@ -1,5 +1,5 @@ // -// marketplace.js +// examples.js // examples // // Created by Eric Levin on 8 Jan 2016 @@ -16,9 +16,9 @@ Script.include([ HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/"; -var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace"; -var marketplaceWindow = new OverlayWebWindow({ - title: 'Marketplace', +var EXAMPLES_URL = "https://metaverse.highfidelity.com/examples"; +var examplesWindow = new OverlayWebWindow({ + title: 'Examples', source: "about:blank", width: 900, height: 700, @@ -29,43 +29,43 @@ var toolHeight = 50; var toolWidth = 50; -function showMarketplace(marketplaceID) { - var url = MARKETPLACE_URL; +function showExamples(marketplaceID) { + var url = EXAMPLES_URL; if (marketplaceID) { url = url + "/items/" + marketplaceID; } - print("setting marketplace URL to " + url); - marketplaceWindow.setURL(url); - marketplaceWindow.setVisible(true); + print("setting examples URL to " + url); + examplesWindow.setURL(url); + examplesWindow.setVisible(true); } -function hideMarketplace() { - marketplaceWindow.setVisible(false); - marketplaceWindow.setURL("about:blank"); +function hideExamples() { + examplesWindow.setVisible(false); + examplesWindow.setURL("about:blank"); } -function toggleMarketplace() { - if (marketplaceWindow.visible) { - hideMarketplace(); +function toggleExamples() { + if (examplesWindow.visible) { + hideExamples(); } else { - showMarketplace(); + showExamples(); } } var toolBar = (function() { var that = {}, toolBar, - browseMarketplaceButton; + browseExamplesButton; function initialize() { - toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.marketplace.toolbar", function(windowDimensions, toolbar) { + toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) { return { x: windowDimensions.x - 8 - toolbar.width, y: 135 }; }); - browseMarketplaceButton = toolBar.addTool({ - imageURL: toolIconUrl + "market-01.svg", + browseExamplesButton = toolBar.addTool({ + imageURL: toolIconUrl + "examples-01.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, @@ -79,10 +79,10 @@ var toolBar = (function() { showButtonDown: true }); - toolBar.showTool(browseMarketplaceButton, true); + toolBar.showTool(browseExamplesButton, true); } - var browseMarketplaceButtonDown = false; + var browseExamplesButtonDown = false; that.mousePressEvent = function(event) { var clickedOverlay, url, @@ -98,10 +98,8 @@ var toolBar = (function() { y: event.y }); - - - if (browseMarketplaceButton === toolBar.clicked(clickedOverlay)) { - toggleMarketplace(); + if (browseExamplesButton === toolBar.clicked(clickedOverlay)) { + toggleExamples(); return true; } @@ -112,7 +110,7 @@ var toolBar = (function() { var handled = false; - if (browseMarketplaceButtonDown) { + if (browseExamplesButtonDown) { var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y @@ -120,7 +118,7 @@ var toolBar = (function() { } newModelButtonDown = false; - browseMarketplaceButtonDown = false; + browseExamplesButtonDown = false; return handled; } From 6df7ddeb16ca6f0c7658449643c75ce26ffdf5f2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 1 Apr 2016 15:13:28 -0700 Subject: [PATCH 2/3] pass the HighFidelityInterface user agent with WebView --- interface/resources/qml/controls/WebView.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/qml/controls/WebView.qml b/interface/resources/qml/controls/WebView.qml index 1361e6e322..1d07c471b4 100644 --- a/interface/resources/qml/controls/WebView.qml +++ b/interface/resources/qml/controls/WebView.qml @@ -5,6 +5,8 @@ WebEngineView { id: root property var newUrl; + profile.httpUserAgent: "Chrome/48.0 (HighFidelityInterface)" + Component.onCompleted: { console.log("Connecting JS messaging to Hifi Logging") // Ensure the JS from the web-engine makes it to our logging From 6e83ed5cccc08961b7d140d97cdac4d5a9ab7dbf Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 1 Apr 2016 15:49:24 -0700 Subject: [PATCH 3/3] use a more generic custom user agent --- interface/resources/qml/controls/WebView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/controls/WebView.qml b/interface/resources/qml/controls/WebView.qml index 1d07c471b4..2f94740fe6 100644 --- a/interface/resources/qml/controls/WebView.qml +++ b/interface/resources/qml/controls/WebView.qml @@ -5,7 +5,7 @@ WebEngineView { id: root property var newUrl; - profile.httpUserAgent: "Chrome/48.0 (HighFidelityInterface)" + profile.httpUserAgent: "Mozilla/5.0 Chrome (HighFidelityInterface)" Component.onCompleted: { console.log("Connecting JS messaging to Hifi Logging")