/** * [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; functionnotiOK(msg){mw.notify?mw.notify(msg,{type:'success'}):alert(msg);} functionnotiWARN(msg){mw.notify?mw.notify(msg,{type:'warn'}):alert('⚠️ '+msg);} constFT=window.FoxTools; constisSysop=mw.config.get("wgUserGroups").includes("sysop"); constmodule={ name:"Protect", init(){ mw.util.addPortletLink( "p-tb", "#", "Pelindungan Halaman (FT)", "t-ft-protect", "Lindungi halaman ini", "h" ).addEventListener("click",()=>this.openPanel()); }, openPanel(){ letpanel=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 — Pelindungan Halaman</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()); } constkonten=document.getElementById("fox-content"); konten.innerHTML=""; if(isSysop){ constpage=mw.config.get('wgPageName').replace(/_/g,' '); konten.innerHTML=` <label><big><b>• Halaman:</b><br><big>${page}</big></big></label> <br> <label><big><b>• Jenis proteksi:</b></big></label> <br> <input id="edit" type="checkbox" checked> Penyuntingan</label> <br> <input id="move" type="checkbox" checked> Pemindahan</label> <br> <input id="create" type="checkbox"> Pembuatan</label> <br> <label><big><b>• Tingkat pelindungan:</b></big></label> <br> <label><input type="radio" name="level" value="" checked>Tidak ada</label> <br> <label><input type="radio" name="level" value="autoconfirmed">Semi (Terkonfirmasi otomatis)</label> <br> <label><input type="radio" name="level" value="extendedconfirmed">Lanjutan (Terkonfirmasi lanjutan)</label> <br> <label><input type="radio" name="level" value="sysop">Penuh (Pengurus)</label> </div> <br> <label><big><b>• Durasi pelindungan:</b></big></label><br><label class="fox-muted"><small><b>(Opsional jika memilih tingkat pelindungan "tidak ada")</b></small></label> <br> <div class="fox-radio-scroll"> <label><input type="radio" name="expiry" value="1 day" checked>1 hari</label> <label><input type="radio" name="expiry" value="3 days">3 hari</label> <label><input type="radio" name="expiry" value="1 week">1 minggu</label> <label><input type="radio" name="expiry" value="2 week">2 minggu</label> <label><input type="radio" name="expiry" value="1 month">1 bulan</label> <label><input type="radio" name="expiry" value="3 month">3 bulan</label> <label><input type="radio" name="expiry" value="6 month">6 bulan</label> <label><input type="radio" name="expiry" value="1 year">1 tahun</label> <label><input type="radio" name="expiry" value="infinite">Tak terbatas</label> </div> <br> <label><big><b>• Alasan:</b></big></label> <br> <textarea id="reason" style="width:95%; height:80px;"></textarea> <br> <br> <button id="fox-protect-exec" class="fox-btn-danger">Lindungi</button> `; document.getElementById("fox-protect-exec").onclick=()=>{ constlevelSelect=document.querySelector('input[name="level"]:checked'); letlevel=levelSelect?levelSelect.value:''; constprotections=[]; if(document.getElementById('edit').checked)protections.push(`edit=${level}`); if(document.getElementById('move').checked)protections.push(`move=${level}`); if(document.getElementById('create').checked)protections.push(`create=${level}`); constexpirySelect=document.querySelector('input[name="expiry"]:checked'); letexpiry=expirySelect?expirySelect.value:''; constreason=document.getElementById('reason').value; if(!reason)returnnotiWARN("⚠️ Masukkan alasan pelindungan!"); constreasons=`${reason} (${FT.ads})`; constapi=newmw.Api(); api.postWithToken('csrf',{ action:'protect', title:page, protections:protections.join('|'), expiry:expiry, reason:reasons, watchlist:'nochange', tags:'FoxTools' }); notiOK("🟢 Pelindungan halaman berhasil diterapkan"); panel.remove(); }; }else{ constpage=mw.config.get('wgPageName').replace(/_/g,' '); konten.innerHTML=` <label><big><b>• Halaman:</b><br><big>${page}</big></big></label> <br> <label><big><b>• Alasan:</b></big></label> <br> <textarea id="reason" style="width:95%; height:80px;"></textarea> <br> <br> <button id="fox-pph-request" class="fox-btn-danger">Kirim</button> `; document.getElementById("fox-pph-request").onclick=()=>{ constreason=document.getElementById('reason').value.trim(); if(!reason)returnnotiWARN("⚠️ Masukkan alasan!"); constreport=`\n{{subst:Wikipedia:Permintaan pelindungan halaman/Peningkatan/baru|halaman=${page}|alasan=${reason}}}`; constapi=newmw.Api(); api.postWithToken('csrf',{ action:'edit', title:'Wikipedia:Permintaan_pelindungan_halaman/Peningkatan', appendtext:report, summary:`Meminta pelindungan halaman untuk [[${page}]] (${FT.ads})`, tags:`FoxTools` }); notiOK("🟢 Permintaan pelindungan halaman berhasil dikirim"); 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("Protect",module); })(); // </nowiki>
MediaWiki:Gadget-FoxTools-Protect.js
Konten disalin dari Wikipedia Bahasa Indonesia (lisensi CC BY-SA)
Lihat versi asli di Wikipedia