mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-09-27 12:39:18 +02:00
Fixed detection of blank entry link
Shortened website text by removing "www."
This commit is contained in:
parent
5eb1c54cd7
commit
f93e3d85fc
2 changed files with 5 additions and 6 deletions
|
@ -91,7 +91,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
}
|
||||
}
|
||||
|
||||
if (entry.links.subreddit) {
|
||||
if (!(entry.links.subreddit === undefined || entry.links.subreddit.length == 0)) {
|
||||
const subredditGroupElement = document.createElement("div");
|
||||
subredditGroupElement.className = "btn-group-vertical";
|
||||
linkListElement.appendChild(subredditGroupElement);
|
||||
|
@ -110,7 +110,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
});
|
||||
};
|
||||
|
||||
if (entry.links.website) {
|
||||
if (!(entry.links.website === undefined || entry.links.website.length == 0)) {
|
||||
const websiteGroupElement = document.createElement("div");
|
||||
websiteGroupElement.className = "btn-group-vertical";
|
||||
linkListElement.appendChild(websiteGroupElement);
|
||||
|
@ -124,7 +124,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
websiteLinkElement.href = link;
|
||||
try {
|
||||
const urlObject = new URL(link)
|
||||
websiteLinkElement.innerHTML = `<i class="bi bi-globe" aria-hidden="true"></i> ${urlObject.hostname}`
|
||||
websiteLinkElement.innerHTML = `<i class="bi bi-globe" aria-hidden="true"></i> ${urlObject.hostname.replace("www.", "")}`
|
||||
} catch (e) {
|
||||
websiteLinkElement.innerHTML = `<i class="bi bi-globe" aria-hidden="true"></i> Website`;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
});
|
||||
}
|
||||
|
||||
if (entry.links.discord) {
|
||||
if (!(entry.links.discord === undefined || entry.links.discord.length == 0)) {
|
||||
const discordGroupElement = document.createElement("div");
|
||||
discordGroupElement.className = "btn-group-vertical";
|
||||
linkListElement.appendChild(discordGroupElement);
|
||||
|
@ -151,7 +151,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
});
|
||||
}
|
||||
|
||||
if (entry.links.wiki) {
|
||||
if (!(entry.links.wiki === undefined || entry.links.wiki.length == 0)) {
|
||||
const wikiGroupElement = document.createElement("div");
|
||||
wikiGroupElement.className = "btn-group-vertical";
|
||||
linkListElement.appendChild(wikiGroupElement);
|
||||
|
|
|
@ -164,7 +164,6 @@ function toggleFixed(e, tapped) {
|
|||
if (!fixed) {
|
||||
updateHovering(e, tapped);
|
||||
render();
|
||||
console.log("fixed");
|
||||
}
|
||||
objectsListOverflowNotice.classList.add("d-none");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue