Skip to content

Commit

Permalink
Merge commit 'refs/pull/647/head' of github.com:IITC-CE/ingress-intel…
Browse files Browse the repository at this point in the history
…-total-conversion
  • Loading branch information
modos189 committed Jul 11, 2023
2 parents 2b5a646 + 4376ad0 commit 8adfe31
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 136 deletions.
66 changes: 48 additions & 18 deletions core/code/dialog_about.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ window.aboutIITC = function() {
}

function createDialogContent() {
var html = ''
+ '<div><b>About IITC</b></div> '
+ '<div>Ingress Intel Total Conversion</div> '
+ '<hr>'
+ '<div>'
+ ' <a href="'+'@url_homepage@'+'" target="_blank">IITC Homepage</a> |'
+ ' <a href="'+'@url_tg@'+'" target="_blank">Telegram channel</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>'
+ '<hr>'
+ '<div>Version: ' + getIITCVersion() + '</div>';
var html = `<div><b>About IITC</b></div>
<div>Ingress Intel Total Conversion</div>
<hr>
<div>
<a href="@url_homepage@" target="_blank">IITC Homepage</a> |
<a href="@url_tg@" target="_blank">Telegram channel</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>
<hr>
<div>Version: ${getIITCVersion()} ${createChangelog(window.script_info)}</div>`;

if (isShortOnLocalStorage()) {
html += '<div class="warning">You are running low on LocalStorage memory.<br/>Please free some space to prevent data loss.</div>';
Expand Down Expand Up @@ -75,6 +74,8 @@ function convertPluginInfo(info, index) {
// (atm: IITC-Mobile for iOS)
var result = {
build: info.buildName,
changelog: info.changelog,
id: info.pluginId,
name: info.pluginId,
date: info.dateTimeVersion,
error: info.error,
Expand Down Expand Up @@ -103,8 +104,33 @@ function convertPluginInfo(info, index) {
return result;
}

function createChangelog(plugin) {
var id = 'plugin-changelog-' + plugin.id;
return (
`<a onclick="$('#${id}').toggle()">changelog</a>` +
`<ul id="${id}" style="display: none;">` +
plugin.changelog
.map(function (logEntry) {
return (
'<li>' +
logEntry.version +
'<ul>' +
logEntry.changes
.map(function (change) {
return `<li>${change}</li>`;
})
.join('') +
'</ul></li>'
);
})
.join('') +
'</ul>'
);
}

function pluginInfoToString(p, extra) {
var info = {
changelog: '',
class: '',
description: p.description || '',
name: p.name,
Expand All @@ -120,7 +146,11 @@ function pluginInfoToString(p, extra) {
info.description = p.error;
}

return L.Util.template('<li class="{class}" title="{description}">{name}{verinfo}</li>', info);
if (p.changelog) {
info.changelog = createChangelog(p);
}

return L.Util.template('<li class="{class}" title="{description}">{name}{verinfo} {changelog}</li>', info);
}


Expand Down
14 changes: 10 additions & 4 deletions core/code/game_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ window.updateGameScore = function(data) {
var s = r+e;
var rp = r/s*100, ep = e/s*100;
r = digits(r), e = digits(e);
var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'%&nbsp;</span>';
var es = '<span class="enl" style="width:'+ep+'%;">&nbsp;'+Math.round(ep)+'%</span>';
$('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() });
var teamId = window.teamStringToId(window.PLAYER.team);
var rs = '<span class="res" style="width:' + rp + '%;text-align: ' + (teamId === window.TEAM_RES ? 'right' : 'left') + ';">' + Math.round(rp) + '%</span>';
var es = '<span class="enl" style="width:' + ep + '%;text-align: ' + (teamId === window.TEAM_ENL ? 'right' : 'left') + ';">' + Math.round(ep) + '%</span>';
var gamestatElement = $('#gamestat');
gamestatElement.html(teamId === window.TEAM_RES ? rs + es : es + rs).one('click', function () {
window.updateGameScore();
});
// help cursor via “#gamestat span”
$('#gamestat').attr('title', 'Resistance:\t'+r+' MindUnits\nEnlightened:\t'+e+' MindUnits');
var resMu = 'Resistance:\t' + r + ' MindUnits';
var enlMu = 'Enlightened:\t' + e + ' MindUnits';
gamestatElement.attr('title', teamId === window.TEAM_RES ? resMu + '\n' + enlMu : enlMu + '\n' + resMu);
} else if (data && data.error) {
log.warn('game score failed to load: '+data.error);
} else {
Expand Down
10 changes: 7 additions & 3 deletions core/code/map_data_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,19 @@ window.Render.prototype.createPlaceholderPortalEntity = function(guid,latE6,lngE
// placeholder portals don't have a useful timestamp value - so the standard code that checks for updated
// portal details doesn't apply
// so, check that the basic details are valid and delete the existing portal if out of date
var portalMoved = false;
if (guid in window.portals) {
var p = window.portals[guid];
if (team != p.options.data.team || latE6 != p.options.data.latE6 || lngE6 != p.options.data.lngE6) {
// team or location have changed - delete existing portal
portalMoved = latE6 !== p.options.data.latE6 || lngE6 !== p.options.data.lngE6;
if (team !== p.options.data.team) {
// team - delete existing portal
this.deletePortalEntity(guid);
}
}

this.createPortalEntity(ent, 'core'); // placeholder
if (!portalMoved) {
this.createPortalEntity(ent, 'core'); // placeholder
}

}

Expand Down
18 changes: 9 additions & 9 deletions core/code/portal_detail_display_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ window.getRangeText = function(d) {

if(!range.isLinkable) title += '\nPortal is missing resonators,\nno new links can be made';

return ['range',
'<a onclick="window.rangeLinkClick()"'
+ (range.isLinkable ? '' : ' style="text-decoration:line-through;"')
+ '>'
+ (range.range > 1000
? Math.floor(range.range/1000) + ' km'
: Math.floor(range.range) + ' m')
+ '</a>',
title];
return [
'range',
'<a onclick="window.rangeLinkClick()"' +
(range.isLinkable ? '' : ' style="text-decoration:line-through;"') +
'>' +
window.formatDistance(range.range) +
'</a>',
title,
];
}


Expand Down
23 changes: 12 additions & 11 deletions core/code/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,18 @@ window.setupPlayerStat = function () {
+ '\nInvites:\t'+PLAYER.available_invites
+ '\n\nNote: your player stats can only be updated by a full reload (F5)';

$('#playerstat').html(''
+ '<h2 title="'+t+'">'+level+'&nbsp;'
+ '<div id="name">'
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
+ '<a href="https://intel.ingress.com/logout" id="signout">sign out</a>'
+ '</div>'
+ '<div id="stats">'
+ '<sup>XM: '+xmRatio+'%</sup>'
+ '<sub>' + (nextLvlAp > 0 ? 'level: '+lvlApProg+'%' : 'max level') + '</sub>'
+ '</div>'
+ '</h2>'
$('#playerstat').html(
`<h2 title="${t}">
${level}
<div id="name">
<span class="playername ${cls}">${window.PLAYER.nickname}</span>
<a href="https://intel.ingress.com/logout" id="signout">sign out</a>
</div>
<div id="stats">
<sup>XM: ${xmRatio}%</sup>
<sub>${nextLvlAp > 0 ? 'level: ' + lvlApProg + '%' : 'max level'}</sub>
</div>
</h2>`
);
};

Expand Down
3 changes: 3 additions & 0 deletions core/code/utils_misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ window.formatInterval = function(seconds,maxTerms) {
return terms.join(' ');
}

window.formatDistance = function (distance) {
return window.digits(distance > 10000 ? (distance / 1000).toFixed(2) + 'km' : Math.round(distance) + 'm');
};

window.rangeLinkClick = function() {
if(window.portalRangeIndicator)
Expand Down
30 changes: 26 additions & 4 deletions core/smartphone.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,33 @@ body {
background-color: #ff0028 !important;
}

#playerstat {
height: initial;
}

#playerstat h2 {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}

#playerstat h2 #name {
width: initial;
}

#playerstat h2 #name .playername,
#playerstat h2 #name:hover .playername{
max-width: 60vw;
}

#playerstat h2 #stats {
white-space: nowrap;
overflow: initial;
}

#name #signout { /* no hover, always show signout button */
display: block;
display: inline-block;
position: initial;
}

#sidebar, #chatcontrols, #chat, #chatinput {
Expand All @@ -106,9 +131,6 @@ body {
margin-left: 5px !important;
}

#searchwrapper {
font-size: 1.2em;
}
#searchwrapper .ui-accordion-header {
padding: 0.3em 0;
}
Expand Down
39 changes: 18 additions & 21 deletions core/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,16 @@ h2 {

h2 #name {
font-weight: 300;
display: inline;
vertical-align: top;
white-space: nowrap;
}

h2 #name .playername {
max-width: 70%;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
width: 205px;
position: relative;
}

h2 #stats {
Expand All @@ -493,16 +496,16 @@ h2 #stats {
#signout {
font-size: 12px;
font-weight: normal;
line-height: 29px;
padding: 0 4px;
position: absolute;
top: 0;
right: 0;
background-color: rgba(8, 48, 78, 0.5);
display: none; /* starts hidden */
vertical-align: text-top;
}
#name:hover .playername {
max-width: 50%;
}
#name:hover #signout {
display: block;
display: inline-block;
}

h2 sup, h2 sub {
Expand All @@ -513,22 +516,16 @@ h2 sup, h2 sub {


/* gamestats */
#gamestat {
height: 22px;
}

#gamestat span {
display: block;
float: left;
display: inline-block;
font-weight: bold;
cursor:help;
height: 21px;
line-height: 22px;
padding: 0 3px;
box-sizing: border-box;
}

#gamestat .res {
background: #005684;
text-align: right;
}

#gamestat .enl {
Expand Down Expand Up @@ -563,18 +560,18 @@ input[type="search"], input[type="url"] {
#buttongeolocation {
position: absolute;
right: 0;
top: 0;
bottom: 0;
margin: 0;
border: 0 none transparent;
padding: 0 2px 0 0;
height: 24px;
height: 100%;
background-color: transparent;
}
#buttongeolocation:focus {
outline: 1px dotted #ffce00;
}
#buttongeolocation img {
display: block;
vertical-align: middle;
}
#searchwrapper h3 {
font-size: 1em;
Expand Down
8 changes: 7 additions & 1 deletion core/total-conversion-build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// @author jonatkins
// @name IITC: Ingress intel map total conversion
// @version 0.35.1
// @version 0.36.0
// @description Total conversion for the ingress intel map.
// @run-at document-end


window.script_info = plugin_info;
window.script_info.changelog = [
{
version: '0.36.0',
changes: ['Ability to define and display changelog', 'Improved info panel styling'],
},
];

// REPLACE ORIG SITE ///////////////////////////////////////////////////
if (document.documentElement.getAttribute('itemscope') !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
Expand Down Expand Up @@ -153,6 +154,11 @@ public void onReceive(Context context, Intent intent) {

@Override
protected void onCreate(final Bundle savedInstanceState) {
// enable webview debug for debug builds
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
&& 0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
WebView.setWebContentsDebuggingEnabled(true);
}

// get status of Samsung DeX Mode at creation
Configuration config = getResources().getConfiguration();
Expand Down
4 changes: 2 additions & 2 deletions mobile/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
<string name="pref_update_plugins_interval_2_days">2 days</string>
<string name="pref_update_plugins_interval_1_week">1 week</string>
<string name="pref_update_plugins_interval_2_weeks">2 weeks</string>
<string name="pref_webview_zoom">WebView Zoom</string>
<string name="pref_webview_zoom">Font size</string>
<string name="pref_webview_zoom_defaultValue">System default</string>
<string name="pref_webview_zoom_sum">Zoom for the internal WebView</string>
<string name="pref_webview_zoom_sum">Affects font/text size in info panel, comm, popup windows, etc…</string>
<string name="menu_reload">Reload IITC</string>
<string name="menu_toggle_fullscreen">Fullscreen</string>
<string name="menu_layer_chooser">Layer Chooser</string>
Expand Down
Loading

0 comments on commit 8adfe31

Please sign in to comment.