{"size": 959, "ext": "js", "max_stars_repo_path": "web-extension/content.js", "max_stars_repo_name": "JawaBaliIBM/Gaia", "max_stars_repo_stars_event_min_datetime": "2021-07-31T10:52:36.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:10:55.000Z", "max_issues_repo_path": "web-extension/content.js", "max_issues_repo_name": "JawaBaliIBM/Gaia", "max_issues_repo_issues_event_min_datetime": "2021-07-24T08:17:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-10T14:41:46.000Z", "max_forks_repo_path": "web-extension/content.js", "max_forks_repo_name": "JawaBaliIBM/Gaia", "max_forks_repo_forks_event_min_datetime": "2021-07-31T10:15:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-31T10:15:45.000Z"}
{"max_stars_count": 6, "max_issues_count": 3, "max_forks_count": 1, "avg_line_length": 24.5897435897, "max_line_length": 60, "alphanum_fraction": 0.6485922836}
let iframe;
const URL = chrome.runtime.getURL("popup.html");

chrome.runtime.onMessage.addListener(function(msg, sender){
  if(msg.message == "show-gaia-popup"){
    changeIframeName(msg.company);
  }
});

window.addEventListener('message', function(event) {
  if(event.data === 'closeIframe') {
    iframe.style.width = "0px";
  }
});

function initIframe() {
  iframe = document.createElement('iframe'); 
  iframe.style.background = "white";
  iframe.style.height = "600px";
  iframe.style.width = "0px";
  iframe.style.position = "fixed";
  iframe.style.top = "5px";
  iframe.style.right = "5px";
  iframe.style.zIndex = "9000000000000000000";
  iframe.frameBorder = "none"; 
  iframe.src = `${URL}`;

  document.body.appendChild(iframe);
}

function changeIframeName(companyName){
  if(iframe.style.width == "0px"){
    iframe.style.width="400px";
  }
  iframe.src = `${URL}?company=${companyName}`;
}

initIframe();
