// ==UserScript== // @name video fullpage // @namespace github.q962 // @match https://*/* // @version 1.0 // @author q962 // @grant GM_registerMenuCommand // @grant GM_addStyle // @license MIT // @description 2024-7-12 18:05:52 // @downloadURL none // ==/UserScript== let global_css = ` .___fullpage{ top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; z-index: 999999999 !important; position: fixed !important; background: black !important; } `; GM_addStyle(global_css); ///////////////////////////////////////////////////////// const all_video_elems = []; let current_video_parent_elemt = null; let current_video_elemt = null; let current_video_next_elemt = null; function set_fullpage(){ if(!current_video_elemt)return; if(current_video_elemt.classList.contains("___fullpage")){ current_video_elemt.classList.remove("___fullpage"); current_video_parent_elemt.insertBefore(current_video_elemt, current_video_next_elemt); }else{ current_video_elemt.classList.add("___fullpage"); document.body.append(current_video_elemt); } } GM_registerMenuCommand('全页', set_fullpage); function bind_evnet(elem){ elem.addEventListener('play', function (e) { current_video_elemt = e.target; current_video_parent_elemt = current_video_elemt.parentElement; current_video_next_elemt = current_video_elemt.nextSibling; }) elem.addEventListener('pause', function (e) { }); } function findingVideoElem(){ let video_elems = document.querySelectorAll("video"); for( let index=0; index < video_elems.length; index++){ let video_elem = video_elems[index]; if( !( video_elem in all_video_elems )) { bind_evnet( video_elem ); all_video_elems.push( video_elem ); } } } setInterval(findingVideoElem, 2000);