-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaginated-list.js
27 lines (24 loc) · 1.1 KB
/
paginated-list.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
import deleteTrick from './trick/removal/delete-trick';
import imageListLoader from './all/image-list-loader';
export default () => {
// ------------------- Paginated page (trick list) -------------------
const element = document.getElementById('st-paginated-trick-list');
if (element) {
// No trick was found! So this will stop all the script.
const nodes = element.querySelectorAll('.uk-card');
if (0 === nodes.length) {
return;
}
// Manage list actions
nodes.forEach(card => {
// Trick list image loader behavior when page is loaded.
imageListLoader(document.getElementById('st-card-image-' + card.parentElement.getAttribute('data-offset')));
// ------------------------------------------------------------------------------------------------------------
// Manage trick deletion
let trickRemovalLink = card.querySelector('.st-delete-trick');
if (trickRemovalLink) {
deleteTrick(card.querySelector('.st-delete-trick'), element);
}
});
}
};