-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterbaru.html
193 lines (168 loc) · 6.65 KB
/
terbaru.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ipul tampan</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">
<style>
.card-image img {
height: 200px;
object-fit: cover;
}
.bold-text {
font-weight: bold;
}
</style>
</head>
<body>
<!-- Navbar -->
<h5 class="black darken-3 white-text z-depth-3"
style="margin-top: 0px; padding: 5px; text-align: center;">
Saepul
</h5>
<div class="container">
<a href="index.html"
class="btn waves waves-effect pink"
>kembali</a>
<a href="simpan.html"
class="btn waves waves-effect blue"
>Tersimpan</a>
</div>
<div class="container">
<h5 class="bold-text">Terbaru Upload Hari ini</h5>
</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>Refresh 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 format date
function formatDate(dateString) {
const date = new Date(dateString);
const currentDate = new Date();
const monthNames = ["Januari", "Februari", "Maret", "April", "Mei", "Juni",
"Juli", "Agustus", "September", "Oktober", "November", "Desember"];
const day = date.getDate();
const month = monthNames[date.getMonth()];
const year = date.getFullYear();
const hours = date.getHours() + 7; // Mengkonversi ke WIB (UTC+7)
const minutes = date.getMinutes().toString().padStart(2, '0');
// Menambahkan "jam yg lalu" jika tanggal adalah hari ini
if (year === currentDate.getFullYear() && month === monthNames[currentDate.getMonth()] && day === currentDate.getDate()) {
return `${day} ${month} ${year} - ${hours} jam yg lalu`;
} else {
return `${day} ${month} ${year} jam ${hours}:${minutes}`;
}
}
// 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 formattedDate = formatDate(file.uploaded);
const cardHtml = `
<div class="col s12 m12 l12">
<div class="card ">
<div style="display:flex;justify-content:start">
<img
style="width:30%"
src="${file.single_img}" alt="${file.title}">
<div style="margin-left:5px">
<span class="pink-text darken-3 bold-text">${truncatedTitle}</span>
<br/>
<a
class="bold-text"
style="font-size:11px"
href="${'/p.html?id=' + file.file_code}" target="_blank">
${window.location.protocol +'//' +window.location.hostname + '/p.html?id=' + file.file_code}
</a>
<br/>
<span class="bold-text">${formattedDate}</span>
<br/>
<div
style="display:flex;justify-content:space-between"
>
<button onclick="savelocal('${encodeURIComponent(JSON.stringify(file))}')" class="btn waves waves-effect blue">Simpan</button>
<a class="btn waves waves-effect pink"
target="_blank"
href="${'/p.html?id=' + file.file_code}"
>Nonton</a>
</div>
</div>
</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);
});
}
fetchData(1);
});
function openvideo(code){
let random_pilih = direct_click(code)
}
</script>
<div style="margin-top:50px">
</div>
</body>
</html>