Merge branch 'master' into highlighter
This commit is contained in:
52
code/boot.js
52
code/boot.js
@ -1,4 +1,3 @@
|
||||
|
||||
// SETUP /////////////////////////////////////////////////////////////
|
||||
// these functions set up specific areas after the boot function
|
||||
// created a basic framework. All of these functions should only ever
|
||||
@ -103,15 +102,35 @@ window.setupStyles = function() {
|
||||
window.setupMap = function() {
|
||||
$('#map').text('');
|
||||
|
||||
var osmOpt = {attribution: 'Map data © OpenStreetMap contributors', maxZoom: 18, detectRetina: true};
|
||||
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt);
|
||||
//OpenStreetMap attribution - required by several of the layers
|
||||
osmAttribution = 'Map data © OpenStreetMap contributors';
|
||||
|
||||
var cmOpt = {attribution: 'Map data © OpenStreetMap contributors, Imagery © CloudMade', maxZoom: 18, detectRetina: true};
|
||||
var cmMin = new L.TileLayer('http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/22677/256/{z}/{x}/{y}.png', cmOpt);
|
||||
var cmMid = new L.TileLayer('http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/999/256/{z}/{x}/{y}.png', cmOpt);
|
||||
//OpenStreetMap tiles - we shouldn't use these by default, or even an option - https://wiki.openstreetmap.org/wiki/Tile_usage_policy
|
||||
// "Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators"
|
||||
//var osmOpt = {attribution: osmAttribution, maxZoom: 18, detectRetina: true};
|
||||
//var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt);
|
||||
|
||||
var views = [cmMid, cmMin, osm, new L.Google('INGRESS'), new L.Google('ROADMAP'),
|
||||
new L.Google('SATELLITE'), new L.Google('HYBRID')];
|
||||
//CloudMade layers - only 500,000 tiles/month in their free plan. nowhere near enough for IITC
|
||||
var cmOpt = {attribution: osmAttribution+', Imagery © CloudMade', maxZoom: 18, detectRetina: true};
|
||||
//var cmMin = new L.TileLayer('http://{s}.tile.cloudmade.com/{your api key here}/22677/256/{z}/{x}/{y}.png', cmOpt);
|
||||
//var cmMid = new L.TileLayer('http://{s}.tile.cloudmade.com/{your api key here}/999/256/{z}/{x}/{y}.png', cmOpt);
|
||||
|
||||
//MapQuest offer tiles - http://developer.mapquest.com/web/products/open/map
|
||||
//their usage policy has no limits (except required notification above 4000 tiles/sec - we're perhaps at 50 tiles/sec based on CloudMade stats)
|
||||
var mqSubdomains = [ 'otile1','otile2', 'otile3', 'otile4' ];
|
||||
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', mazZoom: 18, detectRetena: true, subdomains: mqSubdomains};
|
||||
var mqMap = new L.TileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
||||
//MapQuest satellite coverage outside of the US is rather limited - so not really worth having as we have google as an option
|
||||
//var mqSatOpt = {attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency', mazZoom: 18, detectRetena: true, subdomains: mqSubdomains};
|
||||
//var mqSat = new L.TileLayer('http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg',mqSatOpt);
|
||||
|
||||
var views = [
|
||||
/*0*/ mqMap,
|
||||
/*1*/ new L.Google('INGRESS'),
|
||||
/*2*/ new L.Google('ROADMAP'),
|
||||
/*3*/ new L.Google('SATELLITE'),
|
||||
/*4*/ new L.Google('HYBRID')
|
||||
];
|
||||
|
||||
|
||||
window.map = new L.Map('map', $.extend(getPosition(),
|
||||
@ -137,13 +156,11 @@ window.setupMap = function() {
|
||||
addLayers['Links'] = linksLayer;
|
||||
|
||||
window.layerChooser = new L.Control.Layers({
|
||||
'OSM Midnight': views[0],
|
||||
'OSM Minimal': views[1],
|
||||
'OSM Mapnik': views[2],
|
||||
'Default Ingress Map': views[3],
|
||||
'Google Roads': views[4],
|
||||
'Google Satellite': views[5],
|
||||
'Google Hybrid': views[6]
|
||||
'MapQuest OSM': views[0],
|
||||
'Default Ingress Map': views[1],
|
||||
'Google Roads': views[2],
|
||||
'Google Satellite': views[3],
|
||||
'Google Hybrid': views[4]
|
||||
}, addLayers);
|
||||
|
||||
map.addControl(window.layerChooser);
|
||||
@ -291,12 +308,13 @@ window.setupDialogs = function() {
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{ text: 'OK', click: function() { $(this).dialog('close'); } }
|
||||
{ text: 'OK', click: function() { if($(this).data("closeCallback")) {$(this).data("closeCallback")();} $(this).dialog('close'); } }
|
||||
]
|
||||
});
|
||||
|
||||
window.alert = function(text, isHTML) {
|
||||
window.alert = function(text, isHTML, closeCallback) {
|
||||
var h = isHTML ? text : window.convertTextToTableMagic(text);
|
||||
$('#dialog').data("closeCallback", closeCallback);
|
||||
$('#dialog').html(h).dialog('open');
|
||||
}
|
||||
}
|
||||
|
13
code/chat.js
13
code/chat.js
@ -241,6 +241,14 @@ window.chat.renderFull = function(oldMsgsWereAdded) {
|
||||
// common
|
||||
//
|
||||
|
||||
window.chat.nicknameClicked = function(event, nickname) {
|
||||
var hookData = { event: event, nickname: nickname };
|
||||
|
||||
if (window.runHooks('nicknameClicked', hookData)) {
|
||||
window.chat.addNickname('@' + nickname);
|
||||
}
|
||||
}
|
||||
|
||||
window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
|
||||
$.each(newData.result, function(ind, json) {
|
||||
// avoid duplicates
|
||||
@ -283,9 +291,10 @@ window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
|
||||
case 'AT_PLAYER':
|
||||
var thisToPlayer = (markup[1].plain == ('@'+window.PLAYER.nickname));
|
||||
var spanClass = thisToPlayer ? "pl_nudge_me" : (markup[1].team + " pl_nudge_player");
|
||||
var atPlayerName = markup[1].plain.replace(/^@/, "");
|
||||
msg += $('<div/>').html($('<span/>')
|
||||
.attr('class', spanClass)
|
||||
.attr('onclick',"window.chat.addNickname('"+markup[1].plain+"')")
|
||||
.attr('onclick',"window.chat.nicknameClicked(event, '"+atPlayerName+"')")
|
||||
.text(markup[1].plain)).html();
|
||||
msgToPlayer = msgToPlayer || thisToPlayer;
|
||||
break;
|
||||
@ -401,7 +410,7 @@ window.chat.renderMsg = function(msg, nick, time, team, msgToPlayer, systemNarro
|
||||
var s = 'style="cursor:pointer; color:'+color+'"';
|
||||
var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
|
||||
var i = ['<span class="invisep"><</span>', '<span class="invisep">></span>'];
|
||||
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.addNickname(\'@' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
||||
return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" onclick="window.chat.nicknameClicked(event, \'' + nick + '\')" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>';
|
||||
}
|
||||
|
||||
window.chat.addNickname= function(nick){
|
||||
|
@ -4,7 +4,14 @@
|
||||
window.setupGeosearch = function() {
|
||||
$('#geosearch').keypress(function(e) {
|
||||
if((e.keyCode ? e.keyCode : e.which) != 13) return;
|
||||
$.getJSON(NOMINATIM + encodeURIComponent($(this).val()), function(data) {
|
||||
|
||||
var search = $(this).val();
|
||||
|
||||
if (!runHooks('geoSearch', search)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.getJSON(NOMINATIM + encodeURIComponent(search), function(data) {
|
||||
if(!data || !data[0]) return;
|
||||
var b = data[0].boundingbox;
|
||||
if(!b) return;
|
||||
|
@ -59,15 +59,21 @@
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
|
||||
'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded',
|
||||
'beforePortalReRender', 'checkRenderLimit', 'requestFinished'];
|
||||
'beforePortalReRender', 'checkRenderLimit', 'requestFinished', 'nicknameClicked',
|
||||
'geoSearch'];
|
||||
|
||||
window.runHooks = function(event, data) {
|
||||
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);
|
||||
|
||||
if(!_hooks[event]) return;
|
||||
if(!_hooks[event]) return true;
|
||||
var interupted = false;
|
||||
$.each(_hooks[event], function(ind, callback) {
|
||||
callback(data);
|
||||
if (callback(data) === false) {
|
||||
interupted = true;
|
||||
return false; //break from $.each
|
||||
}
|
||||
});
|
||||
return !interupted;
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,11 +21,18 @@ window.storeMapPosition = function() {
|
||||
// returns a map that shows the whole world.
|
||||
window.getPosition = function() {
|
||||
if(getURLParam('latE6') && getURLParam('lngE6')) {
|
||||
console.log("mappos: reading URL params");
|
||||
console.log("mappos: reading email URL params");
|
||||
var lat = parseInt(getURLParam('latE6'))/1E6 || 0.0;
|
||||
var lng = parseInt(getURLParam('lngE6'))/1E6 || 0.0;
|
||||
// google seems to zoom in far more than leaflet
|
||||
var z = parseInt(getURLParam('z'))+1 || 17;
|
||||
var z = parseInt(getURLParam('z')) || 17;
|
||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
||||
}
|
||||
|
||||
if(getURLParam('ll')) {
|
||||
console.log("mappos: reading stock Intel URL params");
|
||||
var lat = parseFloat(getURLParam('ll').split(",")[0]) || 0.0;
|
||||
var lng = parseFloat(getURLParam('ll').split(",")[1]) || 0.0;
|
||||
var z = parseInt(getURLParam('z')) || 17;
|
||||
return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,30 @@
|
||||
|
||||
|
||||
// UTILS + MISC ///////////////////////////////////////////////////////
|
||||
|
||||
window.aboutIITC = function(){
|
||||
var v = '@@BUILDNAME@@-@@BUILDDATE@@'
|
||||
var a = ''
|
||||
+ ' <div><b>About IITC</b></div> '
|
||||
+ ' <div>Ingress Intel Total Conversion</div> '
|
||||
+ ' <hr>'
|
||||
+ ' <div>'
|
||||
+ ' <a href="http://iitc.jonatkins.com/" target="_blank">IITC Homepage</a><br />'
|
||||
+ ' On the script’s homepage you can:'
|
||||
+ ' <ul>'
|
||||
+ ' <li>Find Updates</li>'
|
||||
+ ' <li>Get Plugins</li>'
|
||||
+ ' <li>Report Bugs</li>'
|
||||
+ ' <li>Contribute!</li>'
|
||||
+ ' </ul>'
|
||||
+ ' </div>'
|
||||
+ ' <div>'
|
||||
+ ' MapQuest OSM tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">'
|
||||
+ ' </div>'
|
||||
+ ' <hr>'
|
||||
+ ' <div>Version: ' + v + '</div>';
|
||||
alert(a);
|
||||
}
|
||||
|
||||
|
||||
window.layerGroupLength = function(layerGroup) {
|
||||
var layersCount = 0;
|
||||
var layers = layerGroup._layers;
|
||||
@ -257,7 +280,7 @@ window.setPermaLink = function(elm) {
|
||||
var c = map.getCenter();
|
||||
var lat = Math.round(c.lat*1E6);
|
||||
var lng = Math.round(c.lng*1E6);
|
||||
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + (map.getZoom()-1);
|
||||
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + map.getZoom();
|
||||
$(elm).attr('href', '/intel?' + qry);
|
||||
}
|
||||
|
||||
|
6
main.js
6
main.js
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id ingress-intel-total-conversion@jonatkins
|
||||
// @name IITC: Ingress intel map total conversion
|
||||
// @version 0.10.3.@@DATETIMEVERSION@@
|
||||
// @version 0.10.5.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -89,8 +89,8 @@ document.getElementsByTagName('body')[0].innerHTML = ''
|
||||
+ ' <div id="portaldetails"></div>'
|
||||
+ ' <input id="redeem" placeholder="Redeem code…" type="text"/>'
|
||||
+ ' <div id="toolbox">'
|
||||
+ ' <a onmouseover="setPermaLink(this)" onclick="setPermaLink(this);return androidCopy(this.href)" >permalink</a>'
|
||||
+ ' <a href="http://iitc.jonatkins.com/" title="IITC = Ingress Intel Total Conversion.\n\nOn the script’s homepage you can:\n– find updates\n– get plugins\n– report bugs\n– and contribute." style="cursor: help">IITC’s page</a></div>'
|
||||
+ ' <a onmouseover="setPermaLink(this)" onclick="setPermaLink(this);return androidCopy(this.href)" >Permalink</a>'
|
||||
+ ' <a onclick="window.aboutIITC()" style="cursor: help">About IITC</a></div>'
|
||||
+ ' </div>'
|
||||
+ '</div>'
|
||||
+ '<div id="updatestatus"></div>'
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cradle.iitc_mobile"
|
||||
android:versionCode="7"
|
||||
android:versionName="0.2.6" >
|
||||
android:versionCode="9"
|
||||
android:versionName="0.2.8" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
@ -14,7 +14,7 @@
|
||||
<string name="about">About</string>
|
||||
|
||||
<string name="pref_about_title">About IITC Mobile</string>
|
||||
<!-- Use CDATA to prevent android from parsin html tags....we are doing this with Html.fromHtml() -->
|
||||
<!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() -->
|
||||
<string name="pref_about_msg">
|
||||
<![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br>
|
||||
<b>by <a href="https://github.com/leCradle">cradle</a></b><br><br>
|
||||
|
@ -34,7 +34,7 @@ public class IITC_AboutDialogPreference extends DialogPreference{
|
||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
builder.setView(message)
|
||||
.setTitle(R.string.about)
|
||||
.setIcon(R.drawable.ic_stat_about)
|
||||
.setIcon(android.R.drawable.ic_dialog_info)
|
||||
.setNeutralButton(R.string.close, new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
|
@ -6,7 +6,6 @@ import com.cradle.iitc_mobile.R;
|
||||
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.NetworkInfo.State;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -85,17 +84,29 @@ public class IITC_Mobile extends Activity {
|
||||
protected void onStop() {
|
||||
ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
State mobile = conMan.getNetworkInfo(0).getState();
|
||||
State wifi = conMan.getNetworkInfo(1).getState();
|
||||
NetworkInfo mobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
|
||||
if (mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING) {
|
||||
// cancel all current requests
|
||||
iitc_view.loadUrl("javascript: window.requests.abort()");
|
||||
// set idletime to maximum...no need for more
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
} else if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
// check if Mobile or Wifi module is available..then handle states
|
||||
// TODO: theory...we do not have to check for a Wifi module...every android device should have one
|
||||
if (mobile != null) {
|
||||
Log.d("iitcm", "mobile internet module detected...check states");
|
||||
if (mobile.getState() == NetworkInfo.State.CONNECTED || mobile.getState() == NetworkInfo.State.CONNECTING) {
|
||||
Log.d("iitcm", "connected to mobile net...abort all running requests");
|
||||
// cancel all current requests
|
||||
iitc_view.loadUrl("javascript: window.requests.abort()");
|
||||
// set idletime to maximum...no need for more
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
} else if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
}
|
||||
} else {
|
||||
Log.d("iitcm", "no mobile internet module detected...check wifi state");
|
||||
if (wifi.getState() == NetworkInfo.State.CONNECTED || wifi.getState() == NetworkInfo.State.CONNECTING) {
|
||||
iitc_view.loadUrl("javascript: window.idleTime = 999");
|
||||
}
|
||||
}
|
||||
Log.d("iitcm", "stopping iitcm");
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebView;
|
||||
@ -22,8 +25,10 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
|
||||
private WebResourceResponse iitcjs;
|
||||
private String js = null;
|
||||
Context context;
|
||||
|
||||
public IITC_WebViewClient(Context c) {
|
||||
this.context = c;
|
||||
try {
|
||||
loadIITC_JS(c);
|
||||
} catch(IOException e) {
|
||||
@ -109,4 +114,17 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
return super.shouldInterceptRequest(view, url);
|
||||
}
|
||||
}
|
||||
|
||||
// start non-ingress-intel-urls in another app...
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.contains("ingress.com")) {
|
||||
return false;
|
||||
} else {
|
||||
Log.d("iitcm", "no ingress intel link, start external app to load url: " + url);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||
window.plugin.guessPlayerLevels = function() {};
|
||||
|
||||
window.plugin.guessPlayerLevels.setupCallback = function() {
|
||||
$('#toolbox').append('<a onclick="window.plugin.guessPlayerLevels.guess()">guess player levels</a> ');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.guessPlayerLevels.guess()">Guess player levels</a>');
|
||||
addHook('portalAdded', window.plugin.guessPlayerLevels.extractPortalData);
|
||||
}
|
||||
|
||||
|
@ -23,19 +23,23 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||
window.plugin.ipasLink = function() {};
|
||||
|
||||
window.plugin.ipasLink.setupCallback = function() {
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.addLink = function(d) {
|
||||
$('.linkdetails').append('<aside style="text-align: center; display: block"><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow">simulate attack with IPAS</a></aside>');
|
||||
$('.linkdetails').append('<aside style="text-align: center; display: block"><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow">simulate attack with IPAS</a></aside>');
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.getHash = function(d) {
|
||||
var hashParts=[];
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
});
|
||||
return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet
|
||||
var hashParts=[];
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
if (reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
} else {
|
||||
hashParts.push(1 + "," + 35 + "," + 0); // Dummy values, the only important one is energy=0
|
||||
}
|
||||
});
|
||||
return hashParts.join(";")+"|" + "0,0,0,0"; //shields not implemented yet
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
@ -57,4 +61,3 @@ if(window.iitcLoaded && typeof setup === 'function') {
|
||||
var script = document.createElement('script');
|
||||
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||
(document.body || document.head || document.documentElement).appendChild(script);
|
||||
|
||||
|
@ -62,6 +62,8 @@ window.plugin.playerTracker.setup = function() {
|
||||
window.plugin.playerTracker.zoomListener();
|
||||
});
|
||||
window.plugin.playerTracker.zoomListener();
|
||||
|
||||
plugin.playerTracker.setupUserSearch();
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.stored = {};
|
||||
@ -341,8 +343,57 @@ window.plugin.playerTracker.handleData = function(data) {
|
||||
plugin.playerTracker.drawData();
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.findUserPosition = function(nick) {
|
||||
nick = nick.toLowerCase();
|
||||
var foundPlayerData = undefined;
|
||||
$.each(plugin.playerTracker.stored, function(pguid, playerData) {
|
||||
if (playerData.nick.toLowerCase() === nick) {
|
||||
foundPlayerData = playerData;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!foundPlayerData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var evtsLength = foundPlayerData.events.length;
|
||||
var last = foundPlayerData.events[evtsLength-1];
|
||||
return plugin.playerTracker.getLatLngFromEvent(last);
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.centerMapOnUser = function(nick) {
|
||||
var position = plugin.playerTracker.findUserPosition(nick);
|
||||
|
||||
if (position === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
map.setView(position, map.getZoom());
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.onNicknameClicked = function(info) {
|
||||
if (info.event.ctrlKey) {
|
||||
plugin.playerTracker.centerMapOnUser(info.nickname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.onGeoSearch = function(search) {
|
||||
if (/^@/.test(search)) {
|
||||
plugin.playerTracker.centerMapOnUser(search.replace(/^@/, ''));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.playerTracker.setupUserSearch = function() {
|
||||
addHook('nicknameClicked', window.plugin.playerTracker.onNicknameClicked);
|
||||
addHook('geoSearch', window.plugin.playerTracker.onGeoSearch);
|
||||
|
||||
var geoSearch = $('#geosearch');
|
||||
var beforeEllipsis = /(.*)…/.exec(geoSearch.attr('placeholder'))[1];
|
||||
geoSearch.attr('placeholder', beforeEllipsis + ' or @player…');
|
||||
}
|
||||
|
||||
|
||||
var setup = plugin.playerTracker.setup;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-portals-count@yenky
|
||||
// @name IITC plugin: Show total counts of portals
|
||||
// @version 0.0.6.@@DATETIMEVERSION@@
|
||||
// @version 0.0.7.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -99,8 +99,7 @@ window.plugin.portalcounts.getPortals = function(){
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="portalcounts" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.portalcounts.getPortals()">Portalcounts</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.portalcounts.getPortals()">Portal&sbsp;counts</a>');
|
||||
$('head').append('<style>' +
|
||||
'#portalcounts table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
'#portalcounts table td, #portalcounts table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' +
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-portals-list@teo96
|
||||
// @name IITC plugin: show list of portals
|
||||
// @version 0.0.9.@@DATETIMEVERSION@@
|
||||
// @version 0.0.10.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -119,7 +119,7 @@ window.plugin.portalslist.displayPL = function() {
|
||||
} else {
|
||||
html = '<table><tr><td>Nothing to Show !</td></tr></table>';
|
||||
};
|
||||
alert('<div id="portalslist">' + html + '</div>');
|
||||
alert('<div id="portalslist">' + html + '</div>', true, function() {$(".ui-dialog").removeClass('ui-dialog-portalslist');});
|
||||
$(".ui-dialog").addClass('ui-dialog-portalslist');
|
||||
|
||||
// Setup sorting
|
||||
@ -403,8 +403,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="portalslist" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.portalslist.displayPL(0)">Portals List</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.portalslist.displayPL(0)">Portals list</a>');
|
||||
$('head').append('<style>' +
|
||||
'.ui-dialog-portalslist {position: absolute !important; top: 10px !important; left: 30px !important;max-width:800px !important; width:733px !important;}' +
|
||||
'#portalslist table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-scoreboard@vita10gy
|
||||
// @name IITC plugin: show a localized scoreboard.
|
||||
// @version 0.1.5.@@DATETIMEVERSION@@
|
||||
// @version 0.1.6.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -362,7 +362,7 @@ window.plugin.scoreboard.display = function() {
|
||||
scoreHtml += 'You need something in view.';
|
||||
}
|
||||
|
||||
alert('<div id="scoreboard">' + scoreHtml + '</div>');
|
||||
alert('<div id="scoreboard">' + scoreHtml + '</div>', true, function() {$(".ui-dialog").removeClass('ui-dialog-scoreboard');});
|
||||
$(".ui-dialog").addClass('ui-dialog-scoreboard');
|
||||
|
||||
// Setup sorting
|
||||
@ -389,8 +389,7 @@ window.plugin.scoreboard.fieldArea = function(field) {
|
||||
}
|
||||
|
||||
var setup = function() {
|
||||
$('body').append('<div id="scoreboard" style="display:none;"></div>');
|
||||
$('#toolbox').append('<a onclick="window.plugin.scoreboard.display()">scoreboard</a>');
|
||||
$('#toolbox').append(' <a onclick="window.plugin.scoreboard.display()">Scoreboard</a>');
|
||||
$('head').append('<style>' +
|
||||
'.ui-dialog-scoreboard {max-width:600px !important; width:600px !important;}' +
|
||||
'#scoreboard table {margin-top:10px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
|
||||
|
Reference in New Issue
Block a user