unify and simplify eligibility code as a tab content script