BR ULTIMATE PANEL

PRO ADMIN PANEL (AI + hotkeys + autosend + logs export)

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @license MIT
// @name         BR ULTIMATE PANEL
// @namespace    https://forum.blackrussia.online/
// @version      7.0
// @description  PRO ADMIN PANEL (AI + hotkeys + autosend + logs export)
// @match        https://forum.blackrussia.online/threads/15397513/
// @grant        none
// ==/UserScript==

(function() {
'use strict';

// ===== RULES =====
let RULES = [
 {id:"3.01", text:"Оскорбление", punish:"Mute 60"},
 {id:"3.02", text:"Флуд", punish:"Mute 30"},
 {id:"3.03", text:"Неадекват", punish:"Mute 60"},
 {id:"3.04", text:"Родные", punish:"Mute 120 / Ban 7-15"},
 {id:"3.05", text:"Угрозы", punish:"Mute 120"},
 {id:"3.06", text:"Обман", punish:"Ban 7"},
 {id:"3.07", text:"Реклама", punish:"Ban 15"},
 {id:"3.08", text:"Капс", punish:"Mute 30"}
];

let LOG = [];

// ===== UI PANEL =====
const panel = document.createElement("div");
panel.style = `
position:fixed; right:10px; top:80px;
width:320px; max-height:750px;
overflow:auto;
background:#0d0d0d;
border:2px solid #333;
border-radius:12px;
padding:10px;
z-index:999999;
color:white;
font-family:Arial;`;
document.body.appendChild(panel);

panel.innerHTML = `<div style="color:#00ffd5;text-align:center;margin-bottom:10px;font-weight:bold;">
BR ULTIMATE v7.0 PRO
</div>`;

// ===== SEARCH =====
const search = document.createElement("input");
search.placeholder = "Поиск...";
search.style = "width:100%;padding:6px;margin-bottom:8px;";
panel.appendChild(search);

// ===== PASTE FIX =====
function paste(text){
    let textarea = document.querySelector("textarea");
    if (textarea) {
        textarea.value = text;
        textarea.dispatchEvent(new Event('input', { bubbles: true }));
        return textarea;
    }

    let editor = document.querySelector('[contenteditable="true"]');
    if (editor) {
        editor.focus();
        document.execCommand('selectAll', false, null);
        document.execCommand('insertText', false, text);
        return editor;
    }

    console.log("❌ Поле ввода не найдено");
    return null;
}

// ===== AUTO SEND =====
function send(){
    let btn = [...document.querySelectorAll("button, input")]
        .find(e => /отправ|send|ответ/i.test(e.innerText || e.value));

    if(btn) btn.click();
}

// ===== TEMPLATE =====
function build(r){
 return `[CENTER][SIZE=4]
[color=#7FFFD4]Здравствуйте, {{ user.mention }}[/color]

Нарушение:
[b]${r.id} — ${r.text}[/b]

Наказание:
[color=red]${r.punish}[/color]

[COLOR=green][b]Одобрено[/b][/COLOR]

BLACK RUSSIA
[/SIZE][/CENTER]`;
}

// ===== RENDER =====
function render(list){
 panel.querySelectorAll(".ruleBtn")?.forEach(e=>e.remove());

 list.forEach(r=>{
  let b=document.createElement("button");
  b.innerText=r.id;
  b.style="width:100%;margin:3px 0;padding:5px;";
  
  b.onclick=()=>{
    paste(build(r));
    LOG.push(r.id);

    // auto send toggle
    if(autoSendEnabled) setTimeout(send, 300);
  };

  panel.appendChild(b);
 });
}

render(RULES);

// ===== SEARCH =====
search.oninput=()=>{
 let v=search.value.toLowerCase();
 render(RULES.filter(r =>
  r.id.includes(v) || r.text.toLowerCase().includes(v)
 ));
};

// ===== AI DETECT =====
function detect(text){
 text=text.toLowerCase();

 if(/родн|мам/.test(text)) return "3.04";
 if(/оск|даун|идиот/.test(text)) return "3.01";
 if(/флуд|спам/.test(text)) return "3.02";
 if(/угроз/.test(text)) return "3.05";
 if(/обман|развод/.test(text)) return "3.06";
 if(/реклам/.test(text)) return "3.07";

 return null;
}

// ===== BUTTONS =====
let autoSendEnabled = false;

function btn(name, fn){
 let b=document.createElement("button");
 b.innerText=name;
 b.style="width:100%;margin:4px 0;padding:6px;";
 b.onclick=fn;
 panel.appendChild(b);
}

btn("🤖 AI определить", ()=>{
 let id=detect(document.body.innerText);
 if(!id) return alert("Не найдено");

 let r=RULES.find(x=>x.id===id);
 if(r) paste(build(r));
});

btn("⚡ AutoSend: OFF/ON", ()=>{
 autoSendEnabled = !autoSendEnabled;
 alert("AutoSend: " + (autoSendEnabled ? "ON" : "OFF"));
});

btn("➕ Добавить правило", ()=>{
 let id=prompt("ID?");
 let text=prompt("Описание?");
 let punish=prompt("Наказание?");
 if(id && text){
  RULES.push({id,text,punish});
  render(RULES);
 }
});

btn("📜 Скачать лог", ()=>{
 let blob = new Blob([LOG.join("\n")], {type:"text/plain"});
 let a = document.createElement("a");
 a.href = URL.createObjectURL(blob);
 a.download = "br_log.txt";
 a.click();
});

btn("🧹 Очистить", ()=>{
 let t=document.querySelector("textarea");
 if(t) t.value="";
});

// ===== HOTKEYS =====
document.addEventListener("keydown", (e)=>{
 if(e.key === "1"){ // AI
  let id = detect(document.body.innerText);
  if(id){
    let r=RULES.find(x=>x.id===id);
    if(r) paste(build(r));
  }
 }

 if(e.key === "2"){ // send
  send();
 }

 if(e.key === "3"){ // clear
  let t=document.querySelector("textarea");
  if(t) t.value="";
 }
});

// ===== DRAG =====
let drag=false,ox,oy;

panel.addEventListener("mousedown", e=>{
 drag=true;
 ox=e.offsetX;
 oy=e.offsetY;
});

document.addEventListener("mouseup", ()=>drag=false);

document.addEventListener("mousemove", e=>{
 if(drag){
  panel.style.left=(e.pageX-ox)+"px";
  panel.style.top=(e.pageY-oy)+"px";
 }
});

})();