diff options
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/client.jsx | 4 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 1 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 30 |
3 files changed, 27 insertions, 8 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index b83ee22e7..786e6dcea 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -4,12 +4,12 @@ module.exports.track = function(category, action, label, prop, val) { global.window.snowplow('trackStructEvent', category, action, label, prop, val); - if (global.window.analytics != null) global.window.analytics.track(action, {category: category, label: label, property: prop, value: val}); + global.window.analytics.track(action, {category: category, label: label, property: prop, value: val}); }; module.exports.trackPage = function() { global.window.snowplow('trackPageView'); - if (global.window.analytics != null) global.window.analytics.page(); + global.window.analytics.page(); }; function handleError(method_name, xhr, status, err) { diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 0a3b1db3d..deb07409b 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -61,6 +61,7 @@ module.exports = { "channel", "internal", "localhost", + "dockerhost", "stag", "post", "cluster", diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index b2dcee7cd..f358f6c05 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -28,6 +28,9 @@ module.exports.isTestDomain = function() { if ((/^localhost/).test(window.location.hostname)) return true; + if ((/^dockerhost/).test(window.location.hostname)) + return true; + if ((/^test/).test(window.location.hostname)) return true; @@ -75,8 +78,14 @@ module.exports.getDomainWithOutSub = function() { var parts = window.location.host.split("."); - if (parts.length == 1) - return "localhost:8065"; + if (parts.length == 1) { + if (parts[0].indexOf("dockerhost") > -1) { + return "dockerhost:8065"; + } + else { + return "localhost:8065"; + } + } return parts[1] + "." + parts[2]; } @@ -357,9 +366,6 @@ module.exports.textToJsx = function(text, options) { if (options && options['singleline']) { var repRegex = new RegExp("\n", "g"); text = text.replace(repRegex, " "); - } else { - var repRegex = new RegExp("\n", "g"); - text = text.replace(repRegex, "<br>"); } var searchTerm = "" @@ -383,7 +389,7 @@ module.exports.textToJsx = function(text, options) { implicitKeywords[keywordArray[i]] = true; } - var lines = text.split("<br>"); + var lines = text.split("\n"); var urlMatcher = new LinkifyIt(); for (var i = 0; i < lines.length; i++) { var line = lines[i]; @@ -730,3 +736,15 @@ Image.prototype.load = function(url, progressCallback) { }; Image.prototype.completedPercentage = 0; + +module.exports.getHomeLink = function() { + if (config.HomeLink != "") { + return config.HomeLink; + } + var parts = window.location.host.split("."); + if (parts.length <= 1) { + return window.location.protocol + "//" + window.location.host; + } + parts[0] = "www"; + return window.location.protocol + "//" + parts.join("."); +} |