AddAll

Add all items of a book list to the lesson queue

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         AddAll
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add all items of a book list to the lesson queue
// @author       This is your fault
// @match        https://floflo.moe/singles/
// @match        https://floflo.moe/alchemizer/
// @grant        none
// ==/UserScript==

var delay = 100;
var buttonHTML = '<div class="elementor-widget-container" style="margin-top: 10px; margin-left: auto; text-align: center;"><div class="elementor-button-wrapper"> <a class="elementor-button elementor-size-lg elementor-animation-grow" role="button"> <span class="elementor-button-content-wrapper"> <span class="elementor-button-icon elementor-align-icon-left"> <i class="fa fa-bomb" aria-hidden="true"></i> </span> <span class="elementor-button-text">add all</span> </span> </a></div></div>';

function chilling(callback){
    console.log("chilling");
  if ( window.vocabTable.loading ){
      setTimeout(function(){chilling(callback);},500);
  } else {
      callback();
  }
}

function addingAll(){
        var addButtons = jQuery('button.col-12.col-md').filter(function() {return jQuery(this).text() === 'Add';});
        var len = addButtons.length;
        addButtons.each(function(index) {
            var button = jQuery(this);
            setTimeout(function(){
                button.click();
                if (index >= len -1) {
                    window.vocabTable.refreshTable();
                    chilling(addingAll);
                }
            },index*delay);
        });
}

(function() {
    'use strict';

    var target = jQuery(".unfortunate_soul .col-4");
    target.append(buttonHTML);
    var addAllButton = jQuery(".elementor-widget-container .elementor-button-wrapper a");
    addAllButton.css("background-color","#ffe400");
    //Some weird stuff happen while the page is being loaded. Make sure we have the right guy
    setTimeout(function(){console.log("trying");jQuery(".elementor-widget-container .elementor-button-wrapper a").on('click',addingAll);},2000);
})();