SUMMARY: DavidJCobb briefly rants on the site's JS problems before offering to fix them single-handedly.
Any way to externalize that? Generally, it's better to not have any event handlers in the HTML whatsoever -- that is, to keep the JavaScript in external files and let it attach event handlers through code.
On a related note, I'm seeing... A lack of encapsulation, a shit-ton of variables polluting the global namespace, a dated
get_by_id function
[1], an overabundance of limited and (IMO) annoying
alert calls where styled modals would be infinitely preferable, usage of if-elses where ternary operators would be shorter and neater, an apparent ignorance of the existence of object prototypes and inheritance
[2], a fragmented AJAX system with a ton of repeated code, various syntactic redundancies
[3], a whole function for the simple task of changing a node's
display CSS, ... I could go on.
But in Devourer's recent post, I spot a solution.
Feel free to make a code for that and I'll implement it, too.
If necessary, I will happily recode all of the JS on this site into a coherent, manageable set of unobtrusive, standards-compliant files. (And unlike with that skin code thing I said I'd do a while back, this time I can set up various automations to nag me into doing this whenever I forget.) 'Course, I'm not gonna start without a green light from Devourer -- I'd hate to write a ton of code if there isn't even a snowball's chance in hell of it getting used.
On a positive note, this site's JS is bad because it hasn't been updated. Compare to more popular (and supposedly more professional) websites like Bungie.net, whose
new and modern code is the worst JavaScript I have ever seen in my entire life, bar absolutely none.
[1] Looks like it was made to account for pre-DOM browsers... Honestly, I think we've reached the point where anyone surfing with a pre-DOM browser
deserves to have the entire web break for them.
[2] To have an object X inherit from Y, simply do
X.prototype = new Y() where X, of course, is the constructor.
[3] Things like using the Array constructor when
httpreqs = [] will do. A minor issue, yes, but the more bytes you can shave off your code, the faster the page will load.
None.