MediaWiki:Common.js: Perbedaan antara revisi
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
||
| Baris 691: | Baris 691: | ||
if (!$sidePanel.is(e.target) && $sidePanel.has(e.target).length === 0 && !$floatBtn.is(e.target)) { | if (!$sidePanel.is(e.target) && $sidePanel.has(e.target).length === 0 && !$floatBtn.is(e.target)) { | ||
$sidePanel.css('right', '-110%'); | $sidePanel.css('right', '-110%'); | ||
} | } | ||
}); | }); | ||
| Baris 778: | Baris 737: | ||
$suggestBox.append($list); | $suggestBox.append($list); | ||
$('.noarticletext').first().after($suggestBox); | $('.noarticletext').first().after($suggestBox); | ||
} | |||
}); | |||
}); | |||
})(); | |||
/* ========================================================== | |||
📅 MIPPEDIA DATA - ON THIS DAY SYSTEM | |||
Otomatis menampilkan entitas yang berulang tahun/anniversary | |||
========================================================== */ | |||
(function() { | |||
$(document).ready(function() { | |||
var today = new Date(); | |||
var currentDay = today.getDate(); | |||
var currentMonth = today.toLocaleString('id-ID', { month: 'long' }); | |||
// Query ke API untuk mencari entitas dengan tanggal hari ini | |||
var searchQuery = currentDay + " " + currentMonth; | |||
var apiUrl = mw.util.wikiScript('api') + "?action=query&list=search&srsearch=" + encodeURIComponent(searchQuery) + "&srlimit=5&format=json"; | |||
$.getJSON(apiUrl, function(data) { | |||
var results = data.query.search; | |||
if (results.length > 0) { | |||
var $otdBox = $('<div id="mip-otd-box">').css({ | |||
'margin': '20px 0', 'padding': '15px', 'background': '#fff', | |||
'border': '2px solid #6a5acd', 'border-radius': '12px', 'box-shadow': '0 4px 10px rgba(0,0,0,0.05)' | |||
}); | |||
$otdBox.append('<div style="font-weight:bold; color:#6a5acd; margin-bottom:10px;">🌟 Hari Ini di Mippedia (' + currentDay + ' ' + currentMonth + ')</div>'); | |||
var $list = $('<div style="display:flex; flex-direction:column; gap:8px;"></div>'); | |||
results.forEach(function(res) { | |||
var link = mw.util.getUrl(res.title); | |||
$list.append('<a href="' + link + '" style="text-decoration:none; color:#333; font-size:0.9em; padding:5px; border-radius:5px;" onmouseover="this.style.background=\'#f4f1ff\'" onmouseout="this.style.background=\'transparent\'">🎂 <strong>' + res.title + '</strong> - Lihat Profil →</a>'); | |||
}); | |||
$otdBox.append($list); | |||
// Tempelkan di sidebar atau area konten utama | |||
$('#mw-content-text').prepend($otdBox); | |||
} | |||
}); | |||
}); | |||
})(); | |||
/* ========================================================== | |||
🧠 MIPPEDIA DATA - SMART SEARCH INTELLIGENCE | |||
Meningkatkan akurasi pencarian berdasarkan properti data | |||
========================================================== */ | |||
(function() { | |||
$(document).ready(function() { | |||
var $searchInput = $('#searchInput'); | |||
$searchInput.on('keydown', function(e) { | |||
if (e.which === 13) { // Saat tekan Enter | |||
var val = $(this).val().toLowerCase(); | |||
// Logika: Jika user mencari kategori umum, arahkan ke pencarian properti | |||
var keywords = ['musisi', 'bandung', 'organisasi', 'pendiri', 'teknologi']; | |||
var isPropertySearch = keywords.some(function(k) { return val.includes(k); }); | |||
if (isPropertySearch) { | |||
e.preventDefault(); | |||
// Arahkan ke halaman pencarian dengan filter teks penuh agar isi tabel kena scan | |||
window.location.href = mw.util.getUrl('Istimewa:Pencarian') + | |||
"?search=" + encodeURIComponent(val) + | |||
"&fulltext=1&ns0=1"; | |||
} | |||
} | |||
}); | |||
// Menambahkan label cerdas di bawah bar pencarian saat diklik | |||
$searchInput.on('focus', function() { | |||
if (!$('#search-hint').length) { | |||
$(this).after('<div id="search-hint" style="font-size:0.7em; color:#6a5acd; margin-top:5px; position:absolute;">💡 Tip: Cari berdasarkan pekerjaan atau kota (misal: "Musisi Bandung")</div>'); | |||
} | } | ||
}); | }); | ||
}); | }); | ||
})(); | })(); | ||