From 1a950319a1a51b1dc2f7824e36110228fb30919d Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 23 Mar 2018 15:05:26 +0100 Subject: [PATCH] Fix broken links --- customize.dist/translations/messages.fr.js | 5 ----- customize.dist/translations/messages.js | 6 ------ www/common/common-ui-elements.js | 16 +++------------- www/common/sframe-common.js | 21 +++++++++++++++++++++ www/drive/inner.js | 11 +++-------- 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 911ee3821..05845a83c 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -613,9 +613,6 @@ define(function () { out.pad_showToolbar = "Afficher la barre d'outils"; out.pad_hideToolbar = "Cacher la barre d'outils"; - // general warnings - out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. En savoir plus..."; - // markdown toolbar out.mdToolbar_button = "Afficher ou cacher la barre d'outils Markdown"; out.mdToolbar_defaultText = "Votre texte ici"; @@ -954,8 +951,6 @@ define(function () { // Header.html - out.header_france = 'Fait avec amour en France par XWiki SAS'; - out.header_support = ' OpenPaaS-ng'; out.updated_0_header_logoTitle = 'Retourner vers votre CryptDrive'; out.header_logoTitle = out.updated_0_header_logoTitle; out.header_homeTitle = "Aller sur la page d'accueil"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 4e81182e9..ce2868783 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -617,9 +617,6 @@ define(function () { out.pad_showToolbar = "Show toolbar"; out.pad_hideToolbar = "Hide toolbar"; - // general warnings - out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. Learn more..."; - // markdown toolbar out.mdToolbar_button = "Show or hide the Markdown toolbar"; out.mdToolbar_defaultText = "Your text here"; @@ -998,9 +995,6 @@ define(function () { // Header.html - out.header_france = 'With love from France by XWiki SAS'; - - out.header_support = ' OpenPaaS-ng'; out.updated_0_header_logoTitle = 'Go to your CryptDrive'; out.header_logoTitle = out.updated_0_header_logoTitle; out.header_homeTitle = 'Go to CryptPad homepage'; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ad936bcff..5383206e5 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -626,7 +626,8 @@ define([ sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) { if (err) { return void callback(err); } var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted; - UI.alert(cMsg, undefined, true); + var msg = common.fixLinks($('
').html(cMsg)); + UI.alert(msg); callback(); return; }); @@ -962,18 +963,7 @@ define([ h('ul', elements) ]); - var origin = common.getMetadataMgr().getPrivateData().origin || ''; - $(text).find('a').click(function (e) { - e.preventDefault(); - e.stopPropagation(); - var href = $(this).attr('href'); - var absolute = /^https?:\/\//i; - if (!absolute.test(href)) { - if (href.slice(0,1) !== '/') { href = '/' + href; } - href = origin + href; - } - common.openUnsafeURL(href); - }); + common.fixLinks(text); var closeButton = h('span.cp-help-close.fa.fa-window-close'); var $toolbarButton = common.createButton('', true, { diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 0d513658b..66cf6aecd 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -343,6 +343,27 @@ define([ window.open(bounceHref); }; + funcs.fixLinks = function (domElement) { + var origin = ctx.metadataMgr.getPrivateData().origin; + $(domElement).find('a[target="_blank"]').click(function (e) { + e.preventDefault(); + e.stopPropagation(); + var href = $(this).attr('href'); + var absolute = /^https?:\/\//i; + if (!absolute.test(href)) { + if (href.slice(0,1) !== '/') { href = '/' + href; } + href = origin + href; + } + funcs.openUnsafeURL(href); + }); + $(domElement).find('a[target!="_blank"]').click(function (e) { + e.preventDefault(); + e.stopPropagation(); + funcs.gotoURL($(this).attr('href')); + }); + return $(domElement)[0]; + }; + funcs.whenRealtimeSyncs = evRealtimeSynced.reg; var logoutHandlers = []; diff --git a/www/drive/inner.js b/www/drive/inner.js index 5b733b86d..a5e0b6815 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -370,7 +370,8 @@ define([ currentPath = [FILES_DATA]; $tree.hide(); if (Object.keys(files.root).length && !proxy.anonymousAlert) { - UI.alert(Messages.fm_alert_anonymous, null, true); + var msg = common.fixLinks($('
').html(Messages.fm_alert_anonymous)); + UI.alert(msg); proxy.anonymousAlert = true; } } @@ -1516,13 +1517,7 @@ define([ } if (!APP.loggedIn) { msg = Messages.fm_info_anonymous; - $box.html(msg); - $box.find('a[target!="_blank"]').click(function (e) { - e.preventDefault(); - var href = $(this).attr('href'); - common.gotoURL(href); - }); - return $box; + return $(common.fixLinks($box.html(msg))); } if (!msg || APP.store['hide-info-' + path[0]] === '1') { $box.hide();