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 335: | Baris 335: | ||
})(); | })(); | ||
/* ========================================================== | |||
🚀 MIPPEDIA DATA - CONTENT GUARD (ULTRA BRUTAL) | |||
Fungsi: Mencegah simpan halaman tanpa {{Infobox}} | |||
Support: Desktop (Vector/Monobook) & Mobile (Minerva) | |||
========================================================== */ | |||
(function() { | (function() { | ||
function | function getGuardStatus() { | ||
var ns = mw.config.get('wgNamespaceNumber'); | var ns = mw.config.get('wgNamespaceNumber'); | ||
if (ns !== 0) return; | // Hanya proteksi Namespace Utama (0) | ||
if (ns !== 0) return false; | |||
// Ambil isi dari textarea (mendukung berbagai jenis selector editor) | |||
var | var content = $('#wpTextbox1, .editor-container textarea, textarea.mw-ui-input').val() || ""; | ||
// Cek apakah ada teks "{{Infobox" | |||
return content.includes('{{Infobox'); | |||
} | |||
function blockAction(e) { | |||
if ( | if (!getGuardStatus()) { | ||
e.preventDefault(); | |||
e.stopPropagation(); | |||
e.stopImmediatePropagation(); | |||
// | // Pake alert standar browser agar pasti muncul di semua jenis HP | ||
window.alert("⚠️ AKSES DITOLAK!\n\nNamespace Utama Mippedia Data wajib menggunakan struktur {{Infobox}}.\n\nAnda dilarang mengunggah teks artikel biasa, huruf asal, atau konten tanpa metadata terstruktur."); | |||
return false; | |||
} | } | ||
} | |||
// 1. Cegah klik pada SEMUA elemen yang berfungsi sebagai tombol simpan/terbit | |||
$(document).on('click mousedown touchstart', '#wpSave, #wpPreview, .editor-save, .mw-ui-button.primary, button[type="submit"], .save-button', function(e) { | |||
return blockAction(e); | |||
}); | |||
// 2. Cegah submit form secara langsung (antisipasi bypass) | |||
$(document).on('submit', '#editform, .editor-container form', function(e) { | |||
return blockAction(e); | |||
}); | }); | ||
console.log("Mippedia: Content Guard Active (Namespace 0)"); | |||
})(); | })(); | ||