// Splash screen code
let closeButton = document.getElementById("close-button");

chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
  if (changeInfo.status == 'complete')
    chrome.tabs.sendMessage(tab.id, { action: "sendDetails" }, receiveDetails)
});
function receiveDetails(res) {
  console.log(res)
  if (res.type !== "") {
    navigate(res.url)
  }
}
chrome.tabs.onActivated.addListener((activeInfo) => {
  chrome.tabs.sendMessage(activeInfo.tabId, { action: "sendDetails" }, receiveDetails)
})
async function init() {
  checkLogin();
  initCloseButton();
  let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
  chrome.tabs.sendMessage(tab.id, { action: "sendDetails" }, receiveDetails)
}
init();