Back to Repository

asdasd

0 upvotes
By sselcukege@gmail.com
Manual (context menu)

Match Pattern

<all_urls>

Script Code

// ==UserScript==
// @name         Gartic Phone Yardimci v3 (La Gardas)
// @namespace    lagardas/gartic
// @version      3.0
// @description  Sinirsiz yazi + zaman + oto-hazir + OTOMATIK CIZIM + aninda turu bitir
// @match        *://*.garticphone.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  /* ==================== AYARLAR ==================== */
  const KEY = 'lg-gartic-ayar';
  const A = Object.assign({
    sinirsizYazi: true, zamanDondur: false, otoDondur: false,
    otoHazir: false, otoHazirGecikme: 2, ctrlEnter: true, sayac: true,
    sesKapat: false, antiAfk: false,
    otoBitir: false, otoBitirSn: 5,
    cizHiz: 4,
    metinler: ['Merhaba!', 'Hazir misin?', 'Bu cok komik', 'Bilmiyorum :)']
  }, JSON.parse(localStorage.getItem(KEY) || '{}'));
  const kaydet = () => localStorage.setItem(KEY, JSON.stringify(A));

  /* ==================== 1) SINIRSIZ YAZI ==================== */
  function sinirKaldir() {
    document.querySelectorAll('textarea[maxlength], input[maxlength]').forEach(function (el) {
      try { el.removeAttribute('maxlength'); el.maxLength = -1; } catch (e) {}
    });
  }
  sinirKaldir();
  new MutationObserver(sinirKaldir).observe(document.documentElement, {
    childList: true, subtree: true, attributes: true, attributeFilter: ['maxlength']
  });
  try {
    Object.defineProperty(HTMLTextAreaElement.prototype, 'maxLength', { configurable: true, get: function () { return -1; }, set: function () {} });
    Object.defineProperty(HTMLInputElement.prototype, 'maxLength', { configurable: true, get: function () { return -1; }, set: function () {} });
  } catch (e) {}

  /* ==================== 2) ZAMAN DONDURMA ==================== */
  let dondur = false, t0 = Date.now();
  const gercekNow = Date.now.bind(Date);
  Date.now = function () { return dondur ? t0 : gercekNow(); };
  const _st = window.setTimeout.bind(window), _si = window.setInterval.bind(window);
  window.setTimeout = function (fn, ms) { return _st.apply(null, [fn, dondur ? (ms || 0) * 100 : ms].concat([].slice.call(arguments, 2))); };
  window.setInterval = function (fn, ms) { return _si.apply(null, [fn, dondur ? (ms || 0) * 100 : ms].concat([].slice.call(arguments, 2))); };
  function donduruAyarla(v) { if (v && !dondur) t0 = Date.now(); dondur = v; }
  setInterval(function () {
    if (!A.otoDondur || dondur) return;
    let min = 9999;
    document.querySelectorAll('div,span,p,b,strong,h1,h2,h3').forEach(function (e) {
      if (e.childElementCount !== 0) return;
      const t = (e.textContent || '').trim();
      const m = t.match(/^(\d{1,2}):(\d{2})$/);
      if (m) { min = Math.min(min, +m[1] * 60 + +m[2]); return; }
      if (/^\d{1,2}$/.test(t)) min = Math.min(min, +t);
    });
    if (min <= 10) donduruAyarla(true);
  }, 300);

  /* ==================== 3) HAZIR / BITIR BUTONLARI ==================== */
  const HAZIR_RE = /(haz[ıi]r|ready|devam|ileri|next|g[öo]nder|send|tamam|bitir|done|ba[şs]la|submit)/i;
  function gorunurluk(el) { const r = el.getBoundingClientRect(); return r.width > 5 && r.height > 5; }
  function hazirButonlari() {
    const out = [];
    document.querySelectorAll('button, [role="button"], a').forEach(function (b) {
      const t = (b.textContent || '').trim();
      if (!t || t.length > 24) return;
      if (!HAZIR_RE.test(t)) return;
      if (!gorunurluk(b) || b.disabled) return;
      out.push(b);
    });
    return out;
  }
  function turuBitir() {
    const ta = document.querySelector('textarea');
    if (ta && !ta.value.trim()) yaz(ta, '.');
    const b = hazirButonlari();
    if (b.length) { b[0].click(); return true; }
    return false;
  }

  /* ==================== 4) OTO-HAZIR / OTO-BITIR ==================== */
  let sonTik = 0;
  const ilkGorulme = new Map();
  setInterval(function () {
    const btns = hazirButonlari();
    if (!btns.length) { ilkGorulme.clear(); return; }
    const aktif = document.activeElement;
    const yaziyor = aktif && (aktif.tagName === 'TEXTAREA' || aktif.tagName === 'INPUT');
    if (A.otoBitir) {
      btns.forEach(function (b) {
        const imza = (b.textContent || '').trim() + '@' + Math.round(b.getBoundingClientRect().left);
        if (!ilkGorulme.has(imza)) ilkGorulme.set(imza, Date.now());
        if (Date.now() - ilkGorulme.get(imza) >= A.otoBitirSn * 1000) {
          const ta = document.querySelector('textarea');
          if (ta && !ta.value.trim()) yaz(ta, '.');
          b.click(); ilkGorulme.clear(); sonTik = Date.now();
        }
      });
      return;
    }
    if (!A.otoHazir || yaziyor) return;
    if (Date.now() - sonTik < A.otoHazirGecikme * 1000 + 1200) return;
    btns[0].click();
    sonTik = Date.now();
  }, 800);

  /* ==================== 5) yaz / aktifKutu ==================== */
  function yaz(el, metin) {
    if (!el) return;
    const proto = el.tagName === 'TEXTAREA' ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
    const setter = Object.getOwnPropertyDescriptor(proto, 'value').set;
    setter.call(el, metin);
    el.dispatchEvent(new Event('input', { bubbles: true }));
    el.dispatchEvent(new Event('change', { bubbles: true }));
    el.focus();
  }
  function aktifKutu() {
    const a = document.activeElement;
    if (a && (a.tagName === 'TEXTAREA' || a.tagName === 'INPUT')) return a;
    return document.querySelector('textarea') || document.querySelector('input[type="text"]');
  }

  /* ==================== 6) CTRL+ENTER ==================== */
  document.addEventListener('keydown', function (e) {
    if (A.ctrlEnter && e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { if (turuBitir()) e.preventDefault(); }
  }, true);

  /* ==================== 7) KARAKTER SAYACI ==================== */
  const sayacEl = document.createElement('div');
  sayacEl.style.cssText = 'position:fixed;right:14px;bottom:14px;z-index:2147483647;background:#0d0d0d;color:#cf8bff;border:1px solid #7a1fb0;border-radius:10px;padding:6px 10px;font:12px "Segoe UI",sans-serif;display:none';
  document.addEventListener('input', function () {
    if (!A.sayac) { sayacEl.style.display = 'none'; return; }
    const el = document.activeElement;
    if (el && (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT')) {
      sayacEl.textContent = 'Karakter: ' + el.value.length;
      sayacEl.style.display = 'block';
    }
  });

  /* ==================== 8) SES / ANTI-AFK ==================== */
  setInterval(function () { if (A.sesKapat) document.querySelectorAll('audio,video').forEach(function (m) { m.muted = true; }); }, 1000);
  setInterval(function () { if (A.antiAfk) document.dispatchEvent(new MouseEvent('mousemove', { bubbles: true, clientX: 5, clientY: 5 })); }, 25000);

  /* ==================== 9) RESIM INDIR ==================== */
  function resimleriIndir() {
    let n = 0;
    document.querySelectorAll('img').forEach(function (im, i) {
      const src = im.currentSrc || im.src; if (!src) return;
      const a = document.createElement('a'); a.href = src; a.download = 'gartic_' + (i + 1) + '.png';
      document.body.appendChild(a); a.click(); a.remove(); n++;
    });
    document.querySelectorAll('canvas').forEach(function (c, i) {
      try { const a = document.createElement('a'); a.href = c.toDataURL('image/png'); a.download = 'gartic_canvas_' + (i + 1) + '.png'; document.body.appendChild(a); a.click(); a.remove(); n++; } catch (e) {}
    });
    return n;
  }

  /* ==================== 10) OTOMATIK CIZIM MOTORU ==================== */
  function enBuyukCanvas() {
    let en = null, alan = 0;
    document.querySelectorAll('canvas').forEach(function (c) {
      const r = c.getBoundingClientRect(); const a = r.width * r.height;
      if (a > alan) { alan = a; en = c; }
    });
    return en;
  }
  function yollariBul(e, w, h, minUzunluk) {
    const idx = (x, y) => y * w + x;
    const pts = new Set();
    for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) if (e[idx(x, y)]) pts.add(idx(x, y));
    if (!pts.size) return [];
    const komsu = (p) => {
      const y = (p / w) | 0, x = p % w, out = [];
      for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) {
        if (!dx && !dy) continue;
        const nx = x + dx, ny = y + dy;
        if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
        const q = idx(nx, ny); if (pts.has(q)) out.push(q);
      }
      return out;
    };
    const derece = new Map(); pts.forEach(p => derece.set(p, komsu(p).length));
    const kalan = new Set(pts);
    const bas = [...pts].filter(p => derece.get(p) === 1).concat([...pts].filter(p => derece.get(p) >= 3));
    const yollar = [];
    const yuru = (s) => {
      const yol = [s]; kalan.delete(s);
      let cur = s, prev = -1, vy = 0, vx = 0;
      while (true) {
        const aday = komsu(cur).filter(q => q !== prev && kalan.has(q));
        if (!aday.length) break;
        let nxt;
        if (aday.length === 1 || (!vy && !vx)) nxt = aday[0];
        else {
          let bd = -9, bi = aday[0];
          const cy = (cur / w) | 0, cx = cur % w;
          for (const q of aday) {
            const qy = (q / w) | 0, qx = q % w, dy = qy - cy, dx = qx - cx, u = Math.hypot(dy, dx);
            const d = (dy * vy + dx * vx) / u; if (d > bd) { bd = d; bi = q; }
          }
          nxt = bi;
        }
        const cy = (cur / w) | 0, cx = cur % w, ny = (nxt / w) | 0, nx = nxt % w;
        vy = ny - cy; vx = nx - cx;
        yol.push(nxt); kalan.delete(nxt); prev = cur; cur = nxt;
      }
      return yol;
    };
    for (const s of bas) if (kalan.has(s)) { const y = yuru(s); if (y.length >= minUzunluk) yollar.push(y); }
    while (kalan.size) { const s = kalan.values().next().value; const y = yuru(s); if (y.length >= minUzunluk) yollar.push(y); }
    return yollar.map(y => y.map(p => [p % w, (p / w) | 0]));
  }
  function kenarYollari(kaynak, gen, yuk, minUzunluk, esik) {
    const t = document.createElement('canvas'); t.width = gen; t.height = yuk;
    const ctx = t.getContext('2d');
    ctx.fillStyle = '#fff'; ctx.fillRect(0, 0, gen, yuk);
    if (kaynak.draw) kaynak.draw(ctx, gen, yuk); else ctx.drawImage(kaynak.img, 0, 0, gen, yuk);
    const d = ctx.getImageData(0, 0, gen, yuk).data;
    const g = new Float32Array(gen * yuk);
    for (let i = 0; i < gen * yuk; i++) g[i] = 0.299 * d[i * 4] + 0.587 * d[i * 4 + 1] + 0.114 * d[i * 4 + 2];
    const e = new Uint8Array(gen * yuk);
    for (let y = 1; y < yuk - 1; y++) for (let x = 1; x < gen - 1; x++) {
      const i = y * gen + x;
      const gx = -g[i - gen - 1] - 2 * g[i - 1] - g[i + gen - 1] + g[i - gen + 1] + 2 * g[i + 1] + g[i + gen + 1];
      const gy = -g[i - gen - 1] - 2 * g[i - gen] - g[i - gen + 1] + g[i + gen - 1] + 2 * g[i + gen] + g[i + gen + 1];
      if (Math.hypot(gx, gy) > esik) e[i] = 1;
    }
    return yollariBul(e, gen, yuk, minUzunluk);
  }
  const beklet = (ms) => new Promise(r => setTimeout(r, ms));
  async function tuvaldeCiz(yollar, gen, yuk) {
    const cv = enBuyukCanvas();
    if (!cv) return 0;
    const r = cv.getBoundingClientRect();
    const marj = 0.08;
    const nok = (x, y) => ({ x: r.left + (marj + (1 - 2 * marj) * x / gen) * r.width, y: r.top + (marj + (1 - 2 * marj) * y / yuk) * r.height });
    const his = () => Math.max(0, 12 - A.cizHiz);
    function ev(h, x, y, basili) {
      const hedef = document.elementFromPoint(x, y) || cv;
      const o = { bubbles: true, cancelable: true, composed: true, clientX: x, clientY: y, view: window, pointerId: 1, pointerType: 'mouse', isPrimary: true, buttons: basili ? 1 : 0, button: basili ? 0 : -1 };
      try { hedef.dispatchEvent(new PointerEvent(h, o)); } catch (e) {}
      try { hedef.dispatchEvent(new MouseEvent(h.replace('pointer', 'mouse'), Object.assign({}, o))); } catch (e) {}
    }
    let sayi = 0;
    for (const yol of yollar.slice(0, 120)) {
      if (yol.length < 2) continue;
      let p = nok(yol[0][0], yol[0][1]);
      ev('pointerdown', p.x, p.y, true);
      for (let i = 1; i < yol.length; i++) {
        p = nok(yol[i][0], yol[i][1]);
        ev('pointermove', p.x, p.y, true);
        if (his() > 0) await beklet(his());
      }
      ev('pointerup', p.x, p.y, false); sayi++;
    }
    return sayi;
  }
  async function resimdenCiz(url) {
    const img = await new Promise((res, rej) => { const i = new Image(); i.crossOrigin = 'anonymous'; i.onload = () => res(i); i.onerror = rej; i.src = url; });
    const gen = 90, yuk = Math.max(30, Math.round(gen * (img.height / img.width)) || 90);
    return tuvaldeCiz(kenarYollari({ img: img }, gen, yuk, 5, 130), gen, yuk);
  }
  async function yazidanCiz(metin) {
    const gen = 320, yuk = 120;
    const y = kenarYollari({ draw: (ctx, w, h) => { ctx.fillStyle = '#000'; ctx.font = 'bold ' + (h * 0.6) + 'px Segoe UI, sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(metin, w / 2, h / 2); } }, gen, yuk, 5, 120);
    return tuvaldeCiz(y, gen, yuk);
  }
  async function karalamaCiz() {
    const y = [];
    for (let k = 0; k < 6; k++) {
      const p = []; let x = 15 + Math.random() * 70, y0 = 15 + Math.random() * 70; p.push([x, y0]);
      for (let i = 0; i < 10; i++) { x += (Math.random() - 0.5) * 30; y0 += (Math.random() - 0.5) * 30; p.push([Math.max(5, Math.min(95, x)), Math.max(5, Math.min(95, y0))]); }
      y.push(p);
    }
    return tuvaldeCiz(y, 100, 100);
  }

  /* ==================== 11) PANEL ==================== */
  function kurPanel() {
    const d = document.createElement('div');
    d.id = 'lg-panel';
    d.style.cssText = 'position:fixed;left:12px;bottom:12px;z-index:2147483647;width:270px;max-height:88vh;overflow:auto;background:#0d0d0d;color:#fff;border:1px solid #7a1fb0;border-radius:12px;padding:10px 12px;font:13px "Segoe UI",sans-serif;box-shadow:0 8px 30px rgba(176,38,255,.4)';
    const h = document.createElement('div');
    h.textContent = 'Gartic Yardimci v3 (F8)';
    h.style.cssText = 'color:#cf8bff;font-weight:700;margin-bottom:6px;cursor:pointer';
    d.appendChild(h);
    const govde = document.createElement('div'); d.appendChild(govde);

    function kutu(yazi, anahtar, fn) {
      const l = document.createElement('label');
      l.style.cssText = 'display:flex;gap:8px;align-items:center;margin:4px 0;cursor:pointer';
      const cb = document.createElement('input'); cb.type = 'checkbox'; cb.checked = !!A[anahtar];
      cb.addEventListener('change', function () { A[anahtar] = cb.checked; kaydet(); if (fn) fn(cb.checked); });
      const s = document.createElement('span'); s.textContent = yazi;
      l.appendChild(cb); l.appendChild(s); govde.appendChild(l);
    }
    function baslik(t) {
      const b = document.createElement('div');
      b.textContent = t; b.style.cssText = 'margin-top:8px;color:#cf8bff;font-weight:600;font-size:12px';
      govde.appendChild(b);
    }
    function btn(t, fn, buyuk) {
      const b = document.createElement('button'); b.textContent = t;
      b.style.cssText = 'margin:3px 0;width:100%;background:' + (buyuk ? '#b026ff' : '#2a2140') + ';border:1px solid ' + (buyuk ? '#b026ff' : '#7a1fb0') + ';color:' + (buyuk ? '#fff' : '#cf8bff') + ';border-radius:8px;padding:6px;cursor:pointer;font-family:inherit;font-weight:600';
      b.addEventListener('click', fn); govde.appendChild(b); return b;
    }
    function slider(yazi, anahtar, min, max, adim) {
      const w = document.createElement('div'); w.style.cssText = 'margin:6px 0;font-size:12px;color:#9a8fb5';
      w.textContent = yazi + ': ' + A[anahtar];
      const r = document.createElement('input'); r.type = 'range'; r.min = min; r.max = max; r.step = adim || 1; r.value = A[anahtar]; r.style.width = '100%';
      r.addEventListener('input', function () { A[anahtar] = +r.value; w.textContent = yazi + ': ' + r.value; kaydet(); });
      w.appendChild(r); govde.appendChild(w);
    }

    baslik('Genel');
    kutu('Sinirsiz yazi', 'sinirsizYazi', sinirKaldir);
    kutu('Zamani DONDUR', 'zamanDondur', function (v) { donduruAyarla(v); });
    kutu('Oto: 10 sn kalinca dondur', 'otoDondur');
    kutu('Ctrl+Enter ile gonder', 'ctrlEnter');
    kutu('Karakter sayaci', 'sayac');
    kutu('Sesi kapat', 'sesKapat');
    kutu('Anti-AFK', 'antiAfk');

    baslik('Tur');
    btn('TURU BITIR (aninda)', function () { if (!turuBitir()) alert('Hazir/Devam butonu bulunamadi.'); }, true);
    kutu('Otomatik bitir', 'otoBitir');
    slider('Otomatik bitir (sn)', 'otoBitirSn', 1, 30);
    kutu('Oto-HAZIR (otomatik devam)', 'otoHazir');
    slider('Oto-hazir gecikme', 'otoHazirGecikme', 0, 15);

    baslik('Otomatik Cizim');
    slider('Cizim hizi', 'cizHiz', 1, 11);
    const uyari = document.createElement('div');
    uyari.style.cssText = 'font-size:11px;color:#9a8fb5;margin:2px 0 4px';
    uyari.textContent = 'Once cizim turunu ac, sonra butona bas.';
    govde.appendChild(uyari);

    const url = document.createElement('input');
    url.placeholder = 'resim URL (https://...)';
    url.style.cssText = 'width:100%;background:#1a1a1a;border:1px solid #3a2d55;color:#fff;border-radius:6px;padding:4px 6px;font-size:12px;box-sizing:border-box';
    govde.appendChild(url);
    btn('Resimden ciz (URL)', async function () {
      try { const n = await resimdenCiz(url.value.trim()); if (!n) alert('Tuval bulunamadi ya da cizgi cikmadi.'); }
      catch (e) { alert('Hata: ' + e.message + '  (resmi indirip "dosya" ile dene)'); }
    });

    const dosya = document.createElement('input');
    dosya.type = 'file'; dosya.accept = 'image/*';
    dosya.style.cssText = 'margin:4px 0;font-size:11px;color:#9a8fb5';
    govde.appendChild(dosya);
    btn('Resimden ciz (dosya)', async function () {
      if (!dosya.files[0]) { alert('Once dosya sec.'); return; }
      const n = await resimdenCiz(URL.createObjectURL(dosya.files[0]));
      if (!n) alert('Tuval bulunamadi ya da cizgi cikmadi.');
    });

    const yaziG = document.createElement('input');
    yaziG.placeholder = 'yazilacak yazi...';
    yaziG.style.cssText = 'width:100%;background:#1a1a1a;border:1px solid #3a2d55;color:#fff;border-radius:6px;padding:4px 6px;font-size:12px;box-sizing:border-box';
    govde.appendChild(yaziG);
    btn('Yazidan ciz', async function () {
      if (!yaziG.value.trim()) { alert('Yazi gir.'); return; }
      const n = await yazidanCiz(yaziG.value.trim());
      if (!n) alert('Tuval bulunamadi.');
    });
    btn('Rastgele karalama', async function () { const n = await karalamaCiz(); if (!n) alert('Tuval bulunamadi.'); });

    baslik('Hizli metinler');
    const satir = document.createElement('div'); satir.style.cssText = 'display:flex;gap:4px;margin:4px 0';
    const inp = document.createElement('input'); inp.placeholder = 'yeni metin...';
    inp.style.cssText = 'flex:1;background:#1a1a1a;border:1px solid #3a2d55;color:#fff;border-radius:6px;padding:3px 6px;font-size:12px';
    const ekle = document.createElement('button'); ekle.textContent = '+';
    ekle.style.cssText = 'background:#b026ff;border:0;color:#fff;border-radius:6px;padding:3px 10px;cursor:pointer';
    satir.appendChild(inp); satir.appendChild(ekle); govde.appendChild(satir);
    const liste = document.createElement('div'); govde.appendChild(liste);
    function listeCiz() {
      liste.innerHTML = '';
      A.metinler.forEach(function (m, i) {
        const s = document.createElement('div'); s.textContent = m; s.title = 'Tikla: kutuya yaz';
        s.style.cssText = 'background:#1a1020;border:1px solid #3a2d55;border-radius:6px;padding:4px 6px;margin:3px 0;cursor:pointer;font-size:12px';
        s.addEventListener('click', function () { yaz(aktifKutu(), m); });
        const sil = document.createElement('span'); sil.textContent = ' \u00d7';
        sil.style.cssText = 'color:#ff6b6b;float:right;font-weight:700';
        sil.addEventListener('click', function (e) { e.stopPropagation(); A.metinler.splice(i, 1); kaydet(); listeCiz(); });
        s.appendChild(sil); liste.appendChild(s);
      });
    }
    ekle.addEventListener('click', function () { if (inp.value.trim()) { A.metinler.push(inp.value.trim()); kaydet(); inp.value = ''; listeCiz(); } });
    listeCiz();

    baslik('Diger');
    btn('Resimleri indir', function () { alert(resimleriIndir() + ' resim indiriliyor.'); });

    h.addEventListener('click', function () { govde.style.display = govde.style.display === 'none' ? 'block' : 'none'; });
    document.body.appendChild(d); document.body.appendChild(sayacEl);
    document.addEventListener('keydown', function (e) { if (e.key === 'F8') { d.style.display = d.style.display === 'none' ? 'block' : 'none'; e.preventDefault(); } });
  }

  if (document.body) kurPanel();
  else window.addEventListener('DOMContentLoaded', kurPanel);
})();
Install requires the InjectJS Chrome extension. Scripts run only on sites matching the pattern above. Review code before installing any community script.