Skip to content

Commit 98ae4ec

Browse files
committed
Updated script
1 parent ad5ef14 commit 98ae4ec

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
lines changed

android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (flutterRoot == null) {
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1515
if (flutterVersionCode == null) {
16-
flutterVersionCode = '372'
16+
flutterVersionCode = '373'
1717
}
1818

1919
def flutterVersionName = localProperties.getProperty('flutter.versionName')

ios/Runner.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@
536536
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
537537
CODE_SIGN_IDENTITY = "Apple Development";
538538
CODE_SIGN_STYLE = Automatic;
539-
CURRENT_PROJECT_VERSION = 372;
539+
CURRENT_PROJECT_VERSION = 373;
540540
DEVELOPMENT_ASSET_PATHS = "";
541541
DEVELOPMENT_TEAM = 53KVJRJS99;
542542
ENABLE_BITCODE = NO;
@@ -680,7 +680,7 @@
680680
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
681681
CODE_SIGN_IDENTITY = "Apple Development";
682682
CODE_SIGN_STYLE = Automatic;
683-
CURRENT_PROJECT_VERSION = 372;
683+
CURRENT_PROJECT_VERSION = 373;
684684
DEVELOPMENT_ASSET_PATHS = "";
685685
DEVELOPMENT_TEAM = 53KVJRJS99;
686686
ENABLE_BITCODE = NO;
@@ -718,7 +718,7 @@
718718
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
719719
CODE_SIGN_IDENTITY = "Apple Development";
720720
CODE_SIGN_STYLE = Automatic;
721-
CURRENT_PROJECT_VERSION = 372;
721+
CURRENT_PROJECT_VERSION = 373;
722722
DEVELOPMENT_ASSET_PATHS = "";
723723
DEVELOPMENT_TEAM = 53KVJRJS99;
724724
ENABLE_BITCODE = NO;

lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ import 'package:workmanager/workmanager.dart';
5555

5656
// TODO: CONFIGURE FOR APP RELEASE, include exceptions in Drawer if applicable
5757
const String appVersion = '3.2.5';
58-
const String androidCompilation = '372';
59-
const String iosCompilation = '372';
58+
const String androidCompilation = '373';
59+
const String iosCompilation = '373';
6060

6161
final FirebaseAnalytics analytics = FirebaseAnalytics.instance;
6262

lib/utils/changelog.dart

+11-13
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@ class ChangeLogState extends State<ChangeLog> {
3939
void _createItems() {
4040
final itemList = <ChangeLogItem>[];
4141

42-
// Build 372 - 03/01/2024
43-
44-
// VERSION 3.2.5
45-
final v3_2_5 = ChangeLogItem();
46-
v3_2_5.version = 'Torn PDA v3.2.5';
47-
v3_2_5.date = '10 JAN 2024';
48-
const String feat3_2_5_1 = "Fixed Company Stock Order example userscript [Kwack]";
49-
const String feat3_2_5_2 = "Fixed energy stacking warning in certain devices";
50-
const String feat3_2_5_3 = "Updated browser to fix reported issues";
51-
v3_2_5.features.add(feat3_2_5_1);
52-
v3_2_5.features.add(feat3_2_5_2);
53-
v3_2_5.features.add(feat3_2_5_3);
42+
// v3.2.5 - Build 373 - 04/01/2024
43+
itemList.add(
44+
ChangeLogItem()
45+
..version = 'Torn PDA v3.2.5'
46+
..date = '08 JAN 2024'
47+
..features = [
48+
"Improved browser performance and stability",
49+
"Fixed Company Stock Order example userscript [Kwack]",
50+
"Fixed energy stacking warning in certain devices",
51+
],
52+
);
5453

5554
// VERSION 3.2.4
5655
final v3_2_4 = ChangeLogItem();
@@ -1650,7 +1649,6 @@ class ChangeLogState extends State<ChangeLog> {
16501649
v1_3_0.features.add(feat1_3_0_4);
16511650

16521651
// NEED TO ADD HERE!
1653-
itemList.add(v3_2_5);
16541652
itemList.add(v3_2_4);
16551653
itemList.add(v3_2_3);
16561654
itemList.add(v3_2_2);

lib/utils/userscript_examples.dart

+9-6
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,9 @@ let waitForElementsAndRun = setInterval(() => {
649649
const source = r"""
650650
// ==UserScript==
651651
// @name auto-stock-fill
652-
// @namespace dev.kwack.torn.scripts
653-
// @version 1.0.0
654-
// @description Automatically fill your company's stock order
652+
// @namespace https://github.com/Kwack-Kwack/pda-userscripts
653+
// @version 1.0.2
654+
// @description Automatically fill your company's stock
655655
// @author Kwack [2190604]
656656
// @match https://www.torn.com/*
657657
// @grant none
@@ -670,12 +670,12 @@ let waitForElementsAndRun = setInterval(() => {
670670
}
671671
function callback(form) {
672672
const storageCap = Array.from(form.querySelectorAll(".storage-capacity > *")).map((el) =>
673-
parseInt(el.innerText),
673+
getNumber(el.innerText),
674674
);
675675
const usableCap = storageCap[1] - storageCap[0];
676-
const totalSoldDaily = parseInt(form.querySelector(".stock-list > li.total .sold-daily").textContent);
676+
const totalSoldDaily = getNumber(form.querySelector(".stock-list > li.total .sold-daily").textContent);
677677
Array.from(form.querySelectorAll(".stock-list > li:not(.total):not(.quantity)")).forEach((el) => {
678-
const soldDaily = parseInt(el.querySelector(".sold-daily").lastChild.textContent);
678+
const soldDaily = getNumber(el.querySelector(".sold-daily").lastChild.textContent);
679679
const neededStock = Math.max((soldDaily / totalSoldDaily) * usableCap, 0);
680680
updateInput(el.querySelector("input"), Math.floor(neededStock).toString());
681681
});
@@ -715,6 +715,9 @@ let waitForElementsAndRun = setInterval(() => {
715715
input.dispatchEvent(new Event("change", { bubbles: true }));
716716
input.dispatchEvent(new Event("input", { bubbles: true }));
717717
}
718+
function getNumber(str) {
719+
return parseInt(str.replace(/,/g, ""));
720+
}
718721
})();
719722
""";
720723

userscripts/Company Stock Order (Torn PDA).js

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
// ==UserScript==
22
// @name auto-stock-fill
3-
// @namespace dev.kwack.torn.scripts
4-
// @version 1.0.0
5-
// @description Automatically fill your company's stock order
3+
// @namespace https://github.com/Kwack-Kwack/pda-userscripts
4+
// @version 1.0.2
5+
// @description Automatically fill your company's stock
66
// @author Kwack [2190604]
7-
// @match https://www.torn.com/companies.php*
7+
// @match https://www.torn.com/*
88
// @grant none
99
// ==/UserScript==
10-
1110
/* https://github.com/Mephiles/torntools_extension/blob/master/extension/scripts/features/auto-stock-fill/ttAutoStockFill.js */
12-
1311
(async () => {
1412
window.addEventListener("hashchange", (e) => {
1513
if (getHashParams(new URL(e.newURL).hash).get("option") === "stock") start();
@@ -23,12 +21,12 @@
2321
}
2422
function callback(form) {
2523
const storageCap = Array.from(form.querySelectorAll(".storage-capacity > *")).map((el) =>
26-
parseInt(el.innerText),
24+
getNumber(el.innerText),
2725
);
2826
const usableCap = storageCap[1] - storageCap[0];
29-
const totalSoldDaily = parseInt(form.querySelector(".stock-list > li.total .sold-daily").textContent);
27+
const totalSoldDaily = getNumber(form.querySelector(".stock-list > li.total .sold-daily").textContent);
3028
Array.from(form.querySelectorAll(".stock-list > li:not(.total):not(.quantity)")).forEach((el) => {
31-
const soldDaily = parseInt(el.querySelector(".sold-daily").lastChild.textContent);
29+
const soldDaily = getNumber(el.querySelector(".sold-daily").lastChild.textContent);
3230
const neededStock = Math.max((soldDaily / totalSoldDaily) * usableCap, 0);
3331
updateInput(el.querySelector("input"), Math.floor(neededStock).toString());
3432
});
@@ -68,4 +66,7 @@
6866
input.dispatchEvent(new Event("change", { bubbles: true }));
6967
input.dispatchEvent(new Event("input", { bubbles: true }));
7068
}
69+
function getNumber(str) {
70+
return parseInt(str.replace(/,/g, ""));
71+
}
7172
})();

0 commit comments

Comments
 (0)