From 7d460bae8fe1eafd542773026d66b7d2c175a0a1 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 5 Nov 2020 17:38:24 +0100 Subject: [PATCH] Clean createHelper --- www/common/common-ui-elements.js | 9 ++------- www/common/drive-ui.js | 10 +--------- www/common/sframe-common.js | 5 ++++- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f9f76429f..8c9aa58aa 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2111,13 +2111,8 @@ define([ var origin = privateData.origin; var createHelper = function (href, text) { - var q = h('a.cp-creation-help.fa.fa-question-circle', { - 'data-cptippy-html': true, - title: text, - href: origin + href, - target: "_blank", - 'data-tippy-placement': "right" - }); + var q = UI.createHelper(origin + href, text); + $(q).addClass('cp-creation-help'); return q; }; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 79ad9b83a..86ea33339 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2473,15 +2473,7 @@ define([ // Get the upload options var addSharedFolderModal = function (cb) { var createHelper = function (href, text) { - var q = h('a.fa.fa-question-circle', { - style: 'text-decoration: none !important;', - 'data-cptippy-html': true, - title: text, - href: APP.origin + href, - target: "_blank", - 'data-tippy-placement': "right" - }); - return q; + return UI.createHelper(APP.origin + href, text); }; // Ask for name, password and owner diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 3eb86ff93..7d2076e81 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -551,8 +551,11 @@ define([ funcs.gotoURL = function (url) { ctx.sframeChan.event('EV_GOTO_URL', url); }; funcs.openURL = function (url) { ctx.sframeChan.event('EV_OPEN_URL', url); }; + funcs.getBounceURL = function (url) { + return window.location.origin + '/bounce/#' + encodeURIComponent(url); + }; funcs.openUnsafeURL = function (url) { - var bounceHref = window.location.origin + '/bounce/#' + encodeURIComponent(url); + var bounceHref = getBounceURL(url); window.open(bounceHref); };