-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
duckRace_cheat.js
62 lines (56 loc) · 1.86 KB
/
duckRace_cheat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { BADGES } from "./helpers/badge.js";
export default {
icon: "https://www.online-stopwatch.com/favicon.ico",
name: {
en: "Hack Duck race",
vi: "Hack Duck race",
},
description: {
en: "Hack result of Duck race, always get the result you want",
vi: "Hack kết quả Duck race, sẽ luôn ra kết quả bạn mong muốn",
img: "/scripts/duckRage_cheat.png",
},
badges: [BADGES.hot],
whiteList: ["https://www.online-stopwatch.com/*"],
pageScript: {
onClick: () => {
let targets = prompt(
"Nhập các kết quả mong muốn (tên hoặc số):\nCách nhau bởi dấu phẩy ,\n Ví dụ: 1,abc,5,20,test",
""
);
if (targets === null) return;
targets = targets
.split(",")
.map((_) => _.trim())
.filter((_) => _);
let iframe = document.querySelector('iframe[src*="duck-race"]');
[window, iframe?.contentWindow]
.filter((_) => _)
.forEach((win) => {
if (!win.ufs_duckRace_originalShuffle)
win.ufs_duckRace_originalShuffle = win.Array.prototype.shuffle;
win.Array.prototype.shuffle = function () {
const result = win.ufs_duckRace_originalShuffle.apply(
this,
arguments
);
if (result?.[0]?.instance) {
for (let target of targets) {
let targetIndex = result.findIndex(
(i) => i?.name === target || i?.number == target
);
if (targetIndex >= 0) {
let temp = result[0];
result[0] = result[targetIndex];
result[targetIndex] = temp;
break;
}
}
}
console.log("shuffle", this, result, result[0]);
return result;
};
});
},
},
};