';
// Only enemy portal list will display destroy checkbox
if(displayEnemy) {
- content += ''
+ content += ' | '
+ (portal ? plugin.apList.getPortalDestroyCheckbox(portal) : ' ')
+ ' | ';
}
- content += ''
+ content += ' | '
+ (portal ? plugin.apList.getPortalLink(portal) : ' ')
+ ' | '
+ ''
@@ -76,16 +79,15 @@ window.plugin.apList.updatePortalTable = function(side) {
window.plugin.apList.getPortalDestroyCheckbox = function(portal) {
// Change background color to border color if portal selected for destroy
- var style = 'width: 10px; height: 10px; border: 1px solid rgb(32, 168, 177); margin: 0 auto; '
- + (plugin.apList.destroyPortalIndex(portal.guid) >= 0
- ? 'background-color: rgb(32, 168, 177);'
- : '');
+ var checkboxClass = plugin.apList.destroyPortalIndex(portal.guid) >= 0
+ ? 'ap-list-checkbox-inner ap-list-checkbox-selected'
+ : 'ap-list-checkbox-inner';
var onClick = 'window.plugin.apList.destroyPortal(\'' + portal.guid + '\');';
// 3 div for centering checkbox horizontally and vertically,
// click event on outest div for people with not so good aiming
- var div = ''
- + ' '
- + ' '
+ var div = ' ';
return div;
@@ -144,24 +146,24 @@ window.plugin.apList.getPortalApTitle = function(portal) {
// hover: show address
window.plugin.apList.getPortalLink = function(portal) {
var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join();
- var jsSingleClick = 'window.renderPortalDetails(\''+portal.guid+'\');return false';
+ var jsSingleClick = 'window.plugin.apList.selectPortal(\''+portal.guid+'\');return false';
var jsDoubleClick = 'window.zoomToAndShowPortal(\''+portal.guid+'\', ['+latlng+']);return false';
var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6
+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+portal.guid;
- var style = plugin.apList.destroyPortalIndex(portal.guid) >= 0
- ? 'font-style:italic'
- : '';
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
var a = $(' ',{
"class": 'help',
- style: style,
text: portal.portalV2.descriptiveText.TITLE,
title: portal.portalV2.descriptiveText.ADDRESS,
href: perma,
onClick: jsSingleClick,
onDblClick: jsDoubleClick
})[0].outerHTML;
- var div = ''+a+' ';
+
+ var divClass = plugin.apList.destroyPortalIndex(portal.guid) >= 0
+ ? 'ap-list-link ap-list-link-selected'
+ : 'ap-list-link';
+ var div = ''+a+' ';
return div;
}
@@ -406,24 +408,70 @@ window.plugin.apList.getAttackApGain = function(d) {
}
}
+window.plugin.apList.selectPortal = function(guid) {
+ renderPortalDetails(guid);
+ plugin.apList.setPortalLocationIndicator(guid);
+}
+
+window.plugin.apList.setPortalLocationIndicator = function(guid) {
+ var portal = window.portals[guid];
+ if(!portal) return;
+ var startRadius = screen.availWidth / 2;
+ var portalRadius = portal.options.radius;
+ var latlng = portal.getLatLng();
+ var property = {
+ radius: startRadius,
+ fill: false,
+ color: COLOR_SELECTED_PORTAL,
+ weight: 2,
+ opacity: 1,
+ portalRadius: portalRadius,
+ clickable: false };
+
+ if(plugin.apList.portalLocationIndicator)
+ map.removeLayer(plugin.apList.portalLocationIndicator);
+ if(plugin.apList.animTimeout)
+ clearTimeout(plugin.apList.animTimeout);
+ plugin.apList.portalLocationIndicator = L.circleMarker(latlng, property).addTo(map);
+ plugin.apList.animTimeout = setTimeout(plugin.apList.animPortalLocationIndicator,100);
+}
+
+window.plugin.apList.animPortalLocationIndicator = function() {
+ var radius = plugin.apList.portalLocationIndicator.options.radius;
+ var portalRadius = plugin.apList.portalLocationIndicator.options.portalRadius
+ if(radius > portalRadius) {
+ var step = radius / 3;
+ if(radius < 80) step = step / 3;
+ var newRadius = plugin.apList.portalLocationIndicator.options.radius -= step;
+ plugin.apList.portalLocationIndicator.setRadius(newRadius);
+ if(plugin.apList.animTimeout)
+ clearTimeout(plugin.apList.animTimeout);
+ plugin.apList.animTimeout = setTimeout(plugin.apList.animPortalLocationIndicator,100);
+ } else {
+ map.removeLayer(plugin.apList.portalLocationIndicator);
+ }
+}
+
// Change display table to friendly portals
window.plugin.apList.displayFriendly = function() {
- plugin.apList.displaySide = plugin.apList.SIDE_FRIENDLY;
- plugin.apList.changeDisplaySide(plugin.apList.displaySide);
+ plugin.apList.changeDisplaySide(plugin.apList.SIDE_FRIENDLY);
}
// Change display table to enemy portals
window.plugin.apList.displayEnemy = function() {
- plugin.apList.displaySide = plugin.apList.SIDE_ENEMY;
- plugin.apList.changeDisplaySide(plugin.apList.displaySide);
+ plugin.apList.changeDisplaySide(plugin.apList.SIDE_ENEMY);
}
window.plugin.apList.changeDisplaySide = function(side) {
- plugin.apList.updatePortalTable(side);
- plugin.apList.toggleSideLabel(side);
-
- var scrollTo = $("#ap-list").position().top + $("#ap-list").outerHeight()
- - $("#sidebar").height() + $("#sidebar").scrollTop()
+ var isChange = (plugin.apList.displaySide !== side);
+ var scrollTo = 0;
+ if(isChange) {
+ plugin.apList.displaySide = side;
+ plugin.apList.updatePortalTable(side);
+ plugin.apList.toggleSideLabel(side);
+ scrollTo = $("#ap-list").position().top + $("#ap-list").outerHeight()
+ - $("#sidebar").height() + $("#sidebar").scrollTop();
+ }
$('#sidebar').scrollTop(scrollTo);
}
@@ -456,17 +504,24 @@ window.plugin.apList.setupVar = function() {
= "#ap-list-eny";
}
+window.plugin.apList.setupCSS = function() {
+ $(" |