0% found this document useful (0 votes)
57 views6 pages

New Userscript .User

The document describes a userscript called 'Google Forms Unlocker' that allows users to bypass restrictions on Google Forms, enabling access without a managed Chromebook. It includes functionalities for error handling, user agent spoofing, and button creation for unlocking forms. The script is designed to enhance user experience by preventing Google Forms from being locked and providing necessary instructions for users to continue using the forms effectively.

Uploaded by

Oloketuyi David
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views6 pages

New Userscript .User

The document describes a userscript called 'Google Forms Unlocker' that allows users to bypass restrictions on Google Forms, enabling access without a managed Chromebook. It includes functionalities for error handling, user agent spoofing, and button creation for unlocking forms. The script is designed to enhance user experience by preventing Google Forms from being locked and providing necessary instructions for users to continue using the forms effectively.

Uploaded by

Oloketuyi David
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// ==UserScript==

// @name Google Forms Unlocker


// @namespace [Link]
// @description Stops Google Forms from being locked, consequently letting you do
them without a chromebook.
// @author Mia @ [Link]/xNasuni
// @match *://[Link]/forms/*
// @grant GM_addStyle
// @version 1.7
// @run-at document-start
// @updateURL
[Link]
// @downloadURL
[Link]
// @supportURL [Link]
// ==/UserScript==

const kAssessmentAssistantExtensionId = "gndmhdcefbhlchkhipcnnbkcmicncehk"


const ERROR_USER_AGENT = "_useragenterror"
const ERROR_UNKNOWN = "_unknown"

var shouldSpoof = [Link] === "#gfu"

// support for browsers other than chrome.


[Link] = [Link] || {}
[Link] = [Link] || {}
[Link] = [Link]
|| function(extId, payload, callback){[Link] = 1; callback()}

const oldSendMessage = [Link]

if (GM_addStyle === undefined) {


// [Link]
tampermonkey
GM_addStyle = function (css) {
const style = [Link]("GM_addStyleBy8626")
|| (function () {
const style = [Link]('style');
[Link] = 'text/css';
[Link] = "GM_addStyleBy8626";
[Link](style);
return style;
})();
const sheet = [Link];
[Link](css, ([Link] || [Link] || []).length);
}
}

function ButtonAction() {
[Link] = "gfu"
[Link]()
}

function MatchExtensionId(ExtensionId) {
return ExtensionId === kAssessmentAssistantExtensionId
}

function GetGoogleForm() {
const Containers = [Link]("[Link]")
var Form

for (const Container of Containers) {


for (const Child of [Link]) {
if ([Link] == "FORM") {
Form = Child
}
}
}

return Form
}

function GetQuizHeader() {
const QuizHeader = [Link]("[Link]")
return QuizHeader
}

function PageIsErrored() {
const QuizHeader = GetQuizHeader()
if (QuizHeader === null) { return false }

const ChildNodes = [Link]


if (ChildNodes[3].getAttribute("aria-live") === "assertive" &&
ChildNodes[4].getAttribute("aria-live") === "assertive") {
return {title: ChildNodes[3].innerText, description:
ChildNodes[4].innerText}
}
return false
}

function MatchErrorType(error) {
if ([Link] === "You can't access this quiz." && [Link] ===
"Locked mode is on. Only respondents using managed Chromebooks can open this quiz.
Learn more") {
return ERROR_USER_AGENT
}
return ERROR_UNKNOWN
}

function MakeButton(Text, Callback, Color) {


const Form = GetGoogleForm()
if (Form === undefined) { return false }

const ButtonHolder = [Link][2]

const Button = [Link]("div")


[Link] = "uArJ5e UQuaGc Y5sE8d TIHcue QvWxOd"
[Link] = "10px"
[Link] = Color
[Link]("role", "button")
[Link]("tabindex", [Link])
[Link]("mia-gfu-state", "custom-button")
[Link](Button)

const Glow = [Link]("div")


[Link] = "Fvio9d MbhUzd"
[Link] = '21px'
[Link] = '9px'
[Link] = '110px'
[Link] = '110px'
[Link](Glow)

const TextContainer = [Link]("span")


[Link] = "l4V7wb Fxmcue"
[Link](TextContainer)

const TextSpan = [Link]("span")


[Link] = "NPEfkd RveJvd snByac"
[Link] = Text
[Link](TextSpan)

[Link]("click", Callback)

return {destroy: function(){[Link]()}}


}

