Quote (Brainwashed @ 19 Apr 2018 21:50)
Can one of you guys that are versed in programming set up exactly whatever I need to copy/paste to make the script work?
Robin from UA was trying to help me, but it's not working. I'm not a programmer, so I'm pretty clueless. He said the same thing :lol:
I'm using Firefox. It's up-to-date.
I installed ViolentMonkey (and removed Greasemonkey)
I copy and pasted what was above (and changed/added my d2jsp user ID...pretty sure I did that right)
My d2jsp user ID is: 256037
Anyways, it's not working. And I'm thinking this should be way more easier to do...but I've tried!
Thanks.
You shouldn't have to insert your d2jsp user ID anywhere.
https://github.com/violentmonkey/violentmonkey/issues/107 There's a bug with ViolentMonkey, so you might wanna use TamperMonkey.
I'm using the Firefox Developer version, that shouldn't matter.
I just:
- went to TamperMonkey
- clicked create new script
- pasted my code
- saved
and it just werks.
I wrote my own script (which slightly differs from the one I posted earlier due to tampermonkey using it slightly different):
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 url = `http://ladderslasher.d2jsp.org/itemHistory.php?i=${id}&c=1`
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`)});
})()
if you want you can try that, or just use what patl posted.