Greasy Fork is available in English.

Auto-Fill Message

Blah blah blah

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Auto-Fill Message
// @description Blah blah blah
// @version     6.9
// @namespace   tornautofill.level15
// @match       https://www.torn.com/messages.php*
// @run-at      document-end
// @grant       none
// @license     MIT
// ==/UserScript==

(function () {
    'use strict';

    const SUBJECT = "We Want YOU";

    const MESSAGE_HTML = `<div style="background-image: url('https://i.ibb.co/PZwGm3kM/d-background.png');
            background-repeat: repeat;
            background-size: cover;
            max-width: 600px;
            margin: 0 auto;
            font-family: georgia, serif;
            text-align: center;
            position: relative;">

  <div style="background: rgba(0,0,0,0.65); padding: 30px 25px;">

    <a class="full" href="https://i.ibb.co/v6r1TnGG/R-moving.gif" rel="page_thread">
      <img style="max-width: 500px; display: block; margin: 0 auto 10px auto;"
           src="https://i.ibb.co/v6r1TnGG/R-moving.gif" alt="R-moving.gif"/>
    </a>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <a href="/factions.php?step=profile&amp;ID=22887" target="_blank" rel="noopener">
      <img style="max-width: 500px; display: block; margin: 0 auto 15px auto; border: 1px solid #c0a060; border-radius: 4px;"
           src="https://i.ibb.co/h1mKrYzv/you-are-mine.png" alt="you-are-mine.png"/>
    </a>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 25px; margin-bottom: 25px; background: rgba(0,0,0,0.5);">
      <p style="color: #c0a060; font-size: 20px; font-weight: bold; letter-spacing: 3px; text-align: center; margin: 0 0 15px 0;">
        YOU CAUGHT OUR ATTENTION
      </p>
      <p style="color: #ffffff; font-size: 15px; line-height: 2; margin: 0 0 15px 0;">
        We don't recruit just anyone.<br>Out of a vast number of players we have reviewed,<br>
        <span style="color: #c0a060; font-weight: bold;">your profile stood out.</span>
      </p>
      <p style="color: #aaa; font-size: 14px; line-height: 1.9; margin: 0 0 15px 0;">
        Your stats, your activity, your progression &mdash; it all caught our eye.<br>
        We see the grind. We see the potential.<br>
        And we want that energy inside <span style="color: #c0a060; font-weight: bold;">RESILIENCE</span>.
      </p>
      <p style="color: #ffffff; font-size: 15px; line-height: 2; margin: 0;">
        This isn't just a faction.<br>
        This is a <span style="color: #c0a060; font-weight: bold;">family that invests in YOU.</span><br>
        Leaders who actually mentor. Members who actually show up.<br>
        Resources most factions charge for &mdash;<br>
        <span style="color: #c0a060; font-weight: bold;">we give them freely.</span>
      </p>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; background: rgba(0,0,0,0.4); text-align: left;">
      <p style="color: #c0a060; font-size: 20px; font-weight: bold; letter-spacing: 3px; text-align: center; margin: 0 0 15px 0;">
        REQUIREMENTS
      </p>
      <p style="color: #ffffff; font-size: 14px; line-height: 2; margin: 0;">
        &gt;&gt; Be active daily (Multiple Daily Logins)<br>
        &gt;&gt; Donator or subscriber status<br>
        &gt;&gt; Efficient training (800E used per day)<br>
        &gt;&gt; Xanax &amp; Daily Energy refill <span style="color: #aaa; font-size: 12px;">(min 2 xanax/day, usage should exceed your age)</span><br>
        &gt;&gt; Participation in ranked wars, chains &amp; territory wars<br>
        &gt;&gt; Participate in Organized Crime at least once per week<br>
        &gt;&gt; All users must sign up with TornStats
      </p>
      <div style="text-align: center; margin-top: 15px;">
        <a style="display: inline-block; background: linear-gradient(135deg, #c0a060, #8a6a30); color: #000; font-weight: bold; font-size: 13px; letter-spacing: 2px; padding: 10px 28px; border-radius: 4px; text-decoration: none;"
           href="https://www.tornstats.com/factions/show/5652/apply" target="_blank" rel="noopener">
          &gt;&gt; SIGN UP TO TORNSTATS &lt;&lt;
        </a>
      </div>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; background: rgba(0,0,0,0.4); text-align: left;">
      <p style="color: #c0a060; font-size: 20px; font-weight: bold; letter-spacing: 3px; text-align: center; margin: 0 0 15px 0;">
        WHAT YOU GET
      </p>
      <p style="color: #ffffff; font-size: 14px; line-height: 2; margin: 0 0 15px 0;">
        &gt;&gt; Vast knowledge from leaders, mentors &amp; members<br>
        &gt;&gt; Medical, drugs, booster, weapons &amp; armor all in armory<br>
        &gt;&gt; A faction that actually <span style="color: #c0a060; font-weight: bold;">fights for its members</span>
      </p>
      <div style="text-align: center; margin-bottom: 20px;">
        <a style="display: inline-block; background: linear-gradient(135deg, #2a6a2a, #1a4a1a); color: #00ff88; font-weight: bold; font-size: 13px; letter-spacing: 2px; padding: 10px 28px; border-radius: 4px; text-decoration: none; border: 1px solid #00ff88;"
           href="/profiles.php?XID=672082" target="_blank" rel="noopener">
          &gt;&gt; ASK ABOUT OUR FREE XANAX PROGRAM &lt;&lt;
        </a>
      </div>

      <div style="border-left: 3px solid #ff6600; padding: 10px 15px; margin-bottom: 12px; background: rgba(255,102,0,0.08);">
        <p style="color: #ff6600; font-weight: bold; font-size: 15px; margin: 0 0 6px 0; letter-spacing: 2px;">
          [SWORD] VORACITY
          <span style="font-size: 11px; background: #ff6600; color: #000; padding: 2px 6px; border-radius: 3px; margin-left: 6px;">MAX</span>
        </p>
        <p style="color: #ddd; font-size: 13px; line-height: 1.9; margin: 0;">
          &gt;&gt; Alcohol effect <span style="color: #ff6600;">+50%</span><br>
          &gt;&gt; Booster cooldown <span style="color: #ff6600;">+24 HOURS</span><br>
          &gt;&gt; Energy drink effect <span style="color: #ff6600;">+50%</span><br>
          &gt;&gt; Candy effect <span style="color: #ff6600;">+50%</span>
        </p>
      </div>

      <div style="border-left: 3px solid #aa44ff; padding: 10px 15px; margin-bottom: 12px; background: rgba(170,68,255,0.08);">
        <p style="color: #aa44ff; font-weight: bold; font-size: 15px; margin: 0 0 6px 0; letter-spacing: 2px;">
          [SHIELD] TOLERATION
          <span style="font-size: 11px; background: #aa44ff; color: #000; padding: 2px 6px; border-radius: 3px; margin-left: 6px;">MAX</span>
        </p>
        <p style="color: #ddd; font-size: 13px; line-height: 1.9; margin: 0;">
          &gt;&gt; Addiction mitigation <span style="color: #aa44ff;">-50%</span><br>
          &gt;&gt; Reduced overdose <span style="color: #aa44ff;">-30%</span><br>
          &gt;&gt; Reduced side effects <span style="color: #aa44ff;">-30%</span>
        </p>
      </div>

      <div style="border-left: 3px solid #00aaff; padding: 10px 15px; margin-bottom: 12px; background: rgba(0,170,255,0.08);">
        <p style="color: #00aaff; font-weight: bold; font-size: 15px; margin: 0 0 6px 0; letter-spacing: 2px;">
          [+] STEADFAST
          <span style="font-size: 11px; background: #00aaff; color: #000; padding: 2px 6px; border-radius: 3px; margin-left: 6px;">ON ROTATION</span>
        </p>
        <p style="color: #ddd; font-size: 13px; line-height: 1.9; margin: 0;">
          &gt;&gt; Base <span style="color: #00aaff;">+10%</span> gains regardless<br>
          &gt;&gt; <span style="color: #00aaff;">+15%</span> on rotation BI-Monthly
        </p>
      </div>

      <div style="border-left: 3px solid #ffdd00; padding: 10px 15px; margin-bottom: 12px; background: rgba(255,221,0,0.08);">
        <p style="color: #ffdd00; font-weight: bold; font-size: 15px; margin: 0 0 6px 0; letter-spacing: 2px;">
          [!] CRIMINALITY
        </p>
        <p style="color: #ddd; font-size: 13px; line-height: 1.9; margin: 0;">
          &gt;&gt; Crime XP &amp; Skill gain <span style="color: #ffdd00;">+10%</span><br>
          &gt;&gt; Nerve <span style="color: #ffdd00;">+30n</span>
        </p>
      </div>

      <div style="border-left: 3px solid #00ffcc; padding: 10px 15px; background: rgba(0,255,204,0.08);">
        <p style="color: #00ffcc; font-weight: bold; font-size: 15px; margin: 0; letter-spacing: 2px;">
          [&gt;] +10 TRAVEL CAPACITY
          <span style="color: #aaa; font-size: 12px; font-weight: normal;">(make your money!)</span>
        </p>
      </div>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; background: rgba(0,0,0,0.4);">
      <p style="color: #c0a060; font-size: 20px; font-weight: bold; letter-spacing: 3px; margin: 0 0 12px 0;">
        UNDER LEVEL 15?
      </p>
      <p style="color: #ffffff; font-size: 14px; line-height: 1.9; margin: 0;">
        No problem. We saw enough in your profile to take a chance on you.<br>
        Hit <span style="color: #c0a060; font-weight: bold;">Level 15</span> ASAP and work towards a
        <span style="color: #c0a060; font-weight: bold;">Private Island</span>.<br>
        <span style="color: #aaa; font-size: 13px;">Full mentorship provided &mdash; we don't leave new members behind.</span>
      </p>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; background: rgba(0,0,0,0.4);">
      <p style="color: #c0a060; font-size: 20px; font-weight: bold; letter-spacing: 3px; margin: 0 0 8px 0;">
        ANY QUESTIONS?
      </p>
      <p style="color: #aaa; font-size: 13px; margin: 0 0 18px 0;">Our leaders are always available &mdash; don't be shy</p>

      <div style="display: inline-block; margin: 0 15px 10px 15px; text-align: center;">
        <a style="text-decoration: none;" href="/profiles.php?XID=1503210" target="_blank" rel="noopener">
          <div style="width: 100px; height: 137px; overflow: hidden; border-radius: 6px;
                      border: 2px solid #c0a060; margin: 0 auto 6px auto;
                      box-shadow: 0 0 10px rgba(192,160,96,0.5);">
            <img src="https://i.ibb.co/jkj1xjGb/retroclick.png"
                 style="width: 100px; height: 137px; object-fit: cover; display: block;">
          </div>
          <span style="color: #c0a060; font-size: 13px; font-weight: bold; letter-spacing: 1px;">Retroclick</span>
        </a>
      </div>

      <div style="display: inline-block; margin: 0 15px 10px 15px; text-align: center;">
        <a style="text-decoration: none;" href="/profiles.php?XID=672082" target="_blank" rel="noopener">
          <div style="width: 100px; height: 137px; overflow: hidden; border-radius: 6px;
                      border: 2px solid #c0a060; margin: 0 auto 6px auto;
                      box-shadow: 0 0 10px rgba(192,160,96,0.5);">
            <img src="https://i.ibb.co/tw5kGnrX/isca.png"
                 style="width: 100px; height: 137px; object-fit: cover; display: block;">
          </div>
          <span style="color: #c0a060; font-size: 13px; font-weight: bold; letter-spacing: 1px;">Isca</span>
        </a>
      </div>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <div style="margin-bottom: 30px;">
      <a href="#" target="_blank" rel="noopener">
        <img style="max-width: 300px; display: block; margin: 0 auto 10px auto; border: 1px solid #7289da; border-radius: 6px;"
             src="https://i.ibb.co/pr253KgB/2b2c16ac-4014-4dc6-aab1-1d25cd16d4e0.png"
             alt="discord"/>
      </a>
      <p style="color: #7289da; font-size: 13px; letter-spacing: 3px; margin: 0;">&gt;&gt; CLICK TO JOIN DISCORD &lt;&lt;</p>
    </div>

    <p style="color: #c0a060; letter-spacing: 6px; font-size: 13px; margin: 0 0 25px 0;">--------- * ---------</p>

    <a class="full" href="https://i.ibb.co/d4ddNqxg/treeoflife-ezgif-com-optimize.gif" rel="page_thread">
      <img style="max-width: 400px; display: block; margin: 0 auto 20px auto;"
           src="https://i.ibb.co/d4ddNqxg/treeoflife-ezgif-com-optimize.gif" alt="treeoflife"/>
    </a>

    <div style="border: 1px solid #c0a060; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; background: rgba(0,0,0,0.5);">
      <p style="color: #ffffff; font-size: 15px; line-height: 2; margin: 0 0 10px 0;">
        We reviewed hundreds of profiles.<br>
        We reached out to <span style="color: #c0a060; font-weight: bold;">very few</span>.<br>
        You are one of them.<br><br>
        Spots in RESILIENCE are <span style="color: #c0a060; font-weight: bold;">limited</span>.<br>
        This offer won't stay open forever.<br>
        <span style="color: #aaa; font-size: 13px;">Don't let someone else take your seat.</span>
      </p>
    </div>

    <a style="display: block; background: linear-gradient(135deg, #c0a060, #8a6a30); color: #000; font-weight: bold; font-size: 18px; letter-spacing: 3px; padding: 18px 50px; border-radius: 6px; text-decoration: none; max-width: 400px; margin: 0 auto 15px auto;"
       href="/factions.php?step=profile&amp;ID=22887" target="_blank" rel="noopener">
      &gt;&gt; APPLY TO RESILIENCE NOW &lt;&lt;
    </a>

    <p style="color: #aaa; font-size: 12px; letter-spacing: 2px; margin: 10px 0 0 0;">
      So what are you waiting for?<br>
      <span style="color: #c0a060;">Your faction is calling.</span>
    </p>

    <p style="color: #555; font-size: 11px; letter-spacing: 3px; margin: 20px 0 0 0;">--------- * ---------</p>

  </div>
</div>`;

    let injected = false;

    function tryInject() {
        if (injected) return;
        if (!window.location.href.includes('p=compose')) return;
        const anonBtn = document.querySelector('#anonymousButton');
        if (!anonBtn) return;
        if (document.querySelector('#qm-autofill-btn')) return;

        const btn = document.createElement('button');
        btn.id = 'qm-autofill-btn';
        btn.type = 'button';
        btn.title = 'Auto-fill Resilience recruitment message';
        btn.style.cssText = `
            background: #344556;
            border: 1px solid #aaa;
            border-radius: 4px;
            cursor: pointer;
            padding: 3px 7px;
            margin-left: 6px;
            vertical-align: middle;
            font-size: 18px;
            line-height: 1;
            color: white;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        `;
        btn.innerHTML = `
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#FFD700" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <rect x="2" y="4" width="20" height="16" rx="2"/>
                <polyline points="2,4 12,13 22,4"/>
            </svg>
            <span style="font-size:11px; color:#FFD700;">RSLNC</span>
        `;

        btn.addEventListener('click', () => { fillMessage(); });
        anonBtn.insertAdjacentElement('afterend', btn);
        injected = true;
    }

    function fillMessage() {
        const subjectSelectors = [
            'input[name="subject"]',
            'input[placeholder*="subject" i]',
            'input[placeholder*="Subject" i]',
            '.subject-input input',
            '#messageSubject',
            'input[type="text"]'
        ];

        let subjectInput = null;
        for (const sel of subjectSelectors) {
            subjectInput = document.querySelector(sel);
            if (subjectInput) break;
        }

        if (subjectInput) {
            subjectInput.focus();
            subjectInput.value = SUBJECT;
            subjectInput.dispatchEvent(new Event('input', { bubbles: true }));
            subjectInput.dispatchEvent(new Event('change', { bubbles: true }));
        }

        const editorSelectors = [
            '.ql-editor',
            '[contenteditable="true"]',
            'div[role="textbox"]',
            'textarea[name="message"]',
            '#messageBody',
            '.message-editor',
            '.editor-content'
        ];

        let editor = null;
        for (const sel of editorSelectors) {
            const candidates = document.querySelectorAll(sel);
            for (const c of candidates) {
                if (c.offsetWidth > 50 && c.offsetHeight > 20) {
                    editor = c;
                    break;
                }
            }
            if (editor) break;
        }

        if (editor) {
            editor.focus();
            if (editor.tagName === 'TEXTAREA') {
                editor.value = MESSAGE_HTML;
                editor.dispatchEvent(new Event('input', { bubbles: true }));
                editor.dispatchEvent(new Event('change', { bubbles: true }));
            } else {
                editor.innerHTML = '';
                editor.focus();
                const success = document.execCommand('insertHTML', false, MESSAGE_HTML);
                if (!success || editor.innerHTML.trim() === '') {
                    editor.innerHTML = MESSAGE_HTML;
                }
                editor.dispatchEvent(new Event('input', { bubbles: true }));
                editor.dispatchEvent(new Event('change', { bubbles: true }));
                editor.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true }));
            }
            showFeedback('Message filled!');
        } else {
            showFeedback('Could not find message editor - try clicking inside the message box first', true);
        }
    }

    function showFeedback(text, isError = false) {
        const existing = document.querySelector('#qm-feedback');
        if (existing) existing.remove();
        const msg = document.createElement('div');
        msg.id = 'qm-feedback';
        msg.textContent = text;
        msg.style.cssText = `
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: ${isError ? '#c0392b' : '#27ae60'};
            color: white;
            padding: 10px 16px;
            border-radius: 6px;
            font-size: 14px;
            font-family: georgia, serif;
            z-index: 99999;
            box-shadow: 0 2px 8px rgba(0,0,0,0.4);
        `;
        document.body.appendChild(msg);
        setTimeout(() => msg.remove(), 3000);
    }

    const observer = new MutationObserver(() => {
        if (window.location.href.includes('p=compose')) {
            tryInject();
        } else {
            injected = false;
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    window.addEventListener('hashchange', () => {
        injected = false;
        setTimeout(tryInject, 500);
    });

    setTimeout(tryInject, 1000);
    setTimeout(tryInject, 3000);

})();
// written by Brxxntt