diff --git a/extension/src/background.js b/extension/src/background.js index bdd52e5..dc92504 100644 --- a/extension/src/background.js +++ b/extension/src/background.js @@ -95,9 +95,9 @@ function handleMessage(message, sender) { } else if (message['type'] === 'create-popup') { const create = message['create']; create.url += '&tabId=' + sender.tab.id; - browser.windows.create(create); + chrome.windows.create(create); } else if (message['type'] === 'autofill-code') { - browser.tabs.sendMessage(message['tabId'], { + chrome.tabs.sendMessage(message['tabId'], { type: 'autofill-code', code: message['code'], }); @@ -106,11 +106,11 @@ function handleMessage(message, sender) { } } -browser.webRequest.onBeforeRequest.addListener(interceptCode, { +chrome.webRequest.onBeforeRequest.addListener(interceptCode, { urls: ['https://checkin.york.ac.uk/api/selfregistration/*/present'], }, ['requestBody']); -browser.webRequest.onCompleted.addListener(interceptSubmit, { +chrome.webRequest.onCompleted.addListener(interceptSubmit, { urls: ['https://checkin.york.ac.uk/api/selfregistration/*/present'], }); -browser.runtime.onMessage.addListener(handleMessage) +chrome.runtime.onMessage.addListener(handleMessage) diff --git a/extension/src/content.js b/extension/src/content.js index ca2832a..a4e9735 100644 --- a/extension/src/content.js +++ b/extension/src/content.js @@ -9,7 +9,7 @@ console.log('hello'); const name = section.querySelector('.row:nth-child(2) > .col-md-4').innerText; const space = section.querySelector('.row:nth-child(4) > .col-md-4').innerText; - browser.runtime.sendMessage({ + chrome.runtime.sendMessage({ type: 'link-activity-details', activityId, date, @@ -26,10 +26,10 @@ console.log('hello'); activity: name, space, }); - browser.runtime.sendMessage({ + chrome.runtime.sendMessage({ type: 'create-popup', create: { - url: browser.runtime.getURL('src/popup.html') + '#' + params.toString(), + url: chrome.runtime.getURL('src/popup.html') + '#' + params.toString(), width: 360, height: 480, type: 'popup', @@ -54,4 +54,4 @@ function handleMessage(message) { } } -browser.runtime.onMessage.addListener(handleMessage); +chrome.runtime.onMessage.addListener(handleMessage); diff --git a/extension/src/popup.js b/extension/src/popup.js index af404ef..3b5a9c5 100644 --- a/extension/src/popup.js +++ b/extension/src/popup.js @@ -61,7 +61,7 @@ window.close(); }, 'warning'); const submitButton = simpleButton(`Autofill ${code}`, function () { - browser.runtime.sendMessage({ + chrome.runtime.sendMessage({ type: 'autofill-code', code, tabId,