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.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);
        };
    }
})();