Skip to content

Commit 188421b

Browse files
committed
locator iframes & add funcaptcha demo & minor design fix & other
1 parent 81ec4c5 commit 188421b

12 files changed

Lines changed: 278 additions & 337 deletions

background.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {Cache, deep_copy, SettingsManager, Time} from './utils.mjs'
22
import * as bapi from './api.js'
33

44

5-
console.clear();
6-
console.log('browser.runtime.id', bapi.browser.runtime.id, 'on', bapi.VERSION);
5+
// console.clear();
6+
// console.log('browser.runtime.id', bapi.browser.runtime.id, 'on', bapi.VERSION);
77

88

99
class Net {
@@ -66,22 +66,22 @@ class Tab {
6666
}
6767

6868
static active() {
69-
// TODO: Implement MV2
70-
// https://developer.chrome.com/docs/extensions/reference/tabs/#get-the-current-tab
71-
7269
// `tab` will either be a `tabs.Tab` instance or `undefined`
7370
return new Promise(async resolve => {
74-
// MV3
75-
const [tab] = await chrome.tabs.query({active: true, lastFocusedWindow: true});
76-
return resolve(tab);
77-
78-
// MV2
79-
// chrome.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => {
80-
// if (chrome.runtime.lastError) {
81-
// console.error(chrome.runtime.lastError);
82-
// }
83-
// resolve(tab);
84-
// });
71+
if (bapi.VERSION === 'firefox') {
72+
// MV2
73+
bapi.browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => {
74+
if (bapi.browser.runtime.lastError) {
75+
console.error(bapi.browser.runtime.lastError);
76+
}
77+
resolve(tab);
78+
});
79+
}
80+
else {
81+
// MV3
82+
const [tab] = await bapi.browser.tabs.query({active: true, lastFocusedWindow: true});
83+
return resolve(tab);
84+
}
8585
});
8686
}
8787
}
@@ -181,7 +181,6 @@ class Injector {
181181
return await Injector._inject(options);
182182
}
183183
}
184-
// Injector.inject_files({tab_id: null, data: {files: ['autodetect.js']}});
185184

186185

