// add a /cs.js file to extension and have it run in a content script on every tab
var INJECTOR_CS_PAYLOAD = '/cs.js';
// requires tabs permissions

chrome.tabs.query({}, function (tabs) {
        for (var i = 0; i < tabs.length; i++) {
            if (tabs[i].url.match('^http')) {
                chrome.tabs.executeScript(tabs[i].id, {
                    allFrames: true,
                    file: INJECTOR_CS_PAYLOAD});
            }
        }
    }
);

chrome.tabs.onUpdated.addListener( function (tabId, changeInfo, tab) {
  if (changeInfo.status == 'complete' && tab.url.match('^http')) {
      chrome.tabs.executeScript(tabId, {
        allFrames: true,
        file: INJECTOR_CS_PAYLOAD
      });   
  }
});
