Adding conditional script loader, extending David Walsh's idea (see http://davidwalsh.name/loading-scripts-jquery)