-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowme.js
158 lines (138 loc) · 5.63 KB
/
Showme.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
javascript:(function() {
function highlightElement(element) {
if (element) {
element.style.border = "2px solid #ff4d4d";
element.style.backgroundColor = "rgba(255,77,77,0.1)";
}
}
// Collect all elements based on type
function collectElements(options = { all: true }) {
let elements = [];
if (options.all) {
elements = Array.from(document.getElementsByTagName("*"));
} else {
let collections = [];
// Input controls
if (options.inputs) {
const inputTypes = ['text', 'password', 'radio', 'checkbox', 'email', 'url',
'number', 'tel', 'search', 'date', 'time', 'datetime-local'];
inputTypes.forEach(type => {
collections.push(Array.from(document.querySelectorAll(`input[type="${type}"]`)));
});
}
// Buttons
if (options.buttons) {
collections.push(
Array.from(document.querySelectorAll('button')),
Array.from(document.querySelectorAll('input[type="submit"]')),
Array.from(document.querySelectorAll('input[type="button"]'))
);
}
// Container elements
if (options.containers) {
collections.push(
Array.from(document.getElementsByTagName('div')),
Array.from(document.getElementsByTagName('section')),
Array.from(document.getElementsByTagName('article')),
Array.from(document.getElementsByTagName('aside'))
);
}
// Label elements
if (options.labels) {
collections.push(
Array.from(document.getElementsByTagName('label')),
Array.from(document.getElementsByTagName('td')),
Array.from(document.getElementsByTagName('tr')),
Array.from(document.getElementsByTagName('span'))
);
}
elements = collections.flat();
}
return [...new Set(elements)]; // Remove duplicates
}
// Main unlocking function
function unlockElements() {
const elements = collectElements({ all: true });
elements.forEach(element => {
let modified = false;
// Remove restrictions
if (element.hasAttribute('disabled')) {
element.disabled = false;
modified = true;
}
if (element.hasAttribute('readonly')) {
element.removeAttribute('readonly');
modified = true;
}
if (element.hasAttribute('required')) {
element.required = false;
modified = true;
}
if (element.hasAttribute('maxLength')) {
element.removeAttribute('maxLength');
modified = true;
}
if (element.hasAttribute('pattern')) {
element.removeAttribute('pattern');
modified = true;
}
if (element.hasAttribute('min')) {
element.removeAttribute('min');
modified = true;
}
if (element.hasAttribute('max')) {
element.removeAttribute('max');
modified = true;
}
// Convert restricted input types to text
if (element.tagName === 'INPUT') {
const restrictedTypes = ['email', 'url', 'number', 'tel', 'date', 'time', 'datetime-local', 'hidden'];
if (restrictedTypes.includes(element.type)) {
element.type = 'text';
modified = true;
}
}
// Make elements visible
const computedStyle = window.getComputedStyle(element);
if (computedStyle.visibility === 'hidden') {
element.style.visibility = 'visible';
modified = true;
}
if (computedStyle.display === 'none') {
element.style.display = 'block';
modified = true;
}
if (parseFloat(computedStyle.opacity) === 0) {
element.style.opacity = '1';
modified = true;
}
// Remove pointer-events: none
if (computedStyle.pointerEvents === 'none') {
element.style.pointerEvents = 'auto';
modified = true;
}
// Highlight modified elements
if (modified) {
highlightElement(element);
}
});
// Stop all intervals and timeouts
const highestTimeoutId = window.setTimeout(() => {}, 0);
for (let i = 0; i <= highestTimeoutId; i++) {
window.clearTimeout(i);
window.clearInterval(i);
}
// Remove overlay elements that might block interaction
const overlays = Array.from(document.querySelectorAll('*')).filter(el => {
const style = window.getComputedStyle(el);
return (style.position === 'fixed' || style.position === 'absolute') &&
(style.zIndex !== 'auto' && parseInt(style.zIndex) > 100);
});
overlays.forEach(overlay => {
overlay.remove();
});
console.log('UI elements unlocked and revealed');
}
// Execute the unlock
unlockElements();
})();