Use tooltip instead of slider text
This commit is contained in:
parent
b4c716d701
commit
42c744b9dd
@ -126,13 +126,6 @@ function sortServers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPercentageBarText(server) {
|
|
||||||
var totalPlayers = getCurrentTotalPlayers();
|
|
||||||
var playerCount = lastPlayerEntries[server];
|
|
||||||
|
|
||||||
showCaption('<strong>' + server + '</strong>: ' + formatNumber(playerCount) + ' online. <strong>' + roundToPoint(playerCount / totalPlayers * 100, 10) + '%</strong> of ' + formatNumber(totalPlayers) + ' tracked players.');
|
|
||||||
}
|
|
||||||
|
|
||||||
function updatePercentageBar() {
|
function updatePercentageBar() {
|
||||||
var keys = Object.keys(lastPlayerEntries);
|
var keys = Object.keys(lastPlayerEntries);
|
||||||
|
|
||||||
@ -164,12 +157,11 @@ function updatePercentageBar() {
|
|||||||
div = $('#perc_bar_part_' + safeNameCopy);
|
div = $('#perc_bar_part_' + safeNameCopy);
|
||||||
|
|
||||||
div.mouseover(function(e) {
|
div.mouseover(function(e) {
|
||||||
renderPercentageBarText(server);
|
|
||||||
currentServerHover = server;
|
currentServerHover = server;
|
||||||
});
|
});
|
||||||
|
|
||||||
div.mouseout(function(e) {
|
div.mouseout(function(e) {
|
||||||
hideCaption();
|
hideTooltip();
|
||||||
currentServerHover = undefined;
|
currentServerHover = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -185,8 +177,6 @@ function updatePercentageBar() {
|
|||||||
leftPadding += width;
|
leftPadding += width;
|
||||||
})(i, keys[i], keys.length);
|
})(i, keys[i], keys.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentServerHover) renderPercentageBarText(currentServerHover);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTotalPlayers() {
|
function getCurrentTotalPlayers() {
|
||||||
@ -300,6 +290,9 @@ $(document).ready(function() {
|
|||||||
$('#big-graph-checkboxes').html('');
|
$('#big-graph-checkboxes').html('');
|
||||||
$('#big-graph-controls').css('display', 'none');
|
$('#big-graph-controls').css('display', 'none');
|
||||||
|
|
||||||
|
$('#perc-bar').html('');
|
||||||
|
$('.mojang-status').css('background', 'transparent');
|
||||||
|
|
||||||
$("#stat_totalPlayers").text(0);
|
$("#stat_totalPlayers").text(0);
|
||||||
$("#stat_networks").text(0);
|
$("#stat_networks").text(0);
|
||||||
|
|
||||||
@ -527,6 +520,15 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('mousemove', function(e) {
|
||||||
|
if (currentServerHover) {
|
||||||
|
var totalPlayers = getCurrentTotalPlayers();
|
||||||
|
var playerCount = lastPlayerEntries[currentServerHover];
|
||||||
|
|
||||||
|
renderTooltip(e.pageX + 10, e.pageY + 10, '<strong>' + currentServerHover + '</strong>: ' + roundToPoint(playerCount / totalPlayers * 100, 10) + '%<br />' + formatNumber(playerCount) + ' of ' + formatNumber(totalPlayers) + ' tracked players.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$(window).on('resize', function() {
|
$(window).on('resize', function() {
|
||||||
updatePercentageBar();
|
updatePercentageBar();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user