Fix broken links

pull/1/head
yflory 7 years ago
parent f1c1d87d3f
commit 1a950319a1

@ -613,9 +613,6 @@ define(function () {
out.pad_showToolbar = "Afficher la barre d'outils"; out.pad_showToolbar = "Afficher la barre d'outils";
out.pad_hideToolbar = "Cacher 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é. <a href='/about.html#pinning'>En savoir plus...</a>";
// markdown toolbar // markdown toolbar
out.mdToolbar_button = "Afficher ou cacher la barre d'outils Markdown"; out.mdToolbar_button = "Afficher ou cacher la barre d'outils Markdown";
out.mdToolbar_defaultText = "Votre texte ici"; out.mdToolbar_defaultText = "Votre texte ici";
@ -954,8 +951,6 @@ define(function () {
// Header.html // Header.html
out.header_france = '<a href="http://www.xwiki.com/fr" target="_blank" rel="noopener noreferrer">Fait avec <img class="bottom-bar-heart" src="/customize/heart.png" alt="amour" /> en <img class="bottom-bar-fr" title="France" alt="France" src="/customize/fr.png" /> par <img src="/customize/logo-xwiki.png" alt="XWiki SAS" class="bottom-bar-xwiki"/></a>';
out.header_support = '<a href="http://ng.open-paas.org/" title="OpenPaaS::ng" target="_blank" rel="noopener noreferrer"> <img src="/customize/openpaasng.png" alt="OpenPaaS-ng" class="bottom-bar-openpaas" /></a>';
out.updated_0_header_logoTitle = 'Retourner vers votre CryptDrive'; out.updated_0_header_logoTitle = 'Retourner vers votre CryptDrive';
out.header_logoTitle = out.updated_0_header_logoTitle; out.header_logoTitle = out.updated_0_header_logoTitle;
out.header_homeTitle = "Aller sur la page d'accueil"; out.header_homeTitle = "Aller sur la page d'accueil";

@ -617,9 +617,6 @@ define(function () {
out.pad_showToolbar = "Show toolbar"; out.pad_showToolbar = "Show toolbar";
out.pad_hideToolbar = "Hide 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. <a href='/about.html#pinning'>Learn more...</a>";
// markdown toolbar // markdown toolbar
out.mdToolbar_button = "Show or hide the Markdown toolbar"; out.mdToolbar_button = "Show or hide the Markdown toolbar";
out.mdToolbar_defaultText = "Your text here"; out.mdToolbar_defaultText = "Your text here";
@ -998,9 +995,6 @@ define(function () {
// Header.html // Header.html
out.header_france = '<a href="http://www.xwiki.com/" target="_blank" rel="noopener noreferrer">With <img class="bottom-bar-heart" src="/customize/heart.png" alt="love" /> from <img class="bottom-bar-fr" src="/customize/fr.png" title="France" alt="France"/> by <img src="/customize/logo-xwiki.png" alt="XWiki SAS" class="bottom-bar-xwiki"/></a>';
out.header_support = '<a href="http://ng.open-paas.org/" title="OpenPaaS::ng" target="_blank" rel="noopener noreferrer"> <img src="/customize/openpaasng.png" alt="OpenPaaS-ng" class="bottom-bar-openpaas" /></a>';
out.updated_0_header_logoTitle = 'Go to your CryptDrive'; out.updated_0_header_logoTitle = 'Go to your CryptDrive';
out.header_logoTitle = out.updated_0_header_logoTitle; out.header_logoTitle = out.updated_0_header_logoTitle;
out.header_homeTitle = 'Go to CryptPad homepage'; out.header_homeTitle = 'Go to CryptPad homepage';

@ -626,7 +626,8 @@ define([
sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) { sframeChan.query('Q_MOVE_TO_TRASH', null, function (err) {
if (err) { return void callback(err); } if (err) { return void callback(err); }
var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted; var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted;
UI.alert(cMsg, undefined, true); var msg = common.fixLinks($('<div>').html(cMsg));
UI.alert(msg);
callback(); callback();
return; return;
}); });
@ -962,18 +963,7 @@ define([
h('ul', elements) h('ul', elements)
]); ]);
var origin = common.getMetadataMgr().getPrivateData().origin || ''; common.fixLinks(text);
$(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);
});
var closeButton = h('span.cp-help-close.fa.fa-window-close'); var closeButton = h('span.cp-help-close.fa.fa-window-close');
var $toolbarButton = common.createButton('', true, { var $toolbarButton = common.createButton('', true, {

@ -343,6 +343,27 @@ define([
window.open(bounceHref); 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; funcs.whenRealtimeSyncs = evRealtimeSynced.reg;
var logoutHandlers = []; var logoutHandlers = [];

@ -370,7 +370,8 @@ define([
currentPath = [FILES_DATA]; currentPath = [FILES_DATA];
$tree.hide(); $tree.hide();
if (Object.keys(files.root).length && !proxy.anonymousAlert) { if (Object.keys(files.root).length && !proxy.anonymousAlert) {
UI.alert(Messages.fm_alert_anonymous, null, true); var msg = common.fixLinks($('<div>').html(Messages.fm_alert_anonymous));
UI.alert(msg);
proxy.anonymousAlert = true; proxy.anonymousAlert = true;
} }
} }
@ -1516,13 +1517,7 @@ define([
} }
if (!APP.loggedIn) { if (!APP.loggedIn) {
msg = Messages.fm_info_anonymous; msg = Messages.fm_info_anonymous;
$box.html(msg); return $(common.fixLinks($box.html(msg)));
$box.find('a[target!="_blank"]').click(function (e) {
e.preventDefault();
var href = $(this).attr('href');
common.gotoURL(href);
});
return $box;
} }
if (!msg || APP.store['hide-info-' + path[0]] === '1') { if (!msg || APP.store['hide-info-' + path[0]] === '1') {
$box.hide(); $box.hide();

Loading…
Cancel
Save