AQA select all

Allows you to select all issues currently visible

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        AQA select all
// @namespace   urn://https://www.georgegillams.co.uk/api/greasemonkey/aqa_select_all
// @include     *usablenet.com/*
// @exclude     none
// @version     3.0.1
// @grant    		none
// @description	Allows you to select all issues currently visible
// ==/UserScript==

const SELECT_ALL_BUTTON_ID = 'SELECT_ALL_BUTTON_ID_92hotv782';

function expandAllCategories() {
  document
    .getElementsByClassName('sc-note--load-more--icon')
    .forEach(e => e.click());
}

function onSelectAll() {
  // Do this twice to make it more reliable
  expandAllCategories();
  expandAllCategories();

  const categoryElements = document.getElementsByClassName('sc-ruleIssue');

  for (let i = 0; i < categoryElements.length; i += 1) {
    const categoryElement = categoryElements[i];
    const checkboxes = categoryElement.getElementsByTagName('INPUT');
    for (let j = 0; j < checkboxes.length; j += 1) {
      const checkbox = checkboxes[j];
      checkbox.click();
    }
  }
}

function addButtonIfNecessary() {
  const currentButton = document.getElementById(SELECT_ALL_BUTTON_ID);
  if (currentButton) {
    return;
  }

  const manualReviewControlPanels = document.getElementsByClassName(
    'manual-review-filters',
  );
  if (!manualReviewControlPanels || manualReviewControlPanels.length < 1) {
    return;
  }

  const manualReviewControlPanel = manualReviewControlPanels[0];

  const selectButton = document.createElement('button');
  selectButton.innerText = `Toggle all`;
  selectButton.style.color = 'white';
  selectButton.style.fontSize = '1rem';
  selectButton.style.fontWeight = 'bold';
  selectButton.style.padding = '0.125rem 1.125rem';
  selectButton.id = SELECT_ALL_BUTTON_ID;
  selectButton.style.border = 'none';
  selectButton.style.backgroundColor = '#0770E3';
  selectButton.style.borderRadius = '0.5rem';
  // eslint-disable-next-line
  selectButton.onclick = onSelectAll;

  manualReviewControlPanel.appendChild(selectButton);
}

function worker() {
  try {
    addButtonIfNecessary();
  } catch (e) {
    // eslint-disable-next-line no-console
    console.log(e);
  }
}

setInterval(worker, 1500);