/**
* [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("wgNamespaceNumber") !== 0) 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 FT = window.FoxTools;
const module = {
name: "UP",
init() {
mw.util.addPortletLink(
"p-tb",
"#",
"Usulkan Penghapusan (FT)",
"t-ft-up",
"Usulkan Penghapusan (FT)",
"u"
).addEventListener("click", () => this.openPanel());
},
openPanel() {
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 — Usulkan Penghapusan</big></h3>
</div>
<br>
<div id="fox-card">
<div id="fox-content"></div>
</div>
`;
document.body.appendChild(panel);
document.getElementById("fox-close").addEventListener("click", () => {
panel.remove();
});
}
const page = mw.config.get('wgPageName').replace(/_/g, ' ');
const konten = document.getElementById("fox-content");
konten.innerHTML = `
<label><big><b>• Artikel:</b><br><big>${page}</big></big></label>
<br>
<label><big><b>• Alasan artikel ini perlu dihapus:</b></big></label>
<br>
<textarea id="reason" style="width:95%; height:80px;"></textarea>
<br>
<br>
<button id="fox-up-exec" class="fox-btn-danger">Ajukan</button>
`;
document.getElementById("fox-up-exec").onclick = async () => {
const reason = document.getElementById("reason").value.trim();
if (!reason) return notiWARN("⚠️ Silahkan isi alasan mengapa halaman ini perlu dihapus!");
const template = `{{subst:Usul penghapusan/UP|alasan=${reason}}}`;
const uptemplate = `{{subst:usul penghapusan|Wikipedia:Usulan penghapusan/${page}}}\n`;
const usertemplate = `\n{{subst:UP-notice|${page}}}--~~~~`;
const api = new mw.Api();
api.postWithEditToken({
action: 'edit',
title: `Wikipedia:Usulan penghapusan/${page}`,
text: template,
summary: `Mengusulkan penghapusan artikel [[${page}]] (${FT.ads})`,
tags: "FoxTools"
});
api.postWithEditToken({
action: 'edit',
title: page,
prependtext: uptemplate,
summary: `Menandai artikel yang sedang diusulkan untuk dihapus (${FT.ads})`,
minor: true,
tags: "FoxTools"
});
const creatorQuery = await api.get({
action: 'query',
prop: 'revisions',
titles: page,
rvlimit: 1,
rvprop: 'user',
rvdir: 'newer',
formatversion: 2
});
const creator = creatorQuery.query.pages[0].revisions?.[0]?.user;
const talkUserPage = `User talk:${creator}`;
api.postWithToken('csrf', {
action: 'edit',
title: talkUserPage,
appendtext: usertemplate,
summary: `Undangan diskusi usulan penghapusan artikel [[${page}]] (${FT.ads})`,
minor: true,
tags: 'FoxTools'
});
notiOK(`🟢 Halaman ${page} berhasil diusulkan untuk dihapus`);
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 {
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 {
background: rgba(255, 255, 255, 0.12);
border-color: rgba(180, 200, 255, 0.6);
}
#fox-panel button:focus,
#fox-panel textarea: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-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);
}
.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("UP", module);
})();
// </nowiki>