eternaldensity / Sandcastle-Builder

xkcd: 1190: Time: The Game
Other
79 stars 65 forks source link

Fix gaq's becoming null #1453

Closed pickten closed 3 years ago

pickten commented 8 years ago

As noted in #1451. I tried testing this and believe it works, but I'd love confirmation from @Zombie-Feynman (it should be testable at pickten.github.io/Sandcastle-Builder).

Zombie-Feynman commented 8 years ago

Nope, still the same error. It looks like the updated code somehow isn't being called before window.onload during normal execution. This causes the call to _gaq.push in Molpy.DefinePersist to trigger the error.

Oddly enough, setting breakpoints and stepping through the execution does appear to lead to _gaq being defined before Molpy.DefinePersist is called.

pickten commented 8 years ago

That makes sense, actually. The gaq code is too dense for me to really read it, but it sounds like it's executed either onload (making it after this fix) or async (again, same issue). Be back with a fix in a minute.

Zombie-Feynman commented 8 years ago

Well, that fixes it on the index page, but not on any of the actual game pages.

After some more digging, I think the best place to put this fix would be persist.js, probably right at the start of Molpy.DefinePersist, as that's consistently where the error originates.

pickten commented 8 years ago

That's really weird, as the game pages themselves don't have the gaq code.

Edit: found the problem: There are some missing _gaq.pushes missing a _gaq &&

Subedit: I think I've found all of them.

eternaldensity commented 8 years ago

But the game pages definitely use google analytics.

pickten commented 8 years ago

Good catch, completely failed to see the gaq code all the way at the bottom of castle.js; didn't think to search non-html for gaq stuff.

Zombie-Feynman commented 8 years ago

Unfortunately I'm no longer able to test this, as I've had to perform a (R.A.Z.O.R.-mandated) downgrade to Firefox 43 due to severe issues unrelated to SB.

eternaldensity commented 3 years ago

I've removed the gaqs so this is no longer needed.