-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpan.html
129 lines (109 loc) · 3.86 KB
/
simpan.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nonton Film</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="config.js"></script>
<style>
.card-image img {
height: 200px;
object-fit: cover;
}
.bold-text {
font-weight: bold;
}
</style>
</head>
<body>
<!-- Navbar -->
<h5 class="pink white-text z-depth-3" style="margin-top: 0px; padding: 5px; text-align: center;">
Pengen Bo
</h5>
<div class="container">
<a href="index.html" class="btn waves waves-effect pink">Kembali</a>
<a href="cari.html" class="btn waves waves-effect purple">Cari Video</a>
</div>
<div class="container" style="margin-top: 10px">
<button onclick="hapusSemua()" class="btn waves waves-effect red">Hapus Semua</button>
</div>
<!-- Container for Cards -->
<div class="container">
<h5 class="bold-text">Video Yang udah lu Simpen disini</h5>
</div>
<div>
<div class="row" id="saved-cards-container">
<!-- Saved 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="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
function openvideo(code) {
let random_pilih = direct_click(code);
}
function hapusvideo(code) {
let savedFiles = localStorage.getItem('nonton-film');
if (savedFiles) {
let files = JSON.parse(savedFiles);
files = files.filter(file => file.file_code !== code);
localStorage.setItem('nonton-film', JSON.stringify(files));
loadSavedVideos();
Swal.fire(
'Terhapus!',
'Video telah dihapus.',
'success'
);
}
}
function hapusSemua() {
localStorage.removeItem('nonton-film');
loadSavedVideos();
Swal.fire(
'Terhapus!',
'Semua video telah dihapus.',
'success'
);
}
function loadSavedVideos() {
const savedFiles = localStorage.getItem('nonton-film');
const container = document.getElementById('saved-cards-container');
container.innerHTML = '';
if (savedFiles) {
const files = JSON.parse(savedFiles);
files.reverse();
files.forEach(file => {
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">${file.title}</span>
</div>
<div style="display:flex; justify-content:space-between; margin-top:20px">
<button onclick="hapusvideo('${file.file_code}')" class="btn waves waves-effect red">Hapus</button>
<button onclick="openvideo('${file.file_code}')" class="btn waves waves-effect blue">Nonton</button>
</div>
</div>
</div>
`;
container.innerHTML += cardHtml;
});
} else {
container.innerHTML = '<p>Ga Ada Video yg lu Simpen . simpen dulu ntar ada disini</p>';
}
}
document.addEventListener('DOMContentLoaded', function() {
loadSavedVideos();
});
</script>
</body>
</html>