Giter Site home page Giter Site logo

ading2210 / edulastic-tools Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 9.0 27 KB

A collection of scripts for screwing around with the online testing software Edulastic.

License: GNU General Public License v3.0

HTML 8.43% JavaScript 91.57%
bookmarklet edulastic javascript

edulastic-tools's People

Contributors

ading2210 avatar doxrgithub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

edulastic-tools's Issues

Login with tokens

image

Could someone provide guidance on which tokens should be entered on the prompt?
because i tried putting "tokens" from the local storage and "tokenKey" , "deafultTokenKey" on the session storage and it didn't work

peardeck post acquirement fix :p

function http_get(url, callback, headers=[], method="GET", content=null) {
let request = new XMLHttpRequest();
request.addEventListener("load", callback);
request.open(method, url, true);
for (const header of headers) {
request.setRequestHeader(header[0], header[1]);
}
request.send(content);
}

function main() {
let url_regex = /https://assessment.peardeck.com/home/class/([a-f0-9]+)/test/([a-f0-9]+)/testActivityReport/([a-f0-9]+)/;
if (!url_regex.test(window.location)) {
alert("Error: Invalid URL.\n\nFor reference, the URL should look like this:\nhttps://app.edulastic.com/home/class/CLASS_ID/test/TEST_ID/testActivityReport/TEST_REPORT_ID");
return;
}
let matches = url_regex.exec(window.location);
let group_id = matches[1];
let test_id = matches[3];
let request_url = https://assessment.peardeck.com/api/test-activity/${test_id}/report?groupId=${group_id};

let token_list = JSON.parse(localStorage.getItem("tokens"));
let token = localStorage.getItem(token_list[0]);

let headers = [
["Authorization", token]
];
http_get(request_url, function(){
if (this.status != 200) {
alert(Error: Status code ${this.status} recieved while trying to fetch the API.);
return;
}
let report = JSON.parse(this.responseText);
let wrong = report.result.testActivity.wrong;
let total = report.result.questionActivities.length;
let percent = (100*(total-wrong)/total).toFixed(2);
alert(${total-wrong}/${total} questions correct (~${percent}%));
}, headers);
}

main();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.