Merge branch 'master' into layerChooser
This commit is contained in:
@ -171,20 +171,20 @@ window.setupMap = function() {
|
|||||||
var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals';
|
var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals';
|
||||||
addLayers[t] = portalsLayers[i];
|
addLayers[t] = portalsLayers[i];
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed(t)) hiddenLayer.push(portalsLayers[i]);
|
if(!isLayerGroupDisplayed(t, true)) hiddenLayer.push(portalsLayers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsLayer = L.layerGroup([]);
|
fieldsLayer = L.layerGroup([]);
|
||||||
map.addLayer(fieldsLayer, true);
|
map.addLayer(fieldsLayer, true);
|
||||||
addLayers['Fields'] = fieldsLayer;
|
addLayers['Fields'] = fieldsLayer;
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed('Fields')) hiddenLayer.push(fieldsLayer);
|
if(!isLayerGroupDisplayed('Fields', true)) hiddenLayer.push(fieldsLayer);
|
||||||
|
|
||||||
linksLayer = L.layerGroup([]);
|
linksLayer = L.layerGroup([]);
|
||||||
map.addLayer(linksLayer, true);
|
map.addLayer(linksLayer, true);
|
||||||
addLayers['Links'] = linksLayer;
|
addLayers['Links'] = linksLayer;
|
||||||
// Store it in hiddenLayer to remove later
|
// Store it in hiddenLayer to remove later
|
||||||
if(!isLayerGroupDisplayed('Links')) hiddenLayer.push(linksLayer);
|
if(!isLayerGroupDisplayed('Links', true)) hiddenLayer.push(linksLayer);
|
||||||
|
|
||||||
window.layerChooser = new L.Control.Layers({
|
window.layerChooser = new L.Control.Layers({
|
||||||
'MapQuest OSM': views[0],
|
'MapQuest OSM': views[0],
|
||||||
|
@ -34,10 +34,12 @@
|
|||||||
<string name="pref_misc_cat">Misc</string>
|
<string name="pref_misc_cat">Misc</string>
|
||||||
<string name="pref_plugins">Plugins</string>
|
<string name="pref_plugins">Plugins</string>
|
||||||
<string name="pref_plugins_title">Available plugins</string>
|
<string name="pref_plugins_title">Available plugins</string>
|
||||||
<string name="pref_user_zoom">Show zoom control</string>
|
|
||||||
<string name="pref_user_zoom_sum">Shows +/- buttons even on multitouch capable devices.</string>
|
|
||||||
<string name="pref_user_loc">Display user location</string>
|
<string name="pref_user_loc">Display user location</string>
|
||||||
<string name="pref_user_loc_sum">Show users position on map</string>
|
<string name="pref_user_loc_sum">Show users position on map</string>
|
||||||
|
<string name="pref_user_zoom">Show zoom control</string>
|
||||||
|
<string name="pref_user_zoom_sum">Shows +/- buttons even on multitouch capable devices.</string>
|
||||||
|
<string name="pref_fullscreen_actionbar">Hide Action Bar in fullscreen mode</string>
|
||||||
|
<string name="pref_fullscreen_actionbar_sum">Nice for screenshots. Note: IITCM cannot be controlled without Action Bar.</string>
|
||||||
<string name="pref_force_https">Force https</string>
|
<string name="pref_force_https">Force https</string>
|
||||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
|
@ -12,15 +12,20 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_about_cat"
|
android:key="pref_about_cat"
|
||||||
android:title="@string/pref_ui_cat">
|
android:title="@string/pref_ui_cat">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_user_loc"
|
||||||
|
android:title="@string/pref_user_loc"
|
||||||
|
android:summary="@string/pref_user_loc_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_user_zoom"
|
android:key="pref_user_zoom"
|
||||||
android:title="@string/pref_user_zoom"
|
android:title="@string/pref_user_zoom"
|
||||||
android:summary="@string/pref_user_zoom_sum"
|
android:summary="@string/pref_user_zoom_sum"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_user_loc"
|
android:key="pref_fullscreen_actionbar"
|
||||||
android:title="@string/pref_user_loc"
|
android:title="@string/pref_fullscreen_actionbar"
|
||||||
android:summary="@string/pref_user_loc_sum"
|
android:summary="@string/pref_fullscreen_actionbar_sum"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
private LocationListener loc_listener = null;
|
private LocationListener loc_listener = null;
|
||||||
private boolean keyboad_open = false;
|
private boolean keyboad_open = false;
|
||||||
private boolean fullscreen_mode = false;
|
private boolean fullscreen_mode = false;
|
||||||
|
private boolean fullscreen_actionbar = false;
|
||||||
private ActionBar actionBar;
|
private ActionBar actionBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,6 +59,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
actionBar.setTitle(getString(R.string.menu_map));
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
actionBar.setHomeButtonEnabled(true);
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
|
||||||
|
// do something if user changed something in the settings
|
||||||
SharedPreferences sharedPref = PreferenceManager
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
.getDefaultSharedPreferences(this);
|
.getDefaultSharedPreferences(this);
|
||||||
listener = new OnSharedPreferenceChangeListener() {
|
listener = new OnSharedPreferenceChangeListener() {
|
||||||
@ -67,6 +69,12 @@ public class IITC_Mobile extends Activity {
|
|||||||
if (key.equals("pref_user_loc"))
|
if (key.equals("pref_user_loc"))
|
||||||
user_loc = sharedPreferences.getBoolean("pref_user_loc",
|
user_loc = sharedPreferences.getBoolean("pref_user_loc",
|
||||||
false);
|
false);
|
||||||
|
if (key.equals("pref_fullscreen_actionbar")) {
|
||||||
|
fullscreen_actionbar =sharedPreferences.getBoolean("pref_fullscreen_actionbar",
|
||||||
|
false);
|
||||||
|
if (fullscreen_mode)
|
||||||
|
IITC_Mobile.this.getActionBar().hide();
|
||||||
|
}
|
||||||
IITC_Mobile.this.loadUrl(intel_url);
|
IITC_Mobile.this.loadUrl(intel_url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -129,6 +137,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
loc_listener);
|
loc_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fullscreen_actionbar = sharedPref.getBoolean("pref_fullscreen_actionbar", false);
|
||||||
|
|
||||||
// load new iitc web view with ingress intel page
|
// load new iitc web view with ingress intel page
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
@ -222,6 +232,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
// leave fullscreen mode if it is enabled
|
// leave fullscreen mode if it is enabled
|
||||||
if (fullscreen_mode) {
|
if (fullscreen_mode) {
|
||||||
|
if (fullscreen_actionbar)
|
||||||
|
this.getActionBar().show();
|
||||||
// show notification bar again
|
// show notification bar again
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
@ -280,6 +292,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
// toggle fullscreen
|
// toggle fullscreen
|
||||||
case R.id.toggle_fullscreen :
|
case R.id.toggle_fullscreen :
|
||||||
if (!this.fullscreen_mode) {
|
if (!this.fullscreen_mode) {
|
||||||
|
if (fullscreen_actionbar)
|
||||||
|
this.getActionBar().hide();
|
||||||
// hide notification bar
|
// hide notification bar
|
||||||
WindowManager.LayoutParams attrs = getWindow()
|
WindowManager.LayoutParams attrs = getWindow()
|
||||||
.getAttributes();
|
.getAttributes();
|
||||||
@ -291,6 +305,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
"Press back button to exit fullscreen",
|
"Press back button to exit fullscreen",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
|
if (fullscreen_actionbar)
|
||||||
|
this.getActionBar().show();
|
||||||
// show notification bar again
|
// show notification bar again
|
||||||
WindowManager.LayoutParams attrs = getWindow()
|
WindowManager.LayoutParams attrs = getWindow()
|
||||||
.getAttributes();
|
.getAttributes();
|
||||||
|
@ -142,7 +142,7 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
SharedPreferences sharedPref = PreferenceManager
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
Set<String> plugin_list = sharedPref.getStringSet("pref_plugins", null);
|
Set<String> plugin_list = sharedPref.getStringSet("pref_plugins", null);
|
||||||
boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", true);
|
boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", false);
|
||||||
|
|
||||||
// iterate through all enabled plugins and load them
|
// iterate through all enabled plugins and load them
|
||||||
if (plugin_list != null) {
|
if (plugin_list != null) {
|
||||||
|
104
plugins/players-resonators.user.js
Normal file
104
plugins/players-resonators.user.js
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-players-resonators@rbino
|
||||||
|
// @name IITC plugin: Player's Resonators
|
||||||
|
// @version 0.1.4.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] The plugins finds the resonators of a given player. The input is in the sidebar. Useful for revenge.
|
||||||
|
// @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==
|
||||||
|
|
||||||
|
/*********************************************************************************************************
|
||||||
|
* Changelog:
|
||||||
|
*
|
||||||
|
* 0.1.4 Added focus link in the toolbox. Some renaming. Removed div to use sidebar style.
|
||||||
|
* 0.1.3 Effective player name (with wrong capitalization) if it finds some reso
|
||||||
|
* 0.1.2 Made nickname case insensitive
|
||||||
|
* 0.1.1 Added mouseover for portal location. Dirty hack to not show mousehover when the alert is fired.
|
||||||
|
* 0.1.0 First public release
|
||||||
|
*********************************************************************************************************/
|
||||||
|
|
||||||
|
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.playersResonators = function() {};
|
||||||
|
|
||||||
|
window.plugin.playersResonators.findReso = function(playername) {
|
||||||
|
var s = "";
|
||||||
|
var portalSet = {};
|
||||||
|
var effectiveNick = "";
|
||||||
|
// Assuming there can be no agents with same nick with different lower/uppercase
|
||||||
|
var nickToFind = playername.toLowerCase();
|
||||||
|
$.each(window.portals, function(ind, portal){
|
||||||
|
var r = portal.options.details.resonatorArray.resonators;
|
||||||
|
$.each(r, function(ind, reso) {
|
||||||
|
if (!reso) return true;
|
||||||
|
var nick = getPlayerName(reso.ownerGuid);
|
||||||
|
if (nick.toLowerCase() === nickToFind){
|
||||||
|
if (!effectiveNick) {
|
||||||
|
effectiveNick = nick;
|
||||||
|
}
|
||||||
|
if (!portalSet.hasOwnProperty(portal.options.guid)){
|
||||||
|
portalSet[portal.options.guid] = true;
|
||||||
|
console.log(portalSet);
|
||||||
|
var latlng = [portal.options.details.locationE6.latE6/1E6, portal.options.details.locationE6.lngE6/1E6].join();
|
||||||
|
var guid = portal.options.guid;
|
||||||
|
var zoomPortal = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false';
|
||||||
|
var perma = '/intel?latE6='+portal.options.details.locationE6.latE6+'&lngE6='+portal.options.details.locationE6.lngE6+'&z=17&pguid='+guid;
|
||||||
|
var a = $('<a>',{
|
||||||
|
"class": 'help',
|
||||||
|
text: portal.options.details.portalV2.descriptiveText.TITLE,
|
||||||
|
title: portal.options.details.portalV2.descriptiveText.ADDRESS,
|
||||||
|
href: perma,
|
||||||
|
onClick: zoomPortal
|
||||||
|
})[0].outerHTML;
|
||||||
|
s += a + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (s) {
|
||||||
|
// Showing the playername as a "fake" link to avoid the auto-mouseover effect on the first portal
|
||||||
|
fakeLinkPlayer = '<a href="#" onClick="return false;">' + effectiveNick + '</a>'
|
||||||
|
s = fakeLinkPlayer + " has resonators on these portals:\n\n" + s;
|
||||||
|
} else {
|
||||||
|
s = playername + " has no resonators in this range\n";
|
||||||
|
}
|
||||||
|
alert(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
var content = '<input id="playerReso" placeholder="Type player name to find resonators..." type="text">';
|
||||||
|
$('#sidebar').append(content);
|
||||||
|
$('#toolbox').append(' <a onclick=$("#playerReso").focus() title="Find all portals with resonators of a certain player">Player\'s Reso</a>');
|
||||||
|
$("#playerReso").keypress(function(e) {
|
||||||
|
if((e.keyCode ? e.keyCode : e.which) !== 13) return;
|
||||||
|
var data = $(this).val();
|
||||||
|
window.plugin.playersResonators.findReso(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
Reference in New Issue
Block a user