Oxm Bot BETA

Fast Auto Bot With Menu - BETA VERSION

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name              Oxm Bot BETA
// @namespace         https://github.com/oxmbot
// @version           3.0.0-beta
// @description       Fast Auto Bot With Menu - BETA VERSION
// @author            Oxm Team
// @match             https://pixelplace.io/*
// @exclude           https://pixelplace.io/forums*
// @exclude           https://pixelplace.io/blog*
// @exclude           https://pixelplace.io/api*
// @exclude           https://pixelplace.io/gold-chart.php
// @exclude           https://pixelplace.io/*ypp=true
// @license           MIT
// @icon              https://r.resimlink.com/rkU4RSlg.png
// @run-at            document-start
// @grant             unsafeWindow
// @grant             GM.info
// @require           https://code.jquery.com/jquery-3.6.0.min.js
// @require           https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js
// @require           https://update.greasyfork.org/scripts/461063/1708713/Library%20For%20Mxobot.js
// @require           https://update.greasyfork.org/scripts/461221/1159560/Hack%20Timerjs%20By%20Turuslan.js
// @require           https://update.greasyfork.org/scripts/445697/1244619/Greasy%20Fork%20API.js
// ==/UserScript==
/* global NevinCore, NevinWaitForElm, NevinProtect, NevinLogger, NevinLoggerFactory, toastr*/
/*jshint esversion: 11 */

// Language System
let currentLang = localStorage.getItem('oxm_lang') || 'en';

const translations = {
  en: {
    language: 'Language',
    links: 'Links',
    bottingrules: 'Botting rules',
    greasyforkpage: 'Greasyfork page',
    discordsrv: 'Discord server',
    imageresizer: 'Image resizer',
    imageconverter: 'Image converter',
    setting: 'Settings',
    image: 'Image',
    loaded: 'Loaded',
    imagenotloaded: 'Image not loaded',
    notloaded: 'Not loaded',
    nset: 'Not Set',
    coordinatesnotset: 'Coordinates not set',
    on: 'On',
    off: 'Off',
    protect: 'Protect',
    coordinate: 'Coordinate',
    strategy: 'Shape',
    welcome: 'Welcome to Oxm Bot BETA! Fast pixel automation.',
    warning: 'Use responsibly.',
    protectionwarning: 'This may result in account ban, use carefully',
    botwarning: 'Bots only allowed in certain locations'
  },
  ru: {
    language: 'Язык',
    links: 'Ссылки',
    bottingrules: 'Правила',
    greasyforkpage: 'Greasyfork',
    discordsrv: 'Discord',
    imageresizer: 'Размер',
    imageconverter: 'Конвертер',
    setting: 'Настройки',
    image: 'Изображение',
    loaded: 'Загружено',
    imagenotloaded: 'Не загружено',
    notloaded: 'Не загружено',
    nset: 'Не установлено',
    coordinatesnotset: 'Координаты не установлены',
    on: 'Вкл',
    off: 'Выкл',
    protect: 'Защита',
    coordinate: 'Координата',
    strategy: 'Форма',
    welcome: 'Добро пожаловать в Oxm Bot BETA!',
    warning: 'Используйте ответственно.',
    protectionwarning: 'Может привести к бану',
    botwarning: 'Боты разрешены в определенных местах'
  }
};

function t(key) {
  return translations[currentLang][key] || translations.en[key] || key;
}

function setLanguage(lang) {
  currentLang = lang;
  localStorage.setItem('oxm_lang', lang);
  location.reload();
}

// Config - FAST MODE (no slider)
const MXOBOT_EXPERIMENTAL_USE_MULTI_ACC = false;
const MXOBOT_ANIMATE_BOT_CANVAS = true;
const BOT_DO_NOT_DITHER = false;
let MXOBOT_TIMEOUT = 15; // Fast mode
const MXOBOT_IMG_NOT_LOADED = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='

