tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mock-wrapper.js (1003B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 class PictureInPictureVideoWrapper {
      8  play() {
      9    let playPauseButton = document.querySelector("#player .play-pause-button");
     10    playPauseButton.click();
     11  }
     12 
     13  pause() {
     14    let invalidSelector = "#player .pause-button";
     15    let playPauseButton = document.querySelector(invalidSelector);
     16    playPauseButton.click();
     17  }
     18 
     19  setMuted(video, shouldMute) {
     20    let muteButton = document.querySelector("#player .mute-button");
     21    if (video.muted !== shouldMute && muteButton) {
     22      muteButton.click();
     23    } else {
     24      video.muted = shouldMute;
     25    }
     26  }
     27 
     28  shouldHideToggle() {
     29    let video = document.getElementById("mock-video-controls");
     30    return !!video.classList.contains("mock-preview-video");
     31  }
     32 }
     33 
     34 this.PictureInPictureVideoWrapper = PictureInPictureVideoWrapper;