separate these two logical points into different functions

Not quite sure what this means. Being inside a shared `$(function() {});` doesn't affect anything.

    call them inside +$(function() {} in the appropriate pages.

The way it works is completely lazy; nothing needs to be called from any page, but if a check for online status is needed, the appropriate check will be performed. If it's not needed, the check will never be run.

I agree on the DRYness, and will work on a refactor now.