/**
* [FOXTOOLS — PATROLLERS HELPER SCRIPT]
*
* •==============================================•
* > Pencipta: Janorovic Volkov
* > Pengembang: Janorovic Volkov
* > Tipe: JavaScript (Module)
*
* Lihat [[WP:FT]] untuk informasi selengkapnya
* tentang skrip ini
* •==============================================•
*/
// <nowiki>
(function () {
if (mw.config.get("wgCanonicalSpecialPageName") !== "Contributions") return;
const sysop = mw.config.get("wgUserGroups").includes("sysop");
if (!sysop) return;
function notiOK(msg){ mw.notify ? mw.notify(msg, { type: 'success' }) : alert(msg); }
function notiWARN(msg){ mw.notify ? mw.notify(msg, { type: 'warn' }) : alert('⚠️ ' + msg); }
const minerva = mw.config.get("skin") === "minerva";
const user = mw.config.get('wgRelevantUserName');
const FT = window.FoxTools;
const module = {
name: "Block",
init() {
if (minerva) {
const button = document.createElement('div');
button.textContent = 'Blokir Pengguna (FT)';
Object.assign(button.style, {
position: 'fixed',
bottom: '80px',
right: '25px',
background: 'linear-gradient(135deg, #2a8af7, #006be6)',
color: '#fff',
border: '1px solid #0060c7',
padding: '6px 10px',
borderRadius: '4px',
cursor: 'pointer',
zIndex: '999999',
fontWeight: 'bold'
});
document.body.appendChild(button);
button.onclick = async () => (this.openPanel());
} else {
mw.util.addPortletLink(
"p-tb",
"#",
"Blokir Pengguna (FT)",
"t-ft-up",
"Blokir pengguna ini",
"b"
).addEventListener("click", () => this.openPanel());
}
},
openPanel() {
function mapExpiryToTemplate(expiry) {
expiry = expiry.trim().toLowerCase();
if (["indef", "infinite", "infinity", "never"].includes(expiry)) {
return { indef: true, time: "" };
}
const patterns = [
{ regex: /^(\d+)\s*hour/, unit: "jam" },
{ regex: /^(\d+)\s*day/, unit: "hari" },
{ regex: /^(\d+)\s*week/, unit: "minggu" },
{ regex: /^(\d+)\s*month/, unit: "bulan" },
{ regex: /^(\d+)\s*year/, unit: "tahun" }
];
for (const p of patterns) {
const match = expiry.match(p.regex);
if (match) {
return {
indef: false,
time: `${match[1]} ${p.unit}`
};
}
}
return { indef: false, time: expiry };
}
let panel = document.getElementById("fox-panel");
if (!panel) {
panel = document.createElement("div");
panel.id = "fox-panel";
panel.innerHTML = `
<div class="fox-header">
<div class="ft-dots">
<div class="dot yellow"></div>
<div class="dot green"></div>
<div class="dot red"></div>
</div>
<div style="float:right;">
<button id="fox-close">×</button>
</div>
<br>
<h3><big>🦊 FoxTools — Blokir Pengguna</big></h3>
</div>
<br>
<div class="fox-card">
<div id="fox-content"></div>
</div>
`;
document.body.appendChild(panel);
document.getElementById("fox-close").addEventListener("click", () => panel.remove());
}
const konten = document.getElementById("fox-content");
konten.innerHTML = `
<label><big><b>• Nama pengguna:</b><br><big>${user}</big></big></label>
<br>
<label><big><b>• Alasan pemblokiran:</b></big></label>
<br><br>
<div class="fox-radio-scroll">
<label><input name="reason" type="radio" value="Menyunting secara terus-menerus tentang informasi yang tidak memiliki referensi" checked>Menyunting tanpa referensi / hoax</label>
<label><input name="reason" type="radio" value="Akun yang tampaknya telah disusupi/digunakan oleh orang lain">Akun yang disusupi / digunakan oleh orang lain</label>
<label><input name="reason" type="radio" value="Akun [[Wikipedia:Vandalisme|vandalisme]] semata">Vandalisme</label>
<label><input name="reason" type="radio" value="Melakukan [[Wikipedia:Etikawiki|tindakan yang tidak sopan dan kasar]]">Tindakan tidak sopan dan kasar</label>
<label><input name="reason" type="radio" value="Melakukan perang suntingan: melanggar [[Wikipedia:Tiga kali pengembalian|tiga kali pengembalian]]">Perang suntingan</label>
<label><input name="reason" type="radio" value="Akun [[Wikipedia:Spam|spam]] semata">Spam / bot spam</label>
<label><input name="reason" type="radio" value="Akun yang sengaja melewati filter penyuntingan">Sengaja melewati filter penyalahgunaan</label>
<label><input name="reason" type="radio" value="Akun yang secara jelas tidak beritikad baik untuk membangun sebuah ensiklopedia">Tidak beritikad baik membangun ensiklopedia</label>
<label><input name="reason" type="radio" value="Akun dengan [[Wikipedia:Nama pengguna#Nama pengguna yang dilarang|nama pengguna yang dilarang]]">Nama pengguna yang dilarang</label>
<label><input name="reason" type="radio" value="Akun bot yang beroperasi di luar kendali operatornya">Bot yang diluar kendali</label>
<label><input name="reason" type="radio" value="Pelanggaran keamanan: melakukan [[Wikipedia:Kebijakan keamanan penyuntingan#Pelecehan|pelecehan]]">Pelecehan</label>
<label><input name="reason" type="radio" value="Pelanggaran keamanan: [[Wikipedia:Kebijakan keamanan penyuntingan#Fitnah terhadap pengguna lain|memfitnah pengguna lain]]">Memfitnah pengguna lain</label>
<label><input name="reason" type="radio" value="Pelanggaran keamanan: [[Wikipedia:Kebijakan keamanan penyuntingan#Pembeberan informasi|membeberkan informasi orang lain tanpa persetujuan]]">Doxxing</label>
<label><input name="reason" type="radio" value="Pelanggaran keamanan: melakukan [[Wikipedia:Kebijakan keamanan penyuntingan#Pengancaman|pengancaman]]">Pengancaman</label>
<label><input name="reason" type="radio" value="Pelanggaran keamanan: melakukan [[Wikipedia:Kebijakan keamanan penyuntingan#Penyerangan|penyerangan]]">Penyerangan</label>
<label><input name="reason" type="radio" value="[[Wikipedia:Pengguna siluman#Jenis-jenis akun boneka yang dilarang|Menyalahgunakan beberapa akun]]">Menyalahgunakan beberapa akun</label>
<label><input name="reason" type="radio" value="[[Wikipedia:Pelanggaran hak cipta|Melakukan pelanggaran hak cipta]]">Melanggar hak cipta</label>
<label><input name="reason" type="radio" value="[[Wikipedia:Memberitahukan kontribusi yang dibayar|Tidak memberitahukan kontribusi yang dibayar]]">Kontribusi bayaran</label>
</div>
<br>
<label><big><b>• Komentar:</b></big></label><br><label style="fox-muted"><small><b>(Opsional)</b></small></label>
<br>
<textarea id="fox-comment" style="width:95%; height:80px;"></textarea>
<br>
<label><big><b>• Durasi pemblokiran:</b></big></label>
<br><br>
<div class="fox-radio-scroll">
<label><input name="expiry" type="radio" value="1 hour" checked>1 jam</label>
<label><input name="expiry" type="radio" value="12 hour">12 jam</label>
<label><input name="expiry" type="radio" value="1 day">1 hari</label>
<label><input name="expiry" type="radio" value="3 day">3 hari</label>
<label><input name="expiry" type="radio" value="1 week">1 minggu</label>
<label><input name="expiry" type="radio" value="2 week">2 minggu</label>
<label><input name="expiry" type="radio" value="1 month">1 bulan</label>
<label><input name="expiry" type="radio" value="3 month">3 bulan</label>
<label><input name="expiry" type="radio" value="6 month">6 bulan</label>
<label><input name="expiry" type="radio" value="1 year">1 tahun</label>
<label><input name="expiry" type="radio" value="infinite">Tak terbatas</label>
</div>
<br>
<input id="fox-autoblock" type="checkbox" checked> Blokir IP yang terakhir dipakai</label>
<br>
<input id="fox-nocreate" type="checkbox" checked> Pembuatan akun dimatikan</label>
<br>
<input id="fox-nousertalk" type="checkbox"> Blokir halaman pembicaraan</label>
<br>
<input id="fox-noemail" type="checkbox"> Blokir surel</label>
<br>
<hr>
<input id="fox-notice" type="checkbox" checked> Beritahu pengguna</label>
<br>
<br>
<button id="block-apply" class="fox-btn-danger">Terapkan</button>
`;
document.getElementById("block-apply").onclick = async () => {
const api = new mw.Api();
const reasonselect = document.querySelector('input[name="reason"]:checked');
const comment = document.getElementById('fox-comment');
const expiryselect = document.querySelector('input[name="expiry"]:checked');
let expiry = expiryselect ? expiryselect.value : '';
let reason = reasonselect.value;
if (comment && comment.value.trim() !== '') {
reason += `: ${comment.value.trim()}`;
}
const autoblock = document.getElementById('fox-autoblock').checked ? 1 : undefined;
const nocreate = document.getElementById('fox-nocreate').checked ? 1 : undefined;
const nousertalk = document.getElementById('fox-nousertalk').checked;
const noemail = document.getElementById('fox-noemail').checked ? 1 : undefined;
const talknote = document.getElementById('fox-notice').checked;
try {
const payload = {
action: 'block',
user,
expiry,
reason,
tags: 'FoxTools'
};
if (document.getElementById('fox-autoblock').checked) payload.autoblock = true;
if (document.getElementById('fox-nocreate').checked) payload.nocreate = true;
if (!nousertalk) payload.allowusertalk = true;
if (document.getElementById('fox-noemail').checked) payload.noemail = true;
await api.postWithToken('block', payload);
if (talknote) {
const exp = mapExpiryToTemplate(expiry);
let templatetext = "";
const notalkparam = nousertalk ? "|notalk=yes" : "";
if (exp.indef) {
templatetext = `== Pemberitahuan pemblokiran selamanya ==\n{{subst:uw-block|indef=yes${notalkparam}|reason=${reasonselect.value}|sig=yes}}`;
api.postWithEditToken({
action: 'edit',
title: 'User talk:' + user,
text: templatetext,
summary: `Anda diblokir selamanya dari penyuntingan karena ${reasonselect.value} (${FT.ads})`,
minor: true,
tags: 'FoxTools'
});
} else {
templatetext = `{{subst:uw-block|time=${exp.time}${notalkparam}|reason=${reasonselect.value}|sig=yes}}`;
api.postWithEditToken({
action: 'edit',
title: 'User talk:' + user,
section: 'new',
sectiontitle: `Pemberitahuan pemblokiran selama ${exp.time}`,
summary: `Anda diblokir selama ${exp.time} dari penyuntingan karena ${reasonselect.value} (${FT.ads})`,
text: templatetext,
minor: true,
tags: 'FoxTools'
});
}
}
notiOK(`🟢 ${user} berhasil diblokir dari penyuntingan`);
panel.remove();
} catch (e) {
notiWARN('⚠️ Terjadi kesalahan ketika memblokir pengguna!');
panel.remove();
}
};
mw.util.addCSS(`
#fox-panel {
position: fixed;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
max-width: 640px;
width: 92%;
background: rgba(30, 35, 45, 0.75);
color: #f5f6fa;
border: 1px solid rgba(180, 200, 255, 0.2);
border-radius: 10px;
padding: 1.2em 1.4em;
font-family: "Noto Sans", "Segoe UI", sans-serif;
font-size: 14px;
z-index: 9999;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
transition: all 0.3s ease-in-out;
animation: foxFadeIn 0.25s ease-out;
}
@keyframes foxFadeIn {
from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#fox-panel h3 {
margin-top: 0;
font-size: 16px;
font-weight: 600;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: .5em;
color: #8be9fd;
display: flex;
align-items: center;
justify-content: space-between;
}
#fox-close {
background: none;
color: #8be9fd;
border: none;
font-weight: bold;
cursor: pointer;
transition: color 0.2s ease;
}
#fox-close:hover {
color: #ff5555;
text-decoration: underline;
}
#fox-panel button,
#fox-panel textarea,
#fox-panel input {
font-family: inherit;
font-size: 14px;
border-radius: 6px;
padding: 6px 12px; border: 1px solid rgba(180, 200, 255, 0.3);
margin-top: 6px;
margin-bottom: 10px;
background: rgba(255, 255, 255, 0.05);
color: #f5f6fa;
transition: all 0.2s ease;
}
#fox-panel button:hover,
#fox-panel textarea:hover,
#fox-panel input:hover {
background: rgba(255, 255, 255, 0.12);
border-color: rgba(180, 200, 255, 0.6);
}
#fox-panel button:focus,
#fox-panel textarea:focus,
#fox-panel input:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(140, 200, 255, 0.5);
}
#fox-panel .fox-btn-danger {
background: linear-gradient(135deg, #d33, #a00);
border: 1px solid #a00;
color: #fff;
font-weight: bold;
}
#fox-panel .fox-btn-danger:hover {
background: linear-gradient(135deg, #e44, #c11);
box-shadow: 0 0 6px rgba(255, 100, 100, 0.6);
}
.fox-radio-scroll {
max-height: 80px;
overflow-y: auto;
padding: 6px;
border: 1px solid rgba(180,200,255,0.2);
border-radius: 6px;
background: rgba(30,35,45,0.95);
}
.fox-radio-scroll label {
display: block;
padding: 4px 8px;
cursor: pointer;
color: #f5f6fa;
}
.fox-radio-scroll label:hover {
background: rgba(255,255,255,0.08);
}
.fox-radio-scroll input[type="radio"] {
margin-right: 6px;
}
.fox-card {
flex: 1 1 260px;
border: 1px solid rgba(180, 200, 255, 0.15);
padding: 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.04);
transition: transform 0.15s ease, background 0.2s ease;
}
.fox-card:hover {
transform: translateY(-2px);
background: rgba(255, 255, 255, 0.07);
}
.fox-muted {
color: #aab6c3;
font-size: 90%;
}
.ft-dots {
display: flex;
gap: 6px;
margin-bottom: 6px;
}
.ft-dots .dot {
width: 10px; height: 10px;
border-radius: 50%;
box-shadow: 0 0 3px rgba(255,255,255,0.4);
}
.dot.red { background: #ff5555; }
.dot.yellow { background: #f1fa8c; }
.dot.green { background: #50fa7b; }
`);
}
};
FT.register && FT.register("Block", module);
})();
// </nowiki>