Greasy Fork is available in English.

Discussioni » Sviluppo

how to auto execute this script of full screen or immerse made forany chromium or kiwibrowser

§
Pubblicato: 11/03/2021

// ==UserScript==
// @name AutoFullScreen
// @namespace Scriptz (https://github.com/d3ward/scriptz)
// @match *://*/*
// @grant none
// @version 1.0
// @author Eduard Ursu ( d3ward )
// @description Script to auto switch to full screen mode
// ==/UserScript==

const bg_color="#99aab5";
const fill_color="#ffffff";
function addStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
(function() {
'use strict';

addStyle('#fly{position:fixed; bottom:0; left:0; padding:6px; width:60px; margin:0; height:60px; z-index:9999;}#fly svg{height:30px;fill:'+fill_color+';}.fly_btn{display:flex;align-items:center;justify-content:center;width: 100%; height:100%;background-color:'+ bg_color+ ';border-radius:50%; user-select: none;}.a_i{display:inline-table; width: 46px; height:46px; background-color: #E84F3E; color:#fff; border-radius:50%; box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.15);} #fs_action.fullscreen #compress,#fs_action #expand{display:inline;}#fs_action.fullscreen #expand,#fs_action #compress{display:none;}');

var div = document.createElement("div");
div.innerHTML = '

';
//Add floatly
document.body.appendChild(div);
var script = document.createElement('script');
script.appendChild(document.createTextNode('function openFS(){let e=document.getElementById("fs_action");e.classList.contains("fullscreen")?(closeFullscreen(),e.classList.remove("fullscreen")):(openFullscreen(),e.classList.add("fullscreen"))}function openFullscreen(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}function closeFullscreen(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()} openFS();'));
document.body.appendChild(script);
})();

§
Pubblicato: 11/03/2021

You could summarize that doing this

var script = document.createElement('script');
script.appendChild(document.createTextNode('setTimeout(function(){ document.querySelector("#playerhdbeta").requestFullscreen(); }, 3000);'));
document.body.appendChild(script);

Pubblica risposta

Accedi per pubblicare una risposta.