[missions] fix: handle unavailable waypoints correctly

This commit is contained in:
fkloft 2015-04-20 15:57:29 +02:00
parent 92422363f2
commit 5bc45b43c3
2 changed files with 9 additions and 2 deletions

View File

@ -132,6 +132,9 @@
width: 8px;
}
.plugin-mission-waypoint.unavailable {
text-decoration: line-through;
}
.plugin-mission-waypoint .title {
font-size: 18px;
font-weight: bold;

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-missions@jonatkins
// @name IITC plugin: Missions
// @category Info
// @version 0.1.0.@@DATETIMEVERSION@@
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -33,7 +33,7 @@ var decodeWaypoint = function(data) {
objectiveNum: data[4],
objective: [null, 'Hack this Portal', 'Capture or Upgrade Portal', 'Create Link from Portal', 'Create Field from Portal', 'Install a Mod on this Portal', 'Take a Photo', 'View this Field Trip Waypoint', 'Enter the Passphrase'][data[4]],
};
if (result.typeNum === 1) {
if (result.typeNum === 1 && data[5]) {
result.portal = window.decodeArray.portalSummary(data[5]);
// Portal waypoints have the same guid as the respective portal.
result.portal.guid = result.guid;
@ -475,6 +475,10 @@ window.plugin.missions = {
ev.preventDefault();
return false;
}, false);
} else if(waypoint.typeNum === 1) {
// if typeNum === 1 but portal is undefined, this waypoint is a deleted portal.
var title = container.appendChild(document.createElement('span'));
container.classList.add('unavailable');
} else {
var title = container.appendChild(document.createElement('span'));
}