From 9847dec56846aebba42c25f58d57244655c3274d Mon Sep 17 00:00:00 2001 From: rongou Date: Sat, 30 Mar 2013 07:59:37 -0700 Subject: [PATCH 01/34] Add a new plugin to display portal levels as numbers, directly on the map. --- plugins/portal-level-numbers.user.js | 100 +++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 plugins/portal-level-numbers.user.js diff --git a/plugins/portal-level-numbers.user.js b/plugins/portal-level-numbers.user.js new file mode 100644 index 00000000..b070b160 --- /dev/null +++ b/plugins/portal-level-numbers.user.js @@ -0,0 +1,100 @@ +// ==UserScript== +// @id iitc-plugin-portal-level-numbers@rongou +// @name IITC plugin: Portal Level Numbers +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Show portal level numbers on map. +// @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.portalLevelNumbers = function() {}; + +window.plugin.portalLevelNumbers.levelLayers = {}; +window.plugin.portalLevelNumbers.levelLayerGroup = new L.LayerGroup(); + +// Use portal add and remove event to control render of portal level numbers +window.plugin.portalLevelNumbers.portalAdded = function(data) { + data.portal.on('add', function() { + plugin.portalLevelNumbers.renderLevel(this.options.guid, this.getLatLng()); + }); + + data.portal.on('remove', function() { + plugin.portalLevelNumbers.removeLevel(this.options.guid); + }); +} + +window.plugin.portalLevelNumbers.renderLevel = function(guid,latLng) { + plugin.portalLevelNumbers.removeLevel(guid); + + var d = window.portals[guid].options.details; + var levelNumber = Math.floor(window.getPortalLevel(d)); + var level = L.marker(latLng, { + icon: L.divIcon({ + className: 'plugin-portal-level-numbers', + iconAnchor: [6,7], + iconSize: [12,10], + html: levelNumber + }), + guid: guid + }); + + plugin.portalLevelNumbers.levelLayers[guid] = level; + level.addTo(plugin.portalLevelNumbers.levelLayerGroup); +} + +window.plugin.portalLevelNumbers.removeLevel = function(guid) { + var previousLayer = plugin.portalLevelNumbers.levelLayers[guid]; + if(previousLayer) { + plugin.portalLevelNumbers.levelLayerGroup.removeLayer(previousLayer); + delete plugin.portalLevelNumbers.levelLayers[guid]; + } +} + +var setup = function() { + $("";return m.insertBefore(c.lastChild,m.firstChild)}function o(){var a=d.elements;return"string"==typeof a?a.split(" "):a}function n(a){var b=t[a[u]];b||(b={},p++,a[u]=p,t[p]=b);return b}function v(a,b,c){b||(b=f);if(e)return b.createElement(a);c||(c=n(b));b=c.cache[a]?c.cache[a].cloneNode():y.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a); +return b.canHaveChildren&&!z.test(a)?c.frag.appendChild(b):b}function A(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();a.createElement=function(c){return!d.shivMethods?b.createElem(c):v(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+o().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(d,b.frag)} +function w(a){a||(a=f);var b=n(a);if(d.shivCSS&&!q&&!b.hasCSS)b.hasCSS=!!s(a,"article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}");e||A(a,b);return a}function B(a){for(var b,c=a.attributes,m=c.length,f=a.ownerDocument.createElement(l+":"+a.nodeName);m--;)b=c[m],b.specified&&f.setAttribute(b.nodeName,b.nodeValue);f.style.cssText=a.style.cssText;return f}function x(a){function b(){clearTimeout(d._removeSheetTimer);c&&c.removeNode(!0); +c=null}var c,f,d=n(a),e=a.namespaces,j=a.parentWindow;if(!C||a.printShived)return a;"undefined"==typeof e[l]&&e.add(l);j.attachEvent("onbeforeprint",function(){b();var g,i,d;d=a.styleSheets;for(var e=[],h=d.length,k=Array(h);h--;)k[h]=d[h];for(;d=k.pop();)if(!d.disabled&&D.test(d.media)){try{g=d.imports,i=g.length}catch(j){i=0}for(h=0;h+~])("+o().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"); +for(k="$1"+l+"\\:$2";i--;)e=g[i]=g[i].split("}"),e[e.length-1]=e[e.length-1].replace(h,k),g[i]=e.join("}");e=g.join("{");i=a.getElementsByTagName("*");h=i.length;k=RegExp("^(?:"+o().join("|")+")$","i");for(d=[];h--;)g=i[h],k.test(g.nodeName)&&d.push(g.applyElement(B(g)));f=d;c=s(a,e)});j.attachEvent("onafterprint",function(){for(var a=f,c=a.length;c--;)a[c].removeNode();clearTimeout(d._removeSheetTimer);d._removeSheetTimer=setTimeout(b,500)});a.printShived=!0;return a}var r=j.html5||{},z=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, +y=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q,u="_html5shiv",p=0,t={},e;(function(){try{var a=f.createElement("a");a.innerHTML="";q="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}e=b}catch(d){e=q=!0}})();var d={elements:r.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video", +version:"3.6.2",shivCSS:!1!==r.shivCSS,supportsUnknownElements:e,shivMethods:!1!==r.shivMethods,type:"default",shivDocument:w,createElement:v,createDocumentFragment:function(a,b){a||(a=f);if(e)return a.createDocumentFragment();for(var b=b||n(a),c=b.frag.cloneNode(),d=0,j=o(),l=j.length;darticle,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}"; +c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| +"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); +for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d From 3268ef04fbc9307062dc2e58a196515f9239baa2 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 04:39:29 +0100 Subject: [PATCH 22/34] website - fix tracking for desktop downloads - didn't test it --- website/page/code/desktop-download.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/website/page/code/desktop-download.php b/website/page/code/desktop-download.php index 8da7750c..9845d07e 100644 --- a/website/page/code/desktop-download.php +++ b/website/page/code/desktop-download.php @@ -3,18 +3,18 @@ include_once ( "userscript.php" ); -function iitcDesktopDownload ( $path ) +function iitcDesktopDownload ( $build ) { - $iitc_details = loadUserScriptHeader ( "$path/total-conversion-build.user.js" ); + $iitc_details = loadUserScriptHeader ( "$build/total-conversion-build.user.js" ); $iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $iitc_details['@version'] ); print "

IITC version $iitc_version

