Skip to content

Commit 19fb96b

Browse files
chore: autopublish 2024-11-06T00:39:26Z
1 parent 261980d commit 19fb96b

File tree

4 files changed

+45
-21
lines changed

4 files changed

+45
-21
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ Show portal info about resonators and mods for the selected portal directly on t
536536

537537
View inventory and highlight portals with keys at any zoom. Can be used with the official plugins Keys and Keys on map to show the number of keys on the map.
538538

539-
*Version:* 0.4.4
539+
*Version:* 0.4.5
540540

541541

542542

dist/jaiperdu/player-inventory.meta.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @author jaiperdu
33
// @name Player Inventory
44
// @category Info
5-
// @version 0.4.4
5+
// @version 0.4.5
66
// @description View inventory and highlight portals with keys at any zoom. Can be used with the official plugins Keys and Keys on map to show the number of keys on the map.
77
// @id player-inventory@jaiperdu
88
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion

dist/jaiperdu/player-inventory.user.js

+40-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @author jaiperdu
44
// @name Player Inventory
55
// @category Info
6-
// @version 0.4.4
6+
// @version 0.4.5
77
// @description View inventory and highlight portals with keys at any zoom. Can be used with the official plugins Keys and Keys on map to show the number of keys on the map.
88
// @id player-inventory@jaiperdu
99
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion
@@ -1250,6 +1250,9 @@ function InventoryTables ({
12501250
const typeName = getItemName(capsule.type);
12511251
const size = capsule.size;
12521252
const head = jsx("b", {
1253+
dataset: {
1254+
capsule: name
1255+
},
12531256
children: `${typeName}: ${displayName} (${size})`
12541257
});
12551258
container.append(jsxs(Fragment, {
@@ -1447,7 +1450,7 @@ function displayNameMapping() {
14471450
});
14481451
}
14491452

1450-
function buildInventoryHTML(inventory) {
1453+
function buildInventoryHTML(inventory, capsule) {
14511454
const container = jsx(InventoryTables, {
14521455
inventory: inventory
14531456
});
@@ -1456,6 +1459,10 @@ function buildInventoryHTML(inventory) {
14561459
heightStyle: 'fill',
14571460
collapsible: true
14581461
});
1462+
if (capsule) {
1463+
let idx = Array.from(container.children).filter(e => e.tagName == 'B').findIndex(e => e.dataset['capsule'] == capsule);
1464+
if (idx >= 0) $(container).accordion("option", "active", idx);
1465+
}
14591466
return container;
14601467
}
14611468
function fillPane(inventory) {
@@ -1470,8 +1477,8 @@ function getTitle() {
14701477
}
14711478
return title;
14721479
}
1473-
function displayInventory(inventory) {
1474-
const container = buildInventoryHTML(inventory);
1480+
function displayInventory(inventory, capsule) {
1481+
const container = buildInventoryHTML(inventory, capsule);
14751482
playerInventory.dialog = window.dialog({
14761483
title: getTitle(),
14771484
id: 'inventory',
@@ -1520,17 +1527,33 @@ function setupDisplay() {
15201527
});
15211528
playerInventory.pane.style.display = 'none';
15221529
document.body.append(playerInventory.pane);
1523-
document.getElementById('toolbox').append(jsx("a", {
1524-
title: "Inventory options",
1525-
onclick: displayOpt,
1526-
children: "Inventory Opt"
1527-
}));
1530+
if (window.script_info.script.version < '0.38') {
1531+
document.getElementById('toolbox').append(jsx("a", {
1532+
title: "Inventory options",
1533+
onclick: displayOpt,
1534+
children: "Inventory Opt"
1535+
}));
1536+
} else {
1537+
window.IITC.toolbox.addButton({
1538+
label: 'Inventory Opt',
1539+
title: 'Inventory options',
1540+
action: displayOpt
1541+
});
1542+
}
15281543
} else {
1529-
document.getElementById('toolbox').append(jsx("a", {
1530-
title: "Show inventory",
1531-
onclick: () => displayInventory(playerInventory.inventory),
1532-
children: "Inventory"
1533-
}));
1544+
if (window.script_info.script.version < '0.38') {
1545+
document.getElementById('toolbox').append(jsx("a", {
1546+
title: "Show inventory",
1547+
onclick: () => displayInventory(playerInventory.inventory),
1548+
children: "Inventory"
1549+
}));
1550+
} else {
1551+
window.IITC.toolbox.addButton({
1552+
label: 'Inventory',
1553+
title: 'Show inventory',
1554+
action: () => displayInventory(playerInventory.inventory)
1555+
});
1556+
}
15341557
}
15351558
}
15361559

@@ -1596,15 +1619,16 @@ function setup () {
15961619
const mapping = playerInventory.settings.capsuleNameMap;
15971620
const capsules = Array.from(key.count.keys()).map(name => jsx("div", {
15981621
title: mapping[name] ? `${mapping[name]} [${name}]` : name,
1622+
onclick: () => displayInventory(playerInventory.inventory, name),
15991623
children: mapping[name] ? `${mapping[name]}` : name
16001624
}));
16011625
document.getElementById('randdetails').append(jsxs("tr", {
16021626
className: "inventory-details",
16031627
children: [jsx("td", {
16041628
children: total
1605-
}), jsx("td", {
1629+
}), jsx("th", {
16061630
children: "Keys"
1607-
}), jsx("td", {
1631+
}), jsx("th", {
16081632
children: "Capsules"
16091633
}), jsx("td", {
16101634
children: capsules

dist/meta.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@
528528
"none"
529529
],
530530
"id_hash": "imattc-by-DanielOnDiordna",
531-
"updatedAt": "2024-10-29T00:40:53.117Z"
531+
"updatedAt": "2024-10-29T00:41:08.000Z"
532532
},
533533
{
534534
"author": "DanielOnDiordna",
@@ -2298,7 +2298,7 @@
22982298
"author": "jaiperdu",
22992299
"name": "Player Inventory",
23002300
"category": "Info",
2301-
"version": "0.4.4",
2301+
"version": "0.4.5",
23022302
"description": "View inventory and highlight portals with keys at any zoom. Can be used with the official plugins Keys and Keys on map to show the number of keys on the map.",
23032303
"id": "player-inventory@jaiperdu",
23042304
"namespace": "https://github.com/IITC-CE/ingress-intel-total-conversion",
@@ -2311,7 +2311,7 @@
23112311
"none"
23122312
],
23132313
"id_hash": "player-inventory-by-jaiperdu",
2314-
"updatedAt": "2022-11-19T14:34:46.000Z"
2314+
"updatedAt": "2024-11-06T00:39:23.111Z"
23152315
},
23162316
{
23172317
"author": "jaiperdu",

0 commit comments

Comments
 (0)