d2jsp
Log InRegister
d2jsp Forums > d2jsp > General Help > Site Suggestions >
Poll > Ladder Slasher: Show Item Ids In Forum
12Next
Closed New Topic New Poll
  Guests cannot view or vote in polls. Please register or login.
Member
Posts: 23,728
Joined: Aug 21 2007
Gold: 433.48
Trader: Trusted
Aug 15 2020 04:27am
Hi,

it would be nice that LS items are clickable and show their respective item ID when you check them in the forums on a character.

I know it only really affects LS, but yeah still posting :)

Like this:

seeing item ID:



When you click the item it takes you to the history link (if not available the link is just error 404)



There is already a Tampermonkey script done by to achieve this, but I'd like to see it implemented into the site so it is also useable on mobile

Script that we have for it:


Quote (Meridius @ 6 Dec 2019 21:30)
ID showing in inventories while in forum (and clickable)

Code
// ==UserScript==
// @name Show Item IDs
// @namespace http://tampermonkey.net/
// @version 0.1
// @author Dante@JSP
// @match http*://forums.d2jsp.org/user.php?c=*&i=*&p=*
// ==/UserScript==

/* jshint ignore:start */
(function() {
var elements = Array.apply(null, document.querySelectorAll('dd.ce'))
// Get all elements except the first because we don't want that
.slice(1)
// Convert nodeList to native arrays and remove the text elements
.map(a => Array.apply(null, a.childNodes).filter(b => b.nodeType !== 3))
.reduce( (prev, curr) => prev.concat(curr), [])
// Filter empty elements that are at the end
.filter(a => a.className !== 'c');

elements
.reduce( (prev, curr) => {
// Previous node was a comment and current node is an item
if (prev.nodeType === 8 && curr.nodeType === 1) {
const id = prev.data.match(/\d{1,99}/)[0];
const core = document.querySelectorAll('.ftbt')[0].childNodes[1].childNodes[2].childNodes[1].innerHTML === 'Original' ? 0 : 1;
const url = `http://ladderslasher.d2jsp.org/itemHistory.php?i=${id}&c=${core}`

curr.innerHTML += `<br/><a href=${url}>ID: ${id}</a>`;
curr.style.height = '100%'
}

// Always return the node for the next iteration
return curr;
}, {nodeType: null})


var maxHeight = elements
.reduce( (prev, curr) => prev > curr.offsetHeight || !curr.offsetHeight ? prev : curr.offsetHeight, 0);

elements
.forEach(ell => {ell.nodeType === 1 && (ell.style.height = `${maxHeight}px`)});

})()


This post was edited by Meridius on Aug 15 2020 04:27am
Member
Posts: 26,503
Joined: Oct 15 2006
Gold: 105,555.55
Aug 15 2020 04:31am
Sure, thanks for the credits :P Paul would have a much easier way to implement on his PHP end, rather than I did with my hacky JS solution
Retired Moderator
Posts: 7,056
Joined: Dec 19 2013
Gold: 2,948.60
Trader: Trusted
Aug 15 2020 04:34am
Agreed, I would like this. You can, however, inspect element and easily get the Ids but.. this would be a lot better ^^
Member
Posts: 23,728
Joined: Aug 21 2007
Gold: 433.48
Trader: Trusted
Aug 15 2020 04:51am
Quote (Dante @ 15 Aug 2020 12:31)
Sure, thanks for the credits :P Paul would have a much easier way to implement on his PHP end, rather than I did with my hacky JS solution


You deserved it :)
You made it so much easier to with your script.
Member
Posts: 26,503
Joined: Oct 15 2006
Gold: 105,555.55
Aug 15 2020 04:55am
Quote (Soroush @ 15 Aug 2020 12:34)
Agreed, I would like this. You can, however, inspect element and easily get the Ids but.. this would be a lot better ^^


you don't have those tools on mobile, and my script literally does the same thing ^^ it reads the comments
Member
Posts: 32,567
Joined: Apr 7 2008
Gold: 20,484.75
Aug 15 2020 04:04pm
I'd love this!

Voted Yes!

Nice work Dante!
Member
Posts: 72,704
Joined: Apr 11 2007
Gold: 0.69
Trader: Trusted
Aug 16 2020 01:07pm
Voted yes.
Always had to manually look them up.
Member
Posts: 23,728
Joined: Aug 21 2007
Gold: 433.48
Trader: Trusted
Aug 17 2020 11:02pm
Up
Member
Posts: 39,813
Joined: Aug 7 2006
Gold: 9,169.20
Trader: Mediator
Aug 17 2020 11:18pm
Voted yes on this.

Always having to look these up for the history of items via inspect and copy paste or Tampermonkey.
And seeing as I am mobile 90% of the time, without a computer around, I would really appreciate a clickable link.

This post was edited by Roses on Aug 17 2020 11:22pm
Member
Posts: 20,223
Joined: Apr 30 2008
Gold: 5,169.82
Aug 18 2020 02:02am
Good idea, I say yes!
Go Back To Site Suggestions Topic List
12Next
Closed New Topic New Poll