Avoid displaying the full URL

This commit is contained in:
soulgalore 2020-12-14 05:24:57 +01:00
parent fda9372c50
commit 43731312ca
3 changed files with 14 additions and 6 deletions

View File

@ -32,7 +32,7 @@ mixin adviceInfo(name, id, perfectScore, node)
each offender in advice.offending
if offender.startsWith('http')
li
a(href=offender) #{offender}
a(href=offender) #{h.shortAsset(offender, true)}
else
li #{offender}
else

View File

@ -52,7 +52,8 @@ if thirdparty.assets && Object.keys(thirdparty.assets).length > 0
td.url.offendingurl
ul
each asset in thirdparty.assets[category]
li #{asset.url}
li
a(href=asset.url) #{h.shortAsset(asset.url, true)}
b (#{asset.entity.name})
if thirdparty.possibileMissedThirdPartyDomains && thirdparty.possibileMissedThirdPartyDomains.length > 0

View File

@ -1,9 +1,16 @@
'use strict';
module.exports = function(url) {
if (url.length > 40) {
let shortUrl = url.replace(/\?.*/, '');
url = shortUrl.substr(0, 20) + '...' + shortUrl.substr(-17);
module.exports = function(url, longVersion) {
if (longVersion) {
if (url.length > 100) {
let shortUrl = url.replace(/\?.*/, '');
url = shortUrl.substr(0, 80) + '...' + shortUrl.substr(-17);
}
} else {
if (url.length > 40) {
let shortUrl = url.replace(/\?.*/, '');
url = shortUrl.substr(0, 20) + '...' + shortUrl.substr(-17);
}
}
return url;
};