<commit_before>var chat = "http://192.168.47.60:8065";
var pingDuration = 2000;
var privateMessageBadge = "icons/icon16.png";
var closedTabBadge = "icons/iconred16.png";
var groupOrChannelBadge = "icons/iconblue36.png";

chrome.browserAction.onClicked.addListener(function(icon) {
  goToChat();
});

function goToChat() {
  chrome.tabs.getAllInWindow(null, function(tabs) {
    var found = false;
    for (var i = 0; i < tabs.length; i++) {
      if (tabs[i].url.indexOf(chat) > -1) {
	found = true;
    	chrome.tabs.update(tabs[i].id, {selected: true});
      }
    }
    if(!found)
	chrome.tabs.create({
    url: chat
  });
  });
}

function ping() {
  checkMessages()
  setTimeout(ping, pingDuration);
}
setTimeout(ping, pingDuration);

function checkMessages() {
 chrome.browserAction.setBadgeText({
            text: ""
          });
  var tabFound = false;
  chrome.tabs.getAllInWindow(null, function(tabs) {
    for (var i = 0; i < tabs.length; i++) {
      if (tabs[i].url.indexOf(chat) > -1) {
        tabFound = true;
        chrome.browserAction.setIcon({
          path: privateMessageBadge
        });
        var title = tabs[i].title;
        if (title.indexOf("*") > -1) {
          chrome.browserAction.setIcon({
            path: groupOrChannelBadge
          });
          chrome.browserAction.setBadgeText({
            text: ""
          });
        }
        if (title.indexOf("(") > -1) {
          chrome.browserAction.setBadgeText({
            text: title
          });
          var rgx = /\(([^)]+)\)/;
          var matcher = title.match(rgx);
          var privateMsgCount = matcher && matcher[1];
          chrome.browserAction.setBadgeText({
            text: privateMsgCount
          });
        }
      }
    }

    if (!tabFound) {
      chrome.browserAction.setBadgeText({
        text: ""
      });
      chrome.browserAction.setIcon({
        path: closedTabBadge
      });
    }
  });

}
<commit_msg>Now checks for tabs in all windows instead of the current one<commit_after>var chat = "http://192.168.47.60:8065";
var pingDuration = 2000;
var privateMessageBadge = "icons/icon16.png";
var closedTabBadge = "icons/iconred16.png";
var groupOrChannelBadge = "icons/iconblue36.png";

chrome.browserAction.onClicked.addListener(function(icon) {
  goToChat();
});

function goToChat() {
  chrome.tabs.getAllInWindow(null, function(tabs) {
    var found = false;
    for (var i = 0; i < tabs.length; i++) {
      if (tabs[i].url.indexOf(chat) > -1) {
	found = true;
    	chrome.tabs.update(tabs[i].id, {selected: true});
      }
    }
    if(!found)
	chrome.tabs.create({
    url: chat
  });
  });
}

function ping() {
  checkMessages()
  setTimeout(ping, pingDuration);
}
setTimeout(ping, pingDuration);

function checkMessages() {
 chrome.browserAction.setBadgeText({
            text: ""
          });
  var tabFound = false;
  chrome.windows.getAll({populate:true}, function(windows){
    windows.forEach(function(window){
      window.tabs.forEach(function(tab){


        if (tab.url.indexOf(chat) > -1) {
          tabFound = true;
          chrome.browserAction.setIcon({
            path: privateMessageBadge
          });
          var title = tab.title;
          if (title.indexOf("*") > -1) {
            chrome.browserAction.setIcon({
              path: groupOrChannelBadge
            });
            chrome.browserAction.setBadgeText({
              text: ""
            });
          }
          if (title.indexOf("(") > -1) {
            chrome.browserAction.setBadgeText({
              text: title
            });
            var rgx = /\(([^)]+)\)/;
            var matcher = title.match(rgx);
            var privateMsgCount = matcher && matcher[1];
            chrome.browserAction.setBadgeText({
              text: privateMsgCount
            });
          }
        }




      });
    });
  });
}

{'fraction_non_alphanumeric': 0.14874319771961647, 'fraction_numerical': 0.01580720393884426, 'mean_word_length': 2.1179321486268177, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2601522', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1207, 'n_words': 219}