-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
174 lines (152 loc) · 5.57 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bang Ipul</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet">
<link rel="stylesheet" href="global.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.card-image img {
height: 200px;
object-fit: cover;
}
.bold-text {
font-weight: bold;
}
</style>
</head>
<body>
<!-- Navbar -->
<h5 class="black darken-3 bold-text white-text z-depth-3"
style="margin-top: 0px; padding: 5px; text-align: center;">
Dion Ganteng
</h5>
<div class="container">
<a href="simpan.html"
class="btn waves waves-effect pink"
>Tersimpan</a>
<a href="cari.html"
class="btn waves waves-effect purple"
>Cari Video</a>
<a href="chat.html"
class="btn waves waves-effect blue"
>Request</a>
</div>
<div class="container" style="margin-top:10px">
<a href="terbaru.html"
class="btn waves waves-effect green bold-text"
>Terbaru Upload</a>
</div>
<!-- Container for Cards -->
<div id="preloader" style="margin-top:30px">
<div style="display: flex;justify-content: center;">
<div class="preloader-wrapper big active">
<div class="spinner-layer spinner-red-only">
<div class="circle-clipper left">
<div class="circle"></div>
</div><div class="gap-patch">
<div class="circle"></div>
</div><div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
</div>
<h6 style="font-weight: bold;text-align: center;">Sedang Mencari Video... <br>Refres web kalo lama</h6>
</div>
<!-- Container for Cards -->
<div >
<div class="row" id="cards-container">
<!-- Cards will be inserted here dynamically -->
</div>
</div>
<!-- Import jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Import Materialize JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="config.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const apiUrl = 'https://doodapi.com/api/file/list';
function togglePreloader(show) {
const preloader = document.getElementById('preloader');
if (show) {
preloader.style.display = 'block';
} else {
preloader.style.display = 'none';
}
}
// Function to truncate text
function truncateText(text, maxLength) {
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text;
}
// Function to fetch data from API
function fetchData(page) {
fetch(`${cors_any}/${apiUrl}?key=${key_api}&page=${page}`)
.then(response => response.json())
.then(data => {
if (data.msg === "OK") {
togglePreloader(false);
const files = data.result.files;
const container = document.getElementById('cards-container');
container.innerHTML = ''; // Clear previous cards
files.forEach(file => {
const truncatedTitle = truncateText(file.title, 40);
const cardHtml = `
<div class="col s6 m3 l3">
<div class="card waves waves-effect">
<div >
<img
style="width:100%"
src="${file.single_img}" alt="${file.title}">
</div>
<div class="container">
<span class="pink-text darken-3 bold-text">${truncatedTitle}</span>
</div>
<div style="display:flex;justify-content:space-between;margin:5px">
<button onclick="savelocal('${encodeURIComponent(JSON.stringify(file))}')" class="btn waves waves-effect blue">Simpan</button>
<button onclick="openvideo('${file.file_code}')" class="btn waves waves-effect pink">Nonton</button>
</div>
</div>
</div>
`;
container.innerHTML += cardHtml;
});
}
})
.catch(error => {
togglePreloader(false);
Swal.fire({
icon: 'error',
title: 'Gagal Dapat Video',
text: 'Coba Lu Refresh , kalo masih lama loading / error berarti server error tungguin aja ntar di benerin',
});
console.error('Error fetching data:', error);
});
}
// Fetch initial data to get total pages
fetch(`${cors_any}/${apiUrl}?key=${key_api}`)
.then(response => response.json())
.then(data => {
if (data.msg === "OK") {
const totalPages = data.result.total_pages;
const randomPage = Math.floor(Math.random() * totalPages) + 1;
fetchData(randomPage);
}
})
.catch(error => {
console.error('Error fetching data:', error);
});
});
function openvideo(code){
let random_pilih = direct_click(code)
}
</script>
<div style="margin-top:50px">
</div>
</body>
</html>