-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiitc-watcher-plugin.js
119 lines (98 loc) · 15.8 KB
/
iitc-watcher-plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// ==UserScript==
// @id iitc-plugin-agent-watcher@dawsonloudon
// @name IITC Plugin: Agent Watcher
// @version 0.0.1.20140212
// @namespace https://github.com/dawsonloudon/agent-watcher-plugin
// @updateURL http://cac.sapphiredev.info/watcher/app/iitc-watcher-plugin.js
// @downloadURL http://cac.sapphiredev.info/watcher/app/iitc-watcher-plugin.js
// @description Shows agents in field from external api
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.agentWatcher = function() {};
window.plugin.agentWatcher.agents = {};
window.plugin.agentWatcher.agentsGroup = new L.LayerGroup();
window.plugin.agentWatcher.setup = function() {
var iconResImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAArHSURBVHjanNV5UJNnAsfxx6W13dnObv/ourbTVlvbrhy5CUe4PQCPerS6oy3tTrfdEUkAFQGRKwlXCGcScnCoIMSDehURrUfRahXeJO+bhJAgVRSUCihaQc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AWUZCt6+K9cW1iivEX+D42+fskarNZrzRAWWiFkvPKS6k9T9XkTDOURRSUBRaIkur5GW7K93ZaQZGo+TdCRV4nVCRk67oEr7y0pge/TR1fL6/pgbyA9YY0bTfvjUuyt/U/+16PXfgkaFMJFQlRUj3k+RYoCilMyjTjxZSecTUp0wxFIQV5vhmiJAM/iid97+dHZG/rf0aoyMuEioRkzW7ICyj45tvw25Qe/Ga1p36b0gPffBvkBRQka3by3jj3SqLmX34QJ3qIRDKJXT4yQJ5ngrzAhokZJvxm9TEPTco0Q15gg1+uCUSinusb2rd/MEeTXknU/AuhIs+xXtkJv3wbZHlWvLj6GH6dzOrF1ccgy7PCL98Gccp23hufhanVL+CHdMbKJ5H8CxvveshyeuGbb8OEDDN+lXwMv0o+hokZZvjm2yDN6eFeC5AgEnVLf3CHxcLU6hdEKvJTQkVClLINsjwbpLk2oX9Ic22Q5dkgSunkvXF8/vznd2DsuZ5480kkF3MtDYmaNX5CuhkT0s2Q5togUfeAUOm4UZxc8IM9vscuteqchIqEaHUHazwnaa4NRHIHP02n+f26P9hziKJE3TxuOg5x1lFIcmyQ5NggzjrqthCtnfWDP1DJPRJbCBUJInkLJDlWSHKsIJI38yC9P4qToQC8iL/rYvnWF2UcgShjZOnTO0EX9aMB4bxyhFCRIFZuZMWCHPzRnNV1mxmHur2cYUfxBF3Ijw6EW83fL0CodPt+VKenPe9gpFzoK4mk/EcLwvWVHYSK3PGjO88+5nhsok40NVEn+rbr+b8BANIDJqc+VKDfAAAAAElFTkSuQmCC';
plugin.agentWatcher.iconRes = L.Icon.Default.extend({options: {
iconUrl: iconResImage,
iconRetinaUrl: iconResRetImage
}});
var searchArea = document.getElementById('geosearchwrapper');
searchArea.style.height = '55px';
var keyinput = document.createElement('input');
keyinput.setAttribute('id', 'sessionkey');
keyinput.style.width = '200px';
keyinput.setAttribute('placeholder','Session Key here...');
searchArea.appendChild(keyinput);
var watcherbtn = document.createElement('button');
watcherbtn.innerHTML = 'Start Watching';
watcherbtn.setAttribute('id','watcherbtn');
watcherbtn.setAttribute('onclick','window.plugin.agentWatcher.startWatch();');
searchArea.appendChild(watcherbtn);
window.layerChooser.addOverlay(window.plugin.agentWatcher.agentsGroup, 'Agents');
map.addLayer(window.plugin.agentWatcher.agentsGroup);
}
window.plugin.agentWatcher.startWatch = function() {
var sessionkey = document.getElementById('sessionkey').value;
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
console.log(xmlhttp.responseText);
var tracks = JSON.parse(xmlhttp.responseText);
for(var i = 0; i < tracks.length; i++) {
window.plugin.agentWatcher.addMarker(tracks[i]);
}
}
}
xmlhttp.open("GET", "http://cac.sapphiredev.info/watcher/api/?session_key="+sessionkey, true);
xmlhttp.send();
}
window.plugin.agentWatcher.addMarker = function(track) {
console.log(track);
var icon = new plugin.agentWatcher.iconRes();
var marker = L.marker([track.lat,track.lon], {
guid: track.tid,
title: track.name,
icon: icon
});
plugin.agentWatcher.agents[track.tid] = marker;
marker.addTo(plugin.agentWatcher.agentsGroup);
/*
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: track.name
});
*/
}
var setup = plugin.agentWatcher.setup;
// PLUGIN END //////////////////////////////////////////////////////////
if(window.iitcLoaded && typeof setup === 'function') {
setup();
} else {
if(window.bootPlugins)
window.bootPlugins.push(setup);
else
window.bootPlugins = [setup];
}
} // wrapper end
// inject code into site context
var script = document.createElement('script');
script.appendChild(document.createTextNode('('+ wrapper +')();'));
(document.body || document.head || document.documentElement).appendChild(script);