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 1.001: | Baris 1.001: | ||
/* ========================================================== | /* ========================================================== | ||
🔵 MIPPEDIA ACCOUNT VERIFICATION SYSTEM | 🔵 MIPPEDIA ACCOUNT VERIFICATION SYSTEM - ULTIMATE | ||
Versi Stabil | Versi: Stabil, Pop-up Centered, Auto-Message & Strict | ||
========================================================== */ | ========================================================== */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
| Baris 1.012: | Baris 1.012: | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
// | // Nama file gambar di Wiki lo (Ganti sesuai nama file yang lo upload) | ||
var | var vFile = 'Verified_Badge.png'; | ||
var vIcon = mw.config.get('wgScriptPath') + '/index.php?title=Special:Redirect/file/' + vFile; | |||
// --- 1. | // --- 1. FUNGSI POP-UP (CENTERED & RAPI) --- | ||
function showVPopup() { | |||
var | var modalHtml = '<div id="v-modal-overlay" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);z-index:99999;display:flex;align-items:center;justify-content:center;">' + | ||
'<div style="background:#fff;padding:25px;border-radius:20px;width:80%;max-width:320px;text-align:center;box-shadow:0 10px 30px rgba(0,0,0,0.5);">' + | |||
'<img src="' + vIcon + '&width=60" style="width:60px;margin-bottom:15px;">' + | |||
'<h2 style="margin:0 0 10px;font-size:20px;color:#1a1a1a;">Akun Terverifikasi</h2>' + | |||
'<p style="color:#555;font-size:13px;line-height:1.5;margin-bottom:20px;">Mippedia telah mengonfirmasi bahwa identitas pemilik akun ini adalah asli berdasarkan dokumen resmi.</p>' + | |||
'<button id="v-modal-close" style="background:#0095f6;color:#fff;border:none;padding:12px;width:100%;border-radius:10px;font-weight:bold;cursor:pointer;">Mengerti</button>' + | |||
'</div></div>'; | |||
$('body').append(modalHtml); | |||
$('#v-modal-close').click(function() { $('#v-modal-overlay').remove(); }); | |||
} | } | ||
// --- 2. | // --- 2. RENDER CENTANG BIRU (DI JUDUL & LINK) --- | ||
api.get({ action: 'query', list: 'categorymembers', cmtitle: 'Category:Pengguna_Terverifikasi', cmlimit: 'max' }).done(function(d) { | |||
var vUsers = d.query.categorymembers.map(function(m) { return m.title.replace('Pengguna:', ''); }); | |||
// Di link nama pengguna | |||
mw.hook('wikipage.content').add(function() { | |||
$('.mw-userlink').each(function() { | |||
var name = $(this).text().trim(); | |||
if (vUsers.includes(name) && !$(this).next('.mp-v-icon').length) { | |||
$(this).after('<img class="mp-v-icon" src="'+vIcon+'&width=13" style="width:13px;margin-left:3px;vertical-align:middle;">'); | |||
} | |||
}); | }); | ||
}); | |||
$(' | // Di judul profil (Bisa diklik buat Pop-up) | ||
var targetUser = mw.config.get('wgTitle'); | |||
if ((ns === 2 || ns === 3) && vUsers.includes(targetUser)) { | |||
var $badge = $('<img src="'+vIcon+'&width=20" style="width:20px;margin-left:8px;vertical-align:middle;cursor:pointer;">'); | |||
$badge.click(showVPopup); | |||
$('#firstHeading').append($badge); | |||
} | } | ||
}); | |||
// --- 3. AUTO-FILL TEKS + TABEL IDENTITAS --- | |||
if (mw.config.get('wgAction') === 'edit' && sessionStorage.getItem('v_req_mippedia')) { | |||
var vTable = "{| class='wikitable' style='width:100%'\n! Jenis Identitas !! Tautan/URL Bukti\n|-\n| Identitas Resmi (KTP/Lainnya) || (Masukkan URL Foto Bukti lo di sini)\n|-\n| Bukti Tambahan || (Opsional)\n|}"; | |||
$('#wpTextbox1').val(sessionStorage.getItem('v_req_mippedia') + "\n\n" + vTable + "\n\n<div class='mippedia-status'>'''Status: 🕒 Sedang diverifikasi'''</div>\n\n--" + user); | |||
sessionStorage.removeItem('v_req_mippedia'); | |||
} | |||
// --- 4. TOMBOL VERIFIKASI --- | |||
if (ns === 2 && user && pageName.includes('Pengguna:' + user)) { | |||
var $btn = $('<li>').attr({'id': 'ca-v-req', 'class': 'mw-list-item'}).append( | |||
$('<a>').attr('href', '#').append($('<span>').text('🔵 Verifikasi').css({'color': '#0095f6', 'font-weight': 'bold'})) | |||
); | |||
$btn.click(function(e) { | |||
e.preventDefault(); | |||
sessionStorage.setItem('v_req_mippedia', "== Permintaan Verifikasi ==\nHalo Pengurus, mohon verifikasi profil [[" + pageName + "]] saya."); | |||
window.location.href = mw.util.getUrl("Pembicaraan_Pengguna:" + user, { action: 'edit', section: 'new' }); | |||
}); | |||
$('#p-cactions ul, #p-views ul').append($btn); | |||
} | } | ||
// --- | // --- 5. SATPAM PENCEGAHAN MANUAL --- | ||
if (ns === 2 && ['edit', 'submit'].includes(mw.config.get('wgAction'))) { | if (ns === 2 && ['edit', 'submit'].includes(mw.config.get('wgAction'))) { | ||
$('#editform').on('submit', function() { | $('#editform').on('submit', function() { | ||
var content = $('#wpTextbox1').val(); | var content = $('#wpTextbox1').val(); | ||
if (/\[\[Category:Pengguna_Terverifikasi\]\]/gi.test(content) && !sessionStorage.getItem(' | if (/\[\[Category:Pengguna_Terverifikasi\]\]/gi.test(content) && !sessionStorage.getItem('admin_bypass')) { | ||
alert("⚠️ | alert("⚠️ DILARANG: Kategori verifikasi tidak boleh diisi manual!"); | ||
$('#wpTextbox1').val(content.replace(/\[\[Category:Pengguna_Terverifikasi\]\]/gi, '')); | $('#wpTextbox1').val(content.replace(/\[\[Category:Pengguna_Terverifikasi\]\]/gi, '')); | ||
return false; | return false; | ||
| Baris 1.058: | Baris 1.084: | ||
} | } | ||
// --- | // --- 6. PANEL ADMIN (APPROVE/REJECT) --- | ||
if (ns === 3 && isAdmin && $content.text().includes("Sedang diverifikasi")) { | if (ns === 3 && isAdmin && $content.text().includes("Sedang diverifikasi")) { | ||
api.get({ action: 'query', prop: 'revisions', titles: pageName, rvprop: 'user|content', rvlimit: 1 }).done(function(res) { | api.get({ action: 'query', prop: 'revisions', titles: pageName, rvprop: 'user|content', rvlimit: 1 }).done(function(res) { | ||
var pg = res.query.pages[Object.keys(res.query.pages)[0]] | var pg = res.query.pages[Object.keys(res.query.pages)[0]], requester = pg.revisions[0].user, oldC = pg.revisions[0]['*']; | ||
var $panel = $('<div style="background:#f0f7ff; border:2px solid #0095f6; padding:15px; border-radius:10px; margin-bottom:15px;"><b>🔵 VERIFICATION CONTROL</b></div>'); | |||
var $btnOk = $('<button>').text('✅ SETUJU').css({'background':'#0095f6','color':'#fff','padding':'5px 12px','border':'none','cursor':'pointer','font-weight':'bold'}); | |||
var $panel = $('<div style="background:#f0f7ff; border:2px solid #0095f6; padding:15px; border-radius:10px; margin-bottom:15px;"> | |||
var $btnOk = $('<button>').text('✅ | |||
var $btnNo = $('<button>').text('❌ TOLAK').css({'background':'#555','color':'#fff','padding':'5px 12px','border':'none','cursor':'pointer','margin-left':'10px'}); | var $btnNo = $('<button>').text('❌ TOLAK').css({'background':'#555','color':'#fff','padding':'5px 12px','border':'none','cursor':'pointer','margin-left':'10px'}); | ||
$btnOk.click(function() { | $btnOk.click(function() { | ||
$(this).prop('disabled', true).text(' | $(this).prop('disabled', true).text('Working...'); | ||
sessionStorage.setItem(' | sessionStorage.setItem('admin_bypass', 'true'); | ||
api.postWithToken('edit', { action: 'edit', title: "Pengguna:" + mw.config.get('wgTitle'), appendtext: '\n[[Category:Pengguna_Terverifikasi]]', summary: 'System: Verified' }) | |||
.then(function() { | |||
api.postWithToken('edit', { | return api.postWithToken('edit', { action: 'edit', title: pageName, text: oldC.replace("Status: 🕒 Sedang diverifikasi", "Status: ✅ '''Terverifikasi''' 🔵"), summary: 'Approved' }); | ||
}).then(function() { | }).then(function() { | ||
return api.postWithToken('edit', { action: 'edit', title: "Pembicaraan_Pengguna:"+requester, section: 'new', text: "\n== Verifikasi ==\nHalo [["+requester+"]], akun lo resmi terverifikasi 🔵. --Admin", summary: 'Notif' }); | |||
}).done(function() { sessionStorage.removeItem('admin_bypass'); location.reload(); }); | |||
return api.postWithToken('edit', { action: 'edit', title: "Pembicaraan_Pengguna:"+requester, section: 'new', text: | |||
}).done(function() { | |||
}); | }); | ||
$btnNo.click(function() { | $btnNo.click(function() { | ||
var alasan = prompt(" | var alasan = prompt("Alasan:"); if (!alasan) return; | ||
api.postWithToken('edit', { action: 'edit', title: pageName, text: oldC.replace("Status: 🕒 Sedang diverifikasi", "Status: ❌ '''Ditolak'''\n\nAlasan: " + alasan), summary: 'Rejected' }) | |||
.then(function() { | |||
return api.postWithToken('edit', { action: 'edit', title: "Pembicaraan_Pengguna:"+requester, section: 'new', text: "\n== Notifikasi ==\nMaaf [["+requester+"]], verifikasi ditolak: " + alasan, summary: 'Notif' }); | |||
}).done(function() { location.reload(); }); | |||
api.postWithToken('edit', { action: 'edit', title: | |||
}).done(function() { | |||
}); | }); | ||
$('#mw-content-text').prepend($panel.append($btnOk, $btnNo)); | |||
$('#mw-content-text').prepend($panel); | |||
}); | }); | ||
} | } | ||
}); | }); | ||