jake-white / VGC-Damage-Calculator

Gen 8 VGC Damage Calculator
http://trainertower.com/damagecalc
MIT License
80 stars 50 forks source link

Custom Sets do not appear until saving a new one #127

Open jaybee216 opened 4 years ago

jaybee216 commented 4 years ago

Upon first revisiting the page, you will not see any of your previously-saved custom sets, even if you have not cleared your cookies.

Once you enter a new or existing custom set and click Save, any previously-saved sets appear again.

jaybee216 commented 4 years ago

Inspecting setdex_custom.js and setdex_ss.js, it looks like the problem may be on line 21 of setdex_custom.js where SETDEX_CUSTOM is redefined as well as being set to the contents of the "custom" cookie.

EDIT: Looked into this further and the main reason it is not working on page load is because setdex_custom.js is being loaded earlier in the document than setdex_ss.js. We just need to move the script tag for setdex_custom.js after the others, and call reloadXYScript() after setting the SETDEX_CUSTOM value from the cookie.

jaybee216 commented 4 years ago

I have a branch with this fixed but get a 403 when trying to push it to the remote to open a PR; do I need to request permissions? @jake-white

jaybee216 commented 4 years ago

https://github.com/jake-white/VGC-Damage-Calculator/pull/128