uBlock will do it for you while keeping the point-and-click ability to un-block on a per-site basis. For example, a site which breaks if it can't connect to Facebook.[1]
Re:µBlock for Firefox
by bsilvereagle on Tuesday January 20, 2015 @10:24AM
(#8917302)
Browser add-ons allow non-admin users to filter these requests. Installing a proxy or editing the hosts file requires admin privileges.
uMatrix also allows you to quickly and easily see which sites are trying to load what resources, which you lose with a hosts file setup.
Sounds like more of a job for a filtering proxy or hosts file.