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 353: | Baris 353: | ||
/* ========================================================== | /* ========================================================== | ||
🛡️ MIPPEDIA SHIELD | 🛡️ MIPPEDIA SHIELD v3.0 (Smart Bot Bypass) | ||
Proteksi halaman untuk user, tapi tetap Open untuk Googlebot | |||
========================================================== */ | ========================================================== */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
// 1. DAFTAR HALAMAN YANG | // 1. DAFTAR HALAMAN YANG DIKUNCI | ||
var protectedPages = [ | var protectedPages = [ | ||
"MediaWiki:", | "MediaWiki:", | ||
" | "Mippedia:Privasi", | ||
"Mippedia:Kebijakan", | |||
"Spesial:Versi", | |||
"Mippedia:Ketentuan_penggunaan" | |||
]; | ]; | ||
// 2. CEK STATUS USER & HALAMAN | // 2. DETEKSI BOT PENCARI (Google, Bing, Yahoo, dll) | ||
var userAgent = navigator.userAgent.toLowerCase(); | |||
var isSearchBot = /googlebot|bingbot|yandexbot|duckduckbot|slurp|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest\/0\.|bingpreview|slackbot|vkShare|W3C_Validator/.test(userAgent); | |||
// 3. CEK STATUS USER & HALAMAN | |||
var userGroups = mw.config.get('wgUserGroups') || []; | var userGroups = mw.config.get('wgUserGroups') || []; | ||
var isStaff = userGroups.some(r => ["sysop", "bureaucrat", "steward", "interface-admin"].includes(r)); | var isStaff = userGroups.some(r => ["sysop", "bureaucrat", "steward", "interface-admin"].includes(r)); | ||
var currentPage = mw.config.get('wgPageName'); | var currentPage = mw.config.get('wgPageName'); | ||
var shouldProtect = protectedPages.some(prefix => currentPage.startsWith(prefix.replace(/ /g, '_'))); | var shouldProtect = protectedPages.some(prefix => currentPage.startsWith(prefix.replace(/ /g, '_'))); | ||
// | // 4. EKSEKUSI PROTEKSI | ||
if (shouldProtect && !isStaff) { | // Syarat kunci: Halaman sensitif AND Bukan Staff AND BUKAN Search Bot | ||
if (shouldProtect && !isStaff && !isSearchBot) { | |||
$('body').addClass('mippedia-locked').html(''); | $('body').addClass('mippedia-locked').html(''); | ||
$('<style>').prop('type', 'text/css').html(` | $('<style>').prop('type', 'text/css').html(` | ||
html, body { | html, body { margin: 0!important; padding: 0!important; height: 100%!important; width: 100%!important; overflow: hidden!important; background: #f8f9fa!important; } | ||
#protection-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100vw; padding: 20px; box-sizing: border-box; font-family: sans-serif; } | |||
.protection-card { width: 100%; max-width: 400px; background: #fff; padding: 40px 25px; border-radius: 30px; box-shadow: 0 15px 50px rgba(54,102,204,0.15); text-align: center; border: 1px solid #eef0f2; } | |||
#protection-wrapper { | |||
.protection-card { | |||
.shield-icon { font-size: 70px; display: block; margin-bottom: 20px; } | .shield-icon { font-size: 70px; display: block; margin-bottom: 20px; } | ||
.lock-title { color: #1a1a1a; font-size: 24px; font-weight: 800; margin: | .lock-title { color: #1a1a1a; font-size: 24px; font-weight: 800; margin-bottom: 15px; } | ||
.lock-desc { color: #5f6368; font-size: | .lock-desc { color: #5f6368; font-size: 14px; line-height: 1.6; margin-bottom: 25px; } | ||
.admin-notice { | .admin-notice { background: #fff5f5; color: #d93025; padding: 12px; border-radius: 12px; font-size: 12px; font-weight: 700; margin-bottom: 30px; border: 1px solid #fadbd8; } | ||
.btn-back { background: #36c; color: #fff; border: none; padding: 16px; border-radius: 18px; font-weight: 700; width: 100%; cursor: pointer; } | |||
.btn-back { | |||
`).appendTo('head'); | `).appendTo('head'); | ||
var shieldHTML = ` | var shieldHTML = ` | ||
<div id="protection-wrapper"> | <div id="protection-wrapper"> | ||
<div class="protection-card"> | <div class="protection-card"> | ||
<span class="shield-icon">🛡️</span> | <span class="shield-icon">🛡️</span> | ||
<h2 class="lock-title">Akses | <h2 class="lock-title">Akses Terbatas</h2> | ||
<p class="lock-desc"> | <p class="lock-desc">Halaman ini adalah bagian sistem yang dilindungi untuk menjaga stabilitas Mippedia.</p> | ||
<div class="admin-notice">Hanya Administrator yang dapat melihat konten ini.</div> | |||
<button class="btn-back" onclick="window.history.back()">Kembali</button> | |||
<div class="admin-notice"> | <br><a href="/" style="display:block; margin-top:20px; color:#70757a; font-size:13px; text-decoration:none;">Ke Beranda</a> | ||
<button class="btn-back" onclick="window.history.back()"> | |||
<a href="/" | |||
</div> | </div> | ||
</div> | </div> | ||
`; | `; | ||
$('body').append(shieldHTML); | $('body').append(shieldHTML); | ||
document.title = "Akses Dilindungi - Mippedia"; | |||
document.title = "Akses Dilindungi - Mippedia | |||
} | } | ||
}); | }); | ||