feat(extension): (theoretical) compatibility with google chrome
Some checks failed
Build extension ZIP / Build extension (push) Failing after 26s
Some checks failed
Build extension ZIP / Build extension (push) Failing after 26s
This commit is contained in:
parent
9400db5a9c
commit
760c204f27
3 changed files with 10 additions and 10 deletions
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue