-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made everything opensource (uploaded the v1.0.1 accidentally encoded). I made some minor changes to both the client and server code
- Loading branch information
Showing
6 changed files
with
225 additions
and
33 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,14 +1,81 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
$(function(){function display(bool){if(bool){$("#container").fadeIn(300)}else{$("#container").fadeOut(0)}} | ||
display(!1);window.addEventListener('message',function(event){var item=event.data;if(item.type==="ui"){if(item.status==!0){display(!0)}else{display(!1)}} | ||
if(item.type==="Info"){$("#name").html(item.name+"!");if(item.dienst==!0){$("#dutybutton").html("Go off duty");$("#dutybutton").css("background-color","#ca0d26");$("#dutybutton:hover").css("background-color","#c20d25")}else $("#dutybutton").html("Go on duty");if(item.logs==!0){$("#extrabutton").html("Extras <br>On");$("#extrabutton").css("background-color","#0d4535");$("#extrabutton:hover").css("background-color","#c20d25")}else $("#extrabutton").html("Extras <br>Off")} | ||
if(item.type==='updatePlayerInfo'){updatePlayerList(event.data.playerList)}}) | ||
document.addEventListener('keyup',function(event){if(event.code==='Escape'){$.post('https://ndl_adminduty/exit',JSON.stringify({}));return}});$("#dutybutton").click(function(){$.post('https://ndl_adminduty/dutybutton',JSON.stringify({}));return}) | ||
$("#extrabutton").click(function(){$.post('https://ndl_adminduty/extrabutton',JSON.stringify({}));return})}) | ||
function updatePlayerList(playerList){const playerListElement=document.getElementById('players');playerListElement.innerHTML='';if(playerList&&Array.isArray(playerList)){playerList.forEach(playerInfo=>{const playerDiv=document.createElement('div');playerDiv.id='player' | ||
const playerName=document.createElement('p');playerName.innerText=playerInfo.name;if(playerInfo.self){playerName.style.color='#1d735b'} | ||
playerDiv.appendChild(playerName);playerListElement.appendChild(playerDiv)})}} | ||
$(function () { | ||
function display(bool) { | ||
if (bool) { | ||
$("#container").fadeIn(300); | ||
} else { | ||
$("#container").fadeOut(0); | ||
} | ||
} | ||
display(false); | ||
window.addEventListener('message', function (event) { | ||
var item = event.data; | ||
if (item.type === "off") { | ||
if (item.status == true) { | ||
display(true); | ||
} else { | ||
display(false); | ||
} | ||
} | ||
|
||
if (item.type === "Info") { | ||
$("#name").html(item.name + "!"); | ||
if (item.dienst == true) { | ||
$("#dutybutton").html("Go off duty"); | ||
$("#dutybutton").css("background-color", "#ca0d26"); | ||
$("#dutybutton:hover").css("background-color", "#c20d25"); | ||
} else | ||
$("#dutybutton").html("Go on duty"); | ||
|
||
if (item.logs == true) { | ||
$("#extrabutton").html("Extras <br>On"); | ||
$("#extrabutton").css("background-color", "#0d4535"); | ||
$("#extrabutton:hover").css("background-color", "#c20d25"); | ||
} | ||
else | ||
$("#extrabutton").html("Extras <br>Off"); | ||
|
||
|
||
} | ||
|
||
if (item.type === 'updatePlayerInfo') { | ||
updateadminList(event.data.adminList); | ||
} | ||
}) | ||
document.onkeyup = function (data) { | ||
if (data.which == 27) { | ||
$.post('https://ndl_adminui/exit', JSON.stringify({})); | ||
return; | ||
} | ||
}; | ||
|
||
$("#dutybutton").click(function () { | ||
$.post('https://ndl_adminui/dutybutton', JSON.stringify({})); | ||
return | ||
}) | ||
|
||
$("#extrabutton").click(function () { | ||
$.post('https://ndl_adminui/extrabutton', JSON.stringify({})); | ||
return | ||
}) | ||
}) | ||
function updateadminList(adminList) { | ||
const adminListElement = document.getElementById('players'); | ||
adminListElement.innerHTML = ''; | ||
|
||
if (adminList && Array.isArray(adminList)) { | ||
adminList.forEach(playerInfo => { | ||
// console.log(playerInfo); | ||
const playerDiv = document.createElement('div'); | ||
playerDiv.id = 'player' | ||
const playerName = document.createElement('p'); | ||
|
||
playerName.innerText = playerInfo.name; | ||
|
||
if (playerInfo.self) { | ||
playerName.style.color = '#1d735b'; | ||
} | ||
playerDiv.appendChild(playerName); | ||
adminListElement.appendChild(playerDiv); | ||
}); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.