const MXOBOT_DRAWING_STYLES = [
  ['Quadratic', function (a, b) {
    const origx = coordinates[0] + ~~(nimage.image.width >> 1)
    const origy = coordinates[1] + ~~(nimage.image.height >> 1)
    return (a[0] - origx) ** 8 + (a[1] - origy) ** 8 - (b[0] - origx) ** 8 - (b[1] - origy) ** 8
  }],
  ['Circular', function (a, b) {
    const origx = coordinates[0] + ~~(nimage.image.width >> 1);
    const origy = coordinates[1] + ~~(nimage.image.height >> 1);
    return (a[0] - origx) ** 2 + (a[1] - origy) ** 2 - (b[0] - origx) ** 2 - (b[1] - origy) ** 2;
  }],
  ['Horizontal', (a, b) => a[0] + a[1] * 0xfffff - b[0] - b[1] * 0xfffff],
  ['Vertical', (a, b) => a[0] * 0xfffff + a[1] - b[0] * 0xfffff - b[1]],
  ['Chess', (a, b) => ((a[0] + a[1]) % 2) - ((b[0] + b[1]) % 2)],
  ['Random', () => 1 - Math.random() * 2],
  ['Diagonal', (pixel1, pixel2) => pixel1[0] - pixel2[0] + (pixel1[1] - pixel2[1])],
  ['Zigzag', (pixel1, pixel2) => (pixel1[0] + pixel1[1]) % 2 === (pixel2[0] + pixel2[1]) % 2 ? pixel1[0] - pixel2[0] : -(pixel1[0] - pixel2[0])]
];

let core = new NevinCore({
  timeout: MXOBOT_TIMEOUT,
  multibot: MXOBOT_EXPERIMENTAL_USE_MULTI_ACC,
});

function showCustomToast(message, type = 'warning') {
  const toast = document.createElement('div');
  toast.style.cssText = `
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a0a2e 0%, #0f0520 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    border: 2px solid ${type === 'warning' ? '#ff0844' : '#0066ff'};
    z-index: 999999;
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 0 30px ${type === 'warning' ? 'rgba(255, 8, 68, 0.5)' : 'rgba(0, 102, 255, 0.5)'};
    animation: toastFade 3s forwards;
  `;
  toast.textContent = type === 'warning' ? `⚠️ ${message}` : `ℹ️ ${message}`;

  if (!document.querySelector('#toast-animation')) {
    const style = document.createElement('style');
    style.id = 'toast-animation';
    style.textContent = `
      @keyframes toastFade {
        0% { opacity: 0; transform: translate(-50%, -40%); }
        20% { opacity: 1; transform: translate(-50%, -50%); }
        80% { opacity: 1; transform: translate(-50%, -50%); }
        100% { opacity: 0; transform: translate(-50%, -60%); }
      }
    `;
    document.head.appendChild(style);
  }

  document.querySelectorAll('[style*="position: fixed"][style*="top: 50%"]').forEach(t => t.remove());
  document.body.appendChild(toast);
  setTimeout(() => toast.remove(), 3000);
}

function toggleLinks() {
  const div = document.getElementById("links");
  const arrow = document.querySelector('.arrow');
  if (div && div.classList.contains('expanded')) {
    div.classList.remove('expanded');
    if (arrow) arrow.classList.remove('expanded');
  } else if (div) {
    div.classList.add('expanded');
    if (arrow) arrow.classList.add('expanded');
  }
}

function draggable(element, handle) {
  let x, y;
  const mouseDownHandler = (e) => {
    x = e.clientX;
    y = e.clientY;
    document.addEventListener("mousemove", mouseMoveHandler);
    document.addEventListener("mouseup", mouseUpHandler);
  };

  const mouseMoveHandler = (e) => {
    const dx = e.clientX - x;
    const dy = e.clientY - y;
    element.style.top = `${element.offsetTop + dy}px`;
    element.style.left = `${element.offsetLeft + dx}px`;
    x = e.clientX;
    y = e.clientY;
  };

  const mouseUpHandler = () => {
    document.removeEventListener("mousemove", mouseMoveHandler);
    document.removeEventListener("mouseup", mouseUpHandler);
  };

  handle.addEventListener("mousedown", mouseDownHandler);
}

