LiveWorksheets Solver

Muestra un botón en la parte superior del DOM de LiveWorksheets y te permite pulsarlo, revelando así las respuestas. Si no se pulsa en 5 segundos, el botón desaparece.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         LiveWorksheets Solver
// @license      GNU GPLv3
// @namespace    https://github.com/danucosukosuko/livesolver
// @version      1.0.5
// @description  Muestra un botón en la parte superior del DOM de LiveWorksheets y te permite pulsarlo, revelando así las respuestas. Si no se pulsa en 5 segundos, el botón desaparece.
// @author       danucosukosuko
// @match        *://www.liveworksheets.com/*/w/*
// @match        *://www.liveworksheets.com/w/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Verificar si la URL contiene "/w/" o "/cualquier-cosa/w/"
    const pathname = window.location.pathname;
    if (pathname.match(/\/w\//) || pathname.match(/\/[^\/]+\/w\//)) {
        let btn = document.createElement("button");
        btn.innerText = "Mostrar Respuestas";
        Object.assign(btn.style, {
            position: "fixed",
            top: "20px",
            right: "20px",
            zIndex: "9999",
            padding: "10px 20px",
            fontSize: "16px",
            background: "red",
            color: "white",
            border: "none",
            borderRadius: "5px",
            cursor: "pointer",
            boxShadow: "0px 0px 5px rgba(0,0,0,0.3)"
        });
        document.body.appendChild(btn);

        let timeout = setTimeout(() => btn.remove(), 5000);

        btn.onclick = function() {
            clearTimeout(timeout);
            btn.remove();

            setTimeout(() => {
                jQuery("#worksheet-preview").worksheetPreview("validation", {
                    clicked: false,
                    showAnswers: true,
                    showRightAnswers: true
                });
            }, 1000);
        };
    }
})();