<commit_before>//
// browserAction Icon Interaction
//
chrome.browserAction.onClicked.addListener(function(tab) {
  
  // Set the text color to red
  chrome.browserAction.setBadgeBackgroundColor({color: "#FF0000"});
  
  chrome.browserAction.getBadgeText({},
    function(currentText) {
      
      //toggle the on/off state of the button
      if (currentText === "off") {
        chrome.browserAction.setBadgeText({text: ""});
        chrome.browserAction.setTitle({title: "Turn Privly Viewing Off"});
        
        // If the badge text was previously set to off, we probably 
        // need to inject the script.
        chrome.tabs.captureVisibleTab(null, null, function(tab){
          if (tab !== undefined) {
            chrome.tabs.executeScript(tab.id, 
              { file: "/javascripts/content_scripts/privly.js", 
                allFrames: true });
          }
        })
      } else {
        chrome.browserAction.setBadgeText({text: "off"});
        chrome.browserAction.setTitle({title: "Turn Privly Viewing On"});
      }
    });
});

//
// Content Script Loading
//
// Loads content script if the badge text is not set to "off"
//
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  chrome.browserAction.getBadgeText({},
    function(currentText) {
      if (currentText !== "off" && 
          tab.url !== "chrome://newtab/" && <commit_msg>removed content script injection from all 'chrome' URLs<commit_after>//
// browserAction Icon Interaction
//
chrome.browserAction.onClicked.addListener(function(tab) {
  
  // Set the text color to red
  chrome.browserAction.setBadgeBackgroundColor({color: "#FF0000"});
  
  chrome.browserAction.getBadgeText({},
    function(currentText) {
      
      //toggle the on/off state of the button
      if (currentText === "off") {
        chrome.browserAction.setBadgeText({text: ""});
        chrome.browserAction.setTitle({title: "Turn Privly Viewing Off"});
        
        // If the badge text was previously set to off, we probably 
        // need to inject the script.
        chrome.tabs.captureVisibleTab(null, null, function(tab){
          if (tab !== undefined) {
            chrome.tabs.executeScript(tab.id, 
              { file: "/javascripts/content_scripts/privly.js", 
                allFrames: true });
          }
        })
      } else {
        chrome.browserAction.setBadgeText({text: "off"});
        chrome.browserAction.setTitle({title: "Turn Privly Viewing On"});
      }
    });
});

//
// Content Script Loading
//
// Loads content script if the badge text is not set to "off"
//
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  chrome.browserAction.getBadgeText({},
    function(currentText) {
      if (currentText !== "off" && 
          tab.url.indexOf("chrome") !== 0 && 
{'fraction_non_alphanumeric': 0.13463587921847248, 'fraction_numerical': 0.003197158081705151, 'mean_word_length': 2.5376884422110555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6264834', 'n_tokens_mistral': 849, 'n_tokens_neox': 795, 'n_words': 189}