msikma / pokesprite

Database project of box and inventory sprites from the Pokémon core series games
https://msikma.github.io/pokesprite/
MIT License
972 stars 167 forks source link

dex number slug not working #36

Closed dominicbarnes closed 6 years ago

dominicbarnes commented 6 years ago

According to the docs and #2, I should be able to do something like:

<span class="pkspr pkmn-004"></span>

But when I try to decorate the node, I just get the following warning message:

Couldn't decorate icon with the following properties: { slug: "004", type: "pkmn" }

I thought maybe this was just a problem with the npm build, but I get the same issue on the overview page. You can reproduce this with a very big hack on the console there:

document.body.innerHTML = '<span class="pkspr pkmn-004"></span>'
PkSpr.decorate(document.body)
msikma commented 6 years ago

I haven't tested that in a while. To be truthful, the JS code is very old and doesn't have unit tests, but I haven't had much time to replace it. I'll see if I can fix this.

ProjectInkfish commented 6 years ago

I was just about to ask the same question. Any luck with a fix?

msikma commented 6 years ago

Apologies for the lack of an update. I'm going to resolve this either today or tomorrow—I've got a pretty short workday today, but I'm hoping to have it resolved anyway. I'm sure the problem isn't that hard to fix.

msikma commented 6 years ago

Strangely, it seems that the Closure Compiler is somehow mangling the input JS code in such a way that it breaks using regular numbers. I'll need to look at this more closely tonight.

msikma commented 6 years ago

Alright - could you try again with the latest build? I've updated to 1.5.1. I also updated the NPM package (forgot to do that for 1.5.0... oops.)

The problem was some variables weren't being protected from name mangling.

andreacassani commented 6 years ago

Working fine for me, thanks!

dominicbarnes commented 6 years ago

I'll take a look at this tonight! Thanks :)

msikma commented 6 years ago

Let me know if anything's wrong, assuming it works for now. 😊