mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
remove old controller when changing to a new video
This commit is contained in:
13
inject.js
13
inject.js
@@ -179,9 +179,10 @@
|
|||||||
|
|
||||||
var observer=new MutationObserver((mutations) => {
|
var observer=new MutationObserver((mutations) => {
|
||||||
mutations.forEach((mutation) => {
|
mutations.forEach((mutation) => {
|
||||||
|
console.log(mutation)
|
||||||
if (mutation.type === 'attributes' && (mutation.attributeName === 'src' || mutation.attributeName === 'currentSrc')){
|
if (mutation.type === 'attributes' && (mutation.attributeName === 'src' || mutation.attributeName === 'currentSrc')){
|
||||||
var controller = getShadow(document.body).filter(x => {
|
var controller = getShadow(document.body).filter(x => {
|
||||||
return x.attributes['data-vscid'] && x.tagName == 'DIV' && x.attributes['data-vscid'].value==`${id}`
|
return x.attributes['data-vscid'] && x.tagName == 'DIV' && x.attributes['data-vscid'].value==`${this.id}`
|
||||||
})[0]
|
})[0]
|
||||||
if(!controller){
|
if(!controller){
|
||||||
return;
|
return;
|
||||||
@@ -453,12 +454,14 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'attributes':
|
case 'attributes':
|
||||||
if (mutation.attributeName == 'aria-hidden' && (mutation.target.tagName == 'APPLE-TV-PLUS-PLAYER') && (mutation.target.attributes['aria-hidden'].value == "false")) {
|
if ((mutation.target.tagName == 'APPLE-TV-PLUS-PLAYER') && (mutation.target.attributes['aria-hidden'].value == "false")) {
|
||||||
var flattenedNodes = getShadow(document.body)
|
var flattenedNodes = getShadow(document.body)
|
||||||
var node = flattenedNodes.filter(x => x.tagName == 'VIDEO')[0]
|
var node = flattenedNodes.filter(x => x.tagName == 'VIDEO')[0]
|
||||||
if (!flattenedNodes.filter(x => x.className == 'vsc-controller')[0]) {
|
var oldController = flattenedNodes.filter(x => x.className == 'vsc-controller')[0]
|
||||||
checkForVideo(node, node.parentNode || mutation.target, true);
|
if (oldController) {
|
||||||
|
oldController.remove()
|
||||||
}
|
}
|
||||||
|
checkForVideo(node, node.parentNode || mutation.target, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@@ -496,7 +499,7 @@
|
|||||||
return x.tagName == 'AUDIO' || x.tagName == 'VIDEO'
|
return x.tagName == 'AUDIO' || x.tagName == 'VIDEO'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var mediaTags = getShadow(document.body).filter(x => x.tagName == 'VIDEO');;
|
var mediaTags = getShadow(document.body).filter(x => x.tagName == 'VIDEO');
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaTags.forEach = Array.prototype.forEach;
|
mediaTags.forEach = Array.prototype.forEach;
|
||||||
|
Reference in New Issue
Block a user