From 2c889b55a8340e703301ad1565e57d752e82f599 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 7 Dec 2018 00:17:49 +0100 Subject: [PATCH] Marking player now works (the div mark remains on top of yt videos). Todo: clear mark when popup goes away. --- js/lib/Comms.js | 4 +--- js/lib/PlayerData.js | 5 ++++- js/lib/VideoData.js | 1 - js/modules/PageInfo.js | 2 -- res/popup/js/popup.js | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/js/lib/Comms.js b/js/lib/Comms.js index 8b5c0ed..b531bc2 100644 --- a/js/lib/Comms.js +++ b/js/lib/Comms.js @@ -87,8 +87,6 @@ class CommsClient { } else if (message.cmd === 'set-zoom') { this.pageInfo.setZoom(message.zoom, true, message.playing); } else if (message.cmd === 'mark-player') { - console.log("COMMS CLIENT MARKING PLAYER!") - this.pageInfo.markPlayer(message.name, message.color); } } @@ -348,7 +346,7 @@ class CommsServer { } else if (message.cmd === 'noVideo') { this.server.unregisterVideo(port.sender); } else if (message.cmd === 'mark-player') { - this.sendToFrame(message, this.tab, message.targetFrame); + this.sendToFrame(message, message.targetTab, message.targetFrame); } } diff --git a/js/lib/PlayerData.js b/js/lib/PlayerData.js index 4060f0f..f8cf910 100644 --- a/js/lib/PlayerData.js +++ b/js/lib/PlayerData.js @@ -70,10 +70,13 @@ class PlayerData { } markPlayer(name, color) { - console.log("PLAYERDATA — MARKING PLAYER!") var overlay = document.createElement('div'); overlay.style.width = '100%'; overlay.style.height = '100%'; + overlay.style.position = 'absolute'; + overlay.style.top = '0'; + overlay.style.left = '0'; + overlay.style.zIndex = '1000000000'; overlay.innerHTML = `
${name}
`; this.overlayNode = overlay; diff --git a/js/lib/VideoData.js b/js/lib/VideoData.js index 32ab87b..547533a 100644 --- a/js/lib/VideoData.js +++ b/js/lib/VideoData.js @@ -190,7 +190,6 @@ class VideoData { } markPlayer(name, color) { - console.log("VIDEO DATA — MARKING PLAYER!") if (this.player) { this.player.markPlayer(name, color) } diff --git a/js/modules/PageInfo.js b/js/modules/PageInfo.js index c0ce0b0..18db9fd 100644 --- a/js/modules/PageInfo.js +++ b/js/modules/PageInfo.js @@ -420,8 +420,6 @@ class PageInfo { } markPlayer(name, color) { - console.log("PAGEINFO — MARKING PLAYER!") - for (var vd of this.videos) { vd.markPlayer(name,color); } diff --git a/res/popup/js/popup.js b/res/popup/js/popup.js index e9fb5ff..872f295 100644 --- a/res/popup/js/popup.js +++ b/res/popup/js/popup.js @@ -105,6 +105,7 @@ function loadFrames(videoTab) { port.postMessage({ cmd: 'mark-player', + targetTab: videoTab.id, targetFrame: videoTab.frames[frame].id, name: videoTab.frames[frame].id, color: '#fa6'