Player FullScreen Auto

Auto Player full screen for web.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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);