\n"; - print "Download\n"; + print "Download\n"; } -function iitcDesktopPluginDownloadTable ( $path ) +function iitcDesktopPluginDownloadTable ( $build ) { ?> @@ -29,7 +29,7 @@ function iitcDesktopPluginDownloadTable ( $path ) $name"; print ""; print ""; - print ""; - -# print "".$details['@name']."$name - version ".$details['@version'].":
\n"; -# print $details['@description']; - + print ""; print "\n"; } From 46cc5a6adce7aefa47a9d23f0a71f0f6dcd95951 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 04:47:36 +0100 Subject: [PATCH 23/34] bump version number in preperation of next release (and partly to confirm automated build system is working) --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 3bebd816..fa632d44 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@jonatkins // @name IITC: Ingress intel map total conversion -// @version 0.11.2.@@DATETIMEVERSION@@ +// @version 0.11.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ From ec7d18232a6e06e851b55edeea24a005489f4038 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 16:31:01 +0100 Subject: [PATCH 24/34] add ApkParser - from https://github.com/tufanbarisyildirim/php-apk-parser --- website/page/code/apk/ApkParser.php | 76 +++++ .../page/code/apk/lib/ApkAndroidPlatform.php | 47 +++ website/page/code/apk/lib/ApkArchive.php | 117 ++++++++ website/page/code/apk/lib/ApkManifest.php | 269 ++++++++++++++++++ .../code/apk/lib/ApkManifestXmlElement.php | 22 ++ website/page/code/apk/lib/ApkStream.php | 88 ++++++ website/page/code/apk/lib/ApkXml.php | 5 + website/page/code/apk/lib/ApkXmlParser.php | 181 ++++++++++++ 8 files changed, 805 insertions(+) create mode 100644 website/page/code/apk/ApkParser.php create mode 100644 website/page/code/apk/lib/ApkAndroidPlatform.php create mode 100644 website/page/code/apk/lib/ApkArchive.php create mode 100644 website/page/code/apk/lib/ApkManifest.php create mode 100644 website/page/code/apk/lib/ApkManifestXmlElement.php create mode 100644 website/page/code/apk/lib/ApkStream.php create mode 100644 website/page/code/apk/lib/ApkXml.php create mode 100644 website/page/code/apk/lib/ApkXmlParser.php diff --git a/website/page/code/apk/ApkParser.php b/website/page/code/apk/ApkParser.php new file mode 100644 index 00000000..4f57de33 --- /dev/null +++ b/website/page/code/apk/ApkParser.php @@ -0,0 +1,76 @@ +apk = new ApkArchive($apkFile); + $this->manifest = new ApkManifest(new ApkXmlParser($this->apk->getManifestStream())); + } + + /** + * Get Manifest Object + * @return ApkManifest + */ + public function getManifest() + { + return $this->manifest; + } + + /** + * Get the apk. Zip handler. + * - Extract all(or sp. entries) files, + * - add file, + * - recompress + * - and other ZipArchive features. + * + * @return ApkArchive + */ + public function getApkArchive() + { + return $this->apk; + } + + /** + * Extract apk content directly + * + * @param mixed $destination + * @param array $entries + * @return bool + */ + public function extractTo($destination,$entries = NULL) + { + return $this->apk->extractTo($destination,$entries); + } +} \ No newline at end of file diff --git a/website/page/code/apk/lib/ApkAndroidPlatform.php b/website/page/code/apk/lib/ApkAndroidPlatform.php new file mode 100644 index 00000000..c696ec3d --- /dev/null +++ b/website/page/code/apk/lib/ApkAndroidPlatform.php @@ -0,0 +1,47 @@ + array('name' => 'Android 1.1 Platfrom'), + 3 => array('name' => 'Android 1.5 Platfrom'), + 4 => array('name' => 'Android 1.6 Platfrom'), + 5 => array('name' => 'Android 2.0 Platfrom'), + 6 => array('name' => 'Android 2.0.1 Platfrom'), + 7 => array('name' => 'Android 2.1 Platfrom'), + 8 => array('name' => 'Android 2.2 Platfrom'), + 9 => array('name' => 'Android 2.3 Platfrom'), + 10 => array('name' => 'Android 2.3.3 Platfrom'), + 10 => array('name' => 'Android 2.3.3 / 2.3.4 Platfroms'), + 11 => array('name' => 'Android 3.0 Platfroms'), + 12 => array('name' => 'Android 3.1 Platfroms'), + 13 => array('name' => 'Android 3.2 Platfroms'), + 14 => array('name' => 'Android 4.0 Platfroms'), + 14 => array('name' => 'Android 4.0.3 Platfroms'), + ); + + public function __construct($apiLevel) + { + $this->level = $apiLevel; + $this->platform = $this->getPlatform(); + } + + /** + * @return array + */ + public function getPlatform() + { + if(!isset(self::$platforms[$this->level])) + throw new Exception("Unknown api level."); + + $platform = self::$platforms[$this->level]; + $platform['level'] = $this->level; + return $platform; + } + +} \ No newline at end of file diff --git a/website/page/code/apk/lib/ApkArchive.php b/website/page/code/apk/lib/ApkArchive.php new file mode 100644 index 00000000..7be663f4 --- /dev/null +++ b/website/page/code/apk/lib/ApkArchive.php @@ -0,0 +1,117 @@ +getResource('file_name'), or getIcon() directly. + * @todo Override the // extractTo() method. Rewrite all of XML files converted from Binary Xml to text based XML! + */ + class ApkArchive extends ZipArchive + { + /** + * @var string + */ + private $filePath; + + /** + * @var string + */ + private $fileName; + + + public function __construct($file = false) + { + if($file && is_file($file)) + { + $this->open($file); + $this->fileName = basename($this->filePath = $file); + } + else + throw new Exception($file . " not a regular file"); + + } + + /** + * Get a file from apk Archive by name. + * + * @param string $name + * @param int $length + * @param int $flags + * @return mixed + */ + public function getFromName($name,$length = NULL,$flags = NULL) + { + if(strtolower(substr($name,-4)) == '.xml') + { + $xmlParser = new ApkXmlParser(new ApkStream($this->getStream($name))); + return $xmlParser->getXmlString(); + } + else + return parent::getFromName($name,$length,$flags); + } + + /** + * Returns an ApkStream whick contains AndroidManifest.xml + * @return ApkStream + */ + public function getManifestStream() + { + return new ApkStream($this->getStream('AndroidManifest.xml')); + } + + /** + * Apk file path. + * @return string + */ + public function getApkPath() + { + return $this->filePath; + } + + /** + * Apk file name + * @return string + */ + public function getApkName() + { + return $this->fileName; + } + + + public function extractTo($destination,$entries = NULL) + { + if($extResult = parent::extractTo($destination,$entries)) + { + //TODO: ApkXmlParser can not parse the main.xml and others! only AndroidManifest.xml + //return $extResult; + + $xmlFiles = $this->glob_recursive($destination . '/*.xml'); + + + foreach($xmlFiles as $xmlFile) + { + // TODO : Remove this ifcheck , if ApkXml can parse! amk! + if($xmlFile == "AndroidManifest.xml") + ApkXmlParser::decompressFile($xmlFile); + } + } + + return $extResult; + + } + + // Can Move to the Utils(???) class. + private function glob_recursive($pattern, $flags = 0) + { + $files = glob($pattern, $flags); + + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) + { + $files = array_merge($files, $this->glob_recursive($dir.'/'.basename($pattern), $flags)); + } + + return $files; + } + + } diff --git a/website/page/code/apk/lib/ApkManifest.php b/website/page/code/apk/lib/ApkManifest.php new file mode 100644 index 00000000..1b070dc1 --- /dev/null +++ b/website/page/code/apk/lib/ApkManifest.php @@ -0,0 +1,269 @@ +xmlParser = $xmlParser; + } + + /** + * Returns ManifestXml as a String. + * @return string + */ + public function getXmlString() + { + return $this->xmlParser->getXmlString(); + } + + /** + * Get Application Permissions + * @return array + */ + public function getPermissions() + { + return $this->getXmlObject()->getPermissions(); + } + + /** + * Android Package Name + * @return string + */ + public function getPackageName() + { + return $this->getAttribute('package'); + } + + /** + * Application Version Name + * @return string + */ + public function getVersionName() + { + return $this->getAttribute('versionName'); + } + + /** + * Application Version Code + * @return mixed + */ + public function getVersionCode() + { + return hexdec( $this->getAttribute('versionCode') ); + } + + /** + * @return bool + */ + public function isDebuggable() + { + return (bool)$this->getAttribute('debuggable'); + } + + /** + * The minimum API Level required for the application to run. + * @return int + */ + public function getMinSdkLevel() + { + $xmlObj = $this->getXmlObject(); + $usesSdk = get_object_vars($xmlObj->{'uses-sdk'}); + return hexdec($usesSdk['@attributes']['minSdkVersion']); + } + + private function getAttribute($attributeName) + { + if($this->attrs === NULL) + { + $xmlObj = $this->getXmlObject(); + $vars = get_object_vars($xmlObj->attributes()); + $this->attrs = $vars['@attributes']; + } + + if(!isset($this->attrs[$attributeName])) + throw new Exception("Attribute not found : " . $attributeName); + + return $this->attrs[$attributeName]; + } + + /** + * More Information About The minimum API Level required for the application to run. + * @return ApkAndroidPlatform + */ + public function getMinSdk() + { + return new ApkAndroidPlatform($this->getMinSdkLevel()); + } + + /** + * get SimleXmlElement created from AndroidManifest.xml + * + * @param mixed $className + * @return ApkManifestXmlElement + */ + public function getXmlObject($className = 'ApkManifestXmlElement') + { + return $this->xmlParser->getXmlObject($className); + } + + /** + * Basicly string casting method. + */ + public function __toString() + { + return $this->getXmlString(); + } + + /** + * Android Permissions list + * @see http://developer.android.com/reference/android/Manifest.permission.html + * + * @todo: Move to {lang}_perms.php file, for easly translations. + * @var mixed + */ + public static $permissions = array( + 'ACCESS_CHECKIN_PROPERTIES' => 'Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded.', + 'ACCESS_COARSE_LOCATION' => 'Allows an application to access coarse (e.g., Cell-ID, WiFi) location', + 'ACCESS_FINE_LOCATION' => 'Allows an application to access fine (e.g., GPS) location', + 'ACCESS_LOCATION_EXTRA_COMMANDS' => 'Allows an application to access extra location provider commands', + 'ACCESS_MOCK_LOCATION' => 'Allows an application to create mock location providers for testing', + 'ACCESS_NETWORK_STATE' => 'Allows applications to access information about networks', + 'ACCESS_SURFACE_FLINGER' => 'Allows an application to use SurfaceFlinger\'s low level features', + 'ACCESS_WIFI_STATE' => 'Allows applications to access information about Wi-Fi networks', + 'ACCOUNT_MANAGER' => 'Allows applications to call into AccountAuthenticators.', + 'ADD_VOICEMAIL' => 'Allows an application to add voicemails into the system.', + 'AUTHENTICATE_ACCOUNTS' => 'Allows an application to act as an AccountAuthenticator for the AccountManager', + 'BATTERY_STATS' => 'Allows an application to collect battery statistics', + 'BIND_APPWIDGET' => 'Allows an application to tell the AppWidget service which application can access AppWidget\'s data.', + 'BIND_DEVICE_ADMIN' => 'Must be required by device administration receiver, to ensure that only the system can interact with it.', + 'BIND_INPUT_METHOD' => 'Must be required by an InputMethodService, to ensure that only the system can bind to it.', + 'BIND_REMOTEVIEWS' => 'Must be required by a RemoteViewsService, to ensure that only the system can bind to it.', + 'BIND_TEXT_SERVICE' => 'Must be required by a TextService (e.g.', + 'BIND_VPN_SERVICE' => 'Must be required by an VpnService, to ensure that only the system can bind to it.', + 'BIND_WALLPAPER' => 'Must be required by a WallpaperService, to ensure that only the system can bind to it.', + 'BLUETOOTH' => 'Allows applications to connect to paired bluetooth devices', + 'BLUETOOTH_ADMIN' => 'Allows applications to discover and pair bluetooth devices', + 'BRICK' => 'Required to be able to disable the device (very dangerous!).', + 'BROADCAST_PACKAGE_REMOVED' => 'Allows an application to broadcast a notification that an application package has been removed.', + 'BROADCAST_SMS' => 'Allows an application to broadcast an SMS receipt notification', + 'BROADCAST_STICKY' => 'Allows an application to broadcast sticky intents.', + 'BROADCAST_WAP_PUSH' => 'Allows an application to broadcast a WAP PUSH receipt notification', + 'CALL_PHONE' => 'Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.', + 'CALL_PRIVILEGED' => 'Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed.', + 'CAMERA' => 'Required to be able to access the camera device.', + 'CHANGE_COMPONENT_ENABLED_STATE' => 'Allows an application to change whether an application component (other than its own) is enabled or not.', + 'CHANGE_CONFIGURATION' => 'Allows an application to modify the current configuration, such as locale.', + 'CHANGE_NETWORK_STATE' => 'Allows applications to change network connectivity state', + 'CHANGE_WIFI_MULTICAST_STATE' => 'Allows applications to enter Wi-Fi Multicast mode', + 'CHANGE_WIFI_STATE' => 'Allows applications to change Wi-Fi connectivity state', + 'CLEAR_APP_CACHE' => 'Allows an application to clear the caches of all installed applications on the device.', + 'CLEAR_APP_USER_DATA' => 'Allows an application to clear user data', + 'CONTROL_LOCATION_UPDATES' => 'Allows enabling/disabling location update notifications from the radio.', + 'DELETE_CACHE_FILES' => 'Allows an application to delete cache files.', + 'DELETE_PACKAGES' => 'Allows an application to delete packages.', + 'DEVICE_POWER' => 'Allows low-level access to power management', + 'DIAGNOSTIC' => 'Allows applications to RW to diagnostic resources.', + 'DISABLE_KEYGUARD' => 'Allows applications to disable the keyguard', + 'DUMP' => 'Allows an application to retrieve state dump information from system services.', + 'EXPAND_STATUS_BAR' => 'Allows an application to expand or collapse the status bar.', + 'FACTORY_TEST' => 'Run as a manufacturer test application, running as the root user.', + 'FLASHLIGHT' => 'Allows access to the flashlight', + 'FORCE_BACK' => 'Allows an application to force a BACK operation on whatever is the top activity.', + 'GET_ACCOUNTS' => 'Allows access to the list of accounts in the Accounts Service', + 'GET_PACKAGE_SIZE' => 'Allows an application to find out the space used by any package.', + 'GET_TASKS' => 'Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.', + 'GLOBAL_SEARCH' => 'This permission can be used on content providers to allow the global search system to access their data.', + 'HARDWARE_TEST' => 'Allows access to hardware peripherals.', + 'INJECT_EVENTS' => 'Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.', + 'INSTALL_LOCATION_PROVIDER' => 'Allows an application to install a location provider into the Location Manager', + 'INSTALL_PACKAGES' => 'Allows an application to install packages.', + 'INTERNAL_SYSTEM_WINDOW' => 'Allows an application to open windows that are for use by parts of the system user interface.', + 'INTERNET' => 'Allows applications to open network sockets.', + 'KILL_BACKGROUND_PROCESSES' => 'Allows an application to call killBackgroundProcesses(String).', + 'MANAGE_ACCOUNTS' => 'Allows an application to manage the list of accounts in the AccountManager', + 'MANAGE_APP_TOKENS' => 'Allows an application to manage (create, destroy, Z-order) application tokens in the window manager.', + 'MASTER_CLEAR' => '', + 'MODIFY_AUDIO_SETTINGS' => 'Allows an application to modify global audio settings', + 'MODIFY_PHONE_STATE' => 'Allows modification of the telephony state - power on, mmi, etc.', + 'MOUNT_FORMAT_FILESYSTEMS' => 'Allows formatting file systems for removable storage.', + 'MOUNT_UNMOUNT_FILESYSTEMS' => 'Allows mounting and unmounting file systems for removable storage.', + 'NFC' => 'Allows applications to perform I/O operations over NFC', + 'PERSISTENT_ACTIVITY' => 'This constant is deprecated. This functionality will be removed in the future; please do not use. Allow an application to make its activities persistent.', + 'PROCESS_OUTGOING_CALLS' => 'Allows an application to monitor, modify, or abort outgoing calls.', + 'READ_CALENDAR' => 'Allows an application to read the user\'s calendar data.', + 'READ_CONTACTS' => 'Allows an application to read the user\'s contacts data.', + 'READ_FRAME_BUFFER' => 'Allows an application to take screen shots and more generally get access to the frame buffer data', + 'READ_HISTORY_BOOKMARKS' => 'Allows an application to read (but not write) the user\'s browsing history and bookmarks.', + 'READ_INPUT_STATE' => 'Allows an application to retrieve the current state of keys and switches.', + 'READ_LOGS' => 'Allows an application to read the low-level system log files.', + 'READ_PHONE_STATE' => 'Allows read only access to phone state.', + 'READ_PROFILE' => 'Allows an application to read the user\'s personal profile data.', + 'READ_SMS' => 'Allows an application to read SMS messages.', + 'READ_SOCIAL_STREAM' => 'Allows an application to read from the user\'s social stream.', + 'READ_SYNC_SETTINGS' => 'Allows applications to read the sync settings', + 'READ_SYNC_STATS' => 'Allows applications to read the sync stats', + 'REBOOT' => 'Required to be able to reboot the device.', + 'RECEIVE_BOOT_COMPLETED' => 'Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting.', + 'RECEIVE_MMS' => 'Allows an application to monitor incoming MMS messages, to record or perform processing on them.', + 'RECEIVE_SMS' => 'Allows an application to monitor incoming SMS messages, to record or perform processing on them.', + 'RECEIVE_WAP_PUSH' => 'Allows an application to monitor incoming WAP push messages.', + 'RECORD_AUDIO' => 'Allows an application to record audio', + 'REORDER_TASKS' => 'Allows an application to change the Z-order of tasks', + 'RESTART_PACKAGES' => 'This constant is deprecated. The restartPackage(String) API is no longer supported.', + 'SEND_SMS' => 'Allows an application to send SMS messages.', + 'SET_ACTIVITY_WATCHER' => 'Allows an application to watch and control how activities are started globally in the system.', + 'SET_ALARM' => 'Allows an application to broadcast an Intent to set an alarm for the user.', + 'SET_ALWAYS_FINISH' => 'Allows an application to control whether activities are immediately finished when put in the background.', + 'SET_ANIMATION_SCALE' => 'Modify the global animation scaling factor.', + 'SET_DEBUG_APP' => 'Configure an application for debugging.', + 'SET_ORIENTATION' => 'Allows low-level access to setting the orientation (actually rotation) of the screen.', + 'SET_POINTER_SPEED' => 'Allows low-level access to setting the pointer speed.', + 'SET_PREFERRED_APPLICATIONS' => 'This constant is deprecated. No longer useful, see addPackageToPreferred(String) for details.', + 'SET_PROCESS_LIMIT' => 'Allows an application to set the maximum number of (not needed) application processes that can be running.', + 'SET_TIME' => 'Allows applications to set the system time', + 'SET_TIME_ZONE' => 'Allows applications to set the system time zone', + 'SET_WALLPAPER' => 'Allows applications to set the wallpaper', + 'SET_WALLPAPER_HINTS' => 'Allows applications to set the wallpaper hints', + 'SIGNAL_PERSISTENT_PROCESSES' => 'Allow an application to request that a signal be sent to all persistent processes', + 'STATUS_BAR' => 'Allows an application to open, close, or disable the status bar and its icons.', + 'SUBSCRIBED_FEEDS_READ' => 'Allows an application to allow access the subscribed feeds ContentProvider.', + 'SUBSCRIBED_FEEDS_WRITE' => '', + 'SYSTEM_ALERT_WINDOW' => 'Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications.', + 'UPDATE_DEVICE_STATS' => 'Allows an application to update device statistics.', + 'USE_CREDENTIALS' => 'Allows an application to request authtokens from the AccountManager', + 'USE_SIP' => 'Allows an application to use SIP service', + 'VIBRATE' => 'Allows access to the vibrator', + 'WAKE_LOCK' => 'Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming', + 'WRITE_APN_SETTINGS' => 'Allows applications to write the apn settings', + 'WRITE_CALENDAR' => 'Allows an application to write (but not read) the user\'s calendar data.', + 'WRITE_CONTACTS' => 'Allows an application to write (but not read) the user\'s contacts data.', + 'WRITE_EXTERNAL_STORAGE' => 'Allows an application to write to external storage', + 'WRITE_GSERVICES' => 'Allows an application to modify the Google service map.', + 'WRITE_HISTORY_BOOKMARKS' => 'Allows an application to write (but not read) the user\'s browsing history and bookmarks.', + 'WRITE_PROFILE' => 'Allows an application to write (but not read) the user\'s personal profile data.', + 'WRITE_SECURE_SETTINGS' => 'Allows an application to read or write the secure system settings.', + 'WRITE_SETTINGS' => 'Allows an application to read or write the system settings.', + 'WRITE_SMS' => 'Allows an application to write SMS messages.', + 'WRITE_SOCIAL_STREAM' => 'Allows an application to write (but not read) the user\'s social stream data.', + 'WRITE_SYNC_SETTINGS' => 'Allows applications to write the sync settings' + ); +} \ No newline at end of file diff --git a/website/page/code/apk/lib/ApkManifestXmlElement.php b/website/page/code/apk/lib/ApkManifestXmlElement.php new file mode 100644 index 00000000..c8a0f9af --- /dev/null +++ b/website/page/code/apk/lib/ApkManifestXmlElement.php @@ -0,0 +1,22 @@ +{'uses-permission'}; + + $perms = array(); + foreach($permsArray as $perm) + { + $permAttr = get_object_vars($perm); + $objNotationArray = explode('.',$permAttr['@attributes']['name']); + $permName = trim(end($objNotationArray)); + $perms[$permName] = ApkManifest::$permissions[$permName]; + } + + return $perms; + } + } diff --git a/website/page/code/apk/lib/ApkStream.php b/website/page/code/apk/lib/ApkStream.php new file mode 100644 index 00000000..a1df19ce --- /dev/null +++ b/website/page/code/apk/lib/ApkStream.php @@ -0,0 +1,88 @@ +stream = $stream; + } + + /** + * Read the next character from stream. + * + * @param mixed $length + */ + public function read($length = 1) + { + return fread($this->stream,$length); + } + + /** + * check if end of filestream + */ + public function feof() + { + return feof($this->stream); + } + + /** + * Jump to the index! + * @param int $offset + */ + public function seek($offset) + { + fseek($this->stream,$offset); + } + + /** + * Close the stream + */ + public function close() + { + fclose($this->stream); + } + + /** + * Read the next byte + * @return byte + */ + public function readByte() + { + return ord($this->read()); + } + + /** + * fetch the remaining byte into an array + * + * @param mixed $count Byte length. + * @return array + */ + public function getByteArray($count = null) + { + $bytes = array(); + + while(!$this->feof() && ($count === null || count($bytes) < $count)) + $bytes[] = $this->readByte(); + + return $bytes; + } + } + diff --git a/website/page/code/apk/lib/ApkXml.php b/website/page/code/apk/lib/ApkXml.php new file mode 100644 index 00000000..2c7f6a8a --- /dev/null +++ b/website/page/code/apk/lib/ApkXml.php @@ -0,0 +1,5 @@ +\r\n"; + private $bytes = array(); + private $ready = false; + + public static $indent_spaces = " "; + + /** + * Store the SimpleXmlElement object + * @var SimpleXmlElement + */ + private $xmlObject = NULL; + + + public function __construct(ApkStream $apkStream) + { + $this->bytes = $apkStream->getByteArray(); + } + + public static function decompressFile($file,$destination = NULL) + { + if(!is_file($file)) + throw new Exception("{$file} is not a regular file"); + + $parser = new self(new ApkStream(fopen($file,'rd'))); + //TODO : write a method in this class, ->saveToFile(); + file_put_contents($destination === NULL ? $file : $destination,$parser->getXmlString()); + } + + public function decompress() + { + $numbStrings = $this->littleEndianWord($this->bytes, 4*4); + $sitOff = 0x24; + $stOff = $sitOff + $numbStrings * 4; + $this->bytesTagOff = $this->littleEndianWord($this->bytes, 3*4); + + for ($ii = $this->bytesTagOff; $ii < count($this->bytes) - 4; $ii += 4): + if ($this->littleEndianWord($this->bytes, $ii) == self::START_TAG) : + $this->bytesTagOff = $ii; + break; + endif; + endfor; + + + + $off = $this->bytesTagOff; + $indentCount = 0; + $startTagLineNo = -2; + + while ($off < count($this->bytes)) + { + $currentTag = $this->littleEndianWord($this->bytes, $off); + $lineNo = $this->littleEndianWord($this->bytes, $off + 2*4); + $nameNsSi = $this->littleEndianWord($this->bytes, $off + 4*4); + $nameSi = $this->littleEndianWord($this->bytes, $off + 5*4); + + + switch($currentTag) + { + case self::START_TAG: + { + $tagSix = $this->littleEndianWord($this->bytes, $off + 6*4); + $numbAttrs = $this->littleEndianWord($this->bytes, $off + 7*4); + $off += 9*4; + $tagName = $this->compXmlString($this->bytes, $sitOff, $stOff, $nameSi); + $startTagLineNo = $lineNo; + $attr_string = ""; + + for ($ii=0; $ii < $numbAttrs; $ii++) + { + $attrNameNsSi = $this->littleEndianWord($this->bytes, $off); + $attrNameSi = $this->littleEndianWord($this->bytes, $off + 1*4); + $attrValueSi = $this->littleEndianWord($this->bytes, $off + 2*4); + $attrFlags = $this->littleEndianWord($this->bytes, $off + 3*4); + $attrResId = $this->littleEndianWord($this->bytes, $off + 4*4); + $off += 5*4; + + $attrName = $this->compXmlString($this->bytes, $sitOff, $stOff, $attrNameSi); + if($attrValueSi != 0xffffffff) + $attrValue = $this->compXmlString($this->bytes, $sitOff, $stOff, $attrValueSi); + else + $attrValue = "0x" . dechex($attrResId); + + $attr_string .= " " . $attrName . "=\"" . $attrValue . "\""; + + } + + $this->appendXmlIndent($indentCount, "<". $tagName . $attr_string . ">"); + $indentCount++; + } + break; + + case self::END_TAG: + { + $indentCount--; + $off += 6*4; + $tagName = $this->compXmlString($this->bytes, $sitOff, $stOff, $nameSi); + $this->appendXmlIndent($indentCount, ""); + } + break; + + case self::END_DOC_TAG: + { + $this->ready = true; + break 2; + } + break; + + default: + throw new Exception("Unrecognized tag code '" . dechex($currentTag) . "' at offset " . $off); + break; + } + + + } + + } + + public function compXmlString($xml, $sitOff, $stOff, $str_index) + { + if ($str_index < 0) + return null; + + $strOff = $stOff + $this->littleEndianWord($xml, $sitOff + $str_index * 4); + return $this->compXmlStringAt($xml, $strOff); + } + + public function appendXmlIndent($indent, $str) + { + $this->appendXml(substr(self::$indent_spaces,0, min($indent * 2, strlen(self::$indent_spaces))) . $str); + } + + public function appendXml($str) + { + $this->xml .= $str ."\r\n"; + } + + public function compXmlStringAt($arr, $string_offset) + { + $strlen = $arr[$string_offset + 1] << 8 & 0xff00 | $arr[$string_offset] & 0xff; + $string = ""; + + for ($i=0; $i<$strlen; $i++) + $string .= chr($arr[$string_offset + 2 + $i * 2]); + + return $string; + } + + public function littleEndianWord($arr, $off) + { + return $arr[$off+3] << 24&0xff000000 | $arr[$off+2] << 16&0xff0000 | $arr[$off+1]<<8&0xff00 | $arr[$off]&0xFF; + } + + public function output() + { + echo $this->getXmlString(); + } + + public function getXmlString() + { + if(!$this->ready) + $this->decompress(); + return $this->xml; + } + + public function getXmlObject($className = 'SimpleXmlElement') + { + if($this->xmlObject === NULL || !$this->xmlObject instanceof $className) + $this->xmlObject = simplexml_load_string($this->getXmlString(),$className); + + return $this->xmlObject; + } + } From a9034f38321c652b9826cbaa7cd2de66d75d36fc Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 16:39:17 +0100 Subject: [PATCH 25/34] website - load mobile .apk version, and embedded IITC version, dynamically - ensures the data remains up to date, even for the 'test builds' page --- website/page/code/mobile-version.php | 32 +++++++++++++++++++++++++++ website/page/code/userscript.php | 9 +++++--- website/page/mobile.php | 33 ++++++++++++++++++++++++---- website/page/test.php | 28 +++++++++++++++++++++-- 4 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 website/page/code/mobile-version.php diff --git a/website/page/code/mobile-version.php b/website/page/code/mobile-version.php new file mode 100644 index 00000000..ffabba55 --- /dev/null +++ b/website/page/code/mobile-version.php @@ -0,0 +1,32 @@ +getManifest(); + + $result['apk_version'] = $manifest->getVersionName(); + + + $archive = $apkinfo->getApkArchive(); + $iitc_file = "assets/total-conversion-build.user.js"; + if ( $archive->statName ( $iitc_file ) === FALSE ); + $iitc_file = "assets/iitc.js"; + + $stream = $archive->getStream ( $iitc_file ); + + $header = loadUserScriptHeader ( $stream ); + + $result['iitc_version'] = $header['@version']; + + return $result; +} + +?> diff --git a/website/page/code/userscript.php b/website/page/code/userscript.php index 7fb570aa..c229df76 100644 --- a/website/page/code/userscript.php +++ b/website/page/code/userscript.php @@ -1,11 +1,14 @@ Download -

-IITC Mobile version 0.3 (with IITC version 0.11.2). -

+Download +include_once ( "code/mobile-version.php" ); +$apkfile = "mobile/IITC-Mobile-0.3.apk"; + + +if ( file_exists($apkfile) ) +{ + $version = getMobileVersion ( $apkfile ); + + $apk_version = $version['apk_version']; + $iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $version['iitc_version'] ); + + print "

IITC Mobile version $apk_version, with IITC version $iitc_version

\n"; + + print "

Download

\n"; + +} +else +{ + print "
Error: $apkfile not found
\n"; +} + +?> + + +
+As IITC Mobile is regularly updated, you may want to consider trying the latest +test build. +
diff --git a/website/page/test.php b/website/page/test.php index 565df00e..7126f67f 100644 --- a/website/page/test.php +++ b/website/page/test.php @@ -16,6 +16,7 @@ builds. include_once ( "code/desktop-download.php" ); + $path = "test"; if ( $_REQUEST['build'] == 'dev' ) @@ -57,7 +58,30 @@ iitcDesktopPluginDownloadTable ( $path );

Mobile test build

-

IITC Mobile version informpation - not currently available for test builds

+.\2', $version['iitc_version'] ); + + print "

IITC Mobile version $apk_version, with IITC version $iitc_version

\n"; + + print "Download\n"; + +} +else +{ + print "
Error: $apkfile not found
\n"; +} + +?> + -Download From 145163f0dea7b9f01bb9ef9330c85ae50c63f350 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 17:01:45 +0100 Subject: [PATCH 26/34] possible fix for #221 --- mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java index 884076b8..fe189ab8 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java @@ -172,7 +172,7 @@ public class IITC_WebViewClient extends WebViewClient { // start non-ingress-intel-urls in another app... @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (url.contains("ingress.com")) { + if (url.contains("ingress.com") || url.contains("appengine.google.com")) { // reload iitc if a poslink is clicked inside the app if (url.contains("intel?ll=") || (url.contains("latE6") && url.contains("lngE6"))) { Log.d("iitcm", "should be an internal clicked position link...reload script for: " + url); From e4db5ce340a9b16ef8abb36f771e52a75e40acf3 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 18:38:50 +0100 Subject: [PATCH 27/34] add absoluteurl - http://sourceforge.net/projects/absoluteurl/ --- website/page/code/url/CHANGELOG.txt | 24 ++ website/page/code/url/README.txt | 26 ++ website/page/code/url/url_to_absolute.php | 485 ++++++++++++++++++++++ 3 files changed, 535 insertions(+) create mode 100644 website/page/code/url/CHANGELOG.txt create mode 100644 website/page/code/url/README.txt create mode 100644 website/page/code/url/url_to_absolute.php diff --git a/website/page/code/url/CHANGELOG.txt b/website/page/code/url/CHANGELOG.txt new file mode 100644 index 00000000..cb7d743f --- /dev/null +++ b/website/page/code/url/CHANGELOG.txt @@ -0,0 +1,24 @@ +Changelog +--------- + +absoluteurl v1.6, March 12, 2010 +--------------------------------- +- added encode_url function to convert an absolute url to its percentage + encoded equivalent, according to RFC 3986 + +absoluteurl v1.5, March 11, 2010 +--------------------------------- +- fixed to allow spaces in the path of url + +absoluteurl v1.4, October 2, 2009 +---------------------------------------------- +- Percentage encoding of the absolute url disabled. + +absoluteurl v1.2, 2009-02-27 +----------------------------------------------- +- Minor bug fix + + +absoluteurl v1.0, 2009-08-28 +---------------------------------------- +- Initial release \ No newline at end of file diff --git a/website/page/code/url/README.txt b/website/page/code/url/README.txt new file mode 100644 index 00000000..35f9c8d2 --- /dev/null +++ b/website/page/code/url/README.txt @@ -0,0 +1,26 @@ +absoluteurl +--------------------- + +This script converts the relative url to absolute url, provided a base url. + + +For more, look here: http://publicmind.in/blog/urltoabsolute + +Usage: +---------- + +Extract the script (url_to_absolute.php) into your web directory, include it into your current php file using: + +require(path-to-file); + +then, you can convert the relative url to absolute url by calling: + +url_to_absolute( $baseUrl, $relativeUrl); + +It return false on failure, otherwise returns the absolute url. If the $relativeUrl is a valid absolute url, it is returned without any modification. + +Author/credits +----------- + +1) Original author: David R. Nadeau, NadeauSoftware.com +2) Edited and maintained by: Nitin Kr, Gupta, publicmind.in \ No newline at end of file diff --git a/website/page/code/url/url_to_absolute.php b/website/page/code/url/url_to_absolute.php new file mode 100644 index 00000000..c6df5c24 --- /dev/null +++ b/website/page/code/url/url_to_absolute.php @@ -0,0 +1,485 @@ + '!%3A!ui', + "/" => '!%2F!ui', + "?" => '!%3F!ui', + "#" => '!%23!ui', + "[" => '!%5B!ui', + "]" => '!%5D!ui', + "@" => '!%40!ui', + "!" => '!%21!ui', + "$" => '!%24!ui', + "&" => '!%26!ui', + "'" => '!%27!ui', + "(" => '!%28!ui', + ")" => '!%29!ui', + "*" => '!%2A!ui', + "+" => '!%2B!ui', + "," => '!%2C!ui', + ";" => '!%3B!ui', + "=" => '!%3D!ui', + "%" => '!%25!ui', + ); + + $url = rawurlencode($url); + $url = preg_replace(array_values($reserved), array_keys($reserved), $url); + return $url; +} + +?> \ No newline at end of file From 2986e5408f395afeef04caa0df6c4e695fe5d49f Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 18:52:54 +0100 Subject: [PATCH 28/34] rework mobile download links - add in QR code too --- website/page/code/mobile-download.php | 68 +++++++++++++++++++++++++++ website/page/code/mobile-version.php | 32 ------------- website/page/mobile.php | 12 +---- website/page/test.php | 14 ++---- 4 files changed, 74 insertions(+), 52 deletions(-) create mode 100644 website/page/code/mobile-download.php delete mode 100644 website/page/code/mobile-version.php diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php new file mode 100644 index 00000000..24393cb8 --- /dev/null +++ b/website/page/code/mobile-download.php @@ -0,0 +1,68 @@ +getManifest(); + + $result['apk_version'] = $manifest->getVersionName(); + + + $archive = $apkinfo->getApkArchive(); + $iitc_file = "assets/total-conversion-build.user.js"; + if ( $archive->statName ( $iitc_file ) === FALSE ); + $iitc_file = "assets/iitc.js"; + + $stream = $archive->getStream ( $iitc_file ); + + $header = loadUserScriptHeader ( $stream ); + + $result['iitc_version'] = $header['@version']; + + return $result; +} + +function iitcMobileDownload ( $apkfile ) +{ + + $version = getMobileVersion ( $apkfile ); + + $apk_version = $version['apk_version']; + $iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $version['iitc_version'] ); + + # we need an absolute link for the QR Code + # get the URL of this page itself + $pageurl = ($_SERVER['HTTPS'] ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + $apkurl = url_to_absolute ( $pageurl, $apkfile ); +?> + + +
+ +QR Code for download + +

+IITC Mobile version , with IITC version +

+ +

+Download or scan the QR Code +

+ +
+
+ + + diff --git a/website/page/code/mobile-version.php b/website/page/code/mobile-version.php deleted file mode 100644 index ffabba55..00000000 --- a/website/page/code/mobile-version.php +++ /dev/null @@ -1,32 +0,0 @@ -getManifest(); - - $result['apk_version'] = $manifest->getVersionName(); - - - $archive = $apkinfo->getApkArchive(); - $iitc_file = "assets/total-conversion-build.user.js"; - if ( $archive->statName ( $iitc_file ) === FALSE ); - $iitc_file = "assets/iitc.js"; - - $stream = $archive->getStream ( $iitc_file ); - - $header = loadUserScriptHeader ( $stream ); - - $result['iitc_version'] = $header['@version']; - - return $result; -} - -?> diff --git a/website/page/mobile.php b/website/page/mobile.php index 1941e49f..8b6c1bb3 100644 --- a/website/page/mobile.php +++ b/website/page/mobile.php @@ -38,22 +38,14 @@ IITC Mobile is still in the early stages of development. Many things do not yet .\2', $version['iitc_version'] ); - - print "