187186
class Recaptcha {
@@ -248,8 +247,9 @@ class Relay {
248247
class Icon {
249248
static set_icon({data}) {
250249
return new Promise(resolve => {
250+
const ba = bapi.VERSION === 'firefox' ? bapi.browser.browserAction : bapi.browser.action;
251251
if (data === 'on') {
252-
bapi.browser.action.setIcon({
252+
ba.setIcon({
253253
path: {
254254
'16': '/icon/16.png',
255255
'32': '/icon/32.png',
@@ -259,7 +259,7 @@ class Icon {
259259
}, resolve);
260260
}
261261
else if (data === 'off') {
262-
bapi.browser.action.setIcon({
262+
ba.setIcon({
263263
path: {
264264
'16': '/icon/16g.png',
265265
'32': '/icon/32g.png',
@@ -347,7 +347,7 @@ const FN = {
347347
relay: Relay.send,
348348

349349
set_icon: Icon.set_icon,
350-
set_badge: Icon.set_badge,
350+
// set_badge: Icon.set_badge,
351351
};
352352

353353

@@ -376,7 +376,7 @@ const FN = {
376376
console.log('result', result);
377377
}
378378
return result;
379-
} catch (e){
379+
} catch (e) {
380380
console.error('Failed while executting ', req, 'exception happened', e);
381381
throw e;
382382
}
@@ -385,4 +385,5 @@ const FN = {
385385
// Will respond using the send callback
386386
return true;
387387
});
388+
388389
})();

funcaptcha.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,18 @@
1616
try {
1717
const $verify = document.querySelector('button[aria-describedby="descriptionVerify"]');
1818
if ($verify) {
19-
// console.log('verify');
2019
window.parent.postMessage({nopecha: true, action: 'clear'}, '*');
2120
$verify.click();
2221
}
2322

2423
const $fail_incorrect = document.querySelector('#wrong_children_button');
2524
if ($fail_incorrect) {
26-
// console.log('fail_incorrect');
2725
window.parent.postMessage({nopecha: true, action: 'clear'}, '*');
2826
$fail_incorrect.click();
2927
}
3028

3129
const $fail_timeout = document.querySelector('#wrongTimeout_children_button');
3230
if ($fail_timeout) {
33-
// console.log('fail_timeout');
3431
window.parent.postMessage({nopecha: true, action: 'clear'}, '*');
3532
$fail_timeout.click();
3633
}
@@ -48,7 +45,6 @@
4845

4946
function get_image_data() {
5047
const $image = document.querySelector('img#game_challengeItem_image');
51-
// return $image?.src?.replace('data:image/jpeg;base64,', '');
5248
return $image?.src?.split(';base64,')[1];
5349
}
5450

@@ -58,7 +54,6 @@
5854
return new Promise(resolve => {
5955
let checking = false;
6056
const check_interval = setInterval(async () => {
61-
// console.log('checking', checking);
6257
if (checking) {
6358
return;
6459
}
@@ -75,28 +70,23 @@
7570

7671
let task = get_task();
7772
if (!task) {
78-
// console.log('no task');
7973
checking = false;
8074
return;
8175
}
82-
// console.log('task', task);
8376

8477
const cells = document.querySelectorAll('#game_children_challenge ul > li > a');
8578
if (cells.length !== 6) {
86-
// console.log('invalid number of cells', cells);
8779
checking = false;
8880
return;
8981
}
9082

9183
const image_data = get_image_data();
9284
if (!image_data) {
93-
// console.log('no image data');
9485
checking = false;
9586
return;
9687
}
9788

9889
if (last_image_data === image_data) {
99-
// console.log('image_data unchanged');
10090
checking = false;
10191
return;
10292
}
@@ -155,7 +145,6 @@
155145

156146
if (window.location.pathname.startsWith('/fc/assets/tile-game-ui/')) {
157147
while (true) {
158-
// console.log('window.location.href', window.location.href);
159148
await Time.sleep(1000);
160149

161150
const settings = await BG.exec('get_settings');

funcaptcha_demo.js

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,29 @@
88
'twitch': 'E5554D43-23CC-1982-971D-6A2262A2CA24', // Pick the dice pair whose top sides add up to 5/6/7/8
99
'demo1': '804380F4-6844-FFA1-ED4E-5877CA1F1EA4', // Pick the image that is the correct way up
1010
'demo2': 'D39B0EE3-2973-4147-98EF-C92F93451E2D', // Pick the clipart object
11-
// 'demo3': '69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC', // Pick the clipart object
11+
// 'octocaptcha': '69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC', // Pick the clipart object
1212
// 'outlook': 'B7D8911C-5CC8-A9A3-35B0-554ACEE604DA',
1313
// 'roblox': 'A2A14B1D-1AF3-C791-9BBC-EE33CC7A0A6F',
1414
// 'roblox': '9F35E182-C93C-EBCC-A31D-CF8ED317B996',
1515
// 'roblox': '476068BF-9607-4799-B53D-966BE98E2B81',
1616
'ea signup': '73BEC076-3E53-30F5-B1EB-84F494D43DBA', // Pick one square that shows two identical objects. / Pick the mouse that can reach all the cheese in the maze / Pick the matching cards
1717
'ea signin': '0F5FE186-B3CA-4EDB-A39B-9B9A3397D01D',
18+
'myprepaidcenter': '0F941BF0-7303-D94B-B76A-EAA2E2048124', // Pick the image where all animals are walking in the same direction as the arrow
19+
'twitter': '2CB16598-CB82-4CF7-B332-5990DB66F3AB', // Pick the shadow with a different object silhouette
1820
};
1921
const SRCS = {
2022
'outlook': 'https://iframe.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', // Pick the penguin
2123
'outlook auth': 'https://iframe-auth.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', // Pick one square that shows two identical objects.
22-
}
23-
let nframes = 14;
24+
};
25+
const MAX_BTNS_PER_ROW = 7;
26+
27+
let nframes = 10;
2428

2529

2630
reset();
31+
// open_all();
2732
// open_frame_token('ea signup', 0, nframes);
28-
open_all();
33+
open_frame_token('twitter', 0, nframes);
2934

3035

3136
function reset() {
@@ -76,6 +81,17 @@
7681
flex-wrap: wrap;
7782
justify-content: center;
7883
}`,
84+
// `.iframe_wrap {
85+
// background-color: #eee;
86+
// width: 350px;
87+
// height: 300px;
88+
// padding: 0;
89+
// overflow: hidden;
90+
// }`,
91+
// `iframe {
92+
// width: 350px;
93+
// height: 300px;
94+
// }`,
7995
`.iframe_wrap {
8096
background-color: #eee;
8197
width: 175px;
@@ -84,24 +100,23 @@
84100
overflow: hidden;
85101
}`,
86102
`iframe {
87-
width: 350px;
88-
height: 300px;
89-
border: none;
90-
-ms-zoom: 0.5;
91-
-moz-transform: scale(0.5);
92-
-moz-transform-origin: 0 0;
93-
-o-transform: scale(0.5);
94-
-o-transform-origin: 0 0;
95-
-webkit-transform: scale(0.5);
96-
-webkit-transform-origin: 0 0;
103+
width: 350px !important;
104+
height: 300px !important;
105+
border: none !important;
106+
-ms-zoom: 0.5 !important;
107+
-moz-transform: scale(0.5) !important;
108+
-moz-transform-origin: 0 0 !important;
109+
-o-transform: scale(0.5) !important;
110+
-o-transform-origin: 0 0 !important;
111+
-webkit-transform: scale(0.5) !important;
112+
-webkit-transform-origin: 0 0 !important;
97113
}`,
98114
];
99115
const sheet = document.body.appendChild(document.createElement('style')).sheet;
100116
for (const i in STYLES) {
101117
sheet.insertRule(STYLES[i], i);
102118
}
103119

104-
const MAX_BTNS_PER_ROW = 6;
105120
let i = 0;
106121
let row = 1;
107122
const $rows = {};
@@ -168,20 +183,22 @@
168183
open_frame_token('blizzard', 0, 1);
169184
open_frame_token('twitch', 0, 1);
170185
open_frame_token('paypal', 0, 1);
171-
open_frame_src('outlook auth', 1, 1);
172-
open_frame_token('github', 1, 1);
173-
open_frame_token('demo2', 1, 1);
174-
// open_frame_token('demo3', 1, 1);
175-
open_frame_src('outlook', 1, 1);
176-
open_frame_token('ea signup', 1, 1);
177-
open_frame_token('ea signin', 1, 1);
186+
open_frame_src('outlook auth', 0, 1);
187+
open_frame_token('github', 0, 1);
188+
open_frame_token('demo2', 0, 1);
189+
// open_frame_token('octocaptcha', 0, 1);
190+
open_frame_src('outlook', 0, 1);
191+
open_frame_token('ea signup', 0, 1);
192+
open_frame_token('ea signin', 0, 1);
193+
open_frame_token('myprepaidcenter', 0, 1);
194+
open_frame_token('twitter', 0, 1);
178195
}
179196

180197
function open_frame_token(k, row, n) {
181198
if (!n) {
182199
n = nframes;
183200
}
184-
console.log('open_frame_token', k, n);
201+
// console.log('open_frame_token', k, n);
185202
for (let i = 0; i < n; i++) {
186203
load_captcha(k, row);
187204
}
@@ -191,7 +208,7 @@
191208
if (!n) {
192209
n = nframes;
193210
}
194-
console.log('open_frame_src', k, n);
211+
// console.log('open_frame_src', k, n);
195212
for (let i = 0; i < n; i++) {
196213
create_frame(k, row, SRCS[k]);
197214
}

funcaptcha_fast.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
window.addEventListener('load', () => {
77
const sheet = document.body.appendChild(document.createElement('style')).sheet;
88
sheet.insertRule('* {transition-duration: 0s !important}', 0);
9+
sheet.insertRule('li > a::after {border: 12px solid rgba(0, 255, 0, 0.9) !important}', 1);
10+
sheet.insertRule('#interstitial {backdrop-filter: none !important}', 2);
11+
sheet.insertRule('#interstitial {background-color: transparent !important}', 3);
12+
// sheet.insertRule('#interstitial {opacity: 0.7 !important}', 4);
913
});
1014
})();

0 commit comments

Comments
 (0)