async function IsOnChromebook() {


return new Promise((resolve, _reject) => {
oldSendMessage(kAssessmentAssistantExtensionId, {command: "isLocked"},
function(_response) {
if ([Link]) {
resolve(false)
}
resolve(true)
})
})
}

async function Initialize() {


GM_addStyle(`
.gfu-red {
font-family: monospace;
text-align: center;
font-size: 11px;
padding-top: 24px;
color: red !important;
}
.EbMsme {
transition: filter cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
filter: blur(8px) !important;
}
.EbMsme:hover {
filter: blur(0px) !important;
}
`)

const Errored = PageIsErrored()


if (Errored !== false) {
switch (MatchErrorType(Errored)) {
case ERROR_USER_AGENT:
const QuizHeader = GetQuizHeader()
const Error = [Link]("div")
[Link] = "gfu-red"
[Link](Error)

const ErrorSpan =
[Link]("span")
[Link] = "Google Forms Unlocker - In order to
continue, you need a User Agent Spoofer. "
[Link](ErrorSpan)

const AnchorSpan = [Link]("a")


[Link] = "gfu-red"
[Link] = "Install one here."
[Link] = "_blank"
[Link] = "noopener"
[Link] = "[Link]
unlocker/blob/main/[Link]#spoofing-your-user-agent"
[Link](AnchorSpan)
break
default:
alert(`Unhandled error type: ${[Link](Errored)}`)
}
return
}

const Form = GetGoogleForm()


if (Form === undefined) { return false }

const IsRealManagedChromebook = await IsOnChromebook()

if (IsRealManagedChromebook === false) {


const ButtonHolder = [Link][2]
for (const Button of [Link]) {
if ([Link]("mia-gfu-state") === "custom-button")
{ continue }
[Link] = "#ccc"
[Link]("jsaction", "")
}
}
MakeButton("Bypass", ButtonAction, "#ff90bf")
}

var fakeIsLocked = shouldSpoof


function InterceptCommand(Payload, Callback) {
switch ([Link]) {
case "isLocked":
Callback({locked: fakeIsLocked})
return true
case "lock":
if (shouldSpoof) {
return false
}
fakeIsLocked = false
Callback({locked: fakeIsLocked})
return true
case "unlock":
fakeIsLocked = false
Callback({locked: fakeIsLocked})
return true
}

return false
}

setInterval(() => {
[Link] = function() {
const ExtensionId = (arguments)[0]
const Payload = (arguments)[1]
const Callback = (arguments)[2]

if (MatchExtensionId(ExtensionId)) {
const Intercepted = InterceptCommand(Payload, Callback)
if (Intercepted) { return null }
}
[Link]("Not intercepting", ExtensionId, Payload, Callback)

return oldSendMessage(ExtensionId, Payload, function() {


if ([Link]) {
alert(`Google Forms Unlocker, please report this to the
GitHub [Link] error: $
{[Link]([Link])}`)
return
}
[Link](this, arguments)
})
}
})

[Link]("DOMContentLoaded", () => {
[Link]("Initialized")
Initialize()
})

[Link]([Link], 'hidden', {
value: false,
writable: false
})
[Link]([Link], 'visibilityState', {
value: "visible",
writable: false
})
[Link]([Link], 'webkitVisibilityState', {
value: "visible",
writable: false
})
[Link]([Link], 'mozVisibilityState', {
value: "visible",
writable: false
})
[Link]([Link], 'msVisibilityState', {
value: "visible",
writable: false
})
const BlacklistedEvents = ['mozvisibilitychange', 'webkitvisibilitychange',
'msvisibilitychange', 'visibilitychange']
const oldAddEventListener = [Link];
[Link] = function() {
const EventType = (arguments)[0]
const Method = (arguments)[1]
const Options = (arguments)[2]

if ([Link](EventType) !== -1) {


[Link](`type ${EventType} blocked from being registered with`,
Method)
return
}

return [Link](this, arguments)


}

You might also like