1
1
// ==UserScript==
2
2
// @name auto-task-v4
3
3
// @namespace auto-task-v4
4
- // @version 4.2.35
4
+ // @version 4.2.36
5
5
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
6
6
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
7
7
// @author HCLonely
@@ -4438,9 +4438,31 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
4438
4438
});
4439
4439
if (result === 'Success') {
4440
4440
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
4441
- var _data$responseText$ma5;
4442
- const currentArea = (_data$responseText$ma5 = data.responseText.match(/<input id="usercountrycurrency".*?value="(.+?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
4443
- const areas = [ ...data.responseText.matchAll(/<div class="currency_change_option .*?" data-country="(.+?)" >/g) ].map(search => search[1]);
4441
+ var _data$responseText$ma5, _data$responseText$ma6;
4442
+ const cartConfigRaw = (_data$responseText$ma5 = data.responseText.match(/data-cart_config="(.*?)"/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1];
4443
+ const temp = document.createElement('div');
4444
+ temp.innerHTML = cartConfigRaw || '{}';
4445
+ const cartConfigStr = temp.textContent || temp.innerText;
4446
+ let cartConfig;
4447
+ try {
4448
+ cartConfig = JSON.parse(cartConfigStr);
4449
+ } catch (error) {
4450
+ logStatus.error('Error: get country info filed');
4451
+ console.error(error);
4452
+ }
4453
+ const userInfoRaw = (_data$responseText$ma6 = data.responseText.match(/data-userinfo="(.*?)"/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1];
4454
+ const temp1 = document.createElement('div');
4455
+ temp1.innerHTML = userInfoRaw || '{}';
4456
+ const userInfoStr = temp1.textContent || temp1.innerText;
4457
+ let userInfo;
4458
+ try {
4459
+ userInfo = JSON.parse(userInfoStr);
4460
+ } catch (error) {
4461
+ logStatus.error('Error: get country info filed');
4462
+ console.error(error);
4463
+ }
4464
+ const currentArea = userInfo.country_code;
4465
+ const areas = Object.keys(cartConfig.rgUserCountryOptions).filter(area => area !== 'help');
4444
4466
if (currentArea && areas.length > 0) {
4445
4467
this.#area = currentArea;
4446
4468
logStatus.success();
@@ -4664,8 +4686,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
4664
4686
});
4665
4687
if (result === 'Success') {
4666
4688
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
4667
- var _data$responseText$ma6 ;
4668
- const groupId = (_data$responseText$ma6 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6 [1];
4689
+ var _data$responseText$ma7 ;
4690
+ const groupId = (_data$responseText$ma7 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7 [1];
4669
4691
if (groupId) {
4670
4692
this.#setCache('group', groupName, groupId);
4671
4693
logStatus.success();
@@ -4704,10 +4726,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
4704
4726
});
4705
4727
if (result === 'Success') {
4706
4728
if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('id="publicGroupJoin"')) {
4707
- var _data$responseText$ma7 ;
4729
+ var _data$responseText$ma8 ;
4708
4730
logStatus.success();
4709
4731
this.tasks.officialGroups = unique([ ...this.tasks.officialGroups, gameId ]);
4710
- const groupId = (_data$responseText$ma7 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7 [1];
4732
+ const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8 [1];
4711
4733
if (groupId) {
4712
4734
this.#setCache('officialGroup', gameId, groupId);
4713
4735
}
@@ -4818,8 +4840,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
4818
4840
});
4819
4841
if (result === 'Success') {
4820
4842
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
4821
- var _data$responseText$ma8 ;
4822
- const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8 [1];
4843
+ var _data$responseText$ma9 ;
4844
+ const groupId = (_data$responseText$ma9 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9 [1];
4823
4845
if (groupId) {
4824
4846
this.#setCache('officialGroup', gameId, groupId);
4825
4847
logStatus.success();
@@ -5137,8 +5159,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
5137
5159
});
5138
5160
if (result === 'Success') {
5139
5161
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
5140
- var _data$responseText, _data$responseText$ma9 ;
5141
- const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma9 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9 [1];
5162
+ var _data$responseText, _data$responseText$ma10 ;
5163
+ const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma10 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10 [1];
5142
5164
if (forumId) {
5143
5165
this.#setCache('forum', gameId, forumId);
5144
5166
logStatus.success();
@@ -5233,8 +5255,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
5233
5255
});
5234
5256
if (result === 'Success') {
5235
5257
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
5236
- var _data$responseText$ma10 ;
5237
- const appId = (_data$responseText$ma10 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10 [1];
5258
+ var _data$responseText$ma11 ;
5259
+ const appId = (_data$responseText$ma11 = data.responseText.match(/<input type="hidden" name="appid" value="([\d]+?)" \/>/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11 [1];
5238
5260
if (appId) {
5239
5261
this.#setCache('workshop', id, appId);
5240
5262
logStatus.success();
@@ -5366,8 +5388,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
5366
5388
});
5367
5389
if (result === 'Success') {
5368
5390
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
5369
- var _data$responseText$ma11 ;
5370
- const curatorId = (_data$responseText$ma11 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11 [1];
5391
+ var _data$responseText$ma12 ;
5392
+ const curatorId = (_data$responseText$ma12 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12 [1];
5371
5393
if (curatorId) {
5372
5394
this.#setCache('curator', `${path}/${name}`, curatorId);
5373
5395
logStatus.success();
@@ -5531,7 +5553,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
5531
5553
});
5532
5554
if (result === 'Success') {
5533
5555
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
5534
- var _data$responseText$ma12 ;
5556
+ var _data$responseText$ma13 ;
5535
5557
if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) {
5536
5558
logStatus.warning(i18n('changeAreaNotice'));
5537
5559
const result = await this.#changeArea();
@@ -5540,7 +5562,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
5540
5562
}
5541
5563
return await this.#appid2subid(id);
5542
5564
}
5543
- const subid = (_data$responseText$ma12 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12 [1];
5565
+ const subid = (_data$responseText$ma13 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma13 === void 0 ? void 0 : _data$responseText$ma13 [1];
5544
5566
if (subid) {
5545
5567
logStatus.success();
5546
5568
return subid;
0 commit comments