// Logo URL
const logoUrl = 'https://i.postimg.cc/7hyLF9qs/4a292d1b-0dae-4d53-8510-14207825.jpg';

const html = `
<div>
<div class="oxm-menu" id="menu-div">
  <div class="oxm-header" id="menu-title">
    <img src="${logoUrl}" class="oxm-logo" alt="Oxm Bot">
    <div class="oxm-title-text">
      <span class="oxm-name">Oxm Bot</span>
      <span class="oxm-beta">BETA</span>
    </div>
  </div>
  
  <div class="oxm-preview">
    <img src="${MXOBOT_IMG_NOT_LOADED}" id="output" class="preview-img">
    <div class="preview-overlay">${t('image')}</div>
  </div>
  
  <div class="oxm-body">
    <div class="oxm-section">
      <div class="section-header">
        <span>${t('setting')}</span>
      </div>
      
      <div class="oxm-row" id="language-row">
        <span class="row-label">${t('language')}</span>
        <select id="language-select" class="oxm-select">
          <option value="en" ${currentLang === 'en' ? 'selected' : ''}>English</option>
          <option value="ru" ${currentLang === 'ru' ? 'selected' : ''}>Русский</option>
        </select>
      </div>
      
      <div class="oxm-row clickable" id="bot_switch">
        <span class="row-label">Bot</span>
        <span class="row-status status-off">${t('off')}</span>
      </div>
      
      <div class="oxm-row clickable" id="protect-switch">
        <span class="row-label">${t('protect')}</span>
        <span class="row-status status-off">${t('off')}</span>
      </div>
      
      <div class="oxm-row clickable" id="load_image">
        <span class="row-label">${t('image')}</span>
        <span class="row-status status-off">${t('notloaded')}</span>
      </div>
      
      <div class="oxm-row clickable" id="coordinate">
        <span class="row-label">${t('coordinate')}</span>
        <span class="row-status status-off" id="coordinate-text">${t('nset')}</span>
      </div>
      
      <div class="oxm-row">
        <span class="row-label">${t('strategy')}</span>
        <select id="strategy" class="oxm-select">
          ${MXOBOT_DRAWING_STYLES.map(([name]) => `<option>${name}</option>`).join('')}
        </select>
      </div>
    </div>
    
    <div class="oxm-section">
      <div class="section-header expandable" id="toggleButton">
        <span>${t('links')}</span>
        <span class="arrow">▼</span>
      </div>
      <div id="links" class="links-container">
        <a id="rules" class="oxm-link" target="_blank">${t('bottingrules')}</a>
        <a id="greasyfork" class="oxm-link" target="_blank">${t('greasyforkpage')}</a>
        <a id="discord" class="oxm-link" target="_blank">${t('discordsrv')}</a>
        <a id="image_resizer" class="oxm-link" target="_blank">${t('imageresizer')}</a>
        <a id="image_converter" class="oxm-link" target="_blank">${t('imageconverter')}</a>
      </div>
    </div>
  </div>
</div>
<style>
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 8, 68, 0.4), 0 0 30px rgba(0, 102, 255, 0.2); }
  50% { box-shadow: 0 0 25px rgba(255, 8, 68, 0.6), 0 0 50px rgba(0, 102, 255, 0.4); }
}

.mxobot-ui-canvas {
  ${MXOBOT_ANIMATE_BOT_CANVAS ? "animation: mxobot_ui_blinker 5s linear infinite;" : ""}
  position: absolute;
  pointer-events: none;
  opacity: 65%;
  outline: 1px solid transparent;
  image-rendering: crisp-edges;
}

@keyframes mxobot_ui_blinker {
  0%, 100% { opacity: .25; }
  50% { opacity: 0; }
}

.oxm-menu {
  position: absolute;
  z-index: 10000;
  top: 20px;
  left: 20px;
  width: 280px;
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(145deg, #0a0a1a 0%, #1a0a2e 50%, #16051f 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border: 2px solid;
  border-image: linear-gradient(135deg, #ff0844, #0066ff) 1;
  animation: fadeIn 0.5s ease, pulse 3s ease-in-out infinite;
  user-select: none;
}

.oxm-header {
  background: linear-gradient(135deg, #ff0844 0%, #0066ff 100%);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: move;
  position: relative;
  overflow: hidden;
}

.oxm-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: rotate(45deg) translateY(-100%); }
  100% { transform: rotate(45deg) translateY(100%); }
}

.oxm-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
  border-radius: 8px;
  background: white;
  padding: 4px;
  z-index: 1;
}

.oxm-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1;
}

.oxm-name {
  font-size: 22px;
  font-weight: 700;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  letter-spacing: 1px;
}

.oxm-beta {
  font-size: 10px;
  font-weight: 600;
  color: #ffee00;
  background: rgba(255,8,68,0.3);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: fit-content;
  border: 1px solid rgba(255,238,0,0.3);
}

.oxm-preview {
  position: relative;
  height: 80px;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,8,68,0.2);
}

.preview-img {
  max-width: 60px;
  max-height: 60px;
  object-fit: contain;
  border-radius: 6px;
  border: 2px solid rgba(0,102,255,0.3);
}

.preview-overlay {
  position: absolute;
  bottom: 5px;
  right: 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.oxm-body {
  padding: 0;
}

.oxm-section {
  margin: 0;
  border-bottom: 1px solid rgba(255,8,68,0.1);
}

.oxm-section:last-child {
  border-bottom: none;
}

.section-header {
  padding: 12px 15px;
  background: linear-gradient(90deg, rgba(255,8,68,0.15), rgba(0,102,255,0.15));
  font-size: 12px;
  font-weight: 700;
  color: #00d9ff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid rgba(0,102,255,0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-header.expandable {
  cursor: pointer;
  transition: background 0.2s;
}

.section-header.expandable:hover {
  background: linear-gradient(90deg, rgba(255,8,68,0.25), rgba(0,102,255,0.25));
}

.arrow {
  transition: transform 0.3s;
  font-size: 10px;
}

.arrow.expanded {
  transform: rotate(180deg);
}

.oxm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.oxm-row:last-child {
  border-bottom: none;
}

.oxm-row.clickable {
  cursor: pointer;
}

.oxm-row.clickable:hover {
  background: rgba(255,8,68,0.08);
}

.row-label {
  font-size: 14px;
  color: #b8b8b8;
  font-weight: 500;
}

.row-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s;
}

.status-off {
  color: #ff0844;
  background: rgba(255,8,68,0.15);
  border: 1px solid rgba(255,8,68,0.3);
}

.status-on {
  color: #00ff88;
  background: rgba(0,255,136,0.15);
  border: 1px solid rgba(0,255,136,0.3);
  box-shadow: 0 0 10px rgba(0,255,136,0.2);
}

.oxm-select {
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: 1px solid rgba(0,102,255,0.4);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.oxm-select:hover {
  border-color: #0066ff;
  background: rgba(0,102,255,0.1);
}

.oxm-select:focus {
  border-color: #ff0844;
  box-shadow: 0 0 8px rgba(255,8,68,0.4);
}

.links-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  background: rgba(0,0,0,0.2);
}

.links-container.expanded {
  max-height: 300px;
  opacity: 1;
  padding: 10px 0;
}

.oxm-link {
  display: block;
  padding: 10px 20px;
  color: #0066ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.oxm-link:hover {
  color: #ff0844;
  background: rgba(255,8,68,0.08);
  border-left-color: #ff0844;
  padding-left: 25px;
}
</style>
</div>`;

