Merge remote-tracking branch 'upstream/gh-pages' into gh-pages
This commit is contained in:
commit
321c744658
@ -102,7 +102,8 @@ Starting from the top, the sidebar shows this information:
|
|||||||
|
|
||||||
#### logged in user, global MU, search
|
#### logged in user, global MU, search
|
||||||
- Details about you, the logged in user. This is only updated if you reload the page. This is a limitation of Ingress, not IITC.
|
- Details about you, the logged in user. This is only updated if you reload the page. This is a limitation of Ingress, not IITC.
|
||||||
- it shows your current level followed by your nick
|
- it shows your current level followed by your nickname
|
||||||
|
- hovering over your nickname allows you to sign out (NIGHTLY ONLY)
|
||||||
- to the right, it shows to percentages. The upper one, e.g. “XM: 37%” tells you how much your XM bar is filled. The lower one, e.g. “level: 37%“ tells you that you have gathered 37% of the AP required for the next level. It shows “max level” if you have reached max level.
|
- to the right, it shows to percentages. The upper one, e.g. “XM: 37%” tells you how much your XM bar is filled. The lower one, e.g. “level: 37%“ tells you that you have gathered 37% of the AP required for the next level. It shows “max level” if you have reached max level.
|
||||||
- the tooltip mainly shows you absolute numbers instead of percentages. It also shows how many invites you have.
|
- the tooltip mainly shows you absolute numbers instead of percentages. It also shows how many invites you have.
|
||||||
- The next bar is a visual representation of global MindUnits (MU) per faction. It is updated every now and then. The tooltip shows the absolute MU count per faction.
|
- The next bar is a visual representation of global MindUnits (MU) per faction. It is updated every now and then. The tooltip shows the absolute MU count per faction.
|
||||||
|
11
code/boot.js
11
code/boot.js
@ -186,13 +186,22 @@ window.setupPlayerStat = function() {
|
|||||||
|
|
||||||
$('#playerstat').html(''
|
$('#playerstat').html(''
|
||||||
+ '<h2 title="'+t+'">'+level+' '
|
+ '<h2 title="'+t+'">'+level+' '
|
||||||
|
+ '<div id="name">'
|
||||||
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
|
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
|
||||||
+ '<div>'
|
+ '<a href="https://www.ingress.com/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttps://appengine.google.com/_ah/logout%253Fcontinue%253Dhttps://www.ingress.com/intel%26service%3Dah" id="signout">sign out</a>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '<div id="stats">'
|
||||||
+ '<sup>XM: '+xmRatio+'%</sup>'
|
+ '<sup>XM: '+xmRatio+'%</sup>'
|
||||||
+ '<sub>' + (level < 8 ? 'level: '+lvlApProg+'%' : 'max level') + '</sub>'
|
+ '<sub>' + (level < 8 ? 'level: '+lvlApProg+'%' : 'max level') + '</sub>'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ '</h2>'
|
+ '</h2>'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$('#name').mouseenter(function() {
|
||||||
|
$('#signout').show();
|
||||||
|
}).mouseleave(function() {
|
||||||
|
$('#signout').hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setupSidebarToggle = function() {
|
window.setupSidebarToggle = function() {
|
||||||
|
@ -49,21 +49,28 @@ window.requestData = function() {
|
|||||||
$.each(tiles, function(ind, tls) {
|
$.each(tiles, function(ind, tls) {
|
||||||
data = { minLevelOfDetail: -1 };
|
data = { minLevelOfDetail: -1 };
|
||||||
data.boundsParamsList = tls;
|
data.boundsParamsList = tls;
|
||||||
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse));
|
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse, window.handleFailedRequest));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle failed map data request
|
||||||
|
window.handleFailedRequest = function() {
|
||||||
|
if(requests.isLastRequest('getThinnedEntitiesV2')) {
|
||||||
|
var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null);
|
||||||
|
handlePortalsRender(leftOverPortals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// works on map data response and ensures entities are drawn/updated.
|
// works on map data response and ensures entities are drawn/updated.
|
||||||
window.handleDataResponse = function(data, textStatus, jqXHR) {
|
window.handleDataResponse = function(data, textStatus, jqXHR) {
|
||||||
// remove from active ajax queries list
|
// remove from active ajax queries list
|
||||||
if(!data || !data.result) {
|
if(!data || !data.result) {
|
||||||
window.failedRequestCount++;
|
window.failedRequestCount++;
|
||||||
console.warn(data);
|
console.warn(data);
|
||||||
|
handleFailedRequest();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var portalUpdateAvailable = false;
|
|
||||||
var portalInUrlAvailable = false;
|
|
||||||
var m = data.result.map;
|
var m = data.result.map;
|
||||||
// defer rendering of portals because there is no z-index in SVG.
|
// defer rendering of portals because there is no z-index in SVG.
|
||||||
// this means that what’s rendered last ends up on top. While the
|
// this means that what’s rendered last ends up on top. While the
|
||||||
@ -72,8 +79,6 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
// https://github.com/Leaflet/Leaflet/issues/185
|
// https://github.com/Leaflet/Leaflet/issues/185
|
||||||
var ppp = [];
|
var ppp = [];
|
||||||
var p2f = {};
|
var p2f = {};
|
||||||
// Reset new portals count of Portal Render Limit handler
|
|
||||||
portalRenderLimit.resetCounting();
|
|
||||||
$.each(m, function(qk, val) {
|
$.each(m, function(qk, val) {
|
||||||
$.each(val.deletedGameEntityGuids, function(ind, guid) {
|
$.each(val.deletedGameEntityGuids, function(ind, guid) {
|
||||||
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
|
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
|
||||||
@ -92,8 +97,6 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
// format for portals: { controllingTeam, turret }
|
// format for portals: { controllingTeam, turret }
|
||||||
|
|
||||||
if(ent[2].turret !== undefined) {
|
if(ent[2].turret !== undefined) {
|
||||||
if(selectedPortal === ent[0]) portalUpdateAvailable = true;
|
|
||||||
if(urlPortal && ent[0] == urlPortal) portalInUrlAvailable = true;
|
|
||||||
|
|
||||||
var latlng = [ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6];
|
var latlng = [ent[2].locationE6.latE6/1E6, ent[2].locationE6.lngE6/1E6];
|
||||||
if(!window.getPaddedBounds().contains(latlng)
|
if(!window.getPaddedBounds().contains(latlng)
|
||||||
@ -102,7 +105,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
) return;
|
) return;
|
||||||
|
|
||||||
|
|
||||||
portalRenderLimit.pushPortal(ent);
|
|
||||||
ppp.push(ent); // delay portal render
|
ppp.push(ent); // delay portal render
|
||||||
} else if(ent[2].edge !== undefined) {
|
} else if(ent[2].edge !== undefined) {
|
||||||
renderLink(ent);
|
renderLink(ent);
|
||||||
@ -118,7 +121,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(ppp, function(ind, portal) {
|
$.each(ppp, function(ind, portal) {
|
||||||
if(portal[2].portalV2['linkedFields'] === undefined) {
|
if(portal[2].portalV2['linkedFields'] === undefined) {
|
||||||
portal[2].portalV2['linkedFields'] = [];
|
portal[2].portalV2['linkedFields'] = [];
|
||||||
@ -128,12 +131,29 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
portal[2].portalV2['linkedFields'] = uniqueArray(p2f[portal[0]]);
|
portal[2].portalV2['linkedFields'] = uniqueArray(p2f[portal[0]]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Process the portals with portal render limit handler first
|
||||||
|
// Low level portal will hold until last request
|
||||||
|
var newPpp = portalRenderLimit.splitOrMergeLowLevelPortals(ppp);
|
||||||
|
handlePortalsRender(newPpp);
|
||||||
|
|
||||||
|
resolvePlayerNames();
|
||||||
|
renderUpdateStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.handlePortalsRender = function(portals) {
|
||||||
|
var portalUpdateAvailable = false;
|
||||||
|
var portalInUrlAvailable = false;
|
||||||
|
|
||||||
// Preserve and restore "selectedPortal" between portal re-render
|
// Preserve and restore "selectedPortal" between portal re-render
|
||||||
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
|
if(portalUpdateAvailable) var oldSelectedPortal = selectedPortal;
|
||||||
|
|
||||||
runHooks('portalDataLoaded', {portals : ppp});
|
runHooks('portalDataLoaded', {portals : portals});
|
||||||
$.each(ppp, function(ind, portal) { renderPortal(portal); });
|
$.each(portals, function(ind, portal) {
|
||||||
|
if(selectedPortal === portal[0]) portalUpdateAvailable = true;
|
||||||
|
if(urlPortal && portal[0] == urlPortal) portalInUrlAvailable = true;
|
||||||
|
renderPortal(portal);
|
||||||
|
});
|
||||||
|
|
||||||
var selectedPortalLayer = portals[oldSelectedPortal];
|
var selectedPortalLayer = portals[oldSelectedPortal];
|
||||||
if(portalUpdateAvailable && selectedPortalLayer) selectedPortal = oldSelectedPortal;
|
if(portalUpdateAvailable && selectedPortalLayer) selectedPortal = oldSelectedPortal;
|
||||||
@ -150,8 +170,6 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(portalUpdateAvailable) renderPortalDetails(selectedPortal);
|
if(portalUpdateAvailable) renderPortalDetails(selectedPortal);
|
||||||
resolvePlayerNames();
|
|
||||||
renderUpdateStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes entities that are still handled by Leaflet, although they
|
// removes entities that are still handled by Leaflet, although they
|
||||||
@ -489,9 +507,9 @@ window.renderLink = function(ent) {
|
|||||||
weight:2,
|
weight:2,
|
||||||
clickable: false,
|
clickable: false,
|
||||||
guid: ent[0],
|
guid: ent[0],
|
||||||
|
data: ent[2],
|
||||||
smoothFactor: 0 // doesn’t work for two points anyway, so disable
|
smoothFactor: 0 // doesn’t work for two points anyway, so disable
|
||||||
});
|
});
|
||||||
|
|
||||||
// determine which links are very short and don’t render them at all.
|
// determine which links are very short and don’t render them at all.
|
||||||
// in most cases this will go unnoticed, but improve rendering speed.
|
// in most cases this will go unnoticed, but improve rendering speed.
|
||||||
poly._map = window.map;
|
poly._map = window.map;
|
||||||
@ -539,8 +557,9 @@ window.renderField = function(ent) {
|
|||||||
smoothFactor: 0, // hiding small fields will be handled below
|
smoothFactor: 0, // hiding small fields will be handled below
|
||||||
vertices: reg,
|
vertices: reg,
|
||||||
lastUpdate: ent[1],
|
lastUpdate: ent[1],
|
||||||
guid: ent[0]});
|
guid: ent[0],
|
||||||
|
data: ent[2]});
|
||||||
|
|
||||||
// determine which fields are too small to be rendered and don’t
|
// determine which fields are too small to be rendered and don’t
|
||||||
// render them, so they don’t count towards the maximum fields limit.
|
// render them, so they don’t count towards the maximum fields limit.
|
||||||
// This saves some DOM operations as well, but given the relatively
|
// This saves some DOM operations as well, but given the relatively
|
||||||
|
@ -3,9 +3,22 @@
|
|||||||
// Functions to handle hiding low level portal when portal render
|
// Functions to handle hiding low level portal when portal render
|
||||||
// limit is reached.
|
// limit is reached.
|
||||||
//
|
//
|
||||||
// After initialized and reset in window.requestData(), portals in
|
// On initialization, previous minLevel will preserve to previousMinLevel
|
||||||
// response data will pass to function "pushPortal". Each new portal
|
// with zoom level difference.
|
||||||
// not on the map will add 1 to newPortalsPerLevel[portal level].
|
//
|
||||||
|
// After initialized and reset in window.requestData(), "processPortals"
|
||||||
|
// intercept all portals data in "handleDataResponse". Put the count of
|
||||||
|
// new portals to newPortalsPerLevel[portal level]. And split portals
|
||||||
|
// into two parts base on previousMinLevel. Portals with level >=
|
||||||
|
// previousMinLevel will return as result and continue to render.
|
||||||
|
// Others will save to portalsPreviousMinLevel. If there is no more
|
||||||
|
// active request of map data, portals will not split and
|
||||||
|
// portalsPreviousMinLevel will add back to result and render base on
|
||||||
|
// current minLevel.
|
||||||
|
//
|
||||||
|
// "handleFailRequest" is added to handle the case when the last request
|
||||||
|
// failed and "processPortals" didn't get called. It will get
|
||||||
|
// portalsPreviousMinLevel base on current minLevel and render them.
|
||||||
//
|
//
|
||||||
// "getMinLevel" will be called by "getMinPortalLevel" in utils_misc.js
|
// "getMinLevel" will be called by "getMinPortalLevel" in utils_misc.js
|
||||||
// to determine min portal level to draw on map.
|
// to determine min portal level to draw on map.
|
||||||
@ -28,12 +41,28 @@ window.portalRenderLimit = function() {}
|
|||||||
window.portalRenderLimit.initialized = false;
|
window.portalRenderLimit.initialized = false;
|
||||||
window.portalRenderLimit.minLevelSet = false;
|
window.portalRenderLimit.minLevelSet = false;
|
||||||
window.portalRenderLimit.minLevel = -1;
|
window.portalRenderLimit.minLevel = -1;
|
||||||
|
window.portalRenderLimit.previousMinLevel = -1;
|
||||||
|
window.portalRenderLimit.previousZoomLevel;
|
||||||
window.portalRenderLimit.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL + 1);
|
window.portalRenderLimit.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL + 1);
|
||||||
|
window.portalRenderLimit.portalsPreviousMinLevel = new Array(MAX_PORTAL_LEVEL + 1);
|
||||||
|
|
||||||
window.portalRenderLimit.init = function () {
|
window.portalRenderLimit.init = function () {
|
||||||
|
var currentZoomLevel = map.getZoom();
|
||||||
|
portalRenderLimit.previousZoomLevel = portalRenderLimit.previousZoomLevel || currentZoomLevel;
|
||||||
|
|
||||||
|
// If there is a minLevel set in previous run, calculate previousMinLevel with it.
|
||||||
|
if(portalRenderLimit.minLevelSet) {
|
||||||
|
var zoomDiff = currentZoomLevel - portalRenderLimit.previousZoomLevel;
|
||||||
|
portalRenderLimit.previousMinLevel = Math.max(portalRenderLimit.minLevel - zoomDiff, -1);
|
||||||
|
portalRenderLimit.previousMinLevel = Math.min(portalRenderLimit.previousMinLevel, MAX_PORTAL_LEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
portalRenderLimit.previousZoomLevel = currentZoomLevel;
|
||||||
|
|
||||||
portalRenderLimit.initialized = true;
|
portalRenderLimit.initialized = true;
|
||||||
portalRenderLimit.minLevel = -1;
|
portalRenderLimit.minLevel = -1;
|
||||||
portalRenderLimit.resetCounting();
|
portalRenderLimit.resetCounting();
|
||||||
|
portalRenderLimit.resetPortalsPreviousMinLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.portalRenderLimit.resetCounting = function() {
|
window.portalRenderLimit.resetCounting = function() {
|
||||||
@ -43,13 +72,59 @@ window.portalRenderLimit.resetCounting = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.portalRenderLimit.pushPortal = function(ent) {
|
window.portalRenderLimit.resetPortalsPreviousMinLevel = function() {
|
||||||
var portalGuid = ent[0];
|
for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
|
||||||
var portalLevel = parseInt(getPortalLevel(ent[2]));
|
portalRenderLimit.portalsPreviousMinLevel[i] = new Array();
|
||||||
var layerGroup = portalsLayers[portalLevel];
|
}
|
||||||
|
}
|
||||||
if(findEntityInLeaflet(layerGroup, window.portals, ent[0])) return;
|
|
||||||
portalRenderLimit.newPortalsPerLevel[portalLevel]++;
|
window.portalRenderLimit.splitOrMergeLowLevelPortals = function(originPortals) {
|
||||||
|
portalRenderLimit.resetCounting();
|
||||||
|
portalRenderLimit.countingPortals(originPortals);
|
||||||
|
|
||||||
|
var resultPortals = requests.isLastRequest('getThinnedEntitiesV2')
|
||||||
|
? portalRenderLimit.mergeLowLevelPortals(originPortals)
|
||||||
|
: portalRenderLimit.splitLowLevelPortals(originPortals);
|
||||||
|
|
||||||
|
return resultPortals;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.portalRenderLimit.countingPortals = function(portals) {
|
||||||
|
$.each(portals, function(ind, portal) {
|
||||||
|
var portalGuid = portal[0];
|
||||||
|
var portalLevel = parseInt(getPortalLevel(portal[2]));
|
||||||
|
var layerGroup = portalsLayers[portalLevel];
|
||||||
|
|
||||||
|
if(findEntityInLeaflet(layerGroup, window.portals, portalGuid)) return true;
|
||||||
|
|
||||||
|
portalRenderLimit.newPortalsPerLevel[portalLevel]++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.portalRenderLimit.splitLowLevelPortals = function(portals) {
|
||||||
|
var resultPortals = new Array();
|
||||||
|
$.each(portals, function(ind, portal) {
|
||||||
|
var portalLevel = parseInt(getPortalLevel(portal[2]));
|
||||||
|
if(portalLevel < portalRenderLimit.previousMinLevel) {
|
||||||
|
portalRenderLimit.portalsPreviousMinLevel[portalLevel].push(portal);
|
||||||
|
}else{
|
||||||
|
resultPortals.push(portal);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return resultPortals;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.portalRenderLimit.mergeLowLevelPortals = function(appendTo) {
|
||||||
|
var resultPortals = appendTo ? appendTo : new Array();
|
||||||
|
for(var i = portalRenderLimit.getMinLevel();
|
||||||
|
i < portalRenderLimit.previousMinLevel;
|
||||||
|
i++) {
|
||||||
|
$.merge(resultPortals, portalRenderLimit.portalsPreviousMinLevel[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset portalsPreviousMinLevel, ensure they return only once
|
||||||
|
portalRenderLimit.resetPortalsPreviousMinLevel();
|
||||||
|
return resultPortals;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.portalRenderLimit.getMinLevel = function() {
|
window.portalRenderLimit.getMinLevel = function() {
|
||||||
|
@ -111,3 +111,14 @@ window.requests._callOnRefreshFunctions = function() {
|
|||||||
window.requests.addRefreshFunction = function(f) {
|
window.requests.addRefreshFunction = function(f) {
|
||||||
window.requests._onRefreshFunctions.push(f);
|
window.requests._onRefreshFunctions.push(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.requests.isLastRequest = function(action) {
|
||||||
|
var result = true;
|
||||||
|
$.each(window.activeRequests, function(ind, req) {
|
||||||
|
if(req.action === action) {
|
||||||
|
result = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
@ -58,7 +58,7 @@ window.postAjax = function(action, data, success, error) {
|
|||||||
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
|
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
|
||||||
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
|
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
|
||||||
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
|
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
|
||||||
return $.ajax({
|
var result = $.ajax({
|
||||||
// use full URL to avoid issues depending on how people set their
|
// use full URL to avoid issues depending on how people set their
|
||||||
// slash. See:
|
// slash. See:
|
||||||
// https://github.com/breunigs/ingress-intel-total-conversion/issues/56
|
// https://github.com/breunigs/ingress-intel-total-conversion/issues/56
|
||||||
@ -73,6 +73,8 @@ window.postAjax = function(action, data, success, error) {
|
|||||||
req.setRequestHeader('X-CSRFToken', readCookie('csrftoken'));
|
req.setRequestHeader('X-CSRFToken', readCookie('csrftoken'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
result.action = action;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// converts unix timestamps to HH:mm:ss format if it was today;
|
// converts unix timestamps to HH:mm:ss format if it was today;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @id iitc-plugin-guess-player-levels@breunigs
|
// @id iitc-plugin-guess-player-levels@breunigs
|
||||||
// @name iitc: guess player level
|
// @name iitc: guess player level
|
||||||
// @version 0.2.1
|
// @version 0.3
|
||||||
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
|
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
|
||||||
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js
|
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js
|
||||||
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js
|
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js
|
||||||
@ -92,19 +92,30 @@ window.plugin.guessPlayerLevels.guess = function() {
|
|||||||
|
|
||||||
var namesR = plugin.guessPlayerLevels.sort(playersRes);
|
var namesR = plugin.guessPlayerLevels.sort(playersRes);
|
||||||
var namesE = plugin.guessPlayerLevels.sort(playersEnl);
|
var namesE = plugin.guessPlayerLevels.sort(playersEnl);
|
||||||
|
var totallvlR = 0;
|
||||||
|
var totallvlE = 0;
|
||||||
var max = Math.max(namesR.length, namesE.length);
|
var max = Math.max(namesR.length, namesE.length);
|
||||||
for(var i = 0; i < max; i++) {
|
for(var i = 0; i < max; i++) {
|
||||||
var nickR = namesR[i];
|
var nickR = namesR[i];
|
||||||
var lvlR = playersRes[nickR];
|
var lvlR = playersRes[nickR];
|
||||||
var lineR = nickR ? nickR + ':\t' + lvlR : '\t';
|
var lineR = nickR ? nickR + ':\t' + lvlR : '\t';
|
||||||
|
if(!isNaN(parseInt(lvlR)))
|
||||||
|
totallvlR += parseInt(lvlR);
|
||||||
|
|
||||||
var nickE = namesE[i];
|
var nickE = namesE[i];
|
||||||
var lvlE = playersEnl[nickE];
|
var lvlE = playersEnl[nickE];
|
||||||
var lineE = nickE ? nickE + ':\t' + lvlE : '\t';
|
var lineE = nickE ? nickE + ':\t' + lvlE : '\t';
|
||||||
|
if(!isNaN(parseInt(lvlE)))
|
||||||
s += lineR + '\t\t' + lineE + '\n';
|
totallvlE += parseInt(lvlE);
|
||||||
|
|
||||||
|
s += '\n'+lineR + '\t' + lineE + '\n';
|
||||||
}
|
}
|
||||||
|
s += '\nTotal level :\t'+totallvlR+'\tTotal level :\t'+totallvlE;
|
||||||
|
s += '\nTotal player:\t'+namesR.length+'\tTotal player:\t'+namesE.length;
|
||||||
|
var averageR = 0, averageE = 0;
|
||||||
|
if (namesR.length > 0) averageR = (totallvlR/namesR.length);
|
||||||
|
if (namesE.length > 0) averageE = (totallvlE/namesE.length);
|
||||||
|
s += '\nAverage level:\t'+averageR.toFixed(2)+'\tAverage level:\t'+averageE.toFixed(2);
|
||||||
s += '\n\nIf there are some unresolved names, simply try again.'
|
s += '\n\nIf there are some unresolved names, simply try again.'
|
||||||
console.log(s);
|
console.log(s);
|
||||||
alert(s);
|
alert(s);
|
||||||
|
17
style.css
17
style.css
@ -329,21 +329,34 @@ h2 {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 span {
|
h2 #name {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: "~";
|
text-overflow: "~";
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 205px;
|
width: 205px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 div {
|
h2 #stats {
|
||||||
float: right;
|
float: right;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 #signout {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 29px;
|
||||||
|
padding: 0 4px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: rgba(8, 48, 78, 0.5);
|
||||||
|
display: none; /* starts hidden */
|
||||||
|
}
|
||||||
|
|
||||||
h2 sup, h2 sub {
|
h2 sup, h2 sub {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user