-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
178 lines (157 loc) · 5.98 KB
/
script.js
File metadata and controls
178 lines (157 loc) · 5.98 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// initiate tooltip
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
function ShowSidebars() {
$(".sidebars").css("display", "flex");
}
function HideSidebars() {
$(".sidebars").css("display", "none");
}
const keyQueue = [];
function CopyKey(key) {
keyQueue.push(key);
if (keyQueue.length === 1) {
processQueue();
}
}
function processQueue() {
const key = keyQueue[0];
navigator.clipboard.writeText(key);
Swal.mixin({
toast: true,
position: 'top',
showConfirmButton: false,
timer: 2000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
}).fire({
icon: 'success',
title: "'" + key + "'<br><br> Has been copied to your clipboard.",
didClose: () => {
keyQueue.shift();
if (keyQueue.length > 0) {
processQueue();
}
}
});
}
$(document).ready(function () {
const crackrows = $("#CrackApps");
const cards = document.querySelectorAll('.card-crack');
const types = new Set();
crackrows.html('');
var bgcolor = "";
var opacity = "";
var source = "";
var available = 0;
var issues = 0;
var deleted = 0;
var total = 0;
$.getJSON("CardItems.json", function (data) {
if (data.length === 0) {
crackrows.append('<div class="col"><h1 class="text-center">No items found!</h1></div>');
return;
}
$.each(data, function (index, item) {
total++;
if (item.source === "MediaFire") {
source = item.source;
item.source = "MF";
} else {
source = item.source;
item.source = "App";
}
if (item.status === "Downloadable") {
bgcolor = "bg-success";
opacity = "opacity-100";
available++;
} else if (item.status === "Not Working Properly") {
bgcolor = "bg-warning";
opacity = "opacity-100";
issues++;
} else if (item.status === "Deleted") {
bgcolor = "bg-danger";
opacity = "opacity-25";
deleted++;
} else {
bgcolor = "bg-secondary";
}
const card = document.createElement('div');
card.classList.add('col', 'scalein');
card.dataset.apptype = item.family;
card.innerHTML = `
<div class="card h-100 card-crack bg-transparent">
<img src="${item.image}" class="card-img-top px-5 py-3 rounded" alt="${item.name}">
<div class="card-body text-bg-body">
<h5 class="card-title">${item.name}</h5>
<p class="card-text">Version: ${item.version}<br>Size: ${item.size}</p>
<span class="vstack gap-1">
<span class="badge text-${bgcolor}">${item.status}</span>
<span class="badge bg-primary">${item.apptype}</span>
</span>
</div>
<div class="card-footer">
<small class="text-body-secondary ${opacity}">
<a href="${item.link}" class="link-underline link-underline-opacity-0" target="_blank">
<svg width="20" height="20" fill="currentColor">
<use xlink:href="#${item.source}" />
</svg>
${source}
</a>
</small>
</div>
</div>
`;
types.add(item.family);
$('#CrackAppsCount').text("There are " + total + " apps available, " + available + " are downloadable, " + issues + " have issues, and " + deleted + " have been deleted.");
crackrows.append(card);
});
// create a all button
const button = document.createElement('button');
button.classList.add('btn', 'btn-sm', 'btn-outline-secondary');
button.textContent = 'All';
button.onclick = () => FilterCrack('All');
document.querySelector('.hstack').appendChild(button);
// create a button for each type
types.forEach(type => {
const button = document.createElement('button');
button.classList.add('btn', 'btn-sm', 'btn-outline-secondary');
button.textContent = type;
button.id = "btn" + type;
button.onclick = () => FilterCrack(type);
document.querySelector('.hstack').appendChild(button);
});
function FilterCrack(type) {
const cards = document.querySelectorAll('.card-crack');
const buttons = document.querySelectorAll('.btn');
buttons.forEach(button => {
button.classList.remove('text-bg-primary');
button.classList.add('btn-outline-secondary');
});
$('#btn' + type).removeClass('btn-outline-secondary').addClass('text-bg-primary');
cards.forEach(card => {
if (type === 'All') {
card.parentElement.style.display = 'block';
} else if (card.parentElement.dataset.apptype === type) {
card.parentElement.style.display = 'block';
} else {
card.parentElement.style.display = 'none';
}
});
}
});
$(window).on('scroll', function () {
var $counter = $('.counterimg');
if ($counter.length === 0) return;
$counter.each(function () {
if ($(window).scrollTop() + $(window).height() >= $(document).height() - 10) {
$(this).show().addClass('mb-3');
} else {
$(this).hide();
}
});
});
});