var menu = new DOMParser().parseFromString(html, "text/html").body.children[0];

var oxm_coordinates;
var oxm_coordinates_text;
var oxm_menu_div;
var oxm_menu_title;
var oxm_game_canvas;
var oxm_game_context;
var oxm_protect;
var oxm_load_image;
var canvas;
var pixelplace_painting_move;
var pixelplace_coordinates;

function initVars() {
  oxm_coordinates = menu.querySelector("#coordinate");
  oxm_coordinates_text = menu.querySelector("#coordinate-text");
  oxm_menu_div = menu.querySelector("#menu-div");
  oxm_menu_title = menu.querySelector("#menu-title");
  oxm_protect = menu.querySelector("#protect-switch");
  oxm_load_image = menu.querySelector("#load_image");
  pixelplace_coordinates = document.querySelector("#coordinates");
  pixelplace_painting_move = document.querySelector("#painting-move");
  canvas = document.querySelector("#canvas");
}

function createBotCanvas() {
  oxm_game_canvas = document.createElement("canvas");
  oxm_game_canvas.width = canvas.width;
  oxm_game_canvas.height = canvas.height;
  oxm_game_context = oxm_game_canvas.getContext("2d");
  oxm_game_canvas.className = "mxobot-ui-canvas";
  pixelplace_painting_move.prepend(oxm_game_canvas);
  
  document.getElementById('rules').href = "https://r.resimlink.com/OdYl_N.png";
  document.getElementById('greasyfork').href = "https://greasyfork.org/scripts";
  document.getElementById('discord').href = "https://discord.gg/bGEk7UEGvg";
  document.getElementById('image_converter').href = "https://duchesskero.moe";
  document.getElementById('image_resizer').href = "https://resizepixel.com";
}

