Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: train all chapters together #110

Open
francvoc opened this issue Mar 6, 2022 · 4 comments
Open

Feature request: train all chapters together #110

francvoc opened this issue Mar 6, 2022 · 4 comments

Comments

@francvoc
Copy link

francvoc commented Mar 6, 2022

A small additional feature I would find very useful.

When I train a study, there is a drop box to choose the chapter. You may want to add an entry to the drop box, with "full study", to train all chapters at once. When starting a new line, your program would choose at random from the various chapters, and then again at random which line to choose.

Thank you again for your work!

@alessandrosantospirito
Copy link

alessandrosantospirito commented Aug 23, 2022

I have written a small js-script with wich you get a random chapter every time you click a button "Random Chapter".
You can paste it into a tampermonkey script (browser extension) and you will get this feature.
By time I will write a script where a random chapter is selected every time a practise is complete.

// ==UserScript==
// @name         Random chapter button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://listudy.org/de/studies/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=listudy.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let select = document.getElementById('chapter_select');

    document.getElementsByClassName('container')[1].children[2].innerText = select[select.value].innerText

    let button = document.createElement("BUTTON");
    button.setAttribute("id", "button");
    button.textContent = "Random chapter"

    let chapterSelection = document.getElementsByClassName('chapter_selection')[0]
    chapterSelection.appendChild(button)

    let button_element = document.getElementById('button')

    button_element.onclick = function() {
        for(let i = 0; i < select.length; i++) {
            select[i].selected = false
        }
        var choosen_chapter = select[Math.floor(Math.random() * select.length)];
        choosen_chapter.selected = true
        select.onchange()
        // Update main-titel
        document.getElementsByClassName('container')[1].children[2].innerText = select[select.value].innerText
    }
})();

@alessandrosantospirito
Copy link

alessandrosantospirito commented Aug 24, 2022

The following js-script lets you train all your chapters at once. Every time when you finish a chapter with success, a new chapter is chosen.

// ==UserScript==
// @name         New Chapter after success
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://listudy.org/de/studies/x14gpe-1001-checkmates
// @icon         https://www.google.com/s2/favicons?sz=64&domain=listudy.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let select = document.getElementById('chapter_select');
    let currentChapter = window.chapter
    let first_move_played = false

    document.getElementsByClassName('container')[1].children[2].innerText = select[select.value].innerText

    let succes_text = document.getElementById('success_text')
    var config = { childList: true };

    function updateChapter() {
        if(window.curr_move.length === 1 && first_move_played) {
            for(let i = 0; i < select.length; i++) {
                select[i].selected = false
            }
            let choosen_chapter = select[Math.floor(Math.random() * select.length)];
            choosen_chapter.selected = true
            document.getElementsByClassName('container')[1].children[2].innerText = select[select.value].innerText
            currentChapter = window.chapter
            first_move_played = false
            select.onchange()
        }
        else if(window.curr_move.length > 1) {
            first_move_played = true
        }
    }

    var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutationRecord) {
        updateChapter()
       });
    });

    observer.observe(succes_text, config)
})();

@olleeriksson
Copy link
Contributor

FYI. I have used ChessTempo to merge chapters into one. Import the PGN file into ChessTempo.com's opening trainer, and then export it and it will come out as one "chapter".

@micha-1972
Copy link

Thank you for the workaround which does a big part of the job. However an additional item in the chapter drop down menu "all chapters" or "random chapter" would allow you to focus on individual chapters and if you feel well prepared you go for the "random line" option to test your knowledge.
Thank you for considering to add the feature to the enhancement list although the workaround exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants