Feature/autoplay focus change #174
|
@ -24,7 +24,7 @@ export function init(): void {
|
||||||
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
getGlobalConfiguration().getProperty(SETTINGS_playerAutopauseAfterFocusLost, value => {
|
getGlobalConfiguration().getProperty(SETTINGS_playerAutopauseAfterFocusLost, value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
core.registerScript((node: Node) => {
|
core.registerScript((node: Node) => {
|
||||||
addVisibilityChangeListener();
|
window.addEventListener('visibilitychange', observeTabFocus, false);
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
}, "^/anime/[0-9]*/[0-9]*$");
|
}, "^/anime/[0-9]*/[0-9]*$");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -54,10 +54,6 @@ function observeScreenshotTooltip(tooltip: HTMLElement): void {
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addVisibilityChangeListener(): void{
|
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
window.addEventListener('visibilitychange', observeTabFocus, false);
|
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
}
|
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
|
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
|||||||
function observeTabFocus(): void {
|
function observeTabFocus(): void {
|
||||||
let docState = document.visibilityState;
|
let docState = document.visibilityState;
|
||||||
let playerElement = findPlayerElement();
|
let playerElement = findPlayerElement();
|
||||||
|
|
||||||
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
Maybe would rename it to indicate it's a Boolean.
Maybe would rename it to indicate it's a Boolean. `onSomething` mostly is used for events or listeners.
```suggestion
let restartPlayerOnVisible: boolean;
```
I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better. I agree, instead of 'restart' I used 'resume' since it fits the overall functionality better.
|
Maybe would rename it to indicate it's a Boolean.
onSomething
mostly is used for events or listeners.