diff options
author | Henry Castro <hcastro@collabora.com> | 2022-08-05 09:30:18 -0400 |
---|---|---|
committer | Gökay ŞATIR <gokaysatir@gmail.com> | 2022-09-29 10:28:18 +0300 |
commit | 9a51d8ec52886ec3249da7185c398acc79038d2c (patch) | |
tree | e7c1195bdc866e59cad00fc3915a952df4736c71 | |
parent | wsd: add remote buy product url (diff) | |
download | online-9a51d8ec52886ec3249da7185c398acc79038d2c.tar.gz online-9a51d8ec52886ec3249da7185c398acc79038d2c.zip |
browser: add util function getProduct
Change-Id: I51be33f5e64c716d22c11ddb1f969e9238c18884
Signed-off-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | browser/src/control/Control.Infobar.js | 13 | ||||
-rw-r--r-- | browser/src/core/Socket.js | 6 | ||||
-rw-r--r-- | browser/src/core/Util.js | 14 |
3 files changed, 16 insertions, 17 deletions
diff --git a/browser/src/control/Control.Infobar.js b/browser/src/control/Control.Infobar.js index 59c27f6665..ba063c4067 100644 --- a/browser/src/control/Control.Infobar.js +++ b/browser/src/control/Control.Infobar.js @@ -13,24 +13,11 @@ L.Control.Infobar = L.Control.extend({ if (!e.msg) return; - var product = function () { - var integratorUrl = encodeURIComponent(window.buyProductUrl); - var productUrl = window.feedbackUrl; - productUrl = productUrl.substring(0, productUrl.lastIndexOf('/')) + - '/product.html?integrator='+ integratorUrl; - var newWin = window.open(productUrl, '_blank'); - newWin.focus(); - }; var buttons = []; var callback = function() {}; if (e.actionLabel && e.action) { buttons.push($.extend({}, vex.dialog.buttons.YES, { text: e.actionLabel })); - if (window.feedbackUrl) - buttons.push($.extend({}, vex.dialog.buttons.YES, { - text: 'Buy Product', - click: product - })); callback = function (value) { if (value === false) // close btn clicked return; diff --git a/browser/src/core/Socket.js b/browser/src/core/Socket.js index c99a4261bb..9ca6a978e9 100644 --- a/browser/src/core/Socket.js +++ b/browser/src/core/Socket.js @@ -3,7 +3,7 @@ * L.Socket contains methods for the communication with the server */ -/* global app _ vex $ errorMessages Uint8Array brandProductName brandProductFAQURL */ +/* global app _ vex $ errorMessages Uint8Array brandProductName */ app.definitions.Socket = L.Class.extend({ ProtocolVersionNumber: '0.1', @@ -1085,12 +1085,10 @@ app.definitions.Socket = L.Class.extend({ textMsg = textMsg.replace(/{connections}/g, command.params[1]); textMsg = textMsg.replace(/{productname}/g, (typeof brandProductName !== 'undefined' ? brandProductName : 'Collabora Online Development Edition')); - var brandFAQURL = (typeof brandProductFAQURL !== 'undefined') ? - brandProductFAQURL : 'https://collaboraonline.github.io/post/faq/'; this._map.fire('infobar', { msg: textMsg, - action: brandFAQURL, + action: L.Util.getProduct(), actionLabel: errorMessages.infoandsupport }); } diff --git a/browser/src/core/Util.js b/browser/src/core/Util.js index 4965f4634d..b12385b919 100644 --- a/browser/src/core/Util.js +++ b/browser/src/core/Util.js @@ -3,6 +3,8 @@ * L.Util contains various utility functions used throughout Leaflet code. */ +/* global brandProductFAQURL */ + L.Util = { // extend an object with properties of one or more other objects extend: function (dest) { @@ -191,6 +193,18 @@ L.Util = { return Math.floor(metrics.width); }, + getProduct: function () { + var brandFAQURL = (typeof brandProductFAQURL !== 'undefined') ? + brandProductFAQURL : 'https://collaboraonline.github.io/post/faq/'; + if (window.feedbackUrl && window.buyProductUrl) { + var integratorUrl = encodeURIComponent(window.buyProductUrl); + brandFAQURL = window.feedbackUrl; + brandFAQURL = brandFAQURL.substring(0, brandFAQURL.lastIndexOf('/')) + + '/product.html?integrator='+ integratorUrl; + } + return brandFAQURL; + }, + replaceCtrlAltInMac: function(msg) { if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) { var ctrl = /Ctrl/g; |