mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 10:38:45 -04:00
26 lines
756 B
JavaScript
26 lines
756 B
JavaScript
browser.runtime.sendMessage({ greeting: "hello" }).then((response) => {
|
|
console.log("Received response: ", response);
|
|
});
|
|
|
|
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|
console.log("Received request: ", request);
|
|
});
|
|
|
|
function afterNavigate() {
|
|
if ('/watch' === location.pathname) {
|
|
window.location.href = `youtube://${window.location.pathname.slice(1)}${
|
|
window.location.search
|
|
}${window.location.hash}`;
|
|
}
|
|
}
|
|
(document.body || document.documentElement).addEventListener('transitionend',
|
|
function(/*TransitionEvent*/ event) {
|
|
if (event.propertyName === 'width' && event.target.id === 'progress') {
|
|
afterNavigate();
|
|
}
|
|
}, true);
|
|
// After page load
|
|
afterNavigate();
|
|
|
|
|