加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
opengame.html 6.87 KB
一键复制 编辑 原始数据 按行查看 历史
huaji 提交于 2024-10-03 06:25 . update opengame.html.
<html lang="zh">
<head>
<meta charset="utf-8">
<link crossorigin="" rel="shortcut icon" type="image/x-icon" href="./logo-200x200.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js').then((registration) => {
console.log('Service Worker registered with scope:', registration.scope);
}).catch((error) => {
console.error('Service Worker registration failed:', error);
});
}
if (navigator.userAgent.indexOf("MicroMessenger") !== -1) {
document.write('<iframe id="fullscreen-iframe" src="about:blank" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; margin: 0; padding: 0; overflow: hidden; z-index: 999999;"></iframe>');
const iframe = document.getElementById("fullscreen-iframe");
iframe.src = window.location.origin + "/openurl.html";
}
var url = window.location.href.split(/\?data=(.+)/)[1];
var zsfappsdk = "tencentmsdk1104466820://"
var tyfappsdk = "tencentmsdk1104791911://"
if (url.includes(zsfappsdk)) {
window.gametype = "正式服"
if (navigator.userAgent.indexOf("QQ/") !== -1) {
window.url = url.replace(new RegExp(zsfappsdk, 'g'), 'https://h5.nes.smoba.qq.com/pvpesport.web.user/#/launch-game-mp-qq');
}
} else if (url.includes(tyfappsdk)) {
window.gametype = "体验服"
if (navigator.userAgent.indexOf("QQ/") !== -1) {
document.write('<iframe id="fullscreen-iframe" src="about:blank" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; margin: 0; padding: 0; overflow: hidden; z-index: 999999;"></iframe>');
const iframe = document.getElementById("fullscreen-iframe");
iframe.src = window.location.origin + "/openurl.html";
}
}
</script>
<title>王者房间加入</title>
<style data-emotion="css" data-s="">
body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100vh;
margin: 0;
background-image: linear-gradient(rgba(255, 255, 255, 0.09) 74%, rgba(0, 156, 238, 0.3));
}
.mytext {
font-size: 1.5rem;
font-weight: 300;
margin-bottom: 22px;
text-align: center;
}
.button {
color: rgb(255, 255, 255);
background: rgb(15, 136, 235);
border-radius: 999999px;
font-size: 18px;
font-weight: 700;
width: 240px;
height: 42px;
border: none;
margin-left: -120px;
display: flex;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
z-index: 1;
margin: 10px 0;
cursor: pointer
}
.button:hover {
background-color: #1976D2;
}
</style>
</head>
<body>
<p class="mytext"></p>
<button class="button" onclick="addroom()">加入房间</button>
<button class="button" onclick="home()">跳转主页</button>
<script src="myjson.js"></script>
<script>
window.top.postMessage({ title: document.title, url: window.location.href }, '*');
function extractNumbers(str) {
const regex = /_(\d+)/g;
let match;
let result = [];
while ((match = regex.exec(str)) !== null) {
// 匹配到的数字位于match[1],因为(\d+)是第一个捕获组
result.push(Number(match[1]));
}
return result;
}
/*
//废弃方案
const gamedata = window.location.href.split(/gamedata=(.+)/)[1];
const numtab = extractNumbers(gamedata)
if (/ShareRoom/.test(gamedata)) {
teambusid = gamedata
teamid = numtab[0] + "_" + numtab[1] + "_" + numtab[2]
}
var apiurl = "https://ouwhiy7vaifi44w6ee26vxikny0bzigt.lambda-url.ap-east-1.on.aws/getroom?teambusid=" + teambusid + "&teamid=" + teamid + "&t" + Date.now()
var xhr = new XMLHttpRequest();
xhr.open('GET', apiurl, true);
xhr.send();
work_message = "正在请求复制链接中 请稍等"
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var mdata = JSON.parse(this.responseText)
}
}
*/
var tipdoc = document.querySelector(".mytext")
var tiptext = "请点击下方加入房间加入"
var mapnametable = {};
var maptable = mydatajson[0]
for (const key in maptable) {
const valueArray = maptable[key];
mapnametable[valueArray[0]] = [key, valueArray[2]];
}
//补全
mapnametable[1010] = ["快速赛", 10]
mapnametable[20031] = ["小峡谷", 10]
mapnametable[25001] = ["1v1对抗路", 2]
mapnametable[25002] = ["1v1中路", 2]
mapnametable[25003] = ["1v1发育路", 2]
mapnametable[20910] = ["5v5征兆0ban位", 10];
mapnametable[20009] = ["火焰山大作战", 10]
mapnametable[20012] = ["克隆模式", 10]
mapnametable[20019] = ["契约之战", 10]
mapnametable[20017] = ["无限乱斗", 10]
mapnametable[90001] = ["梦境大乱斗", 10]
mapnametable[4010] = ["变身大乱斗", 10]
mapnametable[5121] = ["觉醒之战", 10]
mapnametable[5153] = ["多重施法", 10]
mapnametable[5155] = ["双人同舞", 10]
mapnametable[99988] = ["众星峡谷", 20]
const gamedata = window.location.href.split(/gamedata=(.+)/)[1];
const mapid = extractNumbers(gamedata)[9]
if (mapnametable[mapid]) {
var mapname = mapnametable[mapid][0]
} else {
var mapname = mapid
}
if (/ShareRoom/.test(gamedata)) {
roomtype = "房间"
}
else if (/ShareTeam/.test(gamedata)) {
roomtype = "组队"
}
else {
roomtype = "未知"
}
tipdoc.innerText = tiptext + "\n" + gametype + " " + mapname + roomtype
console.log(mapname)
function addroom() {
window.top.location.href = url
}
function home() {
window.top.location.replace(window.location.origin + "/")
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化