Player FullScreen Auto

Auto Player full screen for web.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Player FullScreen Auto
// @name:zh-CN 网页自动加载全屏宽屏播放器 - By 全栈CEO
// @namespace   https://roceys.cn
// @version      20190929
// @description Auto Player full screen for web.
// @description:zh-CN  虎牙+哔哩哔哩+Youtube直播&视频平台自动全屏宽屏播放器
// @require    https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// @require    https://greasyfork.org/scripts/48306-waitforkeyelements/code/waitForKeyElements.js?version=275769
// @inject-into content
// @run-at        document-idle
// @author       Roceys
// @license       Apache License
// @match        *://*.bilibili.com/*
// @match        *://www.huya.com/*
// @match        *://*.youtube.com/*
// ==/UserScript==

'use strict'

var selector = {
  'live.bilibili.com': {
    'on': "i[class='live-icon-web-fullscreen']"
  },
   'www.bilibili.com':{
      'on':"div[class~='bilibili-player-video-btn-widescreen']"
   },
  'www.huya.com': {
    'on': "span[class='player-fullpage-btn']"
  },
  'www.youtube.com': {
    'on': "button[class~='ytp-size-button']"
  }
}

var domain = document.location.hostname;

function openFullScreen() {
  var _click = document.querySelector(selector[domain].on);
  if (_click !== null) {
    _click.click();
  }
}

waitForKeyElements(selector[domain].on, openFullScreen, false);