[uniques] avoid unnecessary resyncs
This commit is contained in:
parent
7031a421e1
commit
45d07d026a
@ -2,7 +2,7 @@
|
||||
// @id iitc-plugin-uniques@3ch01c
|
||||
// @name IITC plugin: Uniques
|
||||
// @category Misc
|
||||
// @version 0.2.3.@@DATETIMEVERSION@@
|
||||
// @version 0.2.4.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/3ch01c/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -199,6 +199,8 @@ window.plugin.uniques.updateCheckedAndHighlight = function(guid) {
|
||||
window.plugin.uniques.setPortalVisited = function(guid) {
|
||||
var uniqueInfo = plugin.uniques.uniques[guid];
|
||||
if (uniqueInfo) {
|
||||
if(uniqueInfo.visited) return;
|
||||
|
||||
uniqueInfo.visited = true;
|
||||
} else {
|
||||
plugin.uniques.uniques[guid] = {
|
||||
@ -214,6 +216,8 @@ window.plugin.uniques.setPortalVisited = function(guid) {
|
||||
window.plugin.uniques.setPortalCaptured = function(guid) {
|
||||
var uniqueInfo = plugin.uniques.uniques[guid];
|
||||
if (uniqueInfo) {
|
||||
if(uniqueInfo.visited && uniqueInfo.captured) return;
|
||||
|
||||
uniqueInfo.visited = true;
|
||||
uniqueInfo.captured = true;
|
||||
} else {
|
||||
@ -238,6 +242,8 @@ window.plugin.uniques.updateVisited = function(visited, guid) {
|
||||
};
|
||||
}
|
||||
|
||||
if(visited == uniqueInfo.visited) return;
|
||||
|
||||
if (visited) {
|
||||
uniqueInfo.visited = true;
|
||||
} else { // not visited --> not captured
|
||||
@ -260,6 +266,8 @@ window.plugin.uniques.updateCaptured = function(captured, guid) {
|
||||
};
|
||||
}
|
||||
|
||||
if(captured == uniqueInfo.captured) return;
|
||||
|
||||
if (captured) { // captured --> visited
|
||||
uniqueInfo.captured = true;
|
||||
uniqueInfo.visited = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user