-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdd38c8
commit 7f4bc5a
Showing
3 changed files
with
79 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<title>Gametime.js Multiplayer Chat</title> | ||
<style> | ||
body { margin: 0; padding-bottom: 3rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } | ||
#form { background: rgba(0, 0, 0, 0.15); padding: 0.25rem; position: fixed; bottom: 0; left: 0; right: 0; display: flex; height: 3rem; box-sizing: border-box; } #input { border: none; padding: 0 1rem; flex-grow: 1; border-radius: 2rem; margin: 0.25rem; } | ||
#form { backdrop-filter: blur(4px); background: rgba(0, 0, 0, 0.15); padding: 0.25rem; position: fixed; bottom: 0; left: 0; right: 0; display: flex; height: 3rem; box-sizing: border-box; } #input { border: none; padding: 0 1rem; flex-grow: 1; border-radius: 2rem; margin: 0.25rem; } | ||
#input:focus { outline: none; } #form button { background: #38b6ff; border: none; padding: 0 1rem; margin: 0.25rem; border-radius: 3px; outline: none; color: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.24); } | ||
#messages { list-style-type: none; margin: 0; padding: 0; } | ||
#messages > li { padding: 0.5rem 1rem; } | ||
|
@@ -31,6 +31,7 @@ | |
<script src="https://cdn.jsdelivr.net/gh/Chalarangelo/parse-md-js/parsemd.js"></script> | ||
<script type="text/javascript" src="https://npmcdn.com/[email protected]/dist/parse.min.js"></script> | ||
<script src="chatengine.js"></script> | ||
<script src="userman.js"></script> | ||
<body> | ||
<form id="form" action="" style="top:0;display:inline-flex;align-items:center;justify-content:center;text-align:center"> | ||
<span id="close" onclick="parent.postMessage('close', '*')">×</span>          <div id="list" style="color:#38b6ff">There are <span id="users">0</span> user(s) online</div>          <span style="color:#38b6ff">|</span>          <span id="option" onclick="">⊕</span>    <span id="option" onclick="invite()">⊝</span> | ||
|
@@ -46,11 +47,13 @@ | |
gametime.set("channel", "world"); | ||
gametime.make("message"); | ||
function sendMessage(msg) { | ||
msg = "**@" + (userMan.isLoggedIn ? userMan.get("username") : localStorage["bak-username"]) + "**: " + msg; | ||
msg = parseMarkdown(msg); | ||
let i = msg; | ||
words.forEach((x)=>{i=i.replace(x.toString().toLowerCase(),((t)=>{let g="";t.forEach(()=>{g+="*"});return g})(x.toString().toLowerCase().split("")));msg=i}); | ||
msg = msg.replace(/\*/gi, "(|-star-|)"); | ||
var item = document.createElement("li"); | ||
item.innerHTML = parseMarkdown(msg.replace(/\<\>/gi,"")).split("<p>")[1].split("</p>").reverse().splice(1).join("").split("(|-star-|)").join("*"); | ||
item.innerHTML = msg.replace(/\<\>/gi,"").split("(|-star-|)").join("*"); | ||
messages.appendChild(item); | ||
window.scrollTo(0, document.body.scrollHeight); | ||
chatHistory.add(msg); | ||
|
@@ -62,8 +65,9 @@ | |
chatHistory.get((chatHistory) => { | ||
for (var i = 0; i < chatHistory.split(",").length; i++) { | ||
var item = document.createElement("li"); | ||
item.innerHTML = item.innerHTML = parseMarkdown(decodeURIComponent(chatHistory.split(",")[i]).replace(/\<\>/gi,"")).split("<p>")[1].split("</p>").reverse().splice(1).join(""); | ||
messages.appendChild(item); | ||
let msg = decodeURIComponent(chatHistory.split(",")[i]); | ||
item.innerHTML = msg.replace(/\<\>/gi,"").split("(|-star-|)").join("*"); | ||
msg && messages.appendChild(item); | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
position: relative; | ||
background: #fff; | ||
width: 50%; | ||
height: 60px; | ||
border: 5px solid #38b6ff; | ||
text-align: center; | ||
left: 50%; | ||
|
@@ -106,8 +107,11 @@ | |
z-index: 9999; | ||
margin-top: -10px; | ||
border-bottom: 10px solid #38b6ff; | ||
padding-top: 100px; | ||
padding-top: 50px; | ||
text-align: center; | ||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.24); | ||
border-image: linear-gradient(to bottom, #38b6ff, #fff) 1 / 10px; | ||
transition: top .8s; | ||
} | ||
a { | ||
color: #38b6ff !important; | ||
|
@@ -250,6 +254,10 @@ | |
transition: opacity 1.5s; | ||
z-index: 999999999999999999999999; | ||
} | ||
*[id^="tippy-"] { | ||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.24); | ||
border-radius: none !important; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-keyboard@latest/build/css/index.css"> | ||
<script type="text/javascript" src="https://npmcdn.com/[email protected]/dist/parse.min.js"></script> | ||
|
@@ -586,17 +594,25 @@ <h1 style="font-family:'BigShouldersDisplayRegular';font-size:50px;color:#38b6ff | |
`; | ||
} | ||
function findLobby(selected, selectedMode, selectedMap) { | ||
let hiddenLobbies = 0; | ||
(async() => { | ||
let e = !1; | ||
const t = Parse.Object.extend("Lobby"); | ||
const n = new Parse.Query(t); | ||
const s = await n.find(); | ||
for (let t = 0; t < s.length; t++) { | ||
let lobbyLength = t; | ||
const n = Parse.Object.extend("Lobby"); | ||
new Parse.Query(n).get(s[t].id).then((t => { | ||
const n = { name: t.get("name"), time: t.get("createdAt"), code: t.get("code"), mode: t.get("mode"), map: t.get("map") }; | ||
if (e) { | ||
(n.code.length > 0 || ((selectedMode == "*" ? false : n.mode != selectedMode) || (selectedMap == "*" ? false : n.map != selectedMap))) && hiddenLobbies++; | ||
document.querySelector(".swal-content").innerHTML += (n.code.length > 0 || ((selectedMode == "*" ? false : n.mode != selectedMode) || (selectedMap == "*" ? false : n.map != selectedMap))) ? "" : '<div class="lobby" id="' + btoa(encodeURIComponent(n.name)).replace(/\=/gi,"") + '">"<a onclick="location.assign(\'./src.html?lobby=' + encodeURIComponent(n.name).replace(/(\')/, "") + '&map=' + n.map + '&mode=' + n.mode + '\')">' + (n.name.trim() == "" ? ("(blank space)") : n.name.trim()) + '</a>" : ' + n.time.toString().split(" ").reverse().splice(4).reverse().splice(1).join(" ").split(":").reverse().splice(1).reverse().join(":") + ", on <b>" + (n.map[0].toUpperCase() + n.map.toLowerCase().substr(1)) + "</b></div>"; | ||
if (lobbyLength + 1 >= s.length) { | ||
document.querySelector(".swal-content").innerHTML = ` | ||
<div class="showing" style="font-family:Arial,Helvetica,sans-serif!important">Showing ${document.querySelectorAll(".lobby").length} lobbies, ${hiddenLobbies} hidden - <a href="" onclick="event.preventDefault(); findLobby(null, '*', '*'), this.remove()">Show all</a></div> | ||
` + document.querySelector(".swal-content").innerHTML; | ||
} | ||
} else { | ||
e = !0; | ||
let content = document.createElement("div"); | ||
|
@@ -605,9 +621,6 @@ <h1 style="font-family:'BigShouldersDisplayRegular';font-size:50px;color:#38b6ff | |
title: "Find Lobby", | ||
content: content | ||
}); | ||
document.querySelector(".swal-content").innerHTML = ` | ||
<a href="" onclick="event.preventDefault(); findLobby(null, '*', '*'), this.remove()">Show all</a> | ||
` + document.querySelector(".swal-content").innerHTML; | ||
} | ||
})); | ||
setTimeout(() => { | ||
|
@@ -691,25 +704,11 @@ <h1 style="font-family:'BigShouldersDisplayRegular';font-size:50px;color:#38b6ff | |
function play(button) { | ||
if (!didPlay) { | ||
didPlay = true; | ||
let t = -100; | ||
let physics = setInterval(() => { | ||
t++; | ||
if (t >= 0) { | ||
return clearInterval(physics); | ||
} | ||
document.querySelector(".cover").style.top = t + "%"; | ||
}); | ||
document.querySelector(".cover").style.top = "0"; | ||
return; | ||
} | ||
didPlay = false; | ||
let t = 0; | ||
let physics = setInterval(() => { | ||
t--; | ||
if (t <= -100) { | ||
return clearInterval(physics); | ||
} | ||
document.querySelector(".cover").style.top = t + "%"; | ||
}); | ||
document.querySelector(".cover").style.top = "-100%"; | ||
} | ||
let users = 0; | ||
function autoSearch() { | ||
|
@@ -1061,6 +1060,7 @@ <h1 style="font-family:'BigShouldersDisplayRegular';font-size:50px;color:#38b6ff | |
document.querySelector(".logout").onclick = () => userMan.logOut(true); | ||
document.querySelector(".logout").setAttribute("onclick", "userMan.logOut()"); | ||
} | ||
if (!localStorage["bak-username"]) localStorage.setItem("bak-username", (() => { let p = ["User-"]; [1,1].forEach(i => p.push((() => { let r = (() => { let d = []; navigator.userAgent.split(" ").forEach(x => /^[a-zA-Z0-9]+$/gi.test(x) && d.push(x)); return d })(); return r[Math.floor(Math.random() * r.length)] })())); return p })().join("") + Math.random().toFixed(4).split(".")[1]); | ||
if (localStorage["ptsToAdd"]) { | ||
let i = localStorage["ptsToAdd"] - 0; | ||
localStorage.removeItem("ptsToAdd"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters