Merge branch 'master' into scoreboard

This commit is contained in:
vita10gy 2013-03-22 00:54:28 -05:00
commit 8036240d85
5 changed files with 194 additions and 38 deletions

View File

@ -19,14 +19,24 @@ try:
except ImportError:
pass
# load default build
try:
from localbuildsettings import defaultBuild
except ImportError:
defaultBuild = None
buildName = defaultBuild
# build name from command line
if len(sys.argv) != 2: # argv[0] = program, argv[1] = buildname, len=2
print ("Usage: build.py buildname")
print (" available build names:", ','.join(buildSettings.keys()))
sys.exit(1)
if len(sys.argv) == 2: # argv[0] = program, argv[1] = buildname, len=2
buildName = sys.argv[1]
buildName = sys.argv[1]
if buildName is None or not buildName in buildSettings:
print ("Usage: build.py buildname")
print (" available build names: %s" % ', '.join(buildSettings.keys()))
sys.exit(1)
settings = buildSettings[buildName]

View File

@ -28,3 +28,8 @@ buildSettings = {
}
# defaultBuild - the name of the default build to use if none is specified on the build.py command line
# (in here as an example - it only works in localbuildsettings.py)
#defaultBuild = 'local'

86
plugins/ap-list.css Normal file
View File

@ -0,0 +1,86 @@
#ap-list {
color: #ffce00;
font-size: 90%;
padding: 4px 2px;
}
#ap-list-side-labels {
display: inline-block;
width: 90%;
}
#ap-list-eny {
display: inline-block;
text-align: center;
width: 50%;
opacity: 1.0;
}
#ap-list-frd {
display: inline-block;
text-align: center;
width: 50%;
opacity: 0.5;
}
#ap-list-reload {
display: inline-block;
text-align: right;
width: 10%;
}
#ap-list-table {
width: 100%;
table-layout:fixed;
}
.ap-list-td-checkbox {
width: 5%;
height: 1px;
}
.ap-list-td-link {
overflow:hidden;
white-space:nowrap;
}
.ap-list-td-link-eny {
width: 80%;
}
.ap-list-td-link-frd {
width: 85%;
}
.ap-list-checkbox-outer {
display: table;
height: 100%;
width: 100%;
}
.ap-list-checkbox-mid {
display: table-cell;
vertical-align: middle;
}
.ap-list-checkbox-inner {
width: 10px;
height: 10px;
border: 1px solid rgb(32, 168, 177);
margin: 0 auto;
}
.ap-list-checkbox-selected {
background-color: rgb(32, 168, 177);
}
.ap-list-link {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ap-list-link-selected {
font-style:italic;
}

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-ap-list@xelio
// @name IITC plugin: AP List
// @version 0.4.1.@@DATETIMEVERSION@@
// @version 0.4.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -40,6 +40,9 @@ window.plugin.apList.cacheActiveZoomLevel;
window.plugin.apList.destroyPortalsGuid = new Array();
window.plugin.apList.portalLocationIndicator;
window.plugin.apList.animTimeout;
window.plugin.apList.handleUpdate = function() {
if(!requests.isLastRequest('getThinnedEntitiesV2')) return;
@ -51,18 +54,18 @@ window.plugin.apList.handleUpdate = function() {
window.plugin.apList.updatePortalTable = function(side) {
var displayEnemy = (plugin.apList.displaySide === window.plugin.apList.SIDE_ENEMY);
var content = '<table style="width: 100%; table-layout:fixed">';
var content = '<table id="ap-list-table">';
for(var i = 0; i < plugin.apList.topMaxCount; i++) {
var portal = plugin.apList.sortedPortals[side][i];
content += '<tr>';
// Only enemy portal list will display destroy checkbox
if(displayEnemy) {
content += '<td style="width: 5%; height: 1px">'
content += '<td class="ap-list-td-checkbox">'
+ (portal ? plugin.apList.getPortalDestroyCheckbox(portal) : '&nbsp;')
+ '</td>';
}
content += '<td style="width: ' + (displayEnemy ? '80%' : '85%')
+ '; overflow:hidden; white-space:nowrap">'
content += '<td class="ap-list-td-link ' + (displayEnemy ? 'ap-list-td-link-eny' : 'ap-list-td-link-frd')
+ '">'
+ (portal ? plugin.apList.getPortalLink(portal) : '&nbsp;')
+ '</td>'
+ '<td>'
@ -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 = '<div style="display: table; height: 100%; width: 100%;" onclick="' + onClick + '">'
+ '<div style="display: table-cell; vertical-align: middle;">'
+ '<div style="' + style + '"/>'
var div = '<div class="ap-list-checkbox-outer" onclick="' + onClick + '">'
+ '<div class="ap-list-checkbox-mid">'
+ '<div class="' + checkboxClass + '"/>'
+ '</div>'
+ '</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 = $('<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 = '<div style="white-space: nowrap; overflow: hidden; text-overflow:ellipsis;">'+a+'</div>';
var divClass = plugin.apList.destroyPortalIndex(portal.guid) >= 0
? 'ap-list-link ap-list-link-selected'
: 'ap-list-link';
var div = '<div class="' + divClass + '">'+a+'</div>';
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) {
var isChange = (plugin.apList.displaySide !== side);
var scrollTo = 0;
if(isChange) {
plugin.apList.displaySide = side;
plugin.apList.updatePortalTable(side);
plugin.apList.toggleSideLabel(side);
var scrollTo = $("#ap-list").position().top + $("#ap-list").outerHeight()
- $("#sidebar").height() + $("#sidebar").scrollTop()
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() {
$("<style>")
.prop("type", "text/css")
.html("@@INCLUDESTRING:plugins/ap-list.css@@")
.appendTo("head");
}
window.plugin.apList.setupList = function() {
var content = '<div id="ap-list">'
+ '<span style="display: inline-block; width: 90%">'
+ '<span id="ap-list-eny" style="display: inline-block; text-align: center; width: 50%; opacity:1.0;">'
+ '<span id="ap-list-side-labels">'
+ '<span id="ap-list-eny">'
+ '<a href="#" onclick="window.plugin.apList.displayEnemy();return false;">Enemy</a>'
+ '</span>'
+ '<span id="ap-list-frd" style="display: inline-block; text-align: center; width: 50%; opacity:0.5;">'
+ '<span id="ap-list-frd">'
+ '<a href="#" onclick="window.plugin.apList.displayFriendly();return false;">Friendly</a>'
+ '</span>'
+ '</span>'
+ '<span id="ap-list-reload" style="display: inline-block; text-align: right; width: 10%">'
+ '<span id="ap-list-reload">'
+ '<a href="#" title="Clear list and reload" onclick="window.plugin.apList.disableCache();'
+ 'plugin.apList.hideReloadLabel();return false;">↻ R</a>'
+ '</span>'
@ -475,7 +530,6 @@ window.plugin.apList.setupList = function() {
$('#sidebar').append(content);
$('#ap-list-reload').hide();
$('#ap-list').css({'color':'#ffce00', 'font-size':'90%', 'padding':'4px 2px'});
}
window.plugin.apList.setupMapEvent = function() {
@ -509,6 +563,7 @@ window.plugin.apList.setupMapEvent = function() {
var setup = function() {
window.plugin.apList.setupVar();
window.plugin.apList.setupCSS();
window.plugin.apList.setupList();
window.plugin.apList.setupMapEvent();
window.addHook('requestFinished', window.plugin.apList.handleUpdate);

View File

@ -21,7 +21,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
window.PLAYER_TRACKER_MAX_TIME = 3*60*60*1000; // in milliseconds
window.PLAYER_TRACKER_MIN_ZOOM = 9;
window.PLAYER_TRACKER_LINE_COLOUR = '#FFFF00';
window.PLAYER_TRACKER_LINE_COLOUR = '#FF00FD';
// use own namespace for plugin