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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/* SPDX-License-Identifier: AGPL-3.0-or-later */
import typescriptNever from "./typescriptNever.js";
export default addEventListener(
"load",
(): void => (
setTimeout(
(): void =>
console.assert(
Array.from(
document.querySelectorAll(
// To select the form element, we use different selectors depending on the input mode.
// If the input mode is "natural language", the form is a direct child of the section element, so we use the selector "section > form".
// However, if the input mode is "math input", the form is a direct child of the div element, so we use the selector "div > form".
`
html > body > #__next > div > main > main > div > div > section > form > div > div > input,
html > body > #__next > div > main > main > div > div > div form > div > div > input
`
)
)
.filter((element: Element): boolean => {
if (element instanceof HTMLInputElement) {
return true;
} else if (element instanceof Element) {
console.warn({ element });
} else {
typescriptNever(element);
}
return false;
})
.map((element: Element): void => {
if (element instanceof HTMLElement) {
element.focus();
} else if (element instanceof Element) {
console.warn({ element });
} else {
typescriptNever(element);
}
}).length === 1
),
1000
),
[
(): void =>
Array.from(
document.querySelectorAll(
// The positioning of the ul element is dynamically adjusted to ensure it adapts well to different viewport widths.
// To specifically target the ul element when the viewport width is larger, we use the selector "div:is(:first-child) > ul".
// Conversely, to target the ul element when the viewport width is smaller, we use the selector "div:is(:first-child) + ul".
`
html > body > #__next > div > main > main > div > div > div > section > section > div:is(:first-child) > ul > li,
html > body > #__next > div > main > main > div > div > div > section > section > div:is(:first-child) + ul > li
`
)
)
.filter((element: Element): boolean => {
if (element instanceof HTMLLIElement) {
return true;
} else if (element instanceof Element) {
console.warn({ element });
} else {
typescriptNever(element);
}
return false;
})
.forEach((element: Element): void => {
if (element instanceof HTMLElement) {
if (element.innerHTML.includes("Step-by-step")) {
element.style.display = "none";
} else {
}
} else if (element instanceof Element) {
console.warn({ element });
} else {
typescriptNever(element);
}
}),
(): void => {
document.title = document.title.replace(
"- Wolfram|Alpha",
"- Free Wolfram|Alpha Step-by-step Solution - Wolfree"
);
},
].map(
(callback: () => void): void => (
setInterval(callback, 2000), addEventListener("click", callback)
)
),
scroll(0, 0)
)
);
|