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 1: | Baris 1: | ||
/* ========================================================== | /* ========================================================== | ||
🧠 MIPPEDIA DATA AUTO-DESCRIPTION ( | 🧠 MIPPEDIA DATA AUTO-DESCRIPTION (PURE & CLEAN) | ||
========================================================== */ | ========================================================== */ | ||
(function() { | (function() { | ||
$(document).ready(function() { | $(document).ready(function() { | ||
var $descBox = $('#mip-auto-description'); | var $descBox = $('#mip-auto-description'); | ||
if ($descBox.length) { | if ($descBox.length) { | ||
| Baris 27: | Baris 24: | ||
var extract = pages[pageId].extract; | var extract = pages[pageId].extract; | ||
// PEMBERSIHAN | // PEMBERSIHAN TOTAL (Template, Kurung Kosong, Spasi Berantakan) | ||
extract = extract.replace(/\{\{[^}]+\}\}/g, '').replace(/\(\s*\)/g, '').replace(/\s\s+/g, ' ').trim(); | extract = extract.replace(/\{\{[^}]+\}\}/g, '') // Hapus {{...}} | ||
.replace(/\(\s*\)/g, '') // Hapus ( ) kosong | |||
.replace(/\s\s+/g, ' ') // Hapus spasi renggang | |||
.trim(); | |||
var sourceLink = 'https://id.mippedia.org/wiki/' + encodeURIComponent(pageTitle); | var sourceLink = 'https://id.mippedia.org/wiki/' + encodeURIComponent(pageTitle); | ||
// Tampilkan teks utuh tanpa fitur lipat | |||
$descBox.html( | |||
extract + | |||
' <a href="' + sourceLink + '" target="_blank" style="color: #6a5acd; font-weight: bold; text-decoration: none;">Dari Mippedia ↗️</a>' | |||
); | |||
} | } | ||
} | } | ||
Revisi per 14 April 2026 22.09
/* ==========================================================
🧠 MIPPEDIA DATA AUTO-DESCRIPTION (PURE & CLEAN)
========================================================== */
(function() {
$(document).ready(function() {
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];
if (pageId != "-1") {
var extract = pages[pageId].extract;
// PEMBERSIHAN TOTAL (Template, Kurung Kosong, Spasi Berantakan)
extract = extract.replace(/\{\{[^}]+\}\}/g, '') // Hapus {{...}}
.replace(/\(\s*\)/g, '') // Hapus ( ) kosong
.replace(/\s\s+/g, ' ') // Hapus spasi renggang
.trim();
var sourceLink = 'https://id.mippedia.org/wiki/' + encodeURIComponent(pageTitle);
// Tampilkan teks utuh tanpa fitur lipat
$descBox.html(
extract +
' <a href="' + sourceLink + '" target="_blank" style="color: #6a5acd; font-weight: bold; text-decoration: none;">Dari Mippedia ↗️</a>'
);
}
}
});
}
});
})();