I feel sorry for the people who wrote this.<p>Which one of us would want a code review by people who did not understand the requirements given by "the client" done on the front page of HN?
While this code is pretty bad, I'm going to guess that the NSA reserves their best IT folks for... you know... the assignments other than their public facing website.
Honestly, it's... not terrible? It's hackish, sure, but the NSA website's frontend isn't a huge app where good software engineering needs to be practiced - the code does what it needs to do, was likely written quite quickly, and doesn't need the likes of webpack to build.<p>In my core projects I'll use Ember or React+Redux, but where I just need a couple hundred lines of one-off code for e.g. a marketing site... why not some hackish jQuery?
A lot of popular websites have pretty crappily written JS code. The reason it's not noticed is that usually it's served compressed. The reason why it's crappy is that the bulk of functionality is implemented server-side, and the person who ends up writing that code is primarily a server-side programmer who half-asses a JS snippet to finish the feature, and then since it works, it is never refactored. It's not "real programming" anyway ;)
What would be the reason for this:<p>// analytics disable if url contains underscore
try {
if(window.location.href.indexOf('_') > 0) {window['ga-disable-UA-20753548-1'] = true;}
} catch(e) {}
});