v0.0.1-alpha.5
Added tooltip UI which shows the status of each Mojang service. Updated dependencies.
This commit is contained in:
@@ -1495,6 +1495,13 @@ p {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/* Wrapper container for the mojang status bar. */
|
||||
#mojangStatusWrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Icon which displays the status of the mojang services. */
|
||||
#mojang_status_icon {
|
||||
font-size: 30px;
|
||||
@@ -1502,6 +1509,94 @@ p {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Tooltip which displays more details about the mojang statuses. */
|
||||
#mojangStatusTooltip {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
width: 145px;
|
||||
min-height: 150px;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 5px 10px;
|
||||
z-index: 1;
|
||||
font-family: 'Avenir Medium';
|
||||
font-size: 12px;
|
||||
transition: visibility 0s linear 0.25s, opacity 0.25s ease;
|
||||
bottom: calc(100% + 15px);
|
||||
transform: translateX(-50%);
|
||||
margin-left: 50%;
|
||||
box-shadow: 0px 0px 20px rgb(0, 0, 0);
|
||||
cursor: default;
|
||||
}
|
||||
#mojangStatusTooltip:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 100%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: rgba(0, 0, 0, 0.75) transparent transparent transparent;
|
||||
}
|
||||
#mojangStatusWrapper:hover #mojangStatusTooltip {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
/* Tooltip title for the mojang statuses. */
|
||||
#mojangStatusTooltipTitle {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Wrapper container for the non essential services title. */
|
||||
#mojangStatusNEContainer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
/* White bar which surrounds the non essential service title. */
|
||||
.mojangStatusNEBar {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
background: white;
|
||||
}
|
||||
|
||||
/* Non essential service title text. */
|
||||
#mojangStatusNETitle {
|
||||
font-size: 10px;
|
||||
padding: 0px 3px;
|
||||
text-align: center;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Wrapper container for mojang service information. */
|
||||
.mojangStatusContainer {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Displays the name of the mojang service. */
|
||||
.mojangStatusName {
|
||||
width: 100%;
|
||||
font-size: 10px;
|
||||
letter-spacing: 1px;
|
||||
line-height: 12px;
|
||||
padding: 6px 0px;
|
||||
}
|
||||
|
||||
/* Displays the status of the mojang service. */
|
||||
.mojangStatusIcon {
|
||||
margin-right: 10px;
|
||||
font-size: 18.5px;
|
||||
color: #848484;
|
||||
}
|
||||
|
||||
/* * *
|
||||
* Landing View (Bottom Styles) | Center Content
|
||||
* * */
|
||||
|
||||
@@ -16,34 +16,40 @@ const minecraftAgent = {
|
||||
const authpath = 'https://authserver.mojang.com'
|
||||
const statuses = [
|
||||
{
|
||||
service: 'minecraft.net',
|
||||
service: 'sessionserver.mojang.com',
|
||||
status: 'grey',
|
||||
name: 'Minecraft.net'
|
||||
},
|
||||
{
|
||||
service: 'api.mojang.com',
|
||||
status: 'grey',
|
||||
name: 'Public API'
|
||||
},
|
||||
{
|
||||
service: 'textures.minecraft.net',
|
||||
status: 'grey',
|
||||
name: 'Minecraft Skins'
|
||||
name: 'Multiplayer Session Service',
|
||||
essential: true
|
||||
},
|
||||
{
|
||||
service: 'authserver.mojang.com',
|
||||
status: 'grey',
|
||||
name: 'Authentication Service'
|
||||
name: 'Authentication Service',
|
||||
essential: true
|
||||
},
|
||||
{
|
||||
service: 'sessionserver.mojang.com',
|
||||
service: 'textures.minecraft.net',
|
||||
status: 'grey',
|
||||
name: 'Multiplayer Session Service'
|
||||
name: 'Minecraft Skins',
|
||||
essential: false
|
||||
},
|
||||
{
|
||||
service: 'api.mojang.com',
|
||||
status: 'grey',
|
||||
name: 'Public API',
|
||||
essential: false
|
||||
},
|
||||
{
|
||||
service: 'minecraft.net',
|
||||
status: 'grey',
|
||||
name: 'Minecraft.net',
|
||||
essential: false
|
||||
},
|
||||
{
|
||||
service: 'account.mojang.com',
|
||||
status: 'grey',
|
||||
name: 'Mojang accounts website'
|
||||
name: 'Mojang Accounts Website',
|
||||
essential: false
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -141,27 +141,52 @@ server_selection_button.addEventListener('click', (e) => {
|
||||
// Update Mojang Status Color
|
||||
const refreshMojangStatuses = async function(){
|
||||
console.log('Refreshing Mojang Statuses..')
|
||||
|
||||
let status = 'grey'
|
||||
let tooltipEssentialHTML = ``
|
||||
let tooltipNonEssentialHTML = ``
|
||||
|
||||
try {
|
||||
const statuses = await Mojang.status()
|
||||
greenCount = 0
|
||||
|
||||
for(let i=0; i<statuses.length; i++){
|
||||
if(statuses[i].status === 'yellow' && status !== 'red'){
|
||||
const service = statuses[i]
|
||||
|
||||
if(service.essential){
|
||||
tooltipEssentialHTML += `<div class="mojangStatusContainer">
|
||||
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">•</span>
|
||||
<span class="mojangStatusName">${service.name}</span>
|
||||
</div>`
|
||||
} else {
|
||||
tooltipNonEssentialHTML += `<div class="mojangStatusContainer">
|
||||
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">•</span>
|
||||
<span class="mojangStatusName">${service.name}</span>
|
||||
</div>`
|
||||
}
|
||||
|
||||
if(service.status === 'yellow' && status !== 'red'){
|
||||
status = 'yellow'
|
||||
continue
|
||||
} else if(statuses[i].status === 'red'){
|
||||
} else if(service.status === 'red'){
|
||||
status = 'red'
|
||||
break
|
||||
}
|
||||
|
||||
++greenCount
|
||||
}
|
||||
|
||||
if(greenCount == statuses.length){
|
||||
status = 'green'
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.warn('Unable to refresh Mojang service status.')
|
||||
console.debug(err)
|
||||
}
|
||||
|
||||
document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
|
||||
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
|
||||
document.getElementById('mojang_status_icon').style.color = Mojang.statusToHex(status)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user