mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-12-24 06:49:29 -05:00
Open all links in new window
This commit is contained in:
parent
420f0d6634
commit
903ea5ea68
@ -5340,6 +5340,23 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||
SAFE_FOR_JQUERY: true
|
||||
});
|
||||
|
||||
// Add a hook to make all links open a new window
|
||||
DOMPurify.addHook('afterSanitizeAttributes', function(node) {
|
||||
// set all elements owning target to target=_blank
|
||||
if ('target' in node && node.id !== 'pasteurl') {
|
||||
node.setAttribute('target', '_blank');
|
||||
}
|
||||
// set non-HTML/MathML links to xlink:show=new
|
||||
if (!node.hasAttribute('target')
|
||||
&& (node.hasAttribute('xlink:href')
|
||||
|| node.hasAttribute('href'))) {
|
||||
node.setAttribute('xlink:show', 'new');
|
||||
}
|
||||
if ('rel' in node) {
|
||||
node.setAttribute('rel', 'nofollow noopener noreferrer');
|
||||
}
|
||||
});
|
||||
|
||||
// center all modals
|
||||
$('.modal').on('show.bs.modal', function(e) {
|
||||
$(e.target).css({
|
||||
|
Loading…
Reference in New Issue
Block a user