// ==UserScript== // @name Chess Plus+ // @namespace https://github.com/longkidkoolstar // @version 1.0.1 // @description Add Essential/Quality of life tweaks to Chess.com // @author longkidkoolstar // @license CC BY-NC-ND 4.0 // @icon https://cdn4.iconfinder.com/data/icons/chess-game-funny-colour/32/chess_game_funy_colour_ok_13-1024.png // @require https://greasyfork.org/scripts/471295-tweaking/code/Tweaking.js // @match https://www.chess.com/* // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== (function () { 'use strict'; // Check if Auto Queue is on var autoQueue = GM_getValue('autoQueue', false); // Function to toggle Auto Queue on/off function toggleAutoQueue() { autoQueue = !autoQueue; GM_setValue('autoQueue', autoQueue); console.log('Auto Queue is now ' + (autoQueue ? 'on' : 'off')); } // Function to click the "New" button function clickButton() { var buttons = document.querySelectorAll('button'); for (var i = 0; i < buttons.length; i++) { if (buttons[i].innerText.includes('New')) { buttons[i].click(); break; } } } // If Auto Queue is on, click the button whenever it becomes available if (autoQueue) { // Click the button immediately if it's available clickButton(); // Click the button whenever it becomes available var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { if (mutation.addedNodes.length > 0) { clickButton(); } }); }); observer.observe(document.body, { childList: true, subtree: true }); } // Add a Tweaks dropdown menu var tweaksMenu = document.createElement('div'); tweaksMenu.classList.add('chess-com-tweaks-menu'); tweaksMenu.innerHTML = `
`; var expanded = false; var menuButton = tweaksMenu.querySelector('#tweaksButton'); menuButton.addEventListener('click', function (event) { event.preventDefault(); expanded = !expanded; tweaksMenu.classList.toggle('expanded', expanded); }); tweaksMenu.querySelector('#autoQueueToggle').addEventListener('change', function (event) { toggleAutoQueue(); }); // Add a CSS class to the document body for the chess.com theme document.body.classList.add('chess-com-theme'); document.body.appendChild(tweaksMenu); })();