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') { } else if (message['type'] === 'create-popup') {
const create = message['create']; const create = message['create'];
create.url += '&tabId=' + sender.tab.id; create.url += '&tabId=' + sender.tab.id;
browser.windows.create(create); chrome.windows.create(create);
} else if (message['type'] === 'autofill-code') { } else if (message['type'] === 'autofill-code') {
browser.tabs.sendMessage(message['tabId'], { chrome.tabs.sendMessage(message['tabId'], {
type: 'autofill-code', type: 'autofill-code',
code: message['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'], urls: ['https://checkin.york.ac.uk/api/selfregistration/*/present'],
}, ['requestBody']); }, ['requestBody']);
browser.webRequest.onCompleted.addListener(interceptSubmit, { chrome.webRequest.onCompleted.addListener(interceptSubmit, {
urls: ['https://checkin.york.ac.uk/api/selfregistration/*/present'], 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 name = section.querySelector('.row:nth-child(2) > .col-md-4').innerText;
const space = section.querySelector('.row:nth-child(4) > .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', type: 'link-activity-details',
activityId, activityId,
date, date,
@ -26,10 +26,10 @@ console.log('hello');
activity: name, activity: name,
space, space,
}); });
browser.runtime.sendMessage({ chrome.runtime.sendMessage({
type: 'create-popup', type: 'create-popup',
create: { create: {
url: browser.runtime.getURL('src/popup.html') + '#' + params.toString(), url: chrome.runtime.getURL('src/popup.html') + '#' + params.toString(),
width: 360, width: 360,
height: 480, height: 480,
type: 'popup', 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(); window.close();
}, 'warning'); }, 'warning');
const submitButton = simpleButton(`Autofill ${code}`, function () { const submitButton = simpleButton(`Autofill ${code}`, function () {
browser.runtime.sendMessage({ chrome.runtime.sendMessage({
type: 'autofill-code', type: 'autofill-code',
code, code,
tabId, tabId,