mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
fix(links): better http/s handling
This commit is contained in:
@@ -213,7 +213,7 @@
|
||||
</a>
|
||||
<a
|
||||
class="social-circle"
|
||||
href="https://twitter.com/habitica"
|
||||
href="https://twitter.com/habitica/"
|
||||
target="_blank"
|
||||
>
|
||||
<div
|
||||
@@ -223,7 +223,7 @@
|
||||
</a>
|
||||
<a
|
||||
class="social-circle"
|
||||
href="https://www.facebook.com/Habitica"
|
||||
href="https://www.facebook.com/Habitica/"
|
||||
target="_blank"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -8,10 +8,11 @@ export default {
|
||||
|
||||
for (let i = 0; i < allLinks.length; i += 1) {
|
||||
const link = allLinks[i];
|
||||
const domainIndex = link.href.indexOf('//') + 2;
|
||||
|
||||
if ((link.classList.value.indexOf('external-link') === -1)
|
||||
&& link.href.slice(0, 4) === 'http'
|
||||
&& !some(TRUSTED_DOMAINS.split(','), domain => link.href.indexOf(domain) === 0)) {
|
||||
&& domainIndex !== 1
|
||||
&& !some(TRUSTED_DOMAINS.split(','), domain => link.href.indexOf(domain) === domainIndex)) {
|
||||
link.classList.add('external-link');
|
||||
link.addEventListener('click', e => {
|
||||
if (e.ctrlKey) {
|
||||
|
||||
Reference in New Issue
Block a user