blob: 649720ac2bf027e9e1bc42f09b7915c618a955a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
document.getElementById('activate').addEventListener('click', () => {
browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
if (tabs[0].url.includes('youtube.com/watch')) {
browser.scripting.executeScript({
target: { tabId: tabs[0].id },
files: ['content-script.js']
});
}
});
});
document.getElementById('offset').addEventListener('input', () => {
const offset = parseInt(document.getElementById('offset').value, 10);
browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
browser.tabs.sendMessage(tabs[0].id, { type: 'SET_OFFSET', offset: offset });
localStorage.setItem('offset', offset);
});
});
localStorage.getItem('offset') !== null ? document.getElementById('offset').value = localStorage.getItem('offset') : document.getElementById('offset').value = 5;
|