This repository has been archived on 2026-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
polyplus/js/op-comments.js
Index 7cd6fb578b improvements and add missing feature parts
- You can no longer wish-list place achievements

- Fixed IRL price and wish-listing game passes

- Fixed the "Item Wishlist" feature link on the inventory page sidebar linking to the wish-list directory several times if clicked on several times

- Fixed "owned" tags on the store main page only loading when the item grid updates, it now loads tags when initially loaded too

- Fixed "Modify Navbar" feature navbar items being shifted and the "Forum" link unable to be edited

- Added IRL prices to the "Game Passes" section of the place view page

- Added IRL prices to the "Trending Items" section of the homepage

- Updates to how the home.js file runs (going to rewrite it eventually)

- Pinned Games now have a gradient overlay displaying the likes and dislikes above the place thumbnail
2024-02-15 23:40:05 -06:00

55 lines
No EOL
2 KiB
JavaScript
Executable file

let Comments = document.getElementById('comments')
const Type = window.location.pathname.split('/')[1]
let CreatorID;
switch (Type) {
case 'store':
if (document.querySelector('h5 .text-reset[href^="/users/"]')) {
CreatorID = document.querySelector('h5 .text-reset[href^="/users/"]').getAttribute('href').split('/')[2]
} else {CreatorID = 1}
break
case 'places':
CreatorID = document.querySelector('.mcard .col .text-muted [href^="/users/"]').getAttribute('href').split('/')[2]
break
/*
case 'feed':
CreatorID = document.querySelector('p a[href^="/users/"].text-reset').getAttribute('href').split('/')[2]
break
*/
case 'guilds':
CreatorID = document.querySelector('[class^="userlink-"][href^="/users/"]').getAttribute('href').split('/')[2]
Comments = document.getElementById('wall-posts')
break
}
Array.from(Comments.children).forEach(element => {
LoadCreatorTag(element)
});
const Observer = new MutationObserver(function (list){
for (let record of list) {
for (let element of record.addedNodes) {
LoadCreatorTag(element)
}
}
});
Observer.observe(Comments, {attributes: false, childList: true, subtree: false})
function LoadCreatorTag(element) {
let NameElement;
if (!(Type === 'guilds')) {
NameElement = element.querySelector('.text-reset[href^="/users/"]')
} else {
NameElement = element.querySelector('[class^="userlink-"][href^="/users/"]')
}
let UserID = NameElement.getAttribute('href').split('/')[2]
if (UserID === CreatorID) {
let Tag = document.createElement('span')
Tag.classList = 'badge bg-primary'
Tag.style.marginLeft = '5px'
Tag.style.verticalAlign = 'text-top'
Tag.innerText = 'CREATOR'
NameElement.appendChild(Tag)
//console.log(window.bootstrap)
//new window.bootstrap.Tooltip(Tag, {toggle:"tooltip",title:"This user is the creator of this asset!"})
}
}