diff --git a/code/boot.js b/code/boot.js index a881f8e0..5cab4e63 100644 --- a/code/boot.js +++ b/code/boot.js @@ -231,7 +231,7 @@ window.setupPlayerStat = function() { + '

'+level+' ' + '
' + ''+PLAYER.nickname+'' - + 'sign out' + + 'sign out' + '
' + '
' + 'XM: '+xmRatio+'%' @@ -386,6 +386,7 @@ try { console.log('Loading included JS now'); } catch(e) {} try { console.log('done loading included JS'); } catch(e) {} +//note: no protocol - so uses http or https as used on the current page var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; var JQUERYUI = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js'; diff --git a/code/chat.js b/code/chat.js index f6716a0d..73d11862 100644 --- a/code/chat.js +++ b/code/chat.js @@ -292,7 +292,7 @@ window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) { case 'PORTAL': var latlng = [markup[1].latE6/1E6, markup[1].lngE6/1E6]; - var perma = 'https://ingress.com/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid; + var perma = '/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid; var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+']);return false'; msg += '@@INCLUDESTRING:style.css@@' + '' //note: smartphone.css injection moved into code/smartphone.js - + ''; + + ''; document.getElementsByTagName('body')[0].innerHTML = '' + '
Loading, please wait
' @@ -168,7 +168,7 @@ window.RANGE_INDICATOR_COLOR = 'red' window.PORTAL_RADIUS_ENLARGE_MOBILE = 5; -window.DEFAULT_PORTAL_IMG = 'https://commondatastorage.googleapis.com/ingress/img/default-portal-image.png'; +window.DEFAULT_PORTAL_IMG = '//commondatastorage.googleapis.com/ingress/img/default-portal-image.png'; window.NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q='; // INGRESS CONSTANTS ///////////////////////////////////////////////// diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index 7bfd23d2..c2cc350f 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="7" + android:versionName="0.2.6" > Clear Cache Get Location local + close Build Version IITC Version + About + About IITC Mobile + + + Ingress Intel Total Conversion Mobile

+ by
cradle

+ Icon by machtwerk

+ IITC Mobile is an optimized mobile browser for the + Ingress Intel Total Conversion (IITC) userscript by breunigs. + After Niantic asked the main developer to shut down his github project, development + is continued on a fork of jonatkins.

+ Website:
+ http://iitc.jonatkins.com/

+ Fork github:
+ https://github.com/jonatkins/ingress-intel-total-conversion

+ Old github:
+ https://github.com/breunigs/ingress-intel-total-conversion]]> + + + UI Force desktop mode Nice for tablets, looks awful on smartphones Developer options diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 6c26dc55..fd50c037 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -1,10 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java b/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java new file mode 100644 index 00000000..fde24883 --- /dev/null +++ b/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java @@ -0,0 +1,46 @@ +package com.cradle.iitc_mobile; + +import android.app.AlertDialog.Builder; +import android.content.Context; +import android.content.DialogInterface; +import android.content.DialogInterface.OnClickListener; +import android.preference.DialogPreference; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.util.AttributeSet; +import android.widget.TextView; + +public class IITC_AboutDialogPreference extends DialogPreference{ + + private Context context; + + public IITC_AboutDialogPreference(Context context, AttributeSet attrs) { + super(context, attrs); + this.context = context; + } + + /* + * start a little about-dialog + * srsly...I found no better way for clickable links in a TextView then + * using Html.fromHtml...Linkify is just broken and does not understand + * html href tags...so let's tag the @string/about_msg with CDATA and + * use Html.fromHtml(...) for clickable hrefs with tags. + */ + @Override + protected void onPrepareDialogBuilder(Builder builder) { + final TextView message = new TextView(context); + String about_msg = context.getText(R.string.pref_about_msg).toString(); + message.setText(Html.fromHtml(about_msg)); + message.setMovementMethod(LinkMovementMethod.getInstance()); + builder.setView(message) + .setTitle(R.string.about) + .setIcon(R.drawable.ic_stat_about) + .setNeutralButton(R.string.close, new OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + super.onPrepareDialogBuilder(builder); + } + +} diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 90f089ec..aa0e683a 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -17,6 +17,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; +import android.content.res.Configuration; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -28,6 +29,7 @@ public class IITC_Mobile extends Activity { private boolean back_button_pressed = false; private boolean desktop = false; private OnSharedPreferenceChangeListener listener; + private String intel_url = "https://www.ingress.com/intel"; @Override protected void onCreate(Bundle savedInstanceState) { @@ -44,46 +46,39 @@ public class IITC_Mobile extends Activity { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals("pref_force_desktop")) desktop = sharedPreferences.getBoolean("pref_force_desktop", false); - // reload intel map - iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel")); - injectJS(); + IITC_Mobile.this.loadUrl(intel_url); } }; sharedPref.registerOnSharedPreferenceChangeListener(listener); - // we do not want to reload our page every time we switch orientations... - // so restore state if activity was already created - if(savedInstanceState != null) { - iitc_view.restoreState(savedInstanceState); + // load new iitc web view with ingress intel page + Intent intent = getIntent(); + String action = intent.getAction(); + if (Intent.ACTION_VIEW.equals(action)) { + Uri uri = intent.getData(); + String url = uri.toString(); + if (intent.getScheme().equals("http://")) + url = url.replace("http://", "https://"); + Log.d("iitcm", "intent received url: " + url); + if (url.contains("ingress.com")) { + Log.d("iitcm", "loading url..."); + this.loadUrl(url); + } } else { - // load new iitc web view with ingress intel page - Intent intent = getIntent(); - String action = intent.getAction(); - if (Intent.ACTION_VIEW.equals(action)) { - Uri uri = intent.getData(); - String url = uri.toString(); - if (intent.getScheme().equals("http://")) - url = url.replace("http://", "https://"); - Log.d("Intent received", "url: " + url); - if (url.contains("ingress.com")) { - Log.d("Intent received", "loading url..."); - iitc_view.loadUrl(addUrlParam(url)); - } - } - else { - Log.d("No Intent call", "loading https://www.ingress.com/intel"); - iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel")); - } + Log.d("iitcm", "no intent...loading " + intel_url); + this.loadUrl(intel_url); } } @Override protected void onResume() { + super.onResume(); + // enough idle...let's do some work + Log.d("iitcm", "resuming...setting reset idleTimer"); iitc_view.loadUrl("javascript: window.idleTime = 0"); iitc_view.loadUrl("javascript: window.renderUpdateStatus()"); - super.onResume(); } @Override @@ -104,10 +99,13 @@ public class IITC_Mobile extends Activity { super.onStop(); } - // save instance state to avoid reloading on orientation change @Override - protected void onSaveInstanceState(Bundle outState) { - iitc_view.saveState(outState); + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + Log.d("iitcm", "configuration changed...restoring...reset idleTimer"); + iitc_view.loadUrl("javascript: window.idleTime = 0"); + iitc_view.loadUrl("javascript: window.renderUpdateStatus()"); } // we want a self defined behavior for the back button @@ -143,8 +141,7 @@ public class IITC_Mobile extends Activity { // Handle item selection switch (item.getItemId()) { case R.id.reload_button: - iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel")); - injectJS(); + this.loadUrl(intel_url); return true; // clear cache case R.id.cache_clear: @@ -156,6 +153,7 @@ public class IITC_Mobile extends Activity { case R.id.locate: iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});"); return true; + // start settings activity case R.id.settings: Intent intent = new Intent(this, IITC_Settings.class); intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion()); @@ -185,4 +183,12 @@ public class IITC_Mobile extends Activity { else return (url + "?vp=m"); } + + public void loadUrl(String url) { + url = addUrlParam(url); + Log.d("iitcm", "injecting js..."); + injectJS(); + Log.d("iitcm", "loading url: " + url); + iitc_view.loadUrl(url); + } } diff --git a/plugins/ap-list.user.js b/plugins/ap-list.user.js index fffce8db..c8a4d575 100644 --- a/plugins/ap-list.user.js +++ b/plugins/ap-list.user.js @@ -200,7 +200,7 @@ window.plugin.apList.getPortalLink = function(portal) { var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join(); 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 + var perma = '/intel?latE6='+portal.locationE6.latE6 +'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+portal.guid; //Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal var a = $('',{ diff --git a/plugins/force-https.user.js b/plugins/force-https.user.js new file mode 100644 index 00000000..4770aebe --- /dev/null +++ b/plugins/force-https.user.js @@ -0,0 +1,25 @@ +// ==UserScript== +// @id force-https@jonatkins +// @name IITC plugin: force https access for ingress.com/intel +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Force https access for ingress.com/intel. If the intel site is accessed via http, it redirects to the https version +// @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== + + + +//NOTE: plugin authors - due to the unique requirements of this plugin, it doesn't use the standard IITC +//plugin architechure. do NOT use it as a template for other plugins + + +if(window.location.protocol !== 'https:') { + var redir = window.location.href.replace(/^http:/, 'https:'); + window.location = redir; + throw('Need to load HTTPS version.'); +} diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js index 7da32e3a..a160c371 100644 --- a/plugins/portals-list.user.js +++ b/plugins/portals-list.user.js @@ -353,7 +353,7 @@ window.plugin.portalslist.exportKML = function(){ // description contain picture of the portal, address and link to the Intel map var description = '
' + portal.address - + '
Link to Intel Map
' + + '
Link to Intel Map' + ']]>'; kml += 'L' + Math.floor(portal.level) + ' - ' + portal.name + '' @@ -387,7 +387,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) { var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join(); var jsSingleClick = 'window.renderPortalDetails(\''+guid+'\');return false'; var jsDoubleClick = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false'; - var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid; + var perma = '/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid; //Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal var a = $('',{