MediaWiki:Common.js: Perbedaan antara revisi
Tampilan
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
||
| Baris 38: | Baris 38: | ||
$descBox.html( | $descBox.html( | ||
extract + | extract + | ||
' <a href="' + sourceLink + '" target="_blank" style="color: #6a5acd; font-weight: bold; text-decoration: none;">Dari Mippedia | ' <a href="' + sourceLink + '" target="_blank" style="color: #6a5acd; font-weight: bold; text-decoration: none;">Dari Mippedia.</a>' | ||
); | ); | ||
$descSection.show(); // Munculin section kalau ada isinya | $descSection.show(); // Munculin section kalau ada isinya | ||
Revisi per 14 April 2026 22.22
/* ==========================================================
🧠 MIPPEDIA DATA AUTO-DESCRIPTION (SMART CHECK EDITION)
========================================================== */
(function() {
$(document).ready(function() {
var $descSection = $('#mip-desc-section');
var $descBox = $('#mip-auto-description');
if ($descBox.length) {
var pageTitle = mw.config.get('wgPageName');
var apiUrl = 'https://id.mippedia.org/api.php';
$.ajax({
url: apiUrl,
data: {
action: 'query', prop: 'extracts', exintro: true, explaintext: true,
titles: pageTitle, format: 'json', origin: '*'
},
dataType: 'json',
success: function(data) {
var pages = data.query.pages;
var pageId = Object.keys(pages)[0];
// JIKA ARTIKEL ADA (Bukan -1)
if (pageId != "-1") {
var extract = pages[pageId].extract;
// PEMBERSIHAN TOTAL
extract = extract.replace(/\{\{[^}]+\}\}/g, '')
.replace(/\(\s*\)/g, '')
.replace(/\s\s+/g, ' ')
.trim();
if (extract !== "") {
var sourceLink = 'https://id.mippedia.org/wiki/' + encodeURIComponent(pageTitle);
// Masukkan teks dan tampilkan section-nya
$descBox.html(
extract +
' <a href="' + sourceLink + '" target="_blank" style="color: #6a5acd; font-weight: bold; text-decoration: none;">Dari Mippedia.</a>'
);
$descSection.show(); // Munculin section kalau ada isinya
}
}
// JIKA GAK ADA ARTIKEL: Section tetep sembunyi (display: none)
}
});
}
});
})();