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

Answer Revealer userscript deprecated #15

Open
2 tasks done
T3M1N4L opened this issue Oct 6, 2024 · 3 comments
Open
2 tasks done

Answer Revealer userscript deprecated #15

T3M1N4L opened this issue Oct 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@T3M1N4L
Copy link

T3M1N4L commented Oct 6, 2024

Describe the bug

Khan Academy gives a crash message when the user script is on, I then tried to update the user script to the latest version but tamper monkey simply says it's not a valid user script. I see you updated the bookmarklet a few hours ago, but I am on the arc browser, rendering bookmarklets useless. Please update the userscript

Steps to reproduce

1. Have the userscript on [if possible]
2. Go to any lesson on khan academy, then it crashes

--

1. Go to revealer.user.js, copy paste it in to tampermonkey
2. Tampermonkey gives error [invalid userscirpt]

Are you stupid

yeah probably

Operating System

Windows

Browser

Arc Browser

Before submitting a bug report

  • This bug wasn't already reported (I have searched bug reports on GitHub).

  • This is a valid bug (I am able to reproduce this on the latest build).

@T3M1N4L T3M1N4L added the bug Something isn't working label Oct 6, 2024
@T3M1N4L
Copy link
Author

T3M1N4L commented Oct 6, 2024

Looks like khan academy may have patched it, as I converted the bookmarklet into a console command and ran it, and Khan Academy just reloaded.

This is what I used -

if (typeof originalParse === "undefined") {
    window.originalParse = JSON.parse;
}

JSON.parse = function (t, e) {
    let n = originalParse(t, e);

    try {
        const itemData = JSON.parse(n.data.assessmentItem.item.itemData);
        const isPT = location.hostname.split(".")[0] === "pt";

        if (itemData.question && itemData.question.content &&
            itemData.question.content[1] === itemData.question.content[1].toUpperCase()) {

            console.log(itemData);

            itemData.question.content += "\n [[☃ explanation 3]] [[☃ explanation 4]]";

            itemData.question.widgets["explanation 3"] = {
                alignment: "default",
                graded: true,
                options: {
                    explanation: itemData.hints[itemData.hints.length - 1].content,
                    hidePrompt: isPT ? "Ocultar" : "Hide",
                    showPrompt: isPT ? "Resposta" : "Answer",
                    static: false,
                    widgets: itemData.hints[itemData.hints.length - 1]
                }
            };

            itemData.question.widgets["explanation 4"] = {
                options: {
                    explanation: "discord.gg/khanacademy",
                    hidePrompt: "",
                    showPrompt: "Discord"
                }
            };

            n.data.assessmentItem.item.itemData = JSON.stringify(itemData);
        }
    } catch (error) {
        console.error("Error parsing lesson data:", error);
    }

    return n;
};

location.softReload = () => {
    const htmlContent = document.getElementsByTagName("html")[0].outerHTML;
    document.open();
    document.write(htmlContent);
    document.close();
};

location.softReload();

console.error = function () {};

@T3M1N4L
Copy link
Author

T3M1N4L commented Oct 6, 2024

I found the userscript i was using, I was using @DoxrGitHub 's

// ==UserScript==
// @name         Khan answer revealer
// @version      1.0
// @description  Khan hack
// @author       IlyTobias (github@ilytobias)
// @match        https://www.khanacademy.org/*
// @grant        none
// ==/UserScript==

let n = JSON.parse;
JSON.parse = function (t) {
    let e = n(t);
    try {
        let t = JSON.parse(e.data.assessmentItem.item.itemData);
        t.question.content = t.question.content + "[[☃ explanation 2]]";
        console.log(t);
        t.question.widgets["explanation 2"] = {
            alignment: "default"
            , graded: true
            , options: {
                explanation: t.hints[t.hints.length - 1].content
                , hidePrompt: "Hide"
                , showPrompt: "Answer"
                , static: false
                , widgets: t.hints[t.hints.length - 1].widgets
            }
            , static: false
            , type: "explanation"
            , version: {
                major: 0
                , minor: 0
            }
        };
        e.data.assessmentItem.item.itemData = JSON.stringify(t)
    } catch (t) {}
    return e
}

This returns a crash screen now
image

On math it returns a full white crash [uh-oh] screen

@ArdC-137
Copy link

ArdC-137 commented Oct 8, 2024

Upup!! He's right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants