diff --git a/index.js b/index.js index e42a108..7a71465 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ video.muted = true; document.body.appendChild(video) - +window.introtext = new IntroText(); window.videoSettings = new videoProperties(); window.mShortcuts = new mouseShortcuts(video); window.cap2vid = new capturecard2Video(video, videoSettings) diff --git a/introtext.js b/introtext.js index 08da8d3..b400f4a 100644 --- a/introtext.js +++ b/introtext.js @@ -1,20 +1,23 @@ class IntroText{ - contructor(){ - self.introText = document.createElement('p'); - self.introText.classList.add("centerscreen") - self.introText.id = "introText" - self.introText.textContent = "Hover the left side to open menu" - document.body.appendChild(introText) + constructor(){ + this.introText = document.createElement('p'); + this.introText.classList.add("centerscreen") + this.introText.id = "introText" + this.introText.textContent = "Hover the left side to open menu" + document.body.appendChild(this.introText) - document.body.addEventListener("mousedown", removeIntro, true) - document.body.addEventListener("keydown", removeIntro, true) - setTimeout(self.removeIntro, 5000) + // Thanks Javascript, I have to mention what "this" means with whatever this means + this.removeIntro = this.removeIntro.bind(this) + + document.body.addEventListener("mousedown", this.removeIntro, true) + document.body.addEventListener("keydown", this.removeIntro, true) + setTimeout(this.removeIntro, 5000) } removeIntro(){ - self.introText.remove() - document.body.removeEventListener("mousedown", removeIntro, false); - document.body.removeEventListener("keydown", removeIntro, false); + this.introText.remove() + document.body.removeEventListener("mousedown", this.removeIntro, false); + document.body.removeEventListener("keydown", this.removeIntro, false); } } diff --git a/sidebar.js b/sidebar.js index 8fa4c8a..659d78e 100644 --- a/sidebar.js +++ b/sidebar.js @@ -55,15 +55,17 @@ class capturecard2VideoSidebar{ this.helpElement = document.createElement('button'); this.helpElement.onclick = this.openHelp; - this.helpElement.textContent = "Help (?)"; + this.helpElement.textContent = "Binds (?)"; this.videobottomother.appendChild(this.helpElement) this.refreshElement = document.createElement('button'); - this.pipElement = document.createElement('button'); - this.pipElement.onclick = this.cap2vid.video.requestPictureInPicture; - this.pipElement.textContent = "Picture in Picture (p)" - this.videobottomother.appendChild(this.pipElement); + if(this.cap2vid.video.requestPictureInPicture){ + this.pipElement = document.createElement('button'); + this.pipElement.onclick = this.cap2vid.video.requestPictureInPicture; + this.pipElement.textContent = "Picture in Picture (p)" + this.videobottomother.appendChild(this.pipElement); + } this.refreshElement.onclick = this.getDevices;