feat(extension): (theoretical) compatibility with google chrome
Some checks failed
Build extension ZIP / Build extension (push) Failing after 26s

This commit is contained in:
Ashhhleyyy 2024-02-25 13:59:09 +00:00
parent 9400db5a9c
commit 760c204f27
Signed by: ash
GPG key ID: 83B789081A0878FB
3 changed files with 10 additions and 10 deletions

View file

@ -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)

View file

@ -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);

View file

@ -61,7 +61,7 @@
window.close();
}, 'warning');
const submitButton = simpleButton(`Autofill ${code}`, function () {
browser.runtime.sendMessage({
chrome.runtime.sendMessage({
type: 'autofill-code',
code,
tabId,