-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathscript.js
73 lines (62 loc) · 2.13 KB
/
script.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
document.onclick = hideMenu;
document.oncontextmenu = rightClick;
function hideMenu() {
document.getElementById("contextMenu").style.display = "none"
}
function rightClick(e) {
e.preventDefault();
if (document.getElementById("contextMenu").style.display == "block")
hideMenu();
else {
var menu = document.getElementById("contextMenu")
menu.style.display = 'block';
menu.style.left = e.pageX + "px";
menu.style.top = e.pageY + "px";
}
}
function cloak() {
document.title = "Home";
var link = document.querySelector("link[rel~='icon']");
if (!link) {
link = document.createElement('link');
link.rel = 'icon';
document.head.appendChild(link);
}
link.href = 'https://ssl.gstatic.com/classroom/ic_product_classroom_32.png';
document.getElementById("contextMenu").style.display = "none";
}
function makenameofgame(name) {
const n = document.createElement('p');
n.innerHTML = name;
document.body.appendChild(n);
}
const buttons = document.getElementsByTagName('button');
const buttonCount = buttons.length;
console.log('Number of buttons:', buttonCount);
function searchButtons() {
var input, filter, container, buttons, button, i, txtValue;
input = document.getElementById('searchInput');
container = document.getElementById('container');
// Check if the necessary elements are present
if (!input || !container) {
console.error("Input or container not found.");
return;
}
filter = input.value.toUpperCase();
buttons = container.getElementsByClassName('bubbly-button');
for (i = 0; i < buttons.length; i++) {
button = buttons[i];
// Check if the button has an anchor tag inside
var anchor = button.querySelector('a');
if (anchor) {
txtValue = anchor.textContent || anchor.innerText;
} else {
txtValue = button.textContent || button.innerText;
}
if (txtValue.toUpperCase().indexOf(filter) > -1) {
button.style.display = '';
} else {
button.style.display = 'none';
}
}
}