mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
move controller check into initialization
This commit is contained in:
@@ -50,6 +50,10 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
|
|
||||||
function defineVideoController() {
|
function defineVideoController() {
|
||||||
tc.videoController = function(target, parent) {
|
tc.videoController = function(target, parent) {
|
||||||
|
if (target.dataset['vscid']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.video = target;
|
this.video = target;
|
||||||
this.parent = target.parentElement || parent;
|
this.parent = target.parentElement || parent;
|
||||||
this.document = target.ownerDocument;
|
this.document = target.ownerDocument;
|
||||||
@@ -244,9 +248,7 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
function checkForVideo(node, parent, added) {
|
function checkForVideo(node, parent, added) {
|
||||||
if (node.nodeName === 'VIDEO') {
|
if (node.nodeName === 'VIDEO') {
|
||||||
if (added) {
|
if (added) {
|
||||||
if (!node.dataset['vscid']) {
|
new tc.videoController(node, parent);
|
||||||
new tc.videoController(node, parent);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (node.classList.contains('vsc-initialized')) {
|
if (node.classList.contains('vsc-initialized')) {
|
||||||
let id = node.dataset['vscid'];
|
let id = node.dataset['vscid'];
|
||||||
|
Reference in New Issue
Block a user