Page 1 of 1

Script: Player Invites - Version 1.1.1

Posted: Wed Jul 02, 2025 6:52 am
by plurple
Player Invites
original by: plurple
contributing users name can be seen in the version history

Where do I get it?
Install the userscript from here: https://tools.conquerclub.com/playerinvites/
Should work on all browsers supporting Tampermonkey

What does it do?
Allows you to paste in a list of names to the game creation page so you don't need to copy them one at a time. Most useful for us tournament makers of multiplayer tournaments :D
Changelog
Changes in version 1.0.0: by plurple
- Uploaded
How do I use this?
Paste your list of names each on a new line into the provided box. Perfect for copying names from a spreadsheet or random.org.
clicking out of the box will transfer the names to the individual invite boxes. (you can click directly on the submit button and it will transfer them before you click the button :D)
Click image to enlarge.
image

Code: Select all

// ==UserScript==
// @name         Conquer Club - Player Invites
// @author       Plurple
// @match        https://www.conquerclub.com/player.php?mode=start*
// @match        http://www.conquerclub.com/player.php?mode=start*
// @match        https://beta.conquerclub.com/player.php?mode=start*
// @match        http://beta.conquerclub.com/player.php?mode=start*
// @grant        none
// @version      1.1.1
// @description  A way to save me time in my multiplayer tournaments
// @run-at       document-idle
// ==/UserScript==

