mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
fix NodeList missing foreach in some browsers
This commit is contained in:
@@ -28,6 +28,8 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
tc.settings.rememberSpeed = Boolean(storage.rememberSpeed);
|
tc.settings.rememberSpeed = Boolean(storage.rememberSpeed);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var forEach = Array.prototype.forEach;
|
||||||
|
|
||||||
function defineVideoController() {
|
function defineVideoController() {
|
||||||
tc.videoController = function(target, parent) {
|
tc.videoController = function(target, parent) {
|
||||||
this.video = target;
|
this.video = target;
|
||||||
@@ -100,7 +102,7 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
shadow.innerHTML = shadowTemplate;
|
shadow.innerHTML = shadowTemplate;
|
||||||
shadow.querySelectorAll('button').forEach(button => {
|
forEach.call(shadow.querySelectorAll('button'), function(button) {
|
||||||
button.onclick = (e) => {
|
button.onclick = (e) => {
|
||||||
runAction(e.target.dataset['action'], document);
|
runAction(e.target.dataset['action'], document);
|
||||||
}
|
}
|
||||||
@@ -164,7 +166,6 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
return false;
|
return false;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
var forEach = Array.prototype.forEach;
|
|
||||||
function checkForVideo(node, parent) {
|
function checkForVideo(node, parent) {
|
||||||
if (node.nodeName === 'VIDEO') {
|
if (node.nodeName === 'VIDEO') {
|
||||||
if (!node.classList.contains('vsc-initialized')) {
|
if (!node.classList.contains('vsc-initialized')) {
|
||||||
@@ -179,7 +180,7 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
}
|
}
|
||||||
var observer = new MutationObserver(function(mutations) {
|
var observer = new MutationObserver(function(mutations) {
|
||||||
mutations.forEach(function(mutation) {
|
mutations.forEach(function(mutation) {
|
||||||
mutation.addedNodes.forEach(node => {
|
forEach.call(mutation.addedNodes, function(node) {
|
||||||
if (typeof node === "function")
|
if (typeof node === "function")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user