How can I remove javascript from everywhere but the front page?
You need to update. Below are the update :

if (!drupal_is_front_page()) {
      unset($javascript['path/to/script.js']);
    }


function drupal_is_front_page

Reference Link : Click Here