MediaWiki:Common.js: Perbedaan antara revisi
Tidak ada ringkasan suntingan Tanda: Dikembalikan Suntingan perangkat seluler Suntingan peramban seluler |
Tidak ada ringkasan suntingan Tanda: Dikembalikan Suntingan perangkat seluler Suntingan peramban seluler |
||
| Baris 1: | Baris 1: | ||
/* ========================================================== | /* ========================================================== | ||
🧠 MIPPEDIA DATA - SMART CONTEXT + AUTO THUMBNAIL (V11) | 🧠 MIPPEDIA DATA - SMART CONTEXT + AUTO THUMBNAIL (V11.2) | ||
Features: Priority Check (ID > EN > CONCISE), Auto-Age, | Features: Priority Check (ID > EN > CONCISE), Auto-Age, | ||
Auto-Bold, Smart Links, Dynamic Context, | Auto-Bold, Smart Links, Dynamic Context, | ||
Dynamic Noindex, Instant Action Hub (3 Buttons). | |||
Fixes: | |||
- Instant isolation hiding for Infobox/Wikidata elements. | |||
- | - Fixed layout text gaps (Removed forced justify spacing). | ||
- | - Removed ugly red block/box layout. | ||
- | - Re-concepted Server Sync radar to "Live Data Integrator Scanner". | ||
========================================================= */ | ========================================================= */ | ||
(function() { | (function() { | ||
| Baris 19: | Baris 19: | ||
var pageTitle = mw.config.get('wgPageName').replace(/_/g, ' '), | var pageTitle = mw.config.get('wgPageName').replace(/_/g, ' '), | ||
cacheKey = 'mip_smart_context_thumb_' + pageTitle | cacheKey = 'mip_smart_context_thumb_' + pageTitle, | ||
currentYear = 2026; | currentYear = 2026; | ||
| Baris 29: | Baris 29: | ||
]; | ]; | ||
// --- 🎨 | // --- 🎨 CSS INJECTION & REAL-TIME ANIMATION (V11.2 FIX) --- | ||
if (!$('#mip-clean-style').length) { | if (!$('#mip-clean-style').length) { | ||
$('head').append( | $('head').append( | ||
'<style id="mip-clean-style">' + | '<style id="mip-clean-style">' + | ||
'@keyframes mipFadeInUp {' + | '@keyframes mipFadeInUp {' + | ||
'from { opacity: 0; transform: translateY( | 'from { opacity: 0; transform: translateY(10px); }' + | ||
'to { opacity: 1; transform: translateY(0); }' + | 'to { opacity: 1; transform: translateY(0); }' + | ||
'}' + | '}' + | ||
'@keyframes mipPulse {' + | '@keyframes mipPulse {' + | ||
'0% { transform: scale(1); opacity: 1; }' + | '0% { transform: scale(1); opacity: 1; }' + | ||
'50% { transform: scale(1. | '50% { transform: scale(1.06); opacity: 0.85; filter: drop-shadow(0 0 6px rgba(217,83,79,0.5)); }' + | ||
'100% { transform: scale(1); opacity: 1; }' + | '100% { transform: scale(1); opacity: 1; }' + | ||
'}' + | '}' + | ||
'@keyframes mipRadarSweep {' + | '@keyframes mipRadarSweep {' + | ||
'0% { transform: translateY(-100%); opacity: 0; }' + | '0% { transform: translateY(-100%); opacity: 0; }' + | ||
| Baris 49: | Baris 47: | ||
'90% { opacity: 1; }' + | '90% { opacity: 1; }' + | ||
'100% { transform: translateY(100%); opacity: 0; }' + | '100% { transform: translateY(100%); opacity: 0; }' + | ||
'}' + | |||
/* Kelas Isolat Instan: Sembunyikan infobox & data mentah secepat kilat */ | |||
'.mip-isolated-active #mw-content-text > *:not(#mip-empty-state-notice):not(#mip-desc-section):not(script):not(style) {' + | |||
'display: none !important;' + | |||
'}' + | '}' + | ||
'#mip-empty-state-notice {' + | '#mip-empty-state-notice {' + | ||
'display: block !important;' + | 'display: block !important;' + | ||
'animation: mipFadeInUp 0. | 'animation: mipFadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;' + | ||
'}' + | '}' + | ||
'.mip-pulse-icon {' + | '.mip-pulse-icon {' + | ||
| Baris 82: | Baris 84: | ||
'color: #ffffff !important; background: #6a5acd;' + | 'color: #ffffff !important; background: #6a5acd;' + | ||
'transform: translateY(-2px); box-shadow: 0 4px 12px rgba(106,92,205,0.2);' + | 'transform: translateY(-2px); box-shadow: 0 4px 12px rgba(106,92,205,0.2);' + | ||
'}' + | '}' + | ||
'</style>' | '</style>' | ||
| Baris 90: | Baris 89: | ||
} | } | ||
// --- | // --- PRE-CHECK CACHE (Eksekusi Instan Sebelum Render API) --- | ||
var cached = JSON.parse(localStorage.getItem(cacheKey) || "{}"); | |||
if (cached.isEmpty) { | |||
$('body').addClass('mip-isolated-active'); | |||
} | |||
function applyAutoBold(text) { return text.replace(new RegExp('(' + pageTitle + ')', 'gi'), '<strong>$1</strong>'); } | function applyAutoBold(text) { return text.replace(new RegExp('(' + pageTitle + ')', 'gi'), '<strong>$1</strong>'); } | ||
function cleanExtract(text) { return text.replace(/\[\d+\]/g, '').replace(/\{\{[^}]+\}\}/g, '').replace(/\(\s*\)/g, '').replace(/\s\s+/g, ' ').trim(); } | function cleanExtract(text) { return text.replace(/\[\d+\]/g, '').replace(/\{\{[^}]+\}\}/g, '').replace(/\(\s*\)/g, '').replace(/\s\s+/g, ' ').trim(); } | ||
| Baris 116: | Baris 120: | ||
} | } | ||
function buildSmartLinks(currentId, validatedEnTitle) { | function buildSmartLinks(currentId, validatedEnTitle) { | ||
$portalLinks.empty(); | $portalLinks.empty(); | ||
var validLinks = []; | var validLinks = []; | ||
var checkRequests = projects.filter(p => p.id !== currentId).map(function(p) { | var checkRequests = projects.filter(p => p.id !== currentId).map(function(p) { | ||
var targetTitle = (p.id === 'en' && validatedEnTitle) ? validatedEnTitle : pageTitle; | var targetTitle = (p.id === 'en' && validatedEnTitle) ? validatedEnTitle : pageTitle; | ||
| Baris 138: | Baris 140: | ||
} | } | ||
// --- 🧠 RENDER EMPTY STATE + INTERACTIVE HUB (V11 | // --- 🧠 RENDER EMPTY STATE + INTERACTIVE HUB (V11.2 REFINED) --- | ||
function toggleMippediaLayout(isEmpty) { | function toggleMippediaLayout(isEmpty) { | ||
var $existingNotice = $('#mip-empty-state-notice'); | var $existingNotice = $('#mip-empty-state-notice'); | ||
var userGroups = mw.config.get('wgUserGroups') || []; | var userGroups = mw.config.get('wgUserGroups') || []; | ||
var isSysop = userGroups.indexOf('sysop') !== -1; | var isSysop = userGroups.indexOf('sysop') !== -1; | ||
var $editElements = $('#ca-edit, .mw-editsection, .wb-editsection, .mip-edit-trigger, [id*="edit"], [class*="edit-pencil"]'); | var $editElements = $('#ca-edit, .mw-editsection, .wb-editsection, .mip-edit-trigger, [id*="edit"], [class*="edit-pencil"]'); | ||
var $metaRobots = $('meta[name="robots"]'); | var $metaRobots = $('meta[name="robots"]'); | ||
if (isEmpty) { | if (isEmpty) { | ||
$('body').addClass('mip-isolated-active'); | |||
if (!$existingNotice.length) { | if (!$existingNotice.length) { | ||
var createUrlID = 'https://id.mippedia.org/index.php?title=' + encodeURIComponent(pageTitle) + '&action=edit'; | var createUrlID = 'https://id.mippedia.org/index.php?title=' + encodeURIComponent(pageTitle) + '&action=edit'; | ||
| Baris 155: | Baris 157: | ||
var noticeHtml = | var noticeHtml = | ||
'<div id="mip-empty-state-notice" style="text-align: center; max-width: 680px; margin: | '<div id="mip-empty-state-notice" style="text-align: center; max-width: 680px; margin: 30px auto; padding: 15px; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;">' + | ||
'<!-- Ikon Warning Dengan Animasi | |||
'<div class="mip-pulse-icon" style="margin-bottom: | '<!-- Ikon Warning Dengan Animasi Denyut Real-Time -->' + | ||
'<svg width=" | '<div class="mip-pulse-icon" style="margin-bottom: 20px; display: inline-block;">' + | ||
'<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#d9534f" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' + | |||
'<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>' + | '<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>' + | ||
'<line x1="12" y1="9" x2="12" y2="13"></line>' + | '<line x1="12" y1="9" x2="12" y2="13"></line>' + | ||
| Baris 166: | Baris 169: | ||
'<!-- Judul Utama -->' + | '<!-- Judul Utama -->' + | ||
'<h4 style="color: #2c3e50; margin: 0 0 | '<h4 style="color: #2c3e50; margin: 0 0 18px 0; font-size: 1.4em; font-weight: 700; letter-spacing: -0.4px;">Item Data Terisolasi: Tidak Ditemukan Sumber Artikel Rujukan</h4>' + | ||
'<!-- 📄 NARASI INFORMASI | '<!-- 📄 NARASI INFORMASI (Symmetry & Text Alignment Refined) -->' + | ||
'<div style="text-align: | '<div style="text-align: left; color: #4a5568; font-size: 0.95em; line-height: 1.6; margin-bottom: 25px; padding: 0 5px;">' + | ||
'<p style="margin-bottom: | '<p style="margin-bottom: 14px; text-align: left; letter-spacing: normal; word-spacing: normal;">' + | ||
'Sistem deteksi otomatis mencatat bahwa item repositori data terstruktur ini berada dalam status <strong>Yatim (Orphaned Data Item)</strong>. Evaluasi siklus menyeluruh yang dijalankan pada sistem internal mengonfirmasi bahwa halaman data ini sama sekali <strong>tidak memiliki tautan rujukan aktif ataupun dokumen artikel ensiklopedia yang terikat</strong> di ketiga pilar utama ekosistem kita, yaitu: <em>Mippedia bahasa Indonesia (ID)</em>, <em>Mippedia bahasa Inggris (EN)</em>, maupun <em>Mippedia Indonesia Ringkas (Concise)</em>.' + | 'Sistem deteksi otomatis mencatat bahwa item repositori data terstruktur ini berada dalam status <strong>Yatim (Orphaned Data Item)</strong>. Evaluasi siklus menyeluruh yang dijalankan pada sistem internal mengonfirmasi bahwa halaman data ini sama sekali <strong>tidak memiliki tautan rujukan aktif ataupun dokumen artikel ensiklopedia yang terikat</strong> di ketiga pilar utama ekosistem kita, yaitu: <em>Mippedia bahasa Indonesia (ID)</em>, <em>Mippedia bahasa Inggris (EN)</em>, maupun <em>Mippedia Indonesia Ringkas (Concise)</em>.' + | ||
'</p>' + | '</p>' + | ||
'<p style="margin-bottom: | |||
'<!-- Perbaikan: Mengubah susunan kotak merah jelek menjadi poin teks yang clean -->' + | |||
'<p style="margin-bottom: 14px; text-align: left; letter-spacing: normal; word-spacing: normal;">' + | |||
'<span style="color: #d9534f; margin-right: 6px; font-size: 1.1em;">🔴</span><strong>DAMPAK STRUKTURAL SISTEM:</strong> ' + | |||
'Berdasarkan protokol standardisasi integritas data Mippedia Foundation, setiap entitas data yang tersimpan wajib merepresentasikan objek nyata yang memiliki cakupan artikel rujukan. Ketiadaan rujukan menyebabkan item ini mengalami anomali pengindeksan, memicu galat visual pada mesin pembaca skrip otomatis, serta secara berkala menurunkan skor optimasi SEO (Search Engine Optimization) ekosistem repositori data secara global.' + | |||
'</p>' + | '</p>' + | ||
'<p style="margin-bottom: | |||
'<strong> | '<p style="margin-bottom: 14px; text-align: left; letter-spacing: normal; word-spacing: normal;">' + | ||
'<span style="color: #f0ad4e; margin-right: 6px; font-size: 1.1em;">⚖️</span><strong>REGULASI PEMELIHARAAN SERVER:</strong> ' + | |||
'Item data tanpa rujukan artikel diklasifikasikan sebagai data konsumsi sementara (*temporary cache entry*). Jika dalam kurun waktu evaluasi berkala item ini tetap dibiarkan kosong tanpa adanya validasi dari pembuatan artikel baru, maka sistem pembersihan otomatis (*cron-job cleaner*) bersama dengan dewan moderator Mippedia Community akan melakukan tindakan pembersihan permanen (*Hard Purge / Delete*) untuk menghemat ruang alokasi database server.' + | |||
'</p>' + | '</p>' + | ||
'<p style="margin-bottom: 0;">' + | |||
'<strong> | '<p style="margin-bottom: 0; text-align: left; letter-spacing: normal; word-spacing: normal;">' + | ||
'<span style="color: #5cb85c; margin-right: 6px; font-size: 1.1em;">💡</span><strong>PANDUAN KONTRIBUTOR:</strong> ' + | |||
'Untuk menyelamatkan entitas data ini, Anda sangat disarankan untuk segera menginisiasi pembuatan draf artikel baru menggunakan tombol modul akselerasi instan di bawah ini. Pastikan Anda memasukkan informasi yang valid, netral, dan menyertakan rujukan literatur yang kredibel saat halaman penyuntingan terbuka.' + | |||
'</p>' + | '</p>' + | ||
'</div>' + | '</div>' + | ||
'<!-- | '<!-- 📡 RE-CONCEPT: LIVE DATA INTEGRATOR SCANNER (ANIMASI REAL-TIME) -->' + | ||
'<div class="mip-radar-box">' + | '<div class="mip-radar-box">' + | ||
'<div class="mip-radar-line"></div>' + | '<div class="mip-radar-line"></div>' + | ||
'<div style="display: flex; align-items: center; justify-content: space-between; font-size: 0.82em; color: #555; font-family: monospace;">' + | '<div style="display: flex; align-items: center; justify-content: space-between; font-size: 0.82em; color: #555; font-family: monospace;">' + | ||
'<span> | '<span>🔍 LIVE DATA INTEGRATOR SCANNER:</span>' + | ||
'<span style="color: #6a5acd; font-weight: bold; animation: mipPulse 1.5s infinite;"> | '<span style="color: #6a5acd; font-weight: bold; animation: mipPulse 1.5s infinite;">MAPPING ACTIVE</span>' + | ||
'</div>' + | '</div>' + | ||
'<div style="margin-top: 8px; font-size: 0.8em; color: # | '<div style="margin-top: 8px; font-size: 0.8em; color: #666; line-height: 1.5; font-family: monospace;">' + | ||
'• | '• ID_MAPPED_ENTITIES : CEK SELESAI (0 INDEKS COCOK)<br>' + | ||
'• | '• EN_MAPPED_ENTITIES : CEK SELESAI (0 INDEKS COCOK)<br>' + | ||
'• | '• CONCISE_MAPPED_INDEX : CEK SELESAI (0 INDEKS COCOK)' + | ||
'</div>' + | '</div>' + | ||
'</div>' + | '</div>' + | ||
'<!-- 🚀 INSTANT ACTION HUB (3 TOMBOL AKSES | '<!-- 🚀 INSTANT ACTION HUB (3 TOMBOL AKSES) -->' + | ||
'<div class="mip-btn-container">' + | '<div class="mip-btn-container">' + | ||
'<a href="' + createUrlID + '" target="_blank" class="mip-action-btn">' + | '<a href="' + createUrlID + '" target="_blank" class="mip-action-btn">' + | ||
| Baris 211: | Baris 221: | ||
'</div>' + | '</div>' + | ||
'<!-- Catatan Kaki | '<!-- Catatan Kaki -->' + | ||
'<div style="font-size: 0. | '<div style="font-size: 0.82em; color: #a0a0a0; line-height: 1.4; font-style: italic; border-top: 1px solid #f0f0f0; padding-top: 15px; text-align: center;">' + | ||
'Informasi Sistem: Item data yang tidak terikat dengan artikel ensiklopedia apa pun dalam ekosistem Mippedia akan dihapus secara otomatis oleh pengurus dalam waktu dekat.' + | 'Informasi Sistem: Item data yang tidak terikat dengan artikel ensiklopedia apa pun dalam ekosistem Mippedia akan dihapus secara otomatis oleh pengurus dalam waktu dekat.' + | ||
'</div>' + | '</div>' + | ||
| Baris 219: | Baris 229: | ||
} | } | ||
$descSection.hide(); | $descSection.hide(); | ||
| Baris 240: | Baris 249: | ||
} else { | } else { | ||
$('body').removeClass('mip-isolated-active'); | |||
if ($existingNotice.length) $existingNotice.remove(); | if ($existingNotice.length) $existingNotice.remove(); | ||
$descSection.show(); | $descSection.show(); | ||
| Baris 250: | Baris 258: | ||
mw.config.set('wgRobotsPolicies', { 'index': 'index', 'follow': 'follow' }); | mw.config.set('wgRobotsPolicies', { 'index': 'index', 'follow': 'follow' }); | ||
if ($metaRobots.length) | if ($metaRobots.length) $metaRobots.attr('content', 'index, follow'); | ||
} | } | ||
} | } | ||
// --- SISTEM PRIORITAS --- | // --- SISTEM PRIORITAS --- | ||
var globalEnTitle = cached.enTitle || ""; | var globalEnTitle = cached.enTitle || ""; | ||