Naurok Bypass v2: Extras

Companion userscript for naurok bypass; Contains unstable and unfinished features and enhancements for the Testing pages.

目前為 2023-12-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Naurok Bypass v2: Extras
// @description Companion userscript for naurok bypass; Contains unstable and unfinished features and enhancements for the Testing pages.
// @author      griffi-gh
// @namespace   griffi-gh
// @match       https://naurok.com.ua/test/testing/*
// @grant       none
// @grant       GM_addStyle
// @version     0.1
// @run-at      document-idle
// @inject-into page
// @sandbox     DOM
// @connect     naurok.com.ua
// @icon        https://play-lh.googleusercontent.com/scIkpmsUJTfDbV39X0rb-AvxbgxOrpa9zIGJQqDHP1VbuBTmortXomSSWVZnpErwyA=w480-h960
// ==/UserScript==

"use strict";

async function displayTestName() {
  //Get session ID
  const session_id = document.querySelector(`[ng-app="testik"]`).getAttribute("ng-init").match(/[0-9]+/g)[1];
  console.log("Session id: ", session_id);

  //Get session info from API
  let session_info = await fetch(`https://naurok.com.ua/api2/test/sessions/${session_id}`, {
    credentials: "include",
    headers: {
      'Accept': 'application/json, text/plain, */*',
      'Content-Type': 'application/json'
    },
    redirect: 'follow',
  }).then(x => x.json());
  console.log("Session info: ", session_info);

  //Add test name to the page
  const testContainer = document.querySelector('.test-container')
  const infoNode = document.createTextNode(`NAME: ${session_info.settings.name}`);
  testContainer.insertBefore(infoNode, testContainer.firstChild);
}

function applyStyles() {
  let styleCss = `
    /* allow selection */
    * {
      -webkit-user-select: unset !important;
      -webkit-touch-callout: unset !important;
      -moz-user-select: unset !important;
      -ms-user-select: unset !important;
      user-select: unset !important;
    }
  `;

  //use layer if possible on newer browsers to override important
  styleCss = `
    ${ styleCss }
    @layer { ${styleCss} }
  `;

  //add css to page, using GM_addStyle if possible
  if (window.GM_addStyle) {
    window.GM_addStyle(styleCss);
  } else {
    const styleElement = document.createElement("style");
    styleElement.innerHTML = styleCss;
    document.querySelector("head").append(styleElement);
  }
}

async function main() {
  await displayTestName();
  applyStyles();
}

main();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址