Uncheck GOG Subscriptions Boxes

Unchecks checkboxes with names containing "_subscriptions" on the GOG subscriptions page

// ==UserScript==
// @name         Uncheck GOG Subscriptions Boxes
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Unchecks checkboxes with names containing "_subscriptions" on the GOG subscriptions page
// @author       yallouch
// @match        https://www.gog.com/fr/account/settings/subscriptions
// @licence      MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the page to be fully loaded
    window.addEventListener('load', function() {
        // Find the checkboxes by their names containing "_subscriptions" and uncheck them
    var checkboxes = document.querySelectorAll('[name*="subscription"]');

        checkboxes.forEach(function(checkbox, index) {
            // Skip the first checkbox (index 0)
            if (index <= 0 && checkbox.checked) {
                // Simulate a user click on each checkbox (excluding the first checkbox)
                checkbox.click();
            } else if (index <= 0 && checkbox.unchecked){
                console.log()
            } else if (index > 0 && checkbox.checked){
                checkbox.click();
            }
        });
})})();