(function () {
  'use strict';

  const containerSelector = '#invite-player';
  let textarea;

  function removeBulkUI() {
    if (textarea) {
      textarea.remove();
      textarea = null;
    }
  }

  function fillInputsAndSubmit() {
    if (!textarea) return;

    const names = textarea.value
      .split('\n')
      .map(n => n.trim())
      .filter(n => n);

    const inputs = document.querySelectorAll('input[id^="textbox"]');

    if (names.length > inputs.length) {
      alert(`You entered ${names.length} names but only ${inputs.length} player slots are available.`);
    }

    inputs.forEach((input, idx) => {
      input.value = names[idx] || '';
      console.log(`Set ${input.id} = "${input.value}"`);
    });

    const form = textarea.closest('form');
    if (form) {
      console.log('Submitting form...');
      form.submit();
    } else {
      console.warn('Form element not found!');
    }
  }

  function injectBulkUI(numRows) {
    const container = document.querySelector(containerSelector);
    if (!container) return;

    removeBulkUI();

    const inputs = document.querySelectorAll('input[id^="textbox"]');
    if (inputs.length === 0) return;

    textarea = document.createElement('textarea');
    textarea.id = 'bulk-fill-textarea';
    textarea.placeholder = "Enter player names, one per line...\n(Loses focus or Ctrl+Enter submits)";
    textarea.style.width = '300px';
    textarea.style.marginBottom = '10px';
    textarea.style.marginLeft = '150px';
    textarea.rows = numRows;
    textarea.autofocus = false;

    textarea.addEventListener('blur', () => {
      fillInputsAndSubmit();
    });

    textarea.addEventListener('keydown', e => {
      if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
        e.preventDefault();
        fillInputsAndSubmit();
      }
    });

    container.prepend(textarea);
    console.log(`Bulk UI injected for ${inputs.length} players.`);
  }

  function watchPlayerInputs() {
    const container = document.querySelector(containerSelector);
    if (!container) return;

    const observer = new MutationObserver(() => {
      const inputs = document.querySelectorAll('input[id^="textbox"]');
      if (inputs.length === 0) {
        removeBulkUI();
      } else {
        if (!textarea) {
          injectBulkUI(inputs.length);
        }
      }
    });

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

  function watchPlayerCountRadios() {
    const radios = document.querySelectorAll('input[name="np"]');
    radios.forEach(radio => {
      radio.addEventListener('change', () => {
        console.log(`Number of players changed to ${radio.value}`);
        removeBulkUI();
        setTimeout(() => {
          injectBulkUI(radio.value);
        }, 100);
      });
    });
  }

  function init() {
    const container = document.querySelector(containerSelector);
    if (!container) return;

    const inputs = document.querySelectorAll('input[id^="textbox"]');
    injectBulkUI(inputs.length);
    watchPlayerInputs();
    watchPlayerCountRadios();
    console.log("Bulk Player Filler with Auto Submit initialized.");
  }

  function waitForContainer() {
    const container = document.querySelector(containerSelector);
    if (container) {
      init();
      return;
    }

    const obs = new MutationObserver(() => {
      const target = document.querySelector(containerSelector);
      if (target) {
        obs.disconnect();
        init();
      }
    });

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

  if (document.readyState === "complete" || document.readyState === "interactive") {
    waitForContainer();
  } else {
    window.addEventListener("DOMContentLoaded", waitForContainer, { once: true });
  }
})();

Re: Script: Player Invites - Version 1.0.0

Posted: Wed Jul 02, 2025 10:46 am
by SoN!c
This is so good for tourney organisers!!! =D> =D> =D>

Re: Script: Player Invites - Version 1.0.0

Posted: Wed Jul 02, 2025 10:47 am
by chanakam2020
Good Boy !!!
Clap Clap Clap.
=D> =D> =D>

Re: Script: Player Invites - Version 1.0.0

Posted: Fri Jul 04, 2025 5:52 pm
by Kingm
Love this script, saves me soooooooooo much time, thanks plurple!

Re: Script: Player Invites - Version 1.0.0

Posted: Sun Jul 06, 2025 8:46 pm
by JJ41375
Great job Plurple!! I know how much time this will save you and other tournament organizers. =D> =D> =D>

Re: Script: Player Invites - Version 1.0.0

Posted: Fri Jul 11, 2025 10:47 pm
by j1mathman
that's pretty cool, i just tested it out!

Re: Script: Player Invites - Version 1.0.0

Posted: Sat Jul 12, 2025 2:49 pm
by SoN!c
Tis is exactly what CCSL 2.0 needs; a well organised brigade should run it. Im volunteering if it's run by an actual brigade

Re: Script: Player Invites - Version 1.0.0

Posted: Sat Aug 30, 2025 7:15 am
by Kingm
I love this in theory, but the script only works for me like 1 out of 20 times, and I do not know why.
And what I mean with works, is that the "invite box" does not show up when I go into the start game page.

I'm planing to run a couple big tournament soon, but I do no think I want to do it without this script

Re: Script: Player Invites - Version 1.0.0

Posted: Sun Aug 31, 2025 7:06 am
by Kingm
I love this script in theory, when it works it makes things so much easier.

But for me I have trouble getting that "invite box" to appear, if I try to go to Start Games page it appears like 1 in 20 times, hell maybe even less.
I have talked to plurple about it, and he says he do not know why it happens, but will look into it when he gets back.

But maybe you tech-mods had some insight?

Re: Script: Player Invites - Version 1.0.0

Posted: Thu Sep 04, 2025 3:41 pm
by j1mathman
hey kingm, what browser version and script package are you using? I can try to look into it. i'm typically using chrome and tampermonkey

Re: Script: Player Invites - Version 1.0.0

Posted: Wed Sep 10, 2025 9:14 am
by plurple
j1mathman wrote:hey kingm, what browser version and script package are you using? I can try to look into it. i'm typically using chrome and tampermonkey
No need to bother I believe I have fixed the issue along with a bug on chrome just need to wait for the new version to be uploaded to the hosting :D But 1.1.1 is ready to go :D

Re: Script: Player Invites - Version 1.0.0

Posted: Wed Sep 10, 2025 8:46 pm
by Rushing777
oh wow this is awesome

Re: Script: Player Invites - Version 1.0.0

Posted: Thu Sep 11, 2025 4:17 am
by plurple
Rushing777 wrote:oh wow this is awesome
Thanks :oops:

Re: Script: Player Invites - Version 1.1.1

Posted: Thu Sep 25, 2025 5:55 pm
by GoranZ
can this be extended to other delimiters like tab and/or comma?

Re: Script: Player Invites - Version 1.1.1

Posted: Fri Sep 26, 2025 5:47 am
by plurple
GoranZ wrote:can this be extended to other delimiters like tab and/or comma?
Comma probably not sure about tab tbh I can have a look into it but won't be for a few days :)

Re: Script: Player Invites - Version 1.1.1

Posted: Mon Jan 19, 2026 9:47 pm
by cpusurfer
I rebuilt my computer and can't find this to download again. Is it being worked on?

Re: Script: Player Invites - Version 1.1.1

Posted: Sun Jan 25, 2026 9:17 am
by plurple
cpusurfer wrote: Mon Jan 19, 2026 9:47 pm I rebuilt my computer and can't find this to download again. Is it being worked on?
Thanks for letting me know. It will hopefully be fixed soon :)

Re: Script: Player Invites - Version 1.1.1

Posted: Sun Jan 25, 2026 10:17 am
by plurple
cpusurfer wrote: Mon Jan 19, 2026 9:47 pm I rebuilt my computer and can't find this to download again. Is it being worked on?
This has now been fixed now :D

Re: Script: Player Invites - Version 1.1.1

Posted: Sun Jan 25, 2026 4:58 pm
by cpusurfer
Thank you!