PluginProbe ʕ •ᴥ•ʔ
Flex Import / 1.4
Flex Import v1.4
2.9 trunk 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8
flex-import / assets / js / dashboard-posts.js
flex-import / assets / js Last commit date
admin-script.js 1 year ago dashboard-posts.js 1 year ago front-script.js 1 year ago jquery.notify.min.js 1 year ago license_script.js 1 year ago plugin-admin.js 1 year ago template-admin.js 1 year ago
dashboard-posts.js
55 lines
1 document.addEventListener('DOMContentLoaded', function() {
2 const dashpostsApiEndpoint = fleximp_dashposts_ajax_object.apiEndpoint;
3 let isFetching = false;
4
5 //new above
6 function fetchPosts() {
7 if (isFetching) return;
8 isFetching = true;
9
10 fetch(dashpostsApiEndpoint, {
11 method: 'POST',
12 headers: {
13 'Content-Type': 'application/json'
14 },
15 body: JSON.stringify({
16 action: 'getLatestPosts'
17 })
18 })
19 .then(response => response.json())
20 .then(data => {
21 if (data.code == 200 && Array.isArray(data.data)) {
22 displayPosts(data.data);
23 } else {
24 console.error('Error fetching plugins:', data);
25 }
26 })
27 .catch(error => {
28 console.error('Error:', error);
29 })
30 .finally(() => {
31 isFetching = false;
32 });
33 }
34
35 // Function to display plugins list
36 function displayPosts(posts) {
37 const dashPostContainer = document.getElementById('dashboard-list');
38 dashPostContainer.innerHTML = '';
39
40 posts.forEach(post => {
41
42 const postHTML = `
43 <div class="plugin-item">
44 <a href="${post.url}" class="plugin-posts" target="_blank">
45 <img src="${post.image}" alt="Plugin Logo" style="max-height:75px; max-width:75px;" class="video-img mt-1">
46 <h3 class="plugin-post-title">${post.title}</h3>
47 </a>
48 </div>`;
49 dashPostContainer.innerHTML += postHTML;
50
51 });
52 }
53 fetchPosts();
54 });
55