Poki 游戏全屏/Poki game full screen

Maximize the poki game window and remove navigation bar

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Poki 游戏全屏/Poki game full screen
// @namespace    https://poki.com/
// @version      1.2
// @author       z6os
// @description  Maximize the poki game window and remove navigation bar
// @match        https://poki.com/en/g/*
// @match        https://poki.com/zh/g/*
// @grant        none
// @noframes
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    var element = document.querySelector('#game-player');

    function makeElementFullScreen(element) {
        if (element) {
            element.style.position = 'fixed';
            element.style.top = '0';
            element.style.left = '0';
            element.style.width = '100vw';
            element.style.height = '100vh';
            element.style.margin = '0';
            element.style.padding = '0';
            element.style.zIndex = 3;
        }
    }

    makeElementFullScreen(element);

    // Hide specific UI elements
    var uiElements = document.querySelector('.J91n1ymJasoch_FZq89b');
    if (uiElements) {
        uiElements.style.display = 'none';
    }

    // Remove navigation bar
    var navBar = document.querySelector('nav#nav.qoMYGbBhf9dsbaBGBphh.DJT17TB5hYo14sdLEAwk');
    if (navBar) {
        navBar.remove();
    }

    // Select all matching ad elements
    var ads = document.querySelectorAll('.yqRHsCZfzhtS8CI82MRw');
    // Traverse each element and hide them
    ads.forEach(function(ad) {
        ad.style.display = 'none';
    });
})();