IITC Mobile version $apk_version, with IITC version $iitc_version

\n"; - - print "

Download

\n"; - + iitcMobileDownload ( $apkfile ); } else { diff --git a/website/page/test.php b/website/page/test.php index 7126f67f..e16a0f3b 100644 --- a/website/page/test.php +++ b/website/page/test.php @@ -60,27 +60,21 @@ iitcDesktopPluginDownloadTable ( $path ); .\2', $version['iitc_version'] ); - - print "

IITC Mobile version $apk_version, with IITC version $iitc_version

\n"; - - print "Download\n"; - + iitcMobileDownload ( $apkfile ); } else { print "
Error: $apkfile not found
\n"; } + ?> From cf3bf41daff7f16ff06b57713de3745b9b7c5f5c Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 18:58:22 +0100 Subject: [PATCH 29/34] website - oops - bad tag --- website/page/code/mobile-download.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php index 24393cb8..18eaeb6d 100644 --- a/website/page/code/mobile-download.php +++ b/website/page/code/mobile-download.php @@ -58,7 +58,7 @@ IITC Mobile version , with IITC version
-
+
Date: Tue, 30 Apr 2013 19:04:01 +0100 Subject: [PATCH 30/34] website - tracking mobile shouldn't always point to 'release' - use apk relative path --- website/page/code/mobile-download.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php index 18eaeb6d..9608bf1a 100644 --- a/website/page/code/mobile-download.php +++ b/website/page/code/mobile-download.php @@ -54,7 +54,7 @@ IITC Mobile version , with IITC version

