手机端浏览器全屏的油猴脚本

点击屏幕左上角,实现浏览器的全屏。我主要把这个脚本用在coze,可以隐藏地址栏。

// @name         Hide Address Bar Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add a button to hide the address bar
// @author       Your Name
// @match        https://www.coze.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 创建按钮并设置样式
    var fullScreenButton = document.createElement('button');
    fullScreenButton.textContent = '全屏模式';
    fullScreenButton.style.position = 'fixed';
    fullScreenButton.style.left = '0';
    fullScreenButton.style.top = '0';
    fullScreenButton.style.zIndex = '9999';
    fullScreenButton.style.padding = '5px 5px';
    fullScreenButton.style.fontSize = '10px';
    fullScreenButton.style.opacity = '0';
    fullScreenButton.style.background = 'transparent';
    fullScreenButton.style.border = 'none';
    fullScreenButton.style.outline = 'none';
    fullScreenButton.style.borderRadius = '4px';
    fullScreenButton.style.cursor = 'pointer';

    // 添加按钮到页面
    document.body.appendChild(fullScreenButton);

    
    // 点击按钮触发全屏
    fullScreenButton.addEventListener('click', function() {
        if (document.documentElement.requestFullscreen) {
            document.documentElement.requestFullscreen();
        } else if (document.documentElement.webkitRequestFullscreen) { /* Chrome, Safari, and Opera */
            document.documentElement.webkitRequestFullscreen();
        } else if (document.documentElement.mozRequestFullScreen) { /* Firefox */
            document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.msRequestFullscreen) { /* IE/Edge */
            document.documentElement.msRequestFullscreen();
        }
    }, false);
})();

3 个赞

爪机也能chrome油猴么

1 个赞

手机端火狐可以用油猴插件

1 个赞

好好好
遥遥领先

1 个赞

请给我点个赞

常规话题软件分享