LatestArticlesUpdate: Difference between revisions
From Sanatan Hindu Dharma
No edit summary |
No edit summary |
||
| Line 85: | Line 85: | ||
<html> | <html> | ||
<div class=" | <div class="latestArticlesSlider"> | ||
<div class=" | <div class="latestArticlesInner" id="LatestArticlesOutput"></div> | ||
</div> | </div> | ||
<script> | <script> | ||
$(document).ready(function () { | $(document).ready(function () { | ||
new mw.Api().get({ | new mw.Api().get({ | ||
action: "query", | action: "query", | ||
titles: " | titles: "LatestArticlesJSON", | ||
prop: "revisions", | prop: "revisions", | ||
rvprop: "content", | rvprop: "content", | ||
| Line 108: | Line 101: | ||
let content = res.query.pages[0].revisions[0].content; | let content = res.query.pages[0].revisions[0].content; | ||
let | let data = []; | ||
try { | try { data = JSON.parse(content); } catch(e){} | ||
let out = $("#LatestArticlesOutput"); | |||
out.html(""); | |||
data.forEach(item => { | |||
out.append(`<a class="latestArticleBtn" href="${item.link}">${item.title}</a>`); | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
</script> | </script> | ||
</html> | </html> | ||
Revision as of 13:42, 21 November 2025
Latest Articles Manager (10 Items)
| # | Title | Link (href) |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 |

Comments