Plugin AP List: add checking for changing in fields
This commit is contained in:
parent
cf985d872e
commit
27aa405c9c
@ -268,7 +268,9 @@ window.plugin.apList.updateSortedPortals = function() {
|
|||||||
var cachedPortal = oldcachedPortal[key];
|
var cachedPortal = oldcachedPortal[key];
|
||||||
// If portal is changed, update playerApGain with latest
|
// If portal is changed, update playerApGain with latest
|
||||||
// information
|
// information
|
||||||
if(!cachedPortal || value.timestamp !== cachedPortal.timestamp) {
|
if(!cachedPortal
|
||||||
|
|| value.timestamp !== cachedPortal.timestamp
|
||||||
|
|| plugin.apList.isFieldsChanged(portal.portalV2.linkedFields, cachedPortal.portalV2.linkedFields)) {
|
||||||
// Shallow copy portal detail to cachedPortal
|
// Shallow copy portal detail to cachedPortal
|
||||||
cachedPortal = $.extend({}, portal);
|
cachedPortal = $.extend({}, portal);
|
||||||
var side = plugin.apList.portalSide(portal);
|
var side = plugin.apList.portalSide(portal);
|
||||||
@ -374,6 +376,11 @@ window.plugin.apList.updateTotalPages = function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.plugin.apList.isFieldsChanged = function(a,b) {
|
||||||
|
// http://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arrays
|
||||||
|
return $(a).not(b).get().length === 0 && $(b).not(a).get().length === 0;;
|
||||||
|
}
|
||||||
|
|
||||||
window.plugin.apList.portalSide = function(portal) {
|
window.plugin.apList.portalSide = function(portal) {
|
||||||
return (portal.controllingTeam.team === PLAYER.team
|
return (portal.controllingTeam.team === PLAYER.team
|
||||||
|| portal.controllingTeam.team === 'NEUTRAL')
|
|| portal.controllingTeam.team === 'NEUTRAL')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user