// ==UserScript== // @name 橙光无限鲜花 // @namespace http://tampermonkey.net/ // @version 2024-05-19 // @description 使用说明:进入游戏后左上角点击启用 // @author You // @match http://*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @match https://m.66rpg.com/h5/* // @match https://www.66rpg.com/game/* // @downloadURL none // ==/UserScript== (function () { 'use strict'; const createButton = (text, position) => { const active = document.createElement('button'); active.style.position = 'fixed'; active.style.zIndex = '9999'; active.style.top = '10px'; active.style.left = '300px'; active.innerHTML = text; active.style.userSelect = 'none'; return active; }; const fsButton = createButton('启动', 'left'); const exitButton = createButton('退出', 'left'); exitButton.style.display = 'none'; let isFullScreen = false; const toggleFullscreen = () => { if (!isFullScreen) { enterFullscreen(); } else { exitFullscreen(); } }; const enterFullscreen = () => { const element = document.documentElement; isFullScreen = true; fsButton.style.display = 'none'; if (element.requestFullscreen) element.requestFullscreen(); else if (element.mozRequestFullScreen) element.mozRequestFullScreen(); else if (element.webkitRequestFullscreen) element.webkitRequestFullscreen(); if (screen.orientation?.lock('landscape')); }; const exitFullscreen = () => { isFullScreen = false; fsButton.style.display = 'block'; if (document.exitFullscreen) document.exitFullscreen(); else if (document.mozCancelFullScreen) document.mozCancelFullScreen(); else if (document.webkitExitFullscreen) document.webkitExitFullscreen(); if (screen.orientation?.unlock()); }; const handleFullscreenChange = () => { if (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement) { isFullScreen = true; fsButton.style.display = 'none'; toggleExitButton(); } else { isFullScreen = false; fsButton.style.display = 'block'; toggleExitButton(); } }; const toggleExitButton = () => { if (isFullScreen) { exitButton.style.display = 'block'; } else { exitButton.style.display = 'none'; } }; fsButton.addEventListener('click', () => { setTimeout(() => { if (typeof userData !== 'undefined') { // 鲜花数量 userData.totalFlower = 666; } if (typeof gIndex !== 'undefined') { // 自己发布新游戏,创建24个商品设置鲜花为0,填入游戏ID gIndex = '1670380'; } toggleFullscreen(); }, 100); }); exitButton.addEventListener('click', exitFullscreen); document.body.appendChild(fsButton); document.body.appendChild(exitButton); document.addEventListener('fullscreenchange', handleFullscreenChange); document.addEventListener('webkitfullscreenchange', handleFullscreenChange); document.addEventListener('mozfullscreenchange', handleFullscreenChange); })();