From 4b6692c92d42af17906f2ba17406c1eb2c2a0d39 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 17 May 2015 22:52:52 -0400 Subject: [PATCH] lazy load chromecast script --- dashboard-ui/scripts/site.js | 12 ++++++++++-- dashboard-ui/thirdparty/cordova/chromecast.js | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 dashboard-ui/thirdparty/cordova/chromecast.js diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 833e7d31f1..9a43b27fb0 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1488,8 +1488,8 @@ var Dashboard = { return deferred.promise(); }, - onLoggedIn: function(serverAddress, userId, accessToken, apiClient) { - + onLoggedIn: function (serverAddress, userId, accessToken, apiClient) { + if (Dashboard.isConnectMode()) { Dashboard.serverAddress(serverAddress); } @@ -1811,6 +1811,14 @@ var AppInfo = {}; e.preventDefault(); return false; }); + + if (Dashboard.isRunningInCordova()) { + requirejs(['thirdparty/cordova/chromecast']); + } else { + if ($.browser.chrome) { + requirejs(['scripts/chromecast']); + } + } } requirejs.config({ diff --git a/dashboard-ui/thirdparty/cordova/chromecast.js b/dashboard-ui/thirdparty/cordova/chromecast.js new file mode 100644 index 0000000000..5f282702bb --- /dev/null +++ b/dashboard-ui/thirdparty/cordova/chromecast.js @@ -0,0 +1 @@ + \ No newline at end of file