{"size": 828, "ext": "js", "max_stars_repo_path": "spell/background.js", "max_stars_repo_name": "Chingiz/Chrome-SpellChecker-for-Azerbaijani", "max_stars_repo_stars_event_min_datetime": "2017-08-09T12:48:09.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-27T17:19:41.000Z", "max_issues_repo_path": "spell/background.js", "max_issues_repo_name": "chingiz/Chrome-SpellChecker-for-Azerbaijani", "max_issues_repo_issues_event_min_datetime": "2017-10-25T20:11:47.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-26T06:01:02.000Z", "max_forks_repo_path": "spell/background.js", "max_forks_repo_name": "chingiz/Chrome-SpellChecker-for-Azerbaijani", "max_forks_repo_forks_event_min_datetime": "2017-10-25T22:57:51.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-25T22:57:51.000Z"}
{"max_stars_count": 3, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 26.7096774194, "max_line_length": 76, "alphanum_fraction": 0.6775362319}
var bootstraped = false;

function bootstrap() {
  chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
    activeTabId = tabs[0].id

    chrome.tabs.insertCSS(activeTabId, {file: "spell/spell.css"});
    chrome.tabs.executeScript(activeTabId, {file: "typo/typo.js"});
    chrome.tabs.executeScript(activeTabId, {file: "spell/spell.js"});
    bootstraped = true;
  });
}

function toggleSpellCheck() {
  if (!bootstraped) {
    bootstrap();
  }
  else {
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
      chrome.tabs.sendMessage(tabs[0].id, { command: 'toggle-spell-check'});
    });
  }
}

chrome.browserAction.onClicked.addListener(bootstrap);

chrome.commands.onCommand.addListener(function(command) {
  if (command === 'toggle-spell-check') {
    toggleSpellCheck();
  }
});