function controlProperty(id, callback) {
  const menu_property = document.getElementById(id);
  if (!menu_property) return;
  
  const span_state = menu_property.querySelector('.row-status');
  if (!span_state) return;
  
  const refreshDOM = function () {
    const state = span_state.textContent.trim() === t('off');
    span_state.textContent = state ? t('on') : t('off');
    span_state.className = state ? "row-status status-on" : "row-status status-off";
  };
  
  menu_property.addEventListener("click", () => {
    refreshDOM();
    callback(span_state.textContent.trim() === t('on'));
  });
  
  refreshDOM();
}

function clearOxmCanvas() {
  if (oxm_game_context) {
    oxm_game_context.clearRect(0, 0, oxm_game_canvas.width, oxm_game_canvas.height);
  }
}

async function Oxm_UIMain() {
  document.body.prepend(menu);
  await NevinWaitForElm("#menu-div");
  await NevinWaitForElm("#canvas");
  initVars();
  createBotCanvas();
  draggable(oxm_menu_div, oxm_menu_title);

  document.getElementById('language-select').addEventListener('change', (e) => {
    setLanguage(e.target.value);
  });

  const toggleBtn = document.getElementById('toggleButton');
  if (toggleBtn) {
    toggleBtn.addEventListener('click', toggleLinks);
  }
}

var nimage;
var coordinates;

async function Oxm_JSMain() {
  if (BOT_DO_NOT_DITHER) unsafeWindow.BOT_DO_NOT_DITHER = true;

  if (!core) {
    core = new NevinCore({
      timeout: MXOBOT_TIMEOUT,
      multibot: MXOBOT_EXPERIMENTAL_USE_MULTI_ACC,
    });
    unsafeWindow.core = core;
    NevinLogger.LEVEL = NevinLoggerFactory.LEVEL_INFO;
  }

  core.protection = null;
  var protection_state = false;
  var drawing_style = MXOBOT_DRAWING_STYLES[0][1];

  function drawingStyleChange(e) {
    const index = e.srcElement.selectedIndex;
    if (index < MXOBOT_DRAWING_STYLES.length) {
      drawing_style = MXOBOT_DRAWING_STYLES[index][1];
      core.engine.tasks.sort(drawing_style);
    }
  }
  
  document.getElementById("strategy").addEventListener("change", drawingStyleChange);

  controlProperty("bot_switch", function (state) {
    if (!nimage) {
      showCustomToast(t('imagenotloaded'));
      return;
    }
    if (!coordinates) {
      showCustomToast(t('coordinatesnotset'));
      return;
    }
    if (!state) {
      clearOxmCanvas();
      core.engine.tasks = [];
      core.protection?.stop();
      return;
    }

    if (!localStorage.getItem('firstBotUse')) {
      showCustomToast(t('botwarning'), 'warning');
      localStorage.setItem('firstBotUse', 'true');
    }
    
    clearOxmCanvas();
    oxm_game_context.drawImage(nimage.image, ...coordinates);
    core.engine.tasks = [
      ...core.engine.tasks,
      ...nimage.convertToTasks(...coordinates, core.nevinWS),
    ].sort(drawing_style);
    
    if (protection_state && nimage && coordinates) {
      core.protection.load(nimage, coordinates);
      core.protection.start();
    }
  });

  function loadImage(img) {
    nimage = img;
    nimage.image.addEventListener("load", function () {
      const statusSpan = oxm_load_image.querySelector('.row-status');
      if (statusSpan) {
        statusSpan.textContent = t('loaded');
        statusSpan.className = "row-status status-on";
      }
      document.getElementById("output").src = nimage.image.src;
      if (coordinates) {
        clearOxmCanvas();
        oxm_game_context.drawImage(nimage.image, ...coordinates);
      }
    });
  }

  oxm_load_image.addEventListener("click", function () {
    core.picker.requestImageFromFileDialog(core.palette).then(loadImage);
  });

  core.picker.addClipboardListener(core.palette, loadImage);

  controlProperty("protect-switch", function (state) {
    protection_state = state;
    if (state) {
      if (!localStorage.getItem('firstProtectionUse')) {
        showCustomToast(t('protectionwarning'), 'warning');
        localStorage.setItem('firstProtectionUse', 'true');
      }
      if (!nimage) {
        showCustomToast(t('imagenotloaded'));
        return;
      }
      if (!coordinates) {
        showCustomToast(t('coordinatesnotset'));
        return;
      }
      if (!core.protection) {
        core.protection = new NevinProtect(core);
        if (coordinates && nimage) {
          core.protection.load(nimage, coordinates);
        }
      }
      core.protection.start();
    }
  });

  canvas.addEventListener("click", function () {
    coordinates = pixelplace_coordinates.textContent.split(",").map(Number);
    oxm_coordinates_text.className = "row-status status-on";
    oxm_coordinates_text.textContent = JSON.stringify(coordinates);
    if (nimage) {
      clearOxmCanvas();
      oxm_game_context.drawImage(nimage.image, ...coordinates);
    }
  });

  var oldTitle = document.title;
  setInterval(function () {
    if (!document.hasFocus()) {
      document.title = "Oxm Bot P" + core.engine.tasks.length;
    } else if (document.title.startsWith("Oxm Bot")) {
      document.title = oldTitle;
    }
  }, 10);
}

async function Oxm_Main() {
  await Oxm_UIMain();
  await Oxm_JSMain();
  
  if (!localStorage.getItem('firstUse')) {
    showCustomToast(t('welcome'), 'info');
    setTimeout(() => showCustomToast(t('warning'), 'info'), 3500);
    localStorage.setItem('firstUse', 'true');
  }
}

(function () {
  var observer = new MutationObserver(function () {
    if (document.body) {
      Oxm_Main();
      observer.disconnect();
    }
  });
  observer.observe(document.documentElement, { childList: true });
})();