-Download or scan the QR Code +Download or scan the QR Code

From c64c144a97a8609ea96d3a2003c64cc0b7918f1f Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 30 Apr 2013 19:10:42 +0100 Subject: [PATCH 31/34] website - i really should test things more... :-/ --- website/page/code/mobile-download.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php index 9608bf1a..9a15e8de 100644 --- a/website/page/code/mobile-download.php +++ b/website/page/code/mobile-download.php @@ -4,7 +4,7 @@ include_once ( "apk/ApkParser.php" ); include_once ( "url/url_to_absolute.php" ); include_once ( "userscript.php" ); -function getMobileVersion($apkfile) +function getMobileVersion ( $apkfile ) { $result = Array(); @@ -54,7 +54,7 @@ IITC Mobile version , with IITC version

-Download or scan the QR Code +Download or scan the QR Code

From 308459178df2fb2b9d313190f754107d2996cf5c Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 1 May 2013 01:57:02 +0100 Subject: [PATCH 32/34] improve refresh handling - increase timeout on zoom/move end to 0.8 seconds - prevent repeated refreshes faster than every 5 seconds - delay initial refresh on load - should prevent immediate refresh after page load fix #200 --- code/boot.js | 12 +++++++----- code/request_handling.js | 28 +++++++++++++++++++++++----- main.js | 4 +++- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/code/boot.js b/code/boot.js index 3fde7730..29b052cc 100644 --- a/code/boot.js +++ b/code/boot.js @@ -226,14 +226,16 @@ window.setupMap = function() { // update map hooks map.on('movestart zoomstart', window.requests.abort); - map.on('moveend zoomend', function() { window.startRefreshTimeout(500) }); - - // run once on init - window.requestData(); - window.startRefreshTimeout(); + map.on('moveend zoomend', function() { console.log('map moveend'); window.startRefreshTimeout(ON_MOVE_REFRESH*1000) }); window.addResumeFunction(window.requestData); window.requests.addRefreshFunction(window.requestData); + + // start the refresh process with a small timeout, so the first data request happens quickly + // (the code originally called the request function directly, and triggered a normal delay for the nxt refresh. + // however, the moveend/zoomend gets triggered on map load, causing a duplicate refresh. this helps prevent that + window.startRefreshTimeout(ON_MOVE_REFRESH*1000); + }; // renders player details into the website. Since the player info is diff --git a/code/request_handling.js b/code/request_handling.js index 6766fd5f..84617d54 100644 --- a/code/request_handling.js +++ b/code/request_handling.js @@ -8,6 +8,10 @@ window.failedRequestCount = 0; window.requests = function() {} +//time of last refresh +window.requests._lastRefreshTime = 0; +window.requests._quickRefreshPending = false; + window.requests.add = function(ajax) { window.activeRequests.push(ajax); renderUpdateStatus(); @@ -38,17 +42,19 @@ window.renderUpdateStatus = function() { if(mapRunsUserAction) t += 'paused during interaction'; else if(isIdle()) - t += 'Idle, not updating.'; + t += 'Idle, not updating.'; else if(window.activeRequests.length > 0) t += window.activeRequests.length + ' requests running.'; + else if(window.requests._quickRefreshPending) + t += 'refreshing...'; else t += 'Up to date.'; if(renderLimitReached()) - t += ' RENDER LIMIT ' + t += ' RENDER LIMIT ' if(window.failedRequestCount > 0) - t += ' ' + window.failedRequestCount + ' failed.' + t += ' ' + window.failedRequestCount + ' failed.' t += '
('; var minlvl = getMinPortalLevel(); @@ -78,19 +84,28 @@ window.startRefreshTimeout = function(override) { if(refreshTimeout) clearTimeout(refreshTimeout); var t = 0; if(override) { + window.requests._quickRefreshPending = true; t = override; + //ensure override can't cause too fast a refresh if repeatedly used (e.g. lots of scrolling/zooming) + timeSinceLastRefresh = new Date().getTime()-window.requests._lastRefreshTime; + if(timeSinceLastRefresh < 0) timeSinceLastRefresh = 0; //in case of clock adjustments + if(timeSinceLastRefresh < MINIMUM_OVERRIDE_REFRESH*1000) + t = (MINIMUM_OVERRIDE_REFRESH*1000-timeSinceLastRefresh); } else { + window.requests._quickRefreshPending = false; t = REFRESH*1000; var adj = ZOOM_LEVEL_ADJ * (18 - window.map.getZoom()); if(adj > 0) t += adj*1000; } var next = new Date(new Date().getTime() + t).toLocaleTimeString(); - console.log('planned refresh: ' + next); + console.log('planned refresh in ' + (t/1000) + ' seconds, at ' + next); refreshTimeout = setTimeout(window.requests._callOnRefreshFunctions, t); + renderUpdateStatus(); } window.requests._onRefreshFunctions = []; window.requests._callOnRefreshFunctions = function() { + console.log('running refresh at ' + new Date().toLocaleTimeString()); startRefreshTimeout(); if(isIdle()) { @@ -101,6 +116,9 @@ window.requests._callOnRefreshFunctions = function() { console.log('refreshing'); + //store the timestamp of this refresh + window.requests._lastRefreshTime = new Date().getTime(); + $.each(window.requests._onRefreshFunctions, function(ind, f) { f(); }); @@ -121,4 +139,4 @@ window.requests.isLastRequest = function(action) { } }); return result; -} \ No newline at end of file +} diff --git a/main.js b/main.js index 73ffe9d0..0431d98e 100644 --- a/main.js +++ b/main.js @@ -112,8 +112,10 @@ function wrapper() { L_PREFER_CANVAS = false; // CONFIG OPTIONS //////////////////////////////////////////////////// -window.REFRESH = 30; // refresh view every 30s (base time) +window.REFRESH = 60; // refresh view every 60s (base time) window.ZOOM_LEVEL_ADJ = 5; // add 5 seconds per zoom level +window.ON_MOVE_REFRESH = 0.8; //refresh time to use after a movement event +window.MINIMUM_OVERRIDE_REFRESH = 5; //limit on refresh time since previous refresh, limiting repeated move refresh rate window.REFRESH_GAME_SCORE = 5*60; // refresh game score every 5 minutes window.MAX_IDLE_TIME = 4; // stop updating map after 4min idling window.PRECACHE_PLAYER_NAMES_ZOOM = 17; // zoom level to start pre-resolving player names From 60dfd5d095a92d1c65b5110b5eed5c07cf0774a2 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 1 May 2013 04:12:10 +0100 Subject: [PATCH 33/34] fix tooltips on player tracker after disabling+enabling the layer fix #106 - inspired by pull request #146 --- plugins/player-tracker.user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/player-tracker.user.js b/plugins/player-tracker.user.js index c1b3f3db..561039bf 100644 --- a/plugins/player-tracker.user.js +++ b/plugins/player-tracker.user.js @@ -49,6 +49,14 @@ window.plugin.playerTracker.setup = function() { plugin.playerTracker.drawnTraces = new L.LayerGroup(); window.layerChooser.addOverlay(plugin.playerTracker.drawnTraces, 'Player Tracker'); map.addLayer(plugin.playerTracker.drawnTraces); + map.on('layeradd',function(obj) { + if(obj.layer === plugin.playerTracker.drawnTraces) + { + obj.layer.eachLayer(function(marker) { + if(marker._icon) window.setupTooltips($(marker._icon)); + }); + } + }); plugin.playerTracker.oms = new OverlappingMarkerSpiderfier(map); plugin.playerTracker.oms.legColors = {'usual': '#FFFF00', 'highlighted': '#FF0000'}; plugin.playerTracker.oms.legWeight = 3.5; From fc3dde2b7a3744bed950dae55470b5eca0cd3681 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 1 May 2013 04:29:14 +0100 Subject: [PATCH 34/34] player tracker - bump version number. missed from previous commit --- plugins/player-tracker.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/player-tracker.user.js b/plugins/player-tracker.user.js index 561039bf..efeb8e24 100644 --- a/plugins/player-tracker.user.js +++ b/plugins/player-tracker.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @id iitc-plugin-player-tracker@breunigs // @name IITC Plugin: Player tracker -// @version 0.9.2.@@DATETIMEVERSION@@ +// @version 0.9.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@
$basename
$version
$descriptionDownload Download