// ==UserScript==
// @name Burlington Books Mod Menu
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Made by iron web10 - Improved UI & Notifications
// @author iron web10
// @match https://app.burlingtonenglish.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=burlingtonenglish.com
// @grant none
// @license Iron web10 2025
// ==/UserScript==
(function() {
let modMenuCreated = false;
let toggleButtonCreated = false;
let correctAnswers = [];
const originalOpen = XMLHttpRequest.prototype.open;
const originalSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.open = function(method, url) {
this._method = method;
this._url = url;
return originalOpen.apply(this, arguments);
};
XMLHttpRequest.prototype.send = function(body) {
if (this._method === 'POST' && (this._url.includes('/Activities/api/DropDownCloze/Reset?token=') || this._url.includes('/Activities/api/TypingSentence/SaveState?token=') || this._url.includes('/Activities/api/TypingCloze/SaveState?token='))) {
const token = this._url.split('token=')[1];
localStorage.removeItem('activityToken');
localStorage.setItem('activityToken', token);
waitForBody(createModMenuOnce);
}
if (this._method === 'PATCH' || this._method === 'PUT') {
}
return originalSend.apply(this, arguments);
};
function makeDraggable(element) {
let offsetX, offsetY;
element.onmousedown = function(event) {
event.preventDefault();
offsetX = event.clientX - element.getBoundingClientRect().left;
offsetY = event.clientY - element.getBoundingClientRect().top;
document.onmousemove = function(event) {
element.style.left = event.clientX - offsetX + 'px';
element.style.top = event.clientY - offsetY + 'px';
};
document.onmouseup = function() {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
function createNotification(message, type = 'info') {
let existingNotification = document.getElementById('custom-notification');
if (existingNotification) {
existingNotification.remove();
}
let notification = document.createElement('div');
notification.id = 'custom-notification';
notification.className = `notification ${type}`;
notification.innerHTML = `<span class="icon"></span> ${message}`;
document.body.appendChild(notification);
requestAnimationFrame(() => {
notification.classList.add('show');
});
setTimeout(() => {
notification.classList.remove('show');
setTimeout(() => notification.remove(), 500);
}, 3000);
}
const style = document.createElement('style');
style.textContent = `
.notification {
position: fixed;
bottom: 20px;
left: 50%;
transform: translate(-50%, 40px);
padding: 16px 32px;
border-radius: 12px;
font-family: 'Arial', sans-serif;
font-size: 16px;
font-weight: bold;
color: white;
z-index: 10001;
display: flex;
align-items: center;
justify-content: center;
min-width: 280px;
max-width: 90%;
text-align: center;
box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.3);
opacity: 0;
transition: opacity 0.4s ease-out, transform 0.4s ease-out;
cursor: pointer;
user-select: none;
overflow: hidden;
animation: pulse 3s infinite;
}
.notification.show {
opacity: 1;
transform: translate(-50%, 0);
}
.notification:hover {
filter: brightness(1.2);
}
.notification.info { background: linear-gradient(45deg, #2196F3, #1976D2); }
.notification.success { background: linear-gradient(45deg, #4CAF50, #388E3C); }
.notification.warning { background: linear-gradient(45deg, #FFC107, #FFA000); }
.notification.error { background: linear-gradient(45deg, #F44336, #D32F2F); }
.notification .icon {
margin-right: 10px;
font-size: 18px;
}
.notification.info .icon::before { content: 'ℹ️'; }
.notification.success .icon::before { content: '✅'; }
.notification.warning .icon::before { content: '⚠️'; }
.notification.error .icon::before { content: '❌'; }
@keyframes pulse {
0% { box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.3); }
50% { box-shadow: 0px 8px 18px rgba(0, 0, 0, 0.5); }
100% { box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.3); }
}
`;
document.head.appendChild(style);
function createModMenuOnce() {
if (modMenuCreated) return;
let menu = document.createElement('div');
menu.id = 'mod-menu';
Object.assign(menu.style, {
position: 'fixed',
top: '20px',
right: '20px',
background: 'linear-gradient(135deg, #333, #111)',
padding: '20px',
borderRadius: '12px',
color: 'white',
fontFamily: 'Arial, sans-serif',
zIndex: '10000',
boxShadow: '0 6px 12px rgba(0, 0, 0, 0.5)',
display: 'none',
flexDirection: 'column',
alignItems: 'center',
border: '1px solid rgba(255, 255, 255, 0.2)',
backdropFilter: 'blur(8px)',
});
let logo = document.createElement('img');
logo.src = 'https://greasyfork.s3.us-east-2.amazonaws.com/l4mkbqjlftekzy22fuh43t6namfg';
Object.assign(logo.style, {
width: '90px',
height: '90px',
marginBottom: '10px',
});
menu.appendChild(logo);
menu.innerHTML += '<h3 style="margin: 10px 0; text-align: center; font-size: 18px; font-weight: bold;">Mod Menu</h3>';
document.body.appendChild(menu);
createMenuButton(menu, 'Get Answers', '#28a745', fetchAndDisplayAnswers);
createMenuButton(menu, 'Get Token', '#007bff', showToken);
createMenuButton(menu, 'Fill Answers', '#6f42c1', fillAnswersInInputs);
createMenuButton(menu, 'Auto Fill Answers', '#fd7e14', () => {
fetchAndDisplayAnswers();
fillAnswersInInputs();
});
if (!toggleButtonCreated) {
let toggleButton = document.createElement('button');
toggleButton.textContent = '☰';
toggleButton.style.position = 'fixed';
toggleButton.style.top = '10px';
toggleButton.style.right = '20px';
toggleButton.style.width = '50px';
toggleButton.style.height = '50px';
toggleButton.style.fontSize = '20px';
toggleButton.style.background = '#333';
toggleButton.style.color = 'white';
toggleButton.style.border = 'none';
toggleButton.style.borderRadius = '10px';
toggleButton.style.cursor = 'pointer';
toggleButton.style.zIndex = '10001';
toggleButton.onclick = () => {
menu.style.display = menu.style.display === 'none' ? 'flex' : 'none';
};
document.body.appendChild(toggleButton);
toggleButtonCreated = true;
makeDraggable(toggleButton);
}
modMenuCreated = true;
}
function createMenuButton(menu, text, color, onClick) {
let button = document.createElement('button');
button.textContent = text;
button.style.margin = '5px';
button.style.padding = '10px 15px';
button.style.background = color;
button.style.color = 'white';
button.style.border = 'none';
button.style.borderRadius = '5px';
button.style.cursor = 'pointer';
button.onclick = onClick;
menu.appendChild(button);
}
function showToken() {
const token = localStorage.getItem('activityToken');
createNotification(token ? `Token: ${token}` : 'No token found!', token ? 'success' : 'error');
}
async function fetchAndDisplayAnswers() {
const token = localStorage.getItem('activityToken');
if (!token) {
alert('No token found! Try again.');
return;
}
const apiUrl = `/Activities/api/TypingCloze/CompleteActivity?token=${token}`;
let data = null;
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
if (!response.ok) {
if (response.status === 500) {
const fallbackApiUrl = `https://app.burlingtonenglish.com/Activities/api/TypingSentence/CompleteActivity?token=${token}`;
const fallbackResponse = await fetch(fallbackApiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
if (!fallbackResponse.ok) {
throw new Error(`Fallback API error: ${fallbackResponse.status} ${fallbackResponse.statusText}`);
}
data = await fallbackResponse.json();
} else {
throw new Error(`Request error: ${response.status} ${response.statusText}`);
}
} else {
data = await response.json();
}
if (!data || !data.correctData) {
alert('No correct answers found!');
return;
}
correctAnswers = [];
data.correctData.objects.forEach(object => {
object.answers.forEach(answer => {
correctAnswers.push(answer.value);
});
});
const correctAnswersJson = JSON.stringify(correctAnswers);
navigator.clipboard.writeText(correctAnswersJson).then(() => {
createNotification('Answers fetched successfully!', 'success');
}).catch(err => {
createNotification('Failed to copy answers!', 'error');
});
localStorage.setItem('correctAnswers', JSON.stringify(correctAnswers));
} catch (error) {
console.error('Error fetching answers:', error);
createNotification('Failed to fetch answers!', 'error');
}
}
function fillAnswersInInputs() {
if (correctAnswers.length === 0) {
createNotification('No answers found! Fetch answers first.', 'error');
return;
}
const inputFields = document.querySelectorAll('input[type="text"]');
inputFields.forEach((input, index) => {
if (index < correctAnswers.length) {
input.value = correctAnswers[index];
}
});
createNotification('Answers filled successfully!', 'success');
}
waitForBody(createModMenuOnce);
function waitForBody(callback) {
if (document.body) callback();
else new MutationObserver((_, observer) => {
if (document.body) {
observer.disconnect();
callback();
}
}).observe(document.documentElement, { childList: true, subtree: true });
}
})();