mirror of https://github.com/lidarr/Lidarr
Fixed: Removed deferrer from external links, instead relying solely on the rel=noreferrer attribute (supported by Chrome and Firefox, but not all browser)
fixes #811
This commit is contained in:
parent
5dae0b24d3
commit
3fc348d045
|
@ -9,7 +9,7 @@ var routeBinder = {
|
||||||
|
|
||||||
bind : function() {
|
bind : function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$(document).on('click', 'a[href]', function(event) {
|
$(document).on('click contextmenu', 'a[href]', function(event) {
|
||||||
self._handleClick(event);
|
self._handleClick(event);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -22,30 +22,25 @@ var routeBinder = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($target.hasClass('no-router')) {
|
var linkElement = $target.closest('a').first();
|
||||||
|
var href = linkElement.attr('href');
|
||||||
|
|
||||||
|
// Set noreferrer for external links.
|
||||||
|
if (href && href.startsWith('http') && !linkElement.attr('rel')) {
|
||||||
|
linkElement.attr('rel', 'noreferrer');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linkElement.hasClass('no-router') || event.type !== 'click') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var href = event.target.getAttribute('href');
|
|
||||||
|
|
||||||
if (!href && $target.closest('a') && $target.closest('a')[0]) {
|
|
||||||
|
|
||||||
var linkElement = $target.closest('a')[0];
|
|
||||||
|
|
||||||
if ($(linkElement).hasClass('no-router')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
href = linkElement.getAttribute('href');
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
if (!href) {
|
if (!href) {
|
||||||
throw 'couldn\'t find route target';
|
throw 'couldn\'t find route target';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!href.startsWith('http')) {
|
if (!href.startsWith('http')) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
window.open(href, '_blank');
|
window.open(href, '_blank');
|
||||||
}
|
}
|
||||||
|
@ -55,12 +50,6 @@ var routeBinder = {
|
||||||
|
|
||||||
Backbone.history.navigate(relativeHref, { trigger : true });
|
Backbone.history.navigate(relativeHref, { trigger : true });
|
||||||
}
|
}
|
||||||
} else if (href.contains('#')) {
|
|
||||||
//Open in new tab without dereferer (since it doesn't support fragments)
|
|
||||||
window.open(href, '_blank');
|
|
||||||
} else {
|
|
||||||
//Open in new tab
|
|
||||||
window.open('http://www.dereferer.org/?' + encodeURI(href), '_blank');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue