Skip to content

Commit

Permalink
Merge branch 'IITC-CE:master' into personal
Browse files Browse the repository at this point in the history
  • Loading branch information
nexushoratio authored Nov 5, 2024
2 parents 552c908 + 6462fbe commit 944f262
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 17 deletions.
1 change: 1 addition & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def run_cmds(cmds, source, target):


def iitc_build(source, outdir, deps_list=None):
settings.generate_timestamps()
run_cmds(settings.pre_build, source, outdir)

iitc_script = 'core/total-conversion-build.js'
Expand Down
7 changes: 5 additions & 2 deletions build_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def append_line(key, value):
if not re.match(r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$', value):
print(f'{plugin_name}: wrong version format: {value}') # expected: major.minor.patch
elif settings.version_timestamp: # append timestamp only for well-formed version
line = line.replace(value, '{ver}.{.build_timestamp}'.format(settings, ver=value))
line = line.replace(value, '{ver}.{timestamp}'.format(ver=value, timestamp=settings.build_timestamp()))
elif key == 'name':
if value == 'IITC: Ingress intel map total conversion':
is_main = True
Expand Down Expand Up @@ -142,7 +142,10 @@ def expand_template(match, path=None):
quote = "'%s'"
kw, filename = match.groups()
if not filename:
return quote % getattr(settings, kw)
value = getattr(settings, kw)
if callable(value):
value = value()
return quote % value

fullname = path / filename
if kw == 'include_raw':
Expand Down
7 changes: 6 additions & 1 deletion core/code/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ chat.show = function (name) {
chat.chooser = function (event) {
var t = $(event.target);
var tab = t.data('channel');
chat.chooseTab(tab);

if (window.isSmartphone() && !window.useAppPanes()) {
window.show(tab);
} else {
chat.chooseTab(tab);
}
};

/**
Expand Down
14 changes: 8 additions & 6 deletions core/code/smartphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,27 @@ window.runOnSmartphonesBeforeBoot = function () {
};

window.smartphone.mapButton = $('<a>map</a>').click(function () {
window.show('map');
$('#map').css({ visibility: 'visible', opacity: '1' });
$('#updatestatus').show();
$('#chatcontrols a .active').removeClass('active');
$('#chatcontrols a.active').removeClass('active');
$("#chatcontrols a:contains('map')").addClass('active');
});

window.smartphone.sideButton = $('<a>info</a>').click(function () {
window.show('info');
$('#scrollwrapper').show();
window.resetScrollOnNewPortal();
$('.active').removeClass('active');
$('#chatcontrols a.active').removeClass('active');
$("#chatcontrols a:contains('info')").addClass('active');
});

$('#chatcontrols').append(window.smartphone.mapButton).append(window.smartphone.sideButton);

if (!window.useAppPanes()) {
document.body.classList.add('show_controls');
}

window.addHook('portalDetailsUpdated', function () {
var x = $('.imgpreview img').removeClass('hide');

Expand Down Expand Up @@ -197,8 +203,4 @@ window.runOnSmartphonesAfterBoot = function () {
$('#sidebar').animate({ scrollTop: newTop }, 200);
}
});

// make buttons in action bar flexible
var l = $('#chatcontrols a:visible');
l.css('width', 100 / l.length + '%');
};
35 changes: 31 additions & 4 deletions core/smartphone.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ body {
margin-left: 4px;
}

#sidebar, #chatcontrols, #chat, #chatinput {
background: transparent !important;
}

.leaflet-top .leaflet-control {
margin-top: 5px !important;
margin-left: 5px !important;
Expand Down Expand Up @@ -257,3 +253,34 @@ body {
https://github.com/IITC-CE/ingress-intel-total-conversion/issues/89
*/
.leaflet-bottom { bottom: 5px; }

/* Controls for mobile view without an app */
:root {
--top-controls-height: 38px;
}

body.show_controls #chatcontrols {
display: flex !important;
top: 0;
overflow-x: auto;
width: calc(100% - 1px);
}

body.show_controls #chatcontrols a {
flex: 1;
min-width: fit-content;
padding: 0 5px;
}

body.show_controls #map {
height: calc(100vh - var(--top-controls-height) - 25px);
margin-top: var(--top-controls-height);
}

body.show_controls #scrollwrapper {
margin-top: var(--top-controls-height)
}

body.show_controls #chat {
top: var(--top-controls-height) !important;
}
20 changes: 16 additions & 4 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
values from localbuildsettings.py (if exists).
"""

import time

_build_date = None
_build_timestamp = None


def generate_timestamps():
"""Generate build date and timestamp in desired formats."""
global _build_date, _build_timestamp

utc = time.gmtime()
_build_date = time.strftime('%Y-%m-%d-%H%M%S', utc)
_build_timestamp = time.strftime('%Y%m%d.%H%M%S', utc)


def load(build_name, localfile=None):
"""Load settings for given iitc build name."""
import buildsettings as config
import time
from pathlib import Path
from runpy import run_path

Expand Down Expand Up @@ -39,9 +52,8 @@ def load(build_name, localfile=None):
mod = vars(__import__(__name__))
mod.pop('load')
mod['build_name'] = build_name
utc = time.gmtime()
mod['build_date'] = time.strftime('%Y-%m-%d-%H%M%S', utc)
mod['build_timestamp'] = time.strftime('%Y%m%d.%H%M%S', utc)
mod['build_date'] = lambda: _build_date
mod['build_timestamp'] = lambda: _build_timestamp
base = Path(localfile or __file__).parent
mod['build_source_dir'] = base
mod['build_target_dir'] = base / 'build' / build_name
Expand Down

0 comments on commit 944f262

